First time here? Check out the FAQ!


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

how can we get param from yaml?

asked Aug 2 '17

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!

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered Aug 2 '17

vkee gravatar image

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

Preview: (hide)

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 image jayess  ( Aug 2 '17 )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 image neil  ( Aug 3 '17 )edit
1

answered Aug 2 '17

Chaos gravatar image

Check this for cpp programming or this for python.

Preview: (hide)

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 image neil  ( Aug 3 '17 )edit

Question Tools

2 followers

Stats

Asked: Aug 2 '17

Seen: 4,242 times

Last updated: Aug 02 '17