ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

What does "ACCEPTED" and "CANCELING" states do in the action state machine?

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?

Thanks for your question. However we ask that you please ask questions on http://answers.ros.org following our support guidelines: Support - ROS Wiki

ROS Discourse is for news and general interest discussions. ROS Answers provides a Q&A site which can be filtered by tags to make sure the relevant people can find and/or answer the question, and not overload everyone with hundreds of posts.