Planar 3-DOF Particle Filter Localization

Submit material you wish to deliver electronically via:

 submit fredm ps7 zip-or-tar-file

Files Needed

Attach:sample_hw7_r2.tar.gz (particles do not have a weight inside them) (particles have weights)

Untar these two directories to somewhere in your ROS path.


For PS 7, you need to write a program that will localize the robot in the hallway using a particle filter.

There are two performance baselines.


Manually position the robot at one end of the hallway, aimed straight down the other end. Command the robot at a constant velocity and without any rotation.

Demonstrate visually that your particles indeed cluster around the robot.

Turn in a screencast recording of the performance (both the Stage view and the particle cloud view)


In addition to the above, create functionality that allows your robot to:

  • discover its own localization position
  • drive it to a specific position while avoiding obstacles (e.g., walls) on the way there

You should be able to start the robot in any location and orientation, and have it localize and drive itself to the position between the two red Xs on the Stage screen.

Record a screencast showing the performance.

To do this, you should only use the following ROS topics:

 - read from /robot/base_scan
 - write to /robot/cmd_vel

You can also read the image file "hallway.png".


In order to use the sample code, you'll have to install a few packages. First, you need to get rid of the ROS version of opencv:

 sudo apt-get remove libopencv2.3-bin


 sudo apt-get install libcv-dev

Now get some more stuff:

 sudo apt-get install libcvaux-dev libhighgui-dev
 sudo apt-get install python-numpy python-opengl
 sudo apt-get install swig

Now, you can build the Python C extension to do raytracing on the image:

 (roscd sample_hw7/src/raycaster && make)

Demonstrating the Code

In a terminal shell, do

 roscd uml_mcl
 roslaunch launch/mcl.launch

You should now see Stage running with a map of Olsen Hall third floor, per below:

In another terminal shell, do

 roscd sample_hw7

You should see the OpenGL map showing particles scattering all around every time step, like this:

Some things to implement:

  • Using the beam range finder model from the book (Table 6.1, pp. 158), compute a measurement correspondence for a given particle with the ray-tracing library (which uses the map). Pick constants for zhit, zshort, zmax, and zrand.
  • Based on this measurement update, regenerate probabilistically with the robot just sitting there, and see if they converge to clusters. Move the robot around and see how the clusters re-form.
  • Put the robot somewhere at the left edge of the map, heading east, and drive it at a constant velocity. Implement a movement update for the particles. See how the clusters behave now.

(added after assignment was due)

To turn in

  • evidence
  • discussion
  • code
  • instructions on how to run the code