Skip to content

Commit 76a93f9

Browse files
author
nemo.liu
committed
Update
1 parent 18cc053 commit 76a93f9

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

metasim/sim/isaacsim/isaacsim.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -487,15 +487,6 @@ def _get_states(self, env_ids: list[int] | None = None) -> TensorState:
487487
if isinstance(bg_depth, np.ndarray):
488488
bg_depth = torch.from_numpy(bg_depth)
489489
bg_depth = bg_depth.to(self.device)
490-
<<<<<<< HEAD
491-
=======
492-
493-
# Ensure foreground_mask shape matches depth
494-
if foreground_mask.shape != sim_depth.shape:
495-
if foreground_mask.numel() == sim_depth.numel():
496-
foreground_mask = foreground_mask.view(sim_depth.shape)
497-
498-
>>>>>>> 67a96accb80767d83772b98e1ea97349097d9194
499490
# Use torch.where for depth composition
500491
depth_comp = torch.where(foreground_mask > 0.5, sim_depth, bg_depth)
501492
depth_data = depth_comp.unsqueeze(0).unsqueeze(-1)

metasim/sim/mujoco/mujoco.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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, well 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

Comments
 (0)