0
$\begingroup$

Rosanswers logo

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/b953bdddf8de213b4a051ecf2d668dad65ff9f89/rclcpp/test/rclcpp/test_node.cpp

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/issues/286

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

Thanks!


Originally posted by kimmcg on ROS Answers with karma: 11 on 2022-08-10

Post score: 1


Original comments

Comment by gvdhoorn on 2022-08-10:
Wouldn't / be slashes instead of dashes?

Comment by kimmcg on 2022-08-10:
you are absolutely right... so stupid of me. I've edited my original question. Thanks for notifying me!

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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).


Originally posted by ljaniec with karma: 3064 on 2022-08-10

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by kimmcg on 2022-08-11:
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?

Comment by ljaniec on 2022-08-11:
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...?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.