Lab 6 Indoor Autonomous Navigation


The goal of this lab is to implement the autonomous navigation indoor using move_base node is ROS.

The first step:

The move-base node in ROS first subscribe the static map using map_server node to import the map we created, therefore, we have to build the map using wifibot first.

The script here is the code of the node we will use that provides following function:

  1. Use motor speed to calculate the distance that robot has moved, and the orientation that robot has made. In this case the magnetic influence is eliminated but the accumulate error will be an issue if the floor is slippy.
  2. The node provides tf from odom to base_footprint, the tf is essential and easy to be used for mapping(gmapping) and navigation(move_base).
  3. The node subscribe two topics of command, the first one is cmd_vel which is usually published by move_base, another one is cmd_vel1 which is published by joysticks or keyboard. This design makes the wifibot more easy to handle. The key “m” is used to switch the mode for wifibot to autonomous mode, when the key from keyboard “m” is pressed, the wifibot will follow the cmd_vel which is the command from autonomous navigation, when the other keys are pressed, the wifibot back to remote-control mode. Therefore the priority is cmd_vel1 which is the topic you are required to published so that you can control wifibot.
  4. The update rate is 20 Hz.


The related CMakeLists and add dependencies for xml file:

Now create a .launch file which is named wifibotbase.launch:

The above launch file is required to be run in the wifibot, it remaps the frame_id of Hokuyo to base_link and also provides tf between base_footprint and base_link(Hokuyo). Therefore, this launch file now provides tf tree as:


The second step:

Once we launch the wifibotbase.launch, we can now either do mapping or navigation.

Create a new package:

The following map.launch file can be used for mapping, where you can run this launch file in another machine or in wifibot, we will suggest you to run this in another machine since the computation power of wifibot is not that good. Noted that the topic of is remap as cmd_vel1, therefore, you can now use keyboard to control wifibot to explore the environment and build the map, open rviz then you will see the map.

Once you satisfy the map result, save it using:

The third step:

  1. Create a folder called “map” in your package folder(the map folder would be the same dir with src or bin folder ). Put the map files you just saved by map_saver command. There are two files, one is your_map_name.pgm another one is your_map_name.yaml.
  2. Create a folder called “launch” in your package folder. And now create four files in this folder:
      1. base_local_planner_params.yaml

      1. costmap_common_params.yaml

      1. global_costmap_params.yaml

      1. local_costmap_params.yaml

Now create a launch file named as nav.launch for autonomous navigation use above parameters files, download lab map labmap.pgm, and labmap.yaml:

Roslaunch the nav.launch, and use rviz to set initial pose and destination. Press “m” button, the robot will autonomously navigate itself.