Autonomous navigation of a known map with Erle-Rover

Builds a map to let the Erle-Rover autonomously move around

Source code

REMINDER: configure your environment before starting this tutorial.

This tutorial shows how to use Erle-Rover with a known map. This assumes that you have a map of robot environment. such as the one generated by the previous tutorial.

Make sure the minimal software has already been launched on the robot and you have configured your network correctly.

For this propuse we are going to use amcl, this is a probabilistic localization system for a robot moving in 2D. It implements the adaptive (or KLD-sampling) Monte Carlo localization approach, which uses a particle filter to track the pose of a robot against a known map.

Download the github repository and compile the code following these instructions:

mkdir -p ~/erle_ws/src
cd ~/erle_ws/src
git clone
cd ..
catkin_make --pkg ros_erle_rover_navigation

Now, let's launch the simulation.

source ~/simulation/ros_catkin_ws/devel/setup.bash
cd ~/simulation/ardupilot/APMrover2
../Tools/autotest/ -j 4 -f Gazebo
# once MAVProxy has launched completely, load the parameters
param load /[path_to_your_home_directory]/simulation/ardupilot/Tools/Frame_params/3DR_Rover.param
# NOTE: replace [path_to_your_home_directory] with the actual path to your home directory.
# Example: param load /home/john/simulation/ardupilot/Tools/Frame_params/3DR_Rover.param
param set SYSID_MYGCS 1

In another terminal

source ~/simulation/ros_catkin_ws/devel/setup.bash
roslaunch ardupilot_sitl_gazebo_plugin rover_maze.launch

This will spawn the Erle-Rover inside a maze.

Now run the nodes to get the autonomous navigation:

source ~/simulation/ros_catkin_ws/devel/setup.bash
roslaunch ros_erle_rover_navigation navigation_sim.launch map_file:=map.yaml

When starting up, the Erle-Rover does not know where to go. To provide it its approximate goal on the map:

  • Click the "2D Nav goal" button
  • Click on the map to select the goal and drag in the direction the Erle-Rover will be pointing.

The navigation stack uses two costmaps to store information about obstacles in the world. One costmap is used for global planning, meaning creating long-term plans over the entire environment, and the other is used for local planning and obstacle avoidance.

You should use costmap_2d package whenever you want to create a costmap for your robot to navigate through. This package has the ability to use distance sensor information in order to create a costmap with information about obstacles in the map.

The costmap update cycles at the rate specified by the update_frequency parameter. Each update, the costmap will mark and clear objects.

  • Mark: insert obstacle information into costmap
  • Clear: remove obstacle information from the costmap

Inflation is the process of propagating cost values from the occupied cells that decrease with distance.

  • Lethal - if robot's center were in that cell, the robot would collide with obstacle
  • Inscribed - an occupied cell is less than the inscribed radius away from an actual obstacle
  • Freespace - assumed to be zero
  • Unknown - no information about cell

The following part describes the costmap of the footprint. It will be centered on the base_footprint frame and will extend to the footprint that you specify below in meters. The padding will specify if you want to create a little bit of a cushion between your footprint and the obstacles. The footprint should be calculated yourself and is very important. It will tell the planner of collisions. The inflation radius determines how much the obstacle is inflated. This is discussed in the inflation section above.

footprint: [[-0.4, -0.2], [-0.4, 0.2], [0.4, 0.2], [0.46, 0.0], [0.4, -0.2]]
inflation_radius: 0.5

The next part is the most important as it will cause the costmap to fail if not specified correctly. We must tell the navigation stack which topic to listen to for the sensor information. We must also specify the type of the source so that it knows how to handle it:

  observation_sources:  scan
    data_type: LaserScan
    topic: scan
    marking: true
    clearing: true
    min_obstacle_height: 0.0
    max_obstacle_height: 0.4
    observation_persistence: 0.0
    expected_update_rate: 0.1
    inf_is_valid: true

The blue and red cells represent obstacles inflated by the inscribed radius of the robot, and the red polygon represents the footprint of the robot.