Additional tools to handle topics
You’ve just written a bunch of nodes containing publishers and subscribers. We will now explore how ROS 2 tools can help you do more things with topics.
We will explore the following topics:
- Introspection with
rqt_graph
- Introspection and debugging with the
ros2 topic
command line - Changing a topic name when starting a node
- Replaying topic data with bags
Introspecting topics with rqt_graph
We used rqt_graph
to visualize nodes in Chapter 3. Let’s run it again and see how to introspect the publisher and subscriber we have just created.
First, start both the number_publisher
and number_counter
nodes (from any package: my_py_pkg
or my_cpp_pkg
).
Then, start rqt_graph
in another Terminal:
$ rqt_graph
If needed, refresh the view a few times and select Nodes/Topics (all). You can also uncheck the Dead sinks box and the Leaf topics box. This will allow you to see topics even if there is just one subscriber...