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

[ROS 2] layered yaml config file

asked 2019-04-16 15:16:37 -0500

vadbut gravatar image

updated 2019-04-16 15:36:55 -0500

Hi, I came across an example of a yaml file:

talker_ns:
    talker:
        ros__parameters:
            some_int: 42
            a_string: "Hello world"
            more_params:
                some_int2: 24
                some_doubles : [3.14, 2.718]

I have no problems with reading the some_int and a_string like this:

get_parameter_or("some_int", some_int, int(0));

However, I can't wrap my head around how to read some_int2. I tried doing it by inserting the parameter category get_parameter_or("more_params/some_int2", some_int2, int(0)); but it doesn't work.

I'm using rclcpp_lifecycle node (I don't know if it matters).

What is the right way to do it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-04-16 17:46:36 -0500

William gravatar image

updated 2019-04-16 17:48:19 -0500

Right now, parameters use the . separator... I really don't like this and would like to change it, but a change like this will take some serious time, as we need to sort out addressing of nodes, parameters and services at the same time.

I guess your code works if you use more_params.some_int2 instead.

EDIT: btw, you could use ros2 param list <node name> to see what was happening.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-04-16 15:16:37 -0500

Seen: 284 times

Last updated: Apr 16 '19