Skip to content

Commit

Permalink
Add guard on Python single goal action server example (#380)
Browse files Browse the repository at this point in the history
Signed-off-by: Ruddick Lawrence <[email protected]>
  • Loading branch information
mrjogo authored May 16, 2024
1 parent 05aa97e commit 65bd653
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ def execute_callback(self, goal_handle):
# Sleep for demonstration purposes
time.sleep(1)

goal_handle.succeed()
with self._goal_lock:
if not goal_handle.is_active:
self.get_logger().info('Goal aborted')
return Fibonacci.Result()

goal_handle.succeed()

# Populate result message
result = Fibonacci.Result()
Expand Down

0 comments on commit 65bd653

Please sign in to comment.