roslaunch XML rosparam 官方文檔 翻譯

roslaunch XML rosparam

目錄

  1. <rosparam> tag
    1. Attributes
    2. Examples

<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.

標籤允許使用rosparam YAML文件從ROS參數服務器加載和轉儲參數。它還可以用於刪除參數。<rosparam>標記可以放在<node>標記中,在這種情況下,該參數被視爲私有名稱。

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.

delete和dump命令,在load命令之前以及其他任何參數上傳到Parameter Server之前運行。 刪除和轉儲命令以聲明的順序運行。

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.

load命令被認爲是附加的:如果你聲明瞭參數的字典或參數的命名空間,則這些參數將添加到,該命名空間聲明的任何其他參數中。類似地,加載命令可以覆蓋先前聲明的參數。

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.

<rosparam>標記可以引用YAML文件或包含原始YAML文本。如果YAML文本定義了字典,那麼param屬性可以省略。

 

Attributes

  • command="load|dump|delete" (optional, default=load)

    file="$(find pkg-name)/path/foo.yaml" (load or dump commands)

    • Name of rosparam file.

    param="param-name"

    • Name of parameter.

    ns="namespace" (optional)

    • Scope the parameters to the specified namespace.

    subst_value=true|false (optional)

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.

Substitution允許您使用roslaunch args,代表全部或部分YAML的字符串。 例如

 

<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.

它們對於在yaml字符串中嵌入$(find…)以及在較小程度上嵌入任何其他替換組合(substitution patterns)也很有用。

它們有利於 ,在yaml字符串中嵌入$(find…),以及以最簡化的方式嵌入  其他  組合替換的表達式(substitution patterns)

Example of accessing a list in roscpp code:

使用roscpp代碼訪問列表的示例:

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;
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章