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

Parameters ROS2 convention: dots or slashes

asked 2022-08-10 05:56:53 -0500

kimmcg gravatar image

updated 2022-08-10 14:46:35 -0500

Hi!

I was wondering what the official or the conventional delimiter is for parameters in ROS2:

  1. dots like in namespace.param.subparam
  2. slashes like in namespace/param/subparam

This test node in rclcpp seem to suggest that it is slashes: https://github.com/ros2/rclcpp/blob/b...

But when override flags are used, the parameters are shown with dot delimiters. Also this issue seem to suggest that dot delimiters are the way to go: https://github.com/ros2/geometry2/iss...

So does anybody know what the (upcoming) right way of describing ROS2 parameters are? Dots or slashes?

Thanks!

edit retag flag offensive close merge delete

Comments

1

Wouldn't / be slashes instead of dashes?

gvdhoorn gravatar image gvdhoorn  ( 2022-08-10 12:01:10 -0500 )edit

you are absolutely right... so stupid of me. I've edited my original question. Thanks for notifying me!

kimmcg gravatar image kimmcg  ( 2022-08-10 14:47:17 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-08-10 18:20:40 -0500

ljaniec gravatar image

updated 2022-08-10 18:22:13 -0500

These links:

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.

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.

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

edit flag offensive delete link more

Comments

Thanks for the links! I have a strong hunch towards dots too, but the first link you send show examples in slashes still? But I do see that the first link (the design doc) was updated in 2019, so technically the second link of the automated api doc should be newer?

kimmcg gravatar image kimmcg  ( 2022-08-11 01:48:29 -0500 )edit

I understand the /foo/bar/baz as an example of ambiguous naming in the current system (that's it, ROS1 then). Honestly, I haven't found any "laws" prohibiting naming with / so it's a matter of choice for programmers...?

ljaniec gravatar image ljaniec  ( 2022-08-11 07:04:22 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-08-10 05:56:53 -0500

Seen: 376 times

Last updated: Aug 10 '22