You're reading the documentation for an older, but still supported, version of ROS 2. For information on the latest version, please have a look at Humble.
ros2 param command-line tool
Table of Contents
Parameters in ROS 2 can be get, set, listed, and described through a set of services as described in the concept document.
ros2 param command-line tool is a wrapper around these service calls that makes it easy to manipulate parameters from the command-line.
This command will list all of the available parameters on a given node, or on all discoverable nodes if no node is given.
To get all of the parameters on a given node:
ros2 param list /my_node
To get all of the parameters on all nodes in the system (this can take a long time on a complicated network):
ros2 param list
This command will get the value of a particular parameter on a particular node.
To get the value of a parameter on a node:
ros2 param get /my_node use_sim_time
This command will set the value of a particular parameter on a particular node. For most parameters, the type of the new value must be the same as the existing type.
To set the value of a parameter on a node:
ros2 param set /my_node use_sim_time false
The value that is passed on the command-line is in YAML, which allows arbitrary YAML expressions to be used.
However, it also means that certain expressions will be interpreted than might be expected.
For instance, if the parameter
my_string on node
my_node is of type string, the following will not work:
ros2 param set /my_node my_string off
That’s because YAML is interpreting “off” as a boolean, and
my_string is a string type.
This command will remove a parameter from a particular node. However, note that this can only remove dynamic parameters (not declared parameters). See the concept document for more information.
ros2 param delete /my_node my_string
This command will provide a textual description of a particular parameter on a particular node:
ros2 param describe /my_node use_sim_time
This command will print out all of the parameters on a particular node in a YAML file format. The output of this command can then be used to re-run the node with the same parameters later:
ros2 param dump /my_node