ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
755 stars 911 forks source link

Can rosparam leverage pyyaml-include? #2258

Open Nosille opened 2 years ago

Nosille commented 2 years ago

As a long time ROS user with complex launch scripts, I have always been frustrated by the fact that yaml files cannot reference other yaml files. I recently found this python package (https://github.com/tanbro/pyyaml-include) that adds this functionality to python-yaml. Basically, it will capture '!include 1.yaml' and replace it with the contents of a file named '1.yaml'. This seems like an easy to implement feature for rosparam.

Simply replace

import yaml

with

import yaml
from yamlinclude import YamlIncludeConstructor
YamlIncludeConstructor.add_to_loader_class(loader_class=yaml.SafeLoader, base_dir='')

I would summit this as pull request ,but I am not sure how to add pyyaml-include, which is only available through pip, as a dependency.