Skip to content

Commit

Permalink
Fix bug that uses the status of a previous goal
Browse files Browse the repository at this point in the history
The `_goal_status` member was not set after sending or accepting a goal.
So the cancel timeout check would check against the status of a previous
goal and then conclude the goal is already finished.
  • Loading branch information
Rayman committed Jun 11, 2024
1 parent bdf18e0 commit c9c5263
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion smach_ros/smach_ros/simple_action_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(self,
self._action_spec = action_spec

# Set timeouts
self._goal_status = 0
self._goal_status = GoalStatus.STATUS_UNKNOWN
self._goal_result = None
self._exec_timeout = exec_timeout
self._preempt_timeout = preempt_timeout
Expand Down Expand Up @@ -354,6 +354,7 @@ def execute(self, ud):
# Activate the state before sending the goal
self._activate_time = self.node.get_clock().now()
self._status = ActionState.ACTIVE
self._goal_status = GoalStatus.STATUS_UNKNOWN

with self._done_cond:
# Dispatch goal via non-blocking call to action server
Expand Down Expand Up @@ -440,6 +441,7 @@ def _goal_accepted_cb(self, future):
Accept or reject a client request to begin an action.
"""
goal_handle = future.result()
self._goal_status = goal_handle.status

if not goal_handle.accepted:
self.node.get_logger().debug(f"Goal request from action {self._action_name} has been rejected!")
Expand Down

0 comments on commit c9c5263

Please sign in to comment.