ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Since you already have the node names and you know that every output yaml file looks like [node-name].yaml, I reckon this something along the lines of this snippet should fit the bill:

file_names = (f'{node}.yaml' for node in node_list)
output_filename  = 'single_file.yaml'
with open(output_filename, 'w') as output_file:
    for file_name in file_names:
        with open(file_name) as input_file:
            output_file.write(input_file.read())

You could even just use this shell command:

cat file1.yaml file2.yaml ... > single_file.yaml

If you're looking for an API in ros2cli/ros2param, I don't think something like that exists. You could always file for a feature request to open discussion about it?