Skip to content

Commit

Permalink
Improve cancellation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-mueller committed Dec 25, 2024
1 parent c36d198 commit 93803a2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pyrobosim/pyrobosim/core/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,15 +946,20 @@ def cancel_actions(self):
self.logger.warning("There is no running action or plan to cancel.")
return

if self.executing_nav and self.path_executor is not None:
self.logger.info("Canceling path execution...")
self.path_executor.cancel_execution = True
while self.executing_nav:
if self.executing_action:
if self.executing_nav and self.path_executor is not None:
self.logger.info("Canceling path execution...")
self.path_executor.cancel_execution = True
while self.executing_nav:
time.sleep(0.1)
# Wait for execute_action to return
while self.executing_action:
time.sleep(0.1)

if self.executing_action or self.executing_plan:
if self.executing_plan:
self.canceling_execution = True
while self.canceling_execution:
# Wait for execute_plan to return
while self.executing_plan:
time.sleep(0.1)

def execute_plan(self, plan, delay=0.5):
Expand Down

0 comments on commit 93803a2

Please sign in to comment.