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

Why rosparam load does not load the correct parameters?

asked 2020-07-12 00:22:32 -0500

Kansai gravatar image

I have been reading this page about rosparam and in it it explains rosparam dump so I did that. I got a yaml file with a parameter set to 0.5

No problem with that. Then I manually changed that value to 0.6 and I did

rosparam load dump2.yaml

and then I did

rosparam get theparam

and I still get 0.5 No matter what I do the param is not changed

In the original page it says "NOTE: this will add to the currently set values" What does that mean and does that have anything to do with this error?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-07-12 00:35:37 -0500

Kansai gravatar image

updated 2020-07-12 02:03:30 -0500

I just found out the answer to my problem. It is due to a very strange way these things work.

When I dump ALL the parameters

rosparam load dump4.yaml

I got the correct ways such as

keys_to_twist: {angular_scale: 0.4, linear_scale: 0.5}

but when I do rosparam load dump5.yaml

I got

{angular_scale: 0.4, linear_scale: 0.5}

so when I load this file, another set of parameters get added! So I have the original keys_to_twist/angular_scale and another angular_scale and therefore the correct values are not set in the parameters it should go.

the solution is to set the yaml file as

 keys_to_twist: {angular_scale: 0.3, linear_scale: 0.6}

The funny thing I found out even later is that the loading of parameters from a launch file does not work at all like this

If you load the parameters from a launch file you have to go again to

{angular_scale: 0.4, linear_scale: 0.5}

otherwise you would have two times the "key_to_twist" part.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-07-12 00:22:32 -0500

Seen: 768 times

Last updated: Jul 12 '20