Skip to content

Commit

Permalink
[SaveState] Fixed issue when removing all saved states.
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelrhmanBassiouny committed Oct 15, 2024
1 parent 47853a6 commit bc8f708
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pycram/datastructures/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -1180,19 +1180,19 @@ def reset_world(self, remove_saved_states=False) -> None:
self.restore_state(self.original_state_id)
if remove_saved_states:
self.remove_saved_states()
self.save_state(use_same_id=True)
self.original_state_id = self.save_state(use_same_id=True)

def remove_saved_states(self) -> None:
"""
Remove all saved states of the World.
"""
if self.conf.use_physics_simulator_state:
for state_id in self.saved_states:
if state_id is not None:
self.remove_physics_simulator_state(state_id)
for state in self.saved_states.values():
self.remove_physics_simulator_state(state.simulator_state_id)
else:
self.remove_objects_saved_states()
super().remove_saved_states()
self.latest_state_id = None
self.original_state_id = None

def remove_objects_saved_states(self) -> None:
Expand Down

0 comments on commit bc8f708

Please sign in to comment.