roslaunch XML param
<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.
<param>标记定义了要在参数服务器上设置的参数。可以指定textfile、binfile或command属性来设置参数值,而不是值。<param>标记可以放在<node>标记中,在这种情况下,该参数被视为私有参数。
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).
还可以使用<param>标记中的~param语法(请参阅ROS names),跨一组节点,设置私有参数。声明的参数将被设置为<node>标记中的本地参数,这些标记位于相同的范围内(即group或ns标记)。
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.
-
定义参数的值。如果省略此属性,则必须指定binfile、textfile或command。
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:
- 指定参数的类型。如果不指定类型,roslaunch将尝试自动确定类型。这些规则非常基本:
- numbers with '.'s are floating point, integers otherwise;
- 带'.'的数字是浮点数,否则为整数;
- "true" and "false" are boolean (not case-sensitive).
- “ true”和“ false”是布尔值(不区分大小写)。
- 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.
-
文件的内容将被读取并存储为字符串。 该文件必须是本地可访问的,但是强烈建议您使用$(find)方式(指定基于包的相对路径的方式),指定路径。
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.
-
该文件的内容将被读取并存储为base64编码的XML-RPC二进制对象。 该文件必须是本地可访问的,但是强烈建议您使用$(find)方式(指定基于包的相对路径的方式),指定路径。
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.
-
命令的输出将被读取并存储为字符串。但是强烈建议您使用$(find)方式(指定基于包的相对路径的方式),指定文件参数。 由于XML转义的要求,您还应该使用单引号对文件参数进行引用。
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:
但这在使用在stdout上输出参数的命令时不起作用。 在这种情况下,可以使用param新的类型yaml:
<param name="params_a" type="yaml" command="cat "$(find roslaunch)/test/params.yaml"" />