Open zichunxx opened 1 month ago
I made a wrapper to collect images from different cameras:
class ImageCollection(gym.Wrapper, gym.utils.RecordConstructorArgs):
def __init__(self, env: gym.Env, camera_names: list):
gym.utils.RecordConstructorArgs.__init__(self, camera_names=camera_names)
gym.Wrapper.__init__(self, env)
assert env.render_mode == "rgb_array"
self.unwrapped_model = env.model
self.unwrapped_mujoco_renderer = env.mujoco_renderer
self.camera_names = camera_names
def render(self):
frames = []
for camera_name in self.camera_names:
frames.append(self.unwrapped_mujoco_renderer.render(render_mode=self.render_mode, camera_name=camera_name))
return frames
I am not sure if the above is the best way to realize this. Please feel free to offer some suggestions.
This solution looks like the best available currently
Thanks for your time to check the above code snippet.
The proper solution for MuJoCo Gymnasium would be to support multiple MujocoRendering
objects in MujocoEnv
, one for each camera, that will enable different configurations such as using "rgb_array" and "depth_array" cameras at the same time and multiple "human" render windows at the same time.
The proper solution for MuJoCo Gymnasium would be to support multiple
MujocoRendering
objects inMujocoEnv
, one for each camera, that will enable different configurations such as using "rgb_array" and "depth_array" cameras at the same time and multiple "human" render windows at the same time.
That would be great if this is implemented.
@Kallinteris-Andreas The render api doesn't seem built to support as by default so would recommend that until this is a common feature wanted by many users, I wouldn't implement it within the codebase.
Question
Hi!
Is it possible to require multiple images from different cameras using Gymnasium API?
The list of camera names cannot be passed during registration and only one camera string is feasible.
Is there any elegant way to realize this feature?
Thanks.