ros2 启动中的多个 yaml 文件

问题描述 投票:0回答:0

有可能像 ros1 一样在启动文件中加载 2 个 yaml 文件吗?

在 ros1 中我可以做到

<node name="node1" type="node1" pkg="pkg1" output="log">
        <rosparam command="load" file="$file1.yaml"/>
        <rosparam command="load" file="$file2.yaml"/>
    </node>

我想知道我们是否可以在 ros2 (foxy) 中做同样的事情 我知道我可以像这样加载一个文件

def generate_launch_description():
    path_file = 'test.yaml'
    file_parameters = os.path.join(
        get_package_share_directory('pkg1'),
        'config',
        path_file
        )

    return LaunchDescription([
        Node(
            package="pkg1",
            executable="node1",
            name="node1",
            output="screen",
            parameters=[file_parameters
            ]
        )
    ])

有办法在 ros2 中加载 2 个 yaml 文件吗?

yaml launch ros2
© www.soinside.com 2019 - 2024. All rights reserved.