Ask Your Question
0

how can we get param from yaml? [closed]

asked 2017-08-02 01:18:56 -0500

neil gravatar image

node_name1: param_name1: value param_name2: value

node_name2: param_name1: value param_name2: value

This is a yaml file,but how can we get param from yaml in our .cpp files? .getParam doesnot work. THANK YOU!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by neil
close date 2017-08-02 20:39:28.436245

2 Answers

Sort by ยป oldest newest most voted
2

answered 2017-08-02 04:38:22 -0500

vkee gravatar image

In your launch file, put <rosparam command="load" file="yaml_filepath"/>

edit flag offensive delete link more

Comments

1

This will load it into the Parameter Server and make the params available to your node. Now you can use getParam() to access those set params.

jayess gravatar imagejayess ( 2017-08-02 13:39:13 -0500 )edit
2

Thank you very much! I have solved the problems.I misunderstood the Parameter Server.Now I understand it . getParam() get params from Paramter Server ,no mater the params come from launch file or yaml file. thank you again.

neil gravatar imageneil ( 2017-08-02 20:35:57 -0500 )edit
1

answered 2017-08-02 07:09:24 -0500

Chaos gravatar image

Check this for cpp programming or this for python.

edit flag offensive delete link more

Comments

Thank you very much! I have solved the problems.I misunderstood the Parameter Server.Now I understand it . getParam() get params from Paramter Server ,no mater the params come from launch file or yaml file. thank you again. ROS answer is wonderful.

neil gravatar imageneil ( 2017-08-02 20:38:34 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-08-02 01:18:56 -0500

Seen: 1,535 times

Last updated: Aug 02 '17