<param> tag

The <param> tag defines a parameter to be set on the Parameter Server. Instead of value, you can specify a textfile, binfile or command attribute to set the value of a parameter. The <param> tag can be put inside of a <node> tag, in which case the parameter is treated like a private parameter.

You can also set private parameter across a group of nodes by using the ~param syntax (see ROS names) in a <param> tag. The declared parameter will be set as a local parameter in the <node> tags that follow that are in the same scope (i.e. group or ns tag).

Attributes

  • name="namespace/name"

    • Parameter name. Namespaces can be included in the parameter name, but globally specified names should be avoided.

    value="value"(optional)

    • Defines the value of the parameter. If this attribute is omitted, binfile, textfile or command must be specified.

    type="str|int|double|bool|yaml"(optional)

    • Specifies the type of the parameter. If you don't specify the type, roslaunch will attempt to automatically determine the type. These rules are very basic:
      • numbers with '.'s are floating point, integers otherwise;
      • "true" and "false" are boolean (not case-sensitive).
      • all other values are strings

    textfile="$(find pkg-name)/path/file.txt"(optional)

    • The contents of the file will be read and stored as a string. The file must be locally accessible, though it is strongly recommended that you use the package-relative $(find)/file.txt syntax to specify the location.

    binfile="$(find pkg-name)/path/file"(optional)

    • The contents of the file will be read and stored as a base64-encoded XML-RPC binary object. The file must be locally accessible, though it is strongly recommended that you use the package-relative $(find)/file.txt syntax to specify the location.

    command="$(find pkg-name)/exe '$(find pkg-name)/arg.txt'"(optional)

    • The output of the command will be read and stored as a string. It is strongly recommended that you use the package-relative $(find)/file.txt syntax to specify file arguments. You should also quote file arguments using single quotes due to XML escaping requirements.

Examples

<param name="publish_frequency" type="double" value="10.0" />

Parameters from YAML output

In order to load a YAML file, you can use:

<rosparam command="load" file="FILENAME" />

New in Lunar

But this doesn't work when using a command which outputs the parameters on stdout. In that case the new param type yaml can be used:

<param name="params_a" type="yaml" command="cat '$(find roslaunch)/test/params.yaml'" />

In the above example, the parameters from the described file would be loaded under the local namespace params_a.

Wiki: roslaunch/XML/param (last edited 2021-01-18 18:07:26 by AvneeshMishra)