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

YAML DUMP USING C++

asked 2017-07-26 14:29:36 -0500

MechLc gravatar image

How do i dumb my param values into a yaml file using C++? I tried system("rosparam dump example.yaml"); but no luck..

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-11-23 04:34:24 -0500

Hi @MechLc!

You say it doesn't work because you can't see the example.yaml file that should be generated, right?

The rosparam dump example.yaml will generate the file on the current working directory.

In order to see the current working directory, you can use the pwd command, like: system(" echo 'ROS Params dumped at: ' $(pwd); rosparam dump example.yaml");

Or you can pass the full path of the yaml file, like: rosparam dump /full/path/to/example.yaml.

Below I have attached a code of a ROS Node in CPP that just dumps the ros params.

If you run the node using roslaunch, the file is going to be generated probably on ~/.ros/example.yaml , as you can see on this video ( https://youtu.be/w5cVKlhy37w ).

#include <ros/ros.h>

int main(int argc, char **argv){

    ros::init(argc, argv, "tutorial_node");

    system(" echo 'ROS Params dumped at: ' $(pwd); rosparam dump example.yaml");

    ros::spin();

    return 0;
}
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-07-26 14:29:36 -0500

Seen: 2,170 times

Last updated: Nov 23 '17