DLR-RM / rl-baselines3-zoo

A training framework for Stable Baselines3 reinforcement learning agents, with hyperparameter optimization and pre-trained agents included.
https://rl-baselines3-zoo.readthedocs.io
MIT License
2.08k stars 515 forks source link

[Feature Request] Properly visually render panda_gym environments via enjoy.py without supplying env-kwargs #310

Closed eric-y-chen closed 1 year ago

eric-y-chen commented 2 years ago

šŸš€ Feature

As of 1.6.3 from PyPI, rendering of panda_gym 1.1.1 environments require env-kwargs render:True to be supplied to properly display the rendering during enjoy replay. If not supplied, no visualization appears and performance is still slowed as if it were rendering, i.e. not even functioning as if --no-render were supplied.

This request aligns the visualization behavior to match mujoco-py/gym_robotics and pybullet environments, like FetchReach-v1 and KukaBulletEnv-v0, without having to supply env-kwargs.

Motivation

No response

Pitch

Add the following snippet, or similar code, to rl_zoo3/utils.py in create_test_env:

if ("panda_gym.envs" in str(gym.envs.registry.env_specs[env_id].entry_point)) and should_render:
    env_kwargs["render"] = True

The snippet was tested to ensure it produced the desired visualization behavior but was not regression tested to confirm whether it introduces bugs elsewhere.


Potentially add another staticmethod in rl_zoo3/exp_manager.py to handle panda_gym environments explicitly rather than simply is_robotics_env to make the above snippet more succinct.

Alternatives

No response

Additional context

No response

Checklist

qgallouedec commented 2 years ago

Thank you for spotting this. LGTM, can you submit a PR?