dynamic_message_introspection
dynamic_message_introspection copied to clipboard
Needs an interface that accepts YAML::Node
When I tried to use yaml_and_typeinfo_to_rosmsg for a robot application, I found myself having converting a YAML::Node to a string, just so yaml_and_typeinfo_to_rosmsg could re-parse it into a YAML::Node.
In my experience, robot configs that complete even simple tasks require complex YAML trees for their config file. You will be parsing many subtrees into ROS msgs, such as geometry_msgs/Pose and geometry_msgs/TransformStamped.
Specifically, my code would:
- Parse the tree using
yamlcpp. - Dive down the YAML tree to the selected key (e.g.
yaml_tree["arm"]["waypoints"]["grasp_approach"]) - Convert that
YAML::Nodeto a string - Pass that string to
yaml_and_typeinfo_to_rosmsg yaml_and_typeinfo_to_rosmsgre-parses the YAML.
Suggested Change
A new interface:
void yaml_node_and_typeinfo_to_rosmsg(
const TypeInfo_Cpp * type_info,
const YAML::Node& yaml_node,
void * ros_message)
Leave the interface for yaml_and_typeinfo_to_rosmsg the same, but move most of the code inside to yaml_node_and_typeinfo_to_rosmsg.
Likewise for the other functions that take as input a yaml_str.