2.
3.
<launch>
<param name="use_sim_time" value="false" />
<!-- Start the ArbotiX controller -->
<include file="$(find rbx1_bringup)/launch/fake_turtlebot.launch" />
<!-- Run the map server with the desired map -->
<node name="map_server" pkg="map_server" type="map_server" args="$(find rbx1_nav)/maps/test_map.yaml"/>
<!-- The move_base node -->
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<rosparam file="$(find rbx1_nav)/config/fake/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find rbx1_nav)/config/fake/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find rbx1_nav)/config/fake/local_costmap_params.yaml" command="load" />
<rosparam file="$(find rbx1_nav)/config/fake/global_costmap_params.yaml" command="load" />
<rosparam file="$(find rbx1_nav)/config/fake/base_local_planner_params.yaml" command="load" />
<rosparam file="$(find rbx1_nav)/config/nav_test_params.yaml" command="load" />
</node>
<!-- Run fake localization compatible with AMCL output -->
<node pkg="fake_localization" type="fake_localization" name="fake_localization" output="screen" />
<!-- For fake localization we need static transform between /odom and /map -->
<node pkg="tf" type="static_transform_publisher" name="map_odom_broadcaster" args="0 0 0 0 0 0 /map /odom 100" />
<!-- Start the navigation test -->
<node pkg="rbx1_nav" type="nav_test.py" name="nav_test" output="screen">
<param name="rest_time" value="1" />
<param name="fake_test" value="true" />
</node>
</launch>
这个launch文件的功能比较多
(1)加载机器人驱动( <include file="$(find rbx1_bringup)/launch/fake_turtlebot.launch" />这样我们就不用在终端中再去加载机器人驱动了)
(2)加载地图
<node name="map_server" pkg="map_server" type="map_server" args="$(find rbx1_nav)/maps/test_map.yaml"/>
这里的地图就是map_server,有时候可不需要
(3)调用move_base节点
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
并且加载了它的几个配置文件,分别是:
costmap_common_params.yaml,local_costmap_params.yaml,global_costmap_params.yaml,base_local_planner_params.yaml,nav_test_params.yaml
(4)调用之前的amcl节点
<node pkg="fake_localization" type="fake_localization" name="fake_localization" output="screen" />
(5)当然还有tf
<node pkg="tf" type="static_transform_publisher" name="map_odom_broadcaster" args="0 0 0 0 0 0 /map /odom 100" />
(6)加载nav_test.py程序,进行随机导航(这里的随机是指目标点位置随机)
其实这个launch文件好像是把之前运行的几个launch文件进行整合了。
运行
roscore
运行
打开一个新终端,运行