roslaunch XML param 官方文檔 翻譯

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 &quot;$(find roslaunch)/test/params.yaml&quot;" />
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章