roslaunch 启动时修改参数

 

启动命令:

roslaunch beginner_tutorials turtlemimic.launch arg1:=3.0

查询命令:

rosparam get /param1

可以看到param1不是默认的5.0,而是3.0

 

launch文件如下

注意:"$(arg arg1)"必须加双引号

<launch>
  <arg name="arg1" default="5.0"/>
  <param name="param1" value="$(arg arg1)" />

  <group ns="turtlesim1">
    <node pkg="turtlesim" name="sim" type="turtlesim_node">
    </node>
  </group>

  <group ns="turtlesim2">
    <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
  </group>

  <node pkg="turtlesim" name="mimic" type="mimic">
    <remap from="input" to="turtlesim1/turtle1"/>
    <remap from="output" to="turtlesim2/turtle1"/>
  </node>

</launch>

 

posted @ 2019-11-22 23:42  xbit  阅读(3656)  评论(0编辑  收藏  举报