-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrun.py
More file actions
22 lines (20 loc) · 712 Bytes
/
run.py
File metadata and controls
22 lines (20 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import carla
from min_carla_env.env import CarlaEnv, CONFIG
if __name__ == "__main__":
client = carla.Client('localhost', 2000)
client.set_timeout(10.0)
for _ in range(5):
try:
env = CarlaEnv(client, CONFIG, debug=True)
old_obs = env.reset()
done = False
t = 0
total_reward = 0.0
while not done:
t += 1
obs, reward, done, info = env.step(0) # Go Forward
total_reward += reward
print("step#:", t, "reward:", round(reward, 4),
"total_reward:", round(total_reward, 4), "done:", done)
finally:
env.mw.clean_world()