Now we have all the files created and the navigation stack is configured. To run everything, we are going to create a launch file. Create a new file in the chapter9_tutorials/launch
folder, and put the following code in a file with the name move_base.launch
:
<launch> <!-- Run the map server --> <node name="map_server" pkg="map_server" type="map_server" args="$(find chapter9_tutorials)/maps/map.yaml" output="screen"/> <include file="$(find amcl)/examples/amcl_diff.launch" /> <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen"> <rosparam file="$(find chapter9_tutorials)/launch/costmap_common_params.yaml" command="load" ns="global_costmap" /> <rosparam file="$(find chapter9_tutorials)/launch/costmap_common_params.yaml" command="load" ns="local_costmap" /> <rosparam file="$(find chapter9_tutorials)/launch/local_costmap_params.yaml" command="load" /> <rosparam file="$(find chapter9_tutorials)/launch/global_costmap_params.yaml" command="load" /> <rosparam file="$(find chapter9_tutorials)/launch/base_local_planner_params.yaml" command="load" /> </node> </launch>
Notice that in this file, we are launching all the files created earlier. We will launch a map server as well with a map that we created in Chapter 8, The Navigation Stack – Robot Setups and the amcl
node.
The amcl
node that we are going to use is for differential robots because our robot is also a differential robot. If you want to use amcl
with holonomic robots, you will need to use the amcl_omni.launch
file. If you want to use another map, go to Chapter 8, The Navigation Stack – Robot Setups, and create a new one.
Now launch the file and type the next command in a new shell. Recall that before you launch this file, you must launch the chapter9_configuration_gazebo.launch
file.
$ roslaunch chapter9_tutorials move_base.launch
You will see the following window:
If you compare this image with the image that you saw when you launched the chapter9_configuration_gazebo.launch
file, you will see that all the options are in blue; this is a good signal and it means that everything is OK.
As we said before, in the next section you will learn which options are necessary to visualize all the topics used in a navigation stack.