From 7d6c734ef583f77cc3a9fe75211ef1b33f87f2bf Mon Sep 17 00:00:00 2001 From: Mikael Dallaire Cote <110583667+0mdc@users.noreply.github.com> Date: Mon, 16 Sep 2024 22:42:01 -0400 Subject: [PATCH] Invalidate contact point cache in all cases. --- .../habitat/sims/habitat_simulator/habitat_simulator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/habitat-lab/habitat/sims/habitat_simulator/habitat_simulator.py b/habitat-lab/habitat/sims/habitat_simulator/habitat_simulator.py index b36a664f1f..187b8eff3a 100644 --- a/habitat-lab/habitat/sims/habitat_simulator/habitat_simulator.py +++ b/habitat-lab/habitat/sims/habitat_simulator/habitat_simulator.py @@ -461,6 +461,8 @@ def _update_agents_state(self) -> bool: return is_updated def reset(self) -> Observations: + self._contact_point_cache_time = 0.0 + sim_obs = super().reset() if self._update_agents_state(): sim_obs = self.get_sensor_observations() @@ -515,7 +517,7 @@ def reconfigure( ep_info: Optional[Episode] = None, should_close_on_new_scene: bool = True, ) -> None: - # TODO(maksymets): Switch to Habitat-Sim more efficient caching + self._contact_point_cache_time = 0.0 is_same_scene = habitat_config.scene == self._current_scene self.habitat_config = habitat_config self.sim_config = self.create_sim_config(self._sensor_suite) @@ -700,6 +702,9 @@ def get_observations_at( else: return None + def perform_discrete_collision_detection(self) -> None: + self._contact_point_cache_time = 0.0 + def get_physics_contact_points(self) -> List[ContactPointData]: sim_time = self.get_world_time() contact_points_dirty = sim_time != self._contact_point_cache_time