Skip to content

Commit

Permalink
change for video render
Browse files Browse the repository at this point in the history
  • Loading branch information
AOS55 committed May 21, 2024
1 parent 753abc2 commit 45761db
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions scripts/aircraft_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@


def main():
env = gym.make("flyer-v1", render_mode="human")
env = gym.make("flyer-v1", render_mode="rgb_array")
env.config['action'] = {'type': 'HeadingAction'}
print(f'config:{env.config}')
env.reset()
v_env = gym.wrappers.RecordVideo(env, 'videos', step_trigger = lambda x: x % 100 == 0)
# v_env = env
v_env.reset()
idr = 0
for _ in range(100000):
action = env.action_space.sample()
# action = [0.5, 0.5, 1.0]
action = 0.5
# print(f'action: {action}')
obs, reward, terminated, truncated, info = env.step(action)
# print(f'obs: {obs}')
if idr == 100:
env.render()
idr = 0
else:
idr += 1
obs, reward, terminated, truncated, info = v_env.step(action)
# if idr == 100:
# v_env.render()
# idr = 0
# else:
# idr += 1


if __name__ == "__main__":
Expand Down

0 comments on commit 45761db

Please sign in to comment.