Closed mertalbaba closed 1 year ago
Solved the problem, solution is using mujoco-py for video generation. I attached a minimal working code below for anyone experiencing a similar problem
import mujoco_py
import gym
import d4rl
env = gym.make('pen-human-v1')
s = env.reset()
frames = []
viewer = mujoco_py.MjRenderContextOffscreen(env.sim, device_id=-1)
for i in range(1000):
viewer.render(width=640, height=480)
frame = np.asarray(viewer.read_pixels(640, 480, depth=False)[::-1, :, :], dtype=np.uint8)
frames.append(frame)
a = model.select_action(s)
s, r, _, _ = env.step(a)
env.close()
frames_np = np.array(frames)
imageio.mimwrite('video.mp4', frames_np, fps=30)
If you are submitting a bug report, please fill in the following details and use the tag [bug].
Describe the bug For Adroit environments, I can't record videos using gym.wrappers.RecordVideo utility since it throws
AttributeError: 'PenEnvV0' object has no attribute 'recording'
Code example
System Info Describe the characteristic of your environment:
D4RL
was installed (pip, docker, source, ...): sourceAdditional context Add any other context about the problem here.
Checklist