From fa18f607fa252cfe53f5f0ffd702f467429c82a8 Mon Sep 17 00:00:00 2001 From: tactino <18781106300@163.com> Date: Tue, 29 Sep 2026 14:06:33 -0400 Subject: [PATCH] robomimic-v1: the state-only metadata (square, lift, can, transport) builds - camera_names is optional, and image observations are on only with cameras --- src/plugrl_env_client/envs/robomimic/robomimic_env.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugrl_env_client/envs/robomimic/robomimic_env.py b/src/plugrl_env_client/envs/robomimic/robomimic_env.py index 9380a76..6720ce7 100644 --- a/src/plugrl_env_client/envs/robomimic/robomimic_env.py +++ b/src/plugrl_env_client/envs/robomimic/robomimic_env.py @@ -135,18 +135,25 @@ def __init__( ) ) + # The `-img` metadata names the cameras whose images go into the + # observation; the state-only metadata (`square`, `lift`, ...) names + # none. Reading the key unconditionally raised KeyError for every one + # of those, and turning image observations on without cameras would + # have robosuite add its default `agentview` image to the states. The + # agentview frame below is rendered either way. + camera_names = list(env_meta["env_kwargs"].get("camera_names", [])) env = _env_utils.create_env_from_metadata( env_meta=env_meta, render=False, render_offscreen=True, - use_image_obs=True, + use_image_obs=bool(camera_names), ) assert isinstance(env, robomimic.envs.env_robosuite.EnvRobosuite) self.env = env self.env.env.hard_reset = False - self.image_keys = env_meta["env_kwargs"]["camera_names"] + self.image_keys = camera_names self.task = env_meta["env_name"] self.agentview_image_size = config.agentview_image_size