Activity 02 - ROS2 Topics

It’s time for a new activity on ROS 2 topics.

Here is a representation of the graph you should get at the end.


The blue boxes are nodes and the green boxes are topics.

And here’s the final result you should get in the terminal (of course the numbers may be different):


__________________________________________

ros2 topic echo /number_count

data: 38

---

data: 40

---

data: 42

---


__________________________________________


You’ll create 2 nodes from scratch. In the first one you’ll have 1 publisher, and in the second one, 1 publisher & 1 subscriber.

A few hints:

And now, let’s get to work! :)

Make sure you really spend some time on this activity, even if you can’t finish it. That’s the only way you will truly progress.

You can do this activity in both Python and Cpp. In fact, you could write the first node in Python, and the second in Cpp, and vice versa!

I’ll see you in the next lecture for the solution.