[Documentation] [TitleIndex] [WordIndex


参数服务器是基于XMLRPC来实施,然后再ROS Master中运行,这意味着它的API可以在普通的XMLRPC库中访问。


参数使用常规的ROS命名规则(参见ROS naming convention)。这意味着ROS参数有一个层级来匹配在 topicsnodes中使用的命名空间。 这个层级是用来防止参数命名发生冲突。同时,采用层及方案也可以允许参数被单独或者作为一树来访问。例如,在下面的参数中:

/camera/left/name: leftcamera
/camera/left/exposure: 1
/camera/right/name: rightcamera
/camera/right/exposure: 1.1

参数 /camera/left/name 的值为 leftcamera。你同样可以从/camera/left,中得到这个值,/camera/left是一个字典。

name: leftcamera
exposure: 1

And you can also get the value for /camera, which has a dictionary of dictionaries representation of the parameter tree:

left: { name: leftcamera, exposure: 1 }
right: { name: rightcamera, exposure: 1.1 }

NOTE: The current implementation does not enforce the naming conventions of parameter names. However in the future they may be so you should follow them.

Parameter Types

The Parameter Server uses XMLRPC data types for parameter values, which include:

You can also store dictionaries (i.e. structs) on the Parameter Server, though they have special meaning. The Parameter Server represents ROS namespaces as dictionaries. For example, imagine you set the following three parameters:

/gains/P = 10.0
/gains/I = 1.0
/gains/D = 0.1

You can either read them back separately, i.e. retrieving /gains/P would return 10.0, or you can retrieving /gains, which would return a dictionary:

{ 'P': 10.0, 'I': 1.0, 'D' : 0.1 }

Just like the ROS naming hierarchy, you can nest dictionaries within dictionaries to represent child namespaces.


The ROS naming convention refers to ~name as a private name. These private names primarily are for parameters specific to a single Node. The ~ prefix prepends the Node's name to use it as a semi-private namespace -- they are still accessible from other parts of the system, but they are generally protected from accidental name collisions.

You can use remapping arguments to specify node parameters on the command line by changing the tilde ~ to an underscore _, e.g.:

rosrun rospy_tutorials talker _param:=1.0





参见 rospy overview.


can roscpp overview.

2020-08-08 12:22