【问题标题】:How to access parameters of xml or yaml files from a ros .launch file?如何从 ros .launch 文件中访问 xml 或 yaml 文件的参数?
【发布时间】:2019-11-02 10:36:33
【问题描述】:

我想使用xmlyaml 文件作为参数运行ros 启动文件。

如何正确设置 .launch 文件以访问作为参数传递的 xml 或 yaml 文件中的参数?

【问题讨论】:

    标签: xml parameters yaml parameter-passing ros


    【解决方案1】:

    如果我理解正确,让我展示一个可以完成工作的跳跃示例。

    假设你想控制你的机器人并且你想在操纵杆和键盘遥控之间进行选择。

    您创建一个 man_ctrl.launch 文件

    <launch>
        <arg name="control_mode" default="joy"/>
        <include file="$(find ctrl)/launch/$(arg control_mode).launch"/>
    </launch>
    

    你可以像这样使用它:

    roslaunch ctrl man_ctrl.launch control_mode:=<joy/key>
    

    这表示你已经把joy.launch和key.launch就位了,比如:

    <launch>
        <node name="joy_node" pkg="joy" type="joy_node"/>
        <node name="joy_teleop" pkg="teleop_twist_joy" type="teleop_node" respawn="true" output="screen">
            <param name="scale_linear" value="1.0"/>
            <param name="scale_angular" value="1.0"/>
        </node>
    </launch>
    

    <launch>
        <node name="keyboard_teleop" pkg="teleop_twist_keyboard" type="teleop_twist_keyboard.py" respawn="true"
              output="screen" launch-prefix="xterm -e" />/>
    </launch>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-07-14
      • 2020-04-29
      • 1970-01-01
      • 1970-01-01
      • 2012-03-20
      • 1970-01-01
      • 2012-10-31
      • 1970-01-01
      相关资源
      最近更新 更多