From the figure above, when exactly does the used-defined functions (handle_goal
, handle_cancel
, and handle_accepted
) passed to the create_server
function get called?
What I understand from the document is that: once we return rclcpp_action::GoalResponse::ACCEPT_AND_EXECUTE
from the handle_goal
(passed to the create_server
), then at some point, the handle_accepted
function will get called and we can perform the task inside the handle_accepted
function.
But for cancelling the action, I am a little bit confused reading the document. From the document, it is written that:
- CANCELING - The client has requested that the goal be canceled and the action server has accepted the cancel request. This state is useful for any user-defined “clean up” that the action server may have to do.
But once we return rclcpp_action::CancelResponse::ACCEPT
in the function handle_cancel
(passed to the create_server
), what happen and what does the “CANCELING” state in the figure do? Where should we define the user-defined “clean up” function?