Skip to content

Needs an interface that accepts YAML::Node #27

Description

@b-adkins

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:

  1. Parse the tree using yamlcpp.
  2. Dive down the YAML tree to the selected key (e.g. yaml_tree["arm"]["waypoints"]["grasp_approach"])
  3. Convert that YAML::Node to a string
  4. Pass that string to yaml_and_typeinfo_to_rosmsg
  5. yaml_and_typeinfo_to_rosmsg re-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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions