CS 154 Homework #4
Due Sunday, March 29, 2008

Readings for HW 4:



Part 1: Project demos - at the semester midpoint

   
The first part of this assignment is the mid-semester update and demo of your robotics project. In particular, you should:

Part 2: Monte Carlo Localization

   

Overview

The basic object of this piece of the assignment is to implement Monte Carlo localization in a robot simulator, using a range sensor and a simple vision sensor.

The starting files for this assignment are available at this link

MCL is a passive localization algorithm in that the robot does not need to be doing anything in particular for MCL to work. Thus, you can be remote-controlling the robot or it can be randomly wandering, or it might be trying to accomplish some task (such as the Mini Grand Challenge tasks). For this hw, it is absolutely OK to be controlling the simulated robot via the keyboard -- indeed, this will certainly help with the development of the algorithm.

MCL can take advantage of odometric sensing, i.e., the robot's estimate of how far it has traveled. With a known map, it does not require any other sensing, but typically at least one other sensor is used. For this project, you should use at least the simulated range sensor provided.

The simulator can model a noisy robot - simply pass a percentage of your commands you'd like allocated to noise as the third parameter to the setVels function, e.g.,


r.setVels(50,0,0.1)  # 10% noise
will send the robot forward at 50 cm/sec, give or take 10% (so 40 to 60 cm/sec) I would suggest keeping error levels low at first - in fact, you might start with no error at all.

Capabilities

In order to build MCL step-by-step, you should make sure these key presses correspond to the following behaviors:

Also, you're encouraged to add other features as you wish -- see the extensions list below -- but please do implement these keypresses in order to make it easy to test the basic functionality in a consistent way!

Representing particles

Though not required, I would suggest representing each particle (each pose hypothesis) as a list of five elements:

[ x coordinate, y coordinate, orientation in radians, probability, range data ]
The probability should be set initially to 1.0, and the range data may be initially set to 0.0. This last component represents the ray-traced range from the particle to the map's walls.

Getting particles' ranges

The getParticleData(x, y, thr, rangeSensorHeadingd=0) function takes in a pose (and an optional direction in which the range sensor is pointing) and returns a four-tuple of the distance to the environment and the r, g, and b components of the color of that nearest obstacle.

One warning: the units are not consistent, in that the particle pose is expected in radians and the sensor heading in degrees. Fortunately, math.radians and math.degrees are available -- unfortunately, their availability leads to such inconsistencies... .

Other provided facilities

On the graphics side of the program, there is a function setParticles that takes in a list of particles and simply places the appropriate number of particles at those locations and orientations, with the range data provided. Simply give ranges of 0.0 or omit the final component to avoid seeing the range data. You can access this through the queue that ferries graphics-updating commands from the robot-controller (main) to the graphics thread (GuiPart in ThreadedHandler.py). Here is an example call from within main:

self.queue.put([self.setParticles, particles])
where particles is the list of particles, represented as described above.

What should you provide?

You should provide a .zip file with all of your code (most likely, posted to your team's project site), and a write-up of ~1 page that describes

In addition, you should describe any additional features you implemented (see the list below) and how to test and see their effects.

Additional features

Completing the basic MCL algorithm, with a cluster of particles tracking the robot even in the presence of modest amounts of noise (5% or 0.05 as a third parameter to setVels is the foundation of the MCL problem and would, alone, earn about 80% of the credit for it.

For full credit on the MCL piece of this hw, you should add an additional feature of your own choosing - perhaps one that would be useful in your project, if MCL will factor into it or one that you simply want to experiment with. Here are some possible ideas, but by no means all of them: