# ROS2 sequence and map parameters

Hello,

From what I can tell (which may be wrong), ROS2 does not allow for parameters which are nothing more than sequences or maps of other parameters, as we could do with the ROS1 xmlrpc parameter server. Is this assessment accurate?

It was fairly common for applications in ROS1 to programmatically inspect the parameter server in order to handle arbitrary amounts of data. I have so far been unable to figure out a simple way to handle something like this YAML which was trivially accessible in ROS1:

points:
- x: 1.0
y: 0.0
- x: 2.0
y: 0.0


Is there a simple way to get the data from this example as parameters in ROS2? If not, why not, and is there a plan for future changes? Links to references/previous discussion would be highly appreciated.

Thanks,

Josh

edit retag close merge delete

Sort by » oldest newest most voted

In general the design is here: https://design.ros2.org/articles/ros_...

We added arrays of homogeneous type at some point in the past:

https://github.com/ros2/design/pull/152

There are some discussions on that pull request about dictionaries, arrays of arrays (multidimensional arrays), and that would include arrays of dictionaries, but ultimately we decided not to do those things in order to simplify the design, especially for languages like C where storing heterogeneous list and maps is hard without non-native types. For example, see:

https://github.com/ros2/design/pull/1...

We discussed multi-dimensional arrays, and I actually felt at the time that it was an important feature, but it didn't get in. I think it's something that the community would be receptive to, but we'd need to have a pr to that design document that laid out all of the features you'd like to see, how they might be used and implemented, and then discuss it with everyone to see if we can justify the increase in complexity.

In the meantime, I would restructure your example like this, which is less convenient to be sure, but might let you keep going without changes to ROS 2 for now:

points:
point1:
x: 1.0
y: 0.0
point2:
x: 2.0
y: 0.0


If we had enabled support for multidimensional arrays, then you would have been able to do something like this:

points: [
[1.0, 0.0],
[2.0, 0.0],
]


Which looses you the named keys x and y for each point, but would have avoided the need to come up with a unique name for each point.

more