[Documentation] [TitleIndex] [WordIndex

Parameters

parameters

The parameters object lets you read and write values to the Parameter Server. This object follows the general ROSH convention for converting ROS names, i.e. to access the parameters /foo/bar/gains, you would use:

You can also use mapping-style lookups on parameters, which is useful if you are dealing with string names:

Retrieving a parameter value

To retrieve a parameter value, simply do a method call on the parameter you want, e.g.:

In [3]: parameters.run_id()
Out[3]: '7ab647bc-c29f-11df-aef2-003048fb8348'

Setting a parameter value

You can set values on the Parameter Server simply by using normal Python assignment, e.g.:

In [4]: parameters.foo = 1

In [5]: parameters.foo
Out[5]: 1

You can also use Python dictionaries to assign create namespaces, e.g.:

In [6]: parameters.bar = dict(child1=1, child2=2)

In [7]: parameters.bar
Out[7]: Boxed[{'child1': 1, 'child2': 2}]

Loading rosparam data

rosparam(filename)

rosparam_str(yaml_data)


2024-11-09 17:35