Metaworld icon indicating copy to clipboard operation
Metaworld copied to clipboard

Mismatch of render() interface between MetaWorld and Gym

Open ottofabian opened this issue 2 years ago • 0 comments

Currently the render function of MujocoEnv does not take a mode argument for the render() function and instead exposes the offscreen flag. https://github.com/rlworkgroup/metaworld/blob/a0009ed9a208ff9864a5c1368c04c273bb20dd06/metaworld/envs/mujoco/mujoco_env.py#L121-L133 This is an issue when using the environments e.g. with any form of gym wrappers. As seen here https://github.com/openai/gym/blob/2853ce4797a4dadb1f8702c8e35143d9fbd43ea6/gym/core.py#L253-L254 the mode is passed as argument to the underlying environment per default. If render is not explicitly called as render(False), we have offscreen='human' and the check for not offscreen will fail.

From what I can see the offscreen flag seems to be the same as mode=human and mode=rgb_array in the base gym interface. Is there any specific reason the offscreen flag is introduced over the default behavior? If not, I think the render() function should not be overloaded this way to remain compatible with existing gym functionality. For the remaining kwargs I do not see any issues, as they fit the interface.

Thanks for looking into this.

ottofabian avatar Aug 20 '21 08:08 ottofabian