Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needs an interface that accepts YAML::Node #27

Open
b-adkins opened this issue Aug 7, 2024 · 0 comments
Open

Needs an interface that accepts YAML::Node #27

b-adkins opened this issue Aug 7, 2024 · 0 comments

Comments

@b-adkins
Copy link

b-adkins commented Aug 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant