What is a ROS 2 topic?
You discovered the concept of topics through hands-on experiments in Chapter 3. With this, you should have a basic intuition of how things work.
I am now going to start from scratch again and explain topics—not by running code, but by using a real-life analogy that makes it easier to understand. We will build an example, step by step, and then recap the most important points.
A publisher and a subscriber
For this analogy, I will use radio transmitters and receivers. As this is a simplified example, not everything I’ll say about radio will be correct, but the point here is to understand ROS 2 topics.
Let’s start with one radio transmitter. This radio transmitter will send some data at a given frequency. To make it easier for people to remember, this frequency is usually represented by a number, such as 98.7. We can even think of 98.7 as a name. If you want to listen to the radio, you know you have to connect your device to 98.7...