ARISE-Initiative / robosuite

robosuite: A Modular Simulation Framework and Benchmark for Robot Learning
https://robosuite.ai
Other
1.24k stars 397 forks source link

Is it possible to record videos without rendering? #132

Closed nsidn98 closed 3 years ago

nsidn98 commented 3 years ago

Is it possible to record videos of the simulation without opening the rendering screen. I was trying to use the gym monitor wrapper but was not able to get it working due to incompatibility between the render() method in gym and robosuite.

env = GymWrapper(
    suite.make(
        "PickPlaceMilk",                # pickPLaceMilk task
        robots="IIWA",                  # use IIWA robot
        use_camera_obs=True,           # do not use pixel observations
        has_offscreen_renderer=True,   # not needed since not using pixel obs
        has_renderer=False,              # make sure we can render to the screen
    )
)
env.metadata = {'render.modes': ['human', 'rgb_array'], 'video.frames_per_second': 25}
env = gym.wrappers.Monitor(env, 'video/MilkPickPlace', force=True) # save video

The error

Traceback (most recent call last):
  File "controllers/robosuitePickAndPlace.py", line 60, in <module>
    observation = env.reset()
  File "/Users/opt/miniconda3/envs/py36/lib/python3.6/site-packages/gym/wrappers/monitor.py", line 39, in reset
    self._after_reset(observation)
  File "/Users/opt/miniconda3/envs/py36/lib/python3.6/site-packages/gym/wrappers/monitor.py", line 185, in _after_reset
    self.reset_video_recorder()
  File "/Users/opt/miniconda3/envs/py36/lib/python3.6/site-packages/gym/wrappers/monitor.py", line 206, in reset_video_recorder
    self.video_recorder.capture_frame()
  File "/Users/opt/miniconda3/envs/py36/lib/python3.6/site-packages/gym/wrappers/monitoring/video_recorder.py", line 101, in capture_frame
    frame = self.env.render(mode=render_mode)
  File "/Users/opt/miniconda3/envs/py36/lib/python3.6/site-packages/robosuite/wrappers/wrapper.py", line 74, in render
    return self.env.render(**kwargs)
TypeError: render() got an unexpected keyword argument 'mode'

Robosuite version: 1.0.1 gym version: 0.17.3 python version: 3.6.10

amandlek commented 3 years ago

Here's an example of making a video by using images from the offscreen renderer.