What is a ROS 2 action?
Let’s start with ROS 2 actions. We have seen what a ROS 2 service is. It is a request/reply kind of communication; it is suitable for short tasks like enabling/disabling some components in the robot. If the task execution of the service takes time, the client must wait for a reply. There is no option to cancel the service if it is taking longer than expected. Also, there is no feedback from the server node on whether to cancel the request or not. That is where ROS actions come in.
A ROS action is well suited for long-running tasks, such as navigation of the robot from A to B, moving an arm from the current position to the goal position, etc. In these kinds of tasks, the task can take time, and getting feedback on the status of the task will be useful. A ROS action involves two key participants: the action client, which sends a goal and can request feedback or cancel it, and the action server, which receives the goal, processes it, and returns the...