From a6292c8558633367341f05cb7b0faaaf25978300 Mon Sep 17 00:00:00 2001 From: Abdelrhman Bassiouny Date: Wed, 23 Oct 2024 11:31:49 +0200 Subject: [PATCH] [Multiverse] corrected multiple removal of same simulator state. --- src/pycram/datastructures/world.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pycram/datastructures/world.py b/src/pycram/datastructures/world.py index 6ca49fd4f..05c4ca03c 100644 --- a/src/pycram/datastructures/world.py +++ b/src/pycram/datastructures/world.py @@ -1227,8 +1227,9 @@ def remove_saved_states(self) -> None: Remove all saved states of the World. """ if self.conf.use_physics_simulator_state: - for state in self.saved_states.values(): - self.remove_physics_simulator_state(state.simulator_state_id) + simulator_state_ids = set([state.simulator_state_id for state in self.saved_states.values()]) + for ssid in simulator_state_ids: + self.remove_physics_simulator_state(ssid) else: self.remove_objects_saved_states() super().remove_saved_states()