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