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

dumping parameters from c++ node

asked 2019-07-02 08:15:34 -0500

schizzz8 gravatar image

Hi all,

I have a simple question but I can't seem to find a nice solution.

My problem is the following:

I have a YAML file that stores some parameters. These parameters are loaded into the parameter server at execution time. For some reason I want to change some parameters and store them permanently in the YAML file.

That is, I retrieve a certain field of the parameter:

XmlRpc::XmlRpcValue param;
nh.getParam("param_name", param);
ROS_ASSERT(param.getType() == XmlRpc::XmlRpcValue::TypeStruct);
std::string field = static_cast<std::string>(param["field]);

and then, after modifying it, I'd like not only to set the new value in the parameter server but also to permanently store this change.

I have seen that rosparam has the dump option and I was wondering if there is an analogous function in roscpp. I'd be very glad if someone could show me how it can be done.

Thanks.

edit retag flag offensive close merge delete

Comments

1

I do not believe there is a C++ equivalent to rosparam dump

ahendrix gravatar image ahendrix  ( 2019-07-02 10:26:16 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-04-27 08:36:19 -0500

You can do that with the tool I am working on -> https://github.com/asherikov/ariles, a slightly dated version is available as a package in melodic.

edit flag offensive delete link more

Comments

Could you please expand a little on your answer? It's not apparent from the readme of that repository how this could be used to achieve what the OP describes.

gvdhoorn gravatar image gvdhoorn  ( 2020-04-27 09:01:44 -0500 )edit

Think of it as a serializer that supports ROS parameter server:

  1. define a class with parameters
  2. deserialize it from parameter server
  3. modify
  4. serialize to a yaml file
asherikov gravatar image asherikov  ( 2020-12-17 08:51:07 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2019-07-02 08:15:34 -0500

Seen: 856 times

Last updated: Jul 02 '19