Parameters
We are now going to come back to the node itself and talk about another important ROS 2 concept: parameters.
This time, it’s not about communication, but about how to give different settings to a node when you start it.
Let’s quickly discover how parameters work, and you’ll get a complete explanation with more examples and use cases in Chapter 8.
Getting the parameters for a node
Stop all running nodes, and start the turtlesim
node in Terminal 1:
$ ros2 run turtlesim turtlesim_node
Then, to list all parameters, it’s quite easy, and you can probably guess the command. If we have ros2 topic list
for topics, ros2 service list
for services, and ros2 action list
for actions, then, for parameters, we have ros2 param list
. The only particularity is that we use the word param
instead of parameter
. Run this command in Terminal 2:
$ ros2 param list /turtlesim: background_b background_g background_r...