forked from deepdrive/deepdrive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_sync.py
38 lines (33 loc) · 1.29 KB
/
example_sync.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import sim
import config
from sim import DrivingStyle
def main():
env = sim.start(is_sync=True,
render=True,
enable_traffic=True,
experiment='my_experiment',
cameras=[config.DEFAULT_CAM],
fps=config.DEFAULT_FPS, # Agent steps per second
sim_step_time=config.DEFAULT_SIM_STEP_TIME,
is_discrete=False, # Discretizes the action space
driving_style=DrivingStyle.NORMAL,
is_remote_client=False,
max_steps=500,
max_episodes=100,
should_record=True, # HDF5/numpy recordings
recording_dir=config.RECORDING_DIR,
randomize_view_mode=False,
view_mode_period=None, # Domain randomization
randomize_sun_speed=False,
randomize_shadow_level=False,
randomize_month=False)
forward = sim.action(throttle=1, steering=0, brake=0)
done = False
while True:
while not done:
observation, reward, done, info = env.step(forward)
env.reset()
print('Episode finished')
done = False
if __name__ == '__main__':
main()