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

Overwriting a parameter in config file during runtime

asked 2020-11-10 04:14:38 -0500

Malkecero gravatar image

Hi,

I'm writing a node that reads a parameter from a config file (.yaml) to set the initial value of a variable (using ros::param::get). During runtime this variable is constantly updated. Before shutdown, I want to overwrite the parameter in the config file so that it takes the final value of my variable. Unfortunately ros::param:set doesn't work as it only updates the parameter in the server but not in the file (that will be read a the next launch).

Is there a simple way to overwrite a parameter in a config file during runtime ? Or is dynamic_reconfigure the way to go ? It seems a bit overkill for the task I want to do ...

Thanks for your help !

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-11-11 06:13:23 -0500

miura gravatar image

You may want to use yaml-cpp to overwrite the yaml files.

Alternatively, you can use rosparam dumpas shown in https://answers.ros.org/question/2674.... (This may be overkill, as all parameters are recorded in this case. )

edit flag offensive delete link more

Comments

1

yaml-cpp seems the right solution to my problem. Thanks !

Malkecero gravatar image Malkecero  ( 2020-11-22 03:35:57 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-11-10 04:11:21 -0500

Seen: 601 times

Last updated: Nov 11 '20