How to parse YAML from parameter server?

asked 2015-07-27 18:25:23 -0600

tomfallen gravatar image

I’m attempting to use a YAML file to load configurations to my robot, in C++. I have YAML parsing working directly from a text file, but would like it to work from the parameter server. I can read individual settings for the server, but I have nested configurations (my robot arm has configs for each of its links, each of which has configurations for its joint, etc.).

It appears that once YAML code is added to the parameter server, you can’t really get back any structure as YAML. I can get the structure as an XmlRpcValue, but don’t know how to convert this to YAML.

These are the options I can see:

Write XmlRpc parsing for each of my custom data structures. I could either maintain separate YAML parsing, or write my config files in XmlRpc. I’d rather not do this.

Load the entire YAML file to the param server as a text file, as described here: This would allow parsing of YAML text from C++, but I wouldn’t be able to change individual paramters and probably lose other useful functionality.

Programmatically dump the desired parameter and its children to a temporary text file, then load it into yaml-cpp. I’m not sure this is even possible, and seems like an awkward hack.

It seems like ROS already knows how to convert XmlRpc info into valid YAML. Is it really possible that there isn’t a better way to do this? How do people deal with large, nested configuration variables?


edit retag flag offensive close merge delete