YAML DUMP USING C++
How do i dumb my param values into a yaml file using C++? I tried system("rosparam dump example.yaml"); but no luck..
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
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;
}
Asked: 2017-07-26 14:29:36 -0500
Seen: 2,179 times
Last updated: Nov 23 '17