Skip to content

Commit

Permalink
Fixes outdated sensor data after reset
Browse files Browse the repository at this point in the history
  • Loading branch information
kellyguo11 committed Oct 20, 2024
1 parent be52603 commit 9b4816a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ def step(self, action: torch.Tensor) -> VecEnvStepReturn:
reset_env_ids = self.reset_buf.nonzero(as_tuple=False).squeeze(-1)
if len(reset_env_ids) > 0:
self._reset_idx(reset_env_ids)
# update articulation kinematics
self.sim.update_fabric_and_kinematics()
# if sensors are added to the scene, make sure we render to reflect changes in reset
if self.sim.has_rtx_sensors() and self.cfg.rerender_on_reset:
self.sim.render()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ def reset(self, seed: int | None = None, options: dict[str, Any] | None = None)
indices = torch.arange(self.num_envs, dtype=torch.int64, device=self.device)
self._reset_idx(indices)

# update articulation kinematics
self.sim.update_fabric_and_kinematics()
# if sensors are added to the scene, make sure we render to reflect changes in reset
if self.sim.has_rtx_sensors() and self.cfg.rerender_on_reset:
self.sim.render()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def step(self, action: torch.Tensor) -> VecEnvStepReturn:
reset_env_ids = self.reset_buf.nonzero(as_tuple=False).squeeze(-1)
if len(reset_env_ids) > 0:
self._reset_idx(reset_env_ids)
# update articulation kinematics
self.sim.update_fabric_and_kinematics()
# if sensors are added to the scene, make sure we render to reflect changes in reset
if self.sim.has_rtx_sensors() and self.cfg.rerender_on_reset:
self.sim.render()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,14 @@ def get_setting(self, name: str) -> Any:
"""
return self._settings.get(name)

def update_fabric_and_kinematics(self) -> None:
"""Updates articulation kinematics and fabric for rendering."""
if self._fabric_iface is not None:
if self.physics_sim_view is not None and self.is_playing():
# Update the articulations' link's poses before rendering
self.physics_sim_view.update_articulations_kinematic()
self._update_fabric(0.0, 0.0)

"""
Operations - Override (standalone)
"""
Expand Down Expand Up @@ -464,11 +472,7 @@ def render(self, mode: RenderMode | None = None):
self.set_setting("/app/player/playSimulations", True)
else:
# manually flush the fabric data to update Hydra textures
if self._fabric_iface is not None:
if self.physics_sim_view is not None and self.is_playing():
# Update the articulations' link's poses before rendering
self.physics_sim_view.update_articulations_kinematic()
self._update_fabric(0.0, 0.0)
self.update_fabric_and_kinematics()
# render the simulation
# note: we don't call super().render() anymore because they do above operation inside
# and we don't want to do it twice. We may remove it once we drop support for Isaac Sim 2022.2.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

# Note: Semantic Versioning is used: https://semver.org/
version = "0.10.7"
version = "0.10.8"

# Description
title = "Isaac Lab Environments"
Expand Down
9 changes: 9 additions & 0 deletions source/extensions/omni.isaac.lab_tasks/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
---------

0.10.8 (2024-10-20)
~~~~~~~~~~~~~~~~~~~

Changed
^^^^^^^

* Added call to update articulation kinematics after reset to ensure updated states in non-rendering sensors.


0.10.7 (2024-10-02)
~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 9b4816a

Please sign in to comment.