ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

These links:

  • https://design.ros2.org/articles/ros_parameters.html

Address all parameters without ambiguity in the names

For example, one of the challenges of the current system is that there is a naming ambiguity between nodes and parameters /foo/bar/baz could be a node /foo/bar/baz or a private parameter baz on node /foo/bar.

  • https://docs.ros2.org/latest/api/rclcpp/classrclcpp_1_1Node.html#a5ebda51ed6fa4ce8f2cddc9f77e9674e

declare_parameters() (...) Declare and initialize several parameters with the same namespace and type.

For each key in the map, a parameter with a name of "namespace.key" will be set to the value in the map. The resulting value for each declared parameter will be returned.

The name expansion is naive, so if you set the namespace to be "foo.", then the resulting parameter names will be like "foo..key". However, if the namespace is an empty string, then no leading '.' will be placed before each key, which would have been the case when naively expanding "namespace.key". This allows you to declare several parameters at once without a namespace.

strongly suggest the first option you mentioned (dots like in namespace.param.subparam).

These links:

  • https://design.ros2.org/articles/ros_parameters.html

Address all parameters without ambiguity in the names

For example, one of the challenges of the current system is that there is a naming ambiguity between nodes and parameters /foo/bar/baz could be a node /foo/bar/baz or a private parameter baz on node /foo/bar.

  • https://docs.ros2.org/latest/api/rclcpp/classrclcpp_1_1Node.html#a5ebda51ed6fa4ce8f2cddc9f77e9674e

declare_parameters() (...) Declare and initialize several parameters with the same namespace and type.

For each key in the map, a parameter with a name of "namespace.key" will be set to the value in the map. The resulting value for each declared parameter will be returned.

The name expansion is naive, so if you set the namespace to be "foo.", then the resulting parameter names will be like "foo..key". However, if the namespace is an empty string, then no leading '.' will be placed before each key, which would have been the case when naively expanding "namespace.key". This allows you to declare several parameters at once without a namespace.

strongly suggest the first option you mentioned (dots like in namespace.param.subparam).