Assignment 3

Autonomous Robotic SystemsAssignment 3

This practical assignment consists of implementing a particle filter for Monte Carlo localization, using ROS (Robot Operating System).

There already is a package in ROS for doing Monte Carlo localization: the amcl package. This assignment is intended as a replacement for AMCL.

Your task is to implement a class that inherits from the MCLocalizer interface and implements the missing methods. Specifically, you should implement a sensor model and a motion model, as well as the particle filter update rules. Skeleton code for running a simulator with a map and a robot, and publishing information from the particle filter, is available.


In addition to the packages installed with the full desktop install, you also have to install occupancy_grid_utils. These are useful tools for dealing with grid maps, and are required for compiling the MyLocalizer class.

Install these packages (occupancy_grid_utils, particle_world, particle_filter) we created for you. Just unzip them in your ~/catkin/src workspace directory.

  1. Install an additional ROS package required to compile occupancy_grid_utils. Just type in a terminal:
    sudo apt-get install ros-{your version of ROS}-tf2-bullet
  2. Compile your catkin workspace. (if in doubt, see Assignment 1 how to do this)
  3. There are two launch files available, which make it more convenient for you to run all components of ROS that are needed for the exercise. The launch files are called particlefilter_swarmlab.launch and particlefilter_willow.launch are located in the particle_world package. The Swarmlab map is a small and simple map; the Willow map is a much larger and more complex map. Launching these should open up two windows – Stage and RViz – both displaying the robot and a map.
  4. In the Stage window, you can drag the display with the mouse, so that you can see the simulated robot. You can also enable display of the simulated laser range finder, under the menu “View / Data”.
  5. In the RViz window,  make sure that the fixed frame is set to /map.The RViz configuration file is also located in the particle_world package.
  6. You can move the robot around with the turtlebot_teleop node or you can try to use your random walk algorithm you implemented in Assignment 1.
  7. Run the provided MCL node (particle_filter). It does not do much yet, but it should show a set of particles as red arrows in the RViz window. The particles should move around as the robot moves.


The assignment

The class MyLocalizer, located in ParticleFilter.hpp, and ParticleFilter.cpp has more-or-less empty methods for implementing a sensor model, a motion model, and a particle-filter update (weighting and resampling) routine.

Your task is to complete the predefined methods in ParticleFilter.cpp needed for localization.
More instructions and explanations are supplied in the source files.


  • Start with the Swarmlab map, later try if you can localize yourself in the Willow map (you might need more particles).
  • Use Gaussians for movement and measurement noise, you should figure out some sensible parameters for your noise.
  • You can set your initiation location in RViz with the 2D Pose Estimate command.
  • Raycasting is done for you (simulatedScan).
  • Use a limited amount of rays (~30).
  • Resampling -> resampling wheel.