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

Can we pass multiple config files to a node in ROS2

asked 2022-01-24 07:18:54 -0500

Raza Rizvi gravatar image

Currently, in all the examples I have seen, load a YAML file inside the Launch file, and pass it to the ROS2 node. I am curious, is there a possibility to pass more than one YAML file to a ROS2 Node?

Something like:

def generate_launch_description():
    ld = LaunchDescription()
    paramaters_one = os.path.join(
        get_package_share_directory('my_robot_bringup'),
        'config',
        'my_params1.yaml'
    )

    paramaters_two = os.path.join(
        get_package_share_directory('my_robot_bringup'),
        'config',
        'my_params2.yaml'
    )

    multiple_parameters_node = Node(
        package='my_robot_bringup',
        executable='multiple_parameters_check',
        name='multiple_parameters_check',
        parameters=[paramaters_one, paramaters_two]
    )
    ld.add_action(multiple_parameters_node)
    return ld
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-01-24 11:44:41 -0500

tfoote gravatar image

updated 2022-01-24 11:48:09 -0500

From @destogl https://discourse.ros.org/t/can-we-pa...

You can find an example how we are doing it in UR Driver repository. For loading files, please check the few lines before.

edit flag offensive delete link more

Comments

This should work in my case, thanks a lot.

Raza Rizvi gravatar image Raza Rizvi  ( 2022-01-25 01:41:56 -0500 )edit

Please use the checkmark at the left of the answer to accept it so others will know that your question is resolved.

tfoote gravatar image tfoote  ( 2022-01-25 01:45:04 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2022-01-24 07:18:54 -0500

Seen: 616 times

Last updated: Jan 24 '22