What is a ROS 2 action?
To understand ROS 2 actions, we need to understand why we need them. That’s what we will focus on first. After that, I will explain how actions work through a real-life example.
You quickly discovered actions in Chapter 3 by running some existing nodes and command-line tools. The intuition you built there will help you better understand the concepts in this chapter.
Let’s dive in and see why and when actions could be needed in a ROS 2 application.
Why actions?
So far, we’ve looked at two forms of communication in ROS 2: topics and services.
Topics are used by nodes to send and receive messages. Publishers will publish data on a topic, and subscribers will subscribe to the topic to receive the data. Thus, topics are perfect for sending data streams in your application.
Services are used for client/server interactions between nodes. The client sends a request to the server, after which the server executes or computes something...