Skip to content

Commit 65bd653

Browse files
authored
Add guard on Python single goal action server example (#380)
Signed-off-by: Ruddick Lawrence <[email protected]>
1 parent 05aa97e commit 65bd653

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_single_goal.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ def execute_callback(self, goal_handle):
100100
# Sleep for demonstration purposes
101101
time.sleep(1)
102102

103-
goal_handle.succeed()
103+
with self._goal_lock:
104+
if not goal_handle.is_active:
105+
self.get_logger().info('Goal aborted')
106+
return Fibonacci.Result()
107+
108+
goal_handle.succeed()
104109

105110
# Populate result message
106111
result = Fibonacci.Result()

0 commit comments

Comments
 (0)