[Bug Report] Rendering problem after first truncation if env is wrapped with RecordVideo
ozhanozen opened this issue · 2 comments
Describe the bug
If I wrap the environment with RecordVideo wrapper when using rgb_array/rgb_array_list as the render_mode, env.render() returns arrays with zero values after the first time the environment is truncated. Reseting the environment does not fix the rendering output. This does not happen when not using the RecordVideo wrapper on Gymnasium-Robotics environments, or when using RecordVideo wrapper on the basic Gymnasium environments (e.g., classic control).
Code example
import gymnasium as gym
from gymnasium.wrappers import RecordVideo
env = gym.make("HandReach-v1", render_mode="rgb_array",max_episode_steps=5)
env = RecordVideo(env, video_folder="videos/",disable_logger=True)
observation, info = env.reset()
for i in range(7):
action = env.action_space.sample()
observation, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
observation, info = env.reset()
print("reset")
else:
out = env.render()
print(out.max())
env.close()
System Info
- macOS 13.1
- python 3.10.8
- gymnasium 0.27.0 (pypi)
- gymnasium-robotics 1.2.0 (pypi)
- moviepy 1.0.3 (pypi)
- ffmpeg-python 0.2.0 (pypi)
Additional context
Checklist
- I have checked that there is no similar issue in the repo (required)
Thanks for raising this issue. We are aware of it and it will be solved in the next Gymnasium
release.
There will be a new version of the record wrapper Farama-Foundation/Gymnasium#246.
If you want to test it you can install Gymansium
from source
Thanks!