Open b-adkins opened 10 years ago
It turns out yaml-cpp (at least the old API, used by ROS) makes it very hard to create YAML::Nodes. It seems that the only way to convert XmlRpcValues into YAML::Nodes is to emit the XmlRpcValue (using YAML::Emitter) as a YAML string, then read it back in using YAML::Parser. As there is a 1 to 1 mapping between XmlRpc and YAML::Node types, it shouldn't be too difficult, just a big switch statement (around XmlRpc::Type) that controls the YAML::Emitter state machine.
After some brainstorming, a simpler solution is to simply dump .yaml text files directly into the param server (kind of like URDF does) and then parse the string at the ROS node level, using yaml-cpp. It's Good Enough, and still more efficient than HTTP or HTML. This can be done from launch files with a tag of the form:
<param name="namespace/name" textfile="$(find pkg-name)/path/file.txt" />
or from the command line with:
$ rosparam set -t path/to/file.yaml /namespace
(Thanks Ed in my lab for helping me brainstorm!)
We need param::get() and param::set() functions for YAML trees. (I.e. something more complex than a Vector or Map of primitives)
If you're a developer writing a library that can be independent of ROS, it's obnoxious and bug-prone to maintain two parallel sets of parsers - one for YAML trees read from config files and one for XmlRpc trees read from a param read from the same config file! It would be nice to be able to do everything in YAML, specifically yaml-cpp which is already used by ROS.
I am writing a limited converter between an XmlRpc tree and YAML tree (so I don't have to maintain parallel parsers), so it could form the beginning of a possible implementation.