Skip to content

Commit

Permalink
fix(simple_action_client): preempts SimpleActionState when preempt is…
Browse files Browse the repository at this point in the history
… requested regardless of GoalSt

Solves ros#52
  • Loading branch information
jorgenfb committed May 15, 2019
1 parent 1a44c12 commit 4d41b88
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions smach_ros/src/smach_ros/simple_action_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,17 @@ def execute(self, ud):

# Check status
if self._status == SimpleActionState.INACTIVE:
# If the state was requested preempted we have to obey it by calling
# self.service_preempt() regardless of the actual goal status to prevent
# this State from ending up in an unfornate situation where it would preempt
# immediately on the next run (See line 278).
if self.preempt_requested():
outcome = 'preempted'
self.service_preempt()

# Set the outcome on the result state
if self._goal_status == GoalStatus.SUCCEEDED:
outcome = 'succeeded'
elif self._goal_status == GoalStatus.PREEMPTED and self.preempt_requested():
outcome = 'preempted'
self.service_preempt()
else:
# All failures at this level are captured by aborting, even if we timed out
# This is an important distinction between local preemption, and preemption
Expand Down

0 comments on commit 4d41b88

Please sign in to comment.