Introspecting your nodes
To finish this chapter, we will practice a bit more with the ros2 node
command line.
So far, you have seen how to write a node, build it, and run it. One missing part is to know how to introspect your nodes. Even if a node can run, it doesn’t mean it will do exactly what you want it to do.
Being able to introspect your nodes will help you fix errors that you might have made in your code. It will also allow you to easily find more information about other nodes that you are starting but didn’t write (as we did in the discovery phase in Chapter 3).
For each core concept in Part 2, we will take a bit of time to experiment with the command-line tools related to the concept. The command-line tool for nodes is ros2 node
.
First, and before we use ros2 node
, we have to start a node. As a recap, to start a node, we use ros2 run <package_name> <executable_name>
. If we start the Python node we have created in this chapter, we use this...