From a5f193d5d4e1062b4e4d38268b0ec7584a41f71c Mon Sep 17 00:00:00 2001 From: Alexander Mock Date: Tue, 15 Apr 2025 23:50:25 +0200 Subject: [PATCH 1/2] removed conditional wait as it caused the state to wait forever --- smach_ros/smach_ros/simple_action_state.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smach_ros/smach_ros/simple_action_state.py b/smach_ros/smach_ros/simple_action_state.py index 9c6b212..197861f 100644 --- a/smach_ros/smach_ros/simple_action_state.py +++ b/smach_ros/smach_ros/simple_action_state.py @@ -354,6 +354,8 @@ 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_result = None + self._goal_status = None with self._done_cond: # Dispatch goal via non-blocking call to action server @@ -368,7 +370,9 @@ def execute(self, ud): self._execution_timer_thread.start() # Wait for action to finish - self._done_cond.wait() + while not self._goal_result: + rclpy.spin_once(self.node) + time.sleep(0.01) # Call user result callback if defined result_cb_outcome = None From 39cdf74d5bb609368e6fee1fc314f50da64a0aa9 Mon Sep 17 00:00:00 2001 From: Alexander Mock Date: Wed, 16 Apr 2025 00:06:49 +0200 Subject: [PATCH 2/2] changed goal result check to is None --- smach_ros/smach_ros/simple_action_state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smach_ros/smach_ros/simple_action_state.py b/smach_ros/smach_ros/simple_action_state.py index 197861f..b0accf9 100644 --- a/smach_ros/smach_ros/simple_action_state.py +++ b/smach_ros/smach_ros/simple_action_state.py @@ -370,7 +370,7 @@ def execute(self, ud): self._execution_timer_thread.start() # Wait for action to finish - while not self._goal_result: + while self._goal_result is None: rclpy.spin_once(self.node) time.sleep(0.01)