@@ -609,7 +609,6 @@ def _get_states(self, env_ids: list[int] | None = None) -> list[dict]:
609609 rgb = None
610610 depth = None
611611
612- # Get simulation rendering (same logic for both normal and GS background cases)
613612 if "rgb" in camera .data_types :
614613 if sys .platform == "darwin" :
615614 with self ._mj_lock : # optional but safer
@@ -637,7 +636,6 @@ def _get_states(self, env_ids: list[int] | None = None) -> list[dict]:
637636 width = camera .width , height = camera .height , camera_id = camera_id , depth = False
638637 )
639638 rgb = torch .from_numpy (np .ascontiguousarray (rgb_np )).unsqueeze (0 )
640-
641639 if "depth" in camera .data_types :
642640 if sys .platform == "darwin" :
643641 with self ._mj_lock :
@@ -665,7 +663,7 @@ def _get_states(self, env_ids: list[int] | None = None) -> list[dict]:
665663 depth_np = self .renderer .render (render_mode = mujoco .RenderMode .DEPTH )
666664 else :
667665 # Very old fallback: some builds returned (rgb, depth) as a tuple.
668- # If this still fails in your env, we' ll need a dedicated mjr_readPixels path.
666+ # If this still fails in your env, we’ ll need a dedicated mjr_readPixels path.
669667 maybe = self .renderer .render ()
670668 if isinstance (maybe , tuple ) and len (maybe ) == 2 :
671669 _ , depth_np = maybe
@@ -727,7 +725,7 @@ def _get_states(self, env_ids: list[int] | None = None) -> list[dict]:
727725 else :
728726 depth = torch .from_numpy (np .ascontiguousarray (depth_comp .copy ())).unsqueeze (0 )
729727
730- state = CameraState (rgb = rgb , depth = depth )
728+ state = CameraState (rgb = locals (). get ( " rgb" , None ), depth = locals (). get ( " depth" , None ) )
731729 camera_states [camera .name ] = state
732730 extras = self .get_extra ()
733731 return TensorState (objects = object_states , robots = robot_states , cameras = camera_states , extras = extras )
0 commit comments