[Documentation] [TitleIndex] [WordIndex

<rosparam> tag

The <rosparam> tag enables the use of rosparam YAML files for loading and dumping parameters from the ROS Parameter Server. It can also be used to remove parameters. The <rosparam> tag can be put inside of a <node> tag, in which case the parameter is treated like a private name.

The delete and dump commands run before the load command as well as before any other parameters are uploaded to the Parameter Server. delete and dump commands run in the declared order.

The load command is considered additive: if you declare a dictionary or namespace of parameters, those parameters will be added to any other parameters declared for that namespace. Similarly, load commands can override parameters previously declared.

The <rosparam> tag can either reference a YAML file or contain raw YAML text. If the YAML text defines a dictionary, the param attribute may be omitted.

Attributes

Examples

<rosparam command="load" file="$(find rosparam)/example.yaml" />
<rosparam command="delete" param="my/param" />

<rosparam param="a_list">[1, 2, 3, 4]</rosparam>

<rosparam>
  a: 1
  b: 2
</rosparam>

Substitution allows you to make use of roslaunch args representing all or part of a YAML string. e.g.

<arg name="whitelist" default="[3, 2]"/>
<rosparam param="whitelist" subst_value="True">$(arg whitelist)</rosparam>

They are also useful for embedding $(find ...) in yaml strings and to a lesser extent any of the other substitution patterns.

Example of accessing a list in roscpp code:

XmlRpc::XmlRpcValue v;
    nh_.param("subscribed_to_nodes", v, v);
    for(int i =0; i < v.size(); i++)
    {
      node_names_.push_back(v[i]);
      std::cerr << "node_names: " << node_names_[i] << std::endl;
    }

2024-11-23 17:51