open-rmf / rmf_ros2

Internal ROS infrastructure for RMF
Apache License 2.0
74 stars 60 forks source link

Allow automatic action cancellation to be toggled #392

Closed mxgrey closed 2 weeks ago

mxgrey commented 3 weeks ago

Historically the way task cancellation worked for "perform action" events was to immediately declare that the action is cancelled and trust the action implementer to somehow gracefully wind down the action even though we might immediately start issuing new commands.

With this PR, the action implementer can use execution.set_automatic_cancel(false) to prevent the task system from immediately declaring that the cancellation is finished. Instead the task system will wait until the implementer calls execution.finished(), at which point the cancellation will be registered.

If the action implementer does not call execution.set_automatic_cancel(false) then the old behavior will remain as it has always been.