## Project 1: Particle and Kalman filter localization

### What we expect

The project is due on Tuesday, February 1st. The key goal of this
project is to get a deep understanding of the properties of Kalman
filters and particle filters for state estimation. You should try to
"play around" with the parameters of the algorithm, so as to see how
they deal with different levels of noise. Also, try to see how the
algorithms handle global localization and the kidnapped robot
problem.
You will present what you learned in the robotics lab. The
presentation should be very informal, mostly demonstrating the system
in different contexts. For example, you can show how the filters work
if some of the assumptions are violated (bad initial belief). We will
try to connect Matlab to the real AIBO robots, so that you'll be able
to show your system in an online demo. To tune your parameters, we
will provide you with sample scripts taken with the real robots.

### 1. Get a project partner

For the projects in this class, you should work with another
person. However, we assume that everybody understands the derivation
and implementation of the algorithms.
### 2. Get to know Matlab

Matlab is available on the CSE machines from
`/projects/matlab/bin/matlab`. If you have access to these
machines, but can't get Matlab running, talk to benson. If you don't have
access to Matlab in general, talk to Dieter.
There are a lot of useful tutorials online if you don't know how to use
Matlab. Here's the first hit from Google: http://www.math.ufl.edu/help/matlab-tutorial/.
I'm not saying that it's good (or bad); I'm just saying that it was the
first hit.

Matlab has a lot of useful functions, so don't reinvent the wheel!
Need to sum a whole list of numbers (hint, hint)? Use `sum`! Need
to know more about function `<function-name>`? Type `help
<function-name>`. You will find `help` to be very
helpful. Additionally, `randn` is a good one to use.

### 3. Get the files

The files are accessible here: project1.tar.gz
### 4. Get to know the files

Here are the descriptions of the files that you'll find in the tarball.
You may end up not using every single file. Some are utilities for other
files, and you don't really need to bother with them. Some have useful
utilities, so you won't have to reinvent the wheel. Some have fuller
descriptions in the files themselves.
#### Things to implement

`run.m` -- Main update loop, should call ekfUpdate and pfUpdate

`ekfUpdate.m` -- EKF update

`pfUpdate.m` -- Particle filter update

`resample.m` -- particle filter resampling, called by pfUpdate
#### Tools

`generateScript.m` -- generates data according to initial mean and noise parameters

`prediction.m` -- move robot according to specified motion

`endPoint.m` -- returns the location of an observation

`generateMotion.m` -- simulates simple motion commands

`sampleOdometry.m` -- implements Table 5.6

`sample.m` -- samples from a covariance matrix (ignores cross correlations)

`initSamples.m` -- generates samples around a mean

`meanAndVariance.m ` -- returns the mean and variance for a set of non-weighted samples (illustrates handling of angles)

`rotcov.m` -- rotates a 2-D covariance matrix

`cvecrep.m` -- replicates a N x 1 column vector C times to make an N x C matrix

`getfieldinfo.m` -- gets field information

`minimizedAngle.m` -- normalizes an angle to [-pi, pi]

`matlab.el` -- customization file for emacs
#### Display functions

`plotcircle.m` -- draws a circle

`plotcov2d.m` -- draws a 2-D covariance matrix

`plotfield.m` -- draws the field with landmarks

`plotmarker.m ` -- draws an 'x' at a specified point (useful for drawing samples)

`plotrobot.m` -- draws the robot, duh!

`plotSamples.m` -- do I really have to explain this one?
### 5. Get to work

You are to write a particle filter and a Kalman filter for robot
localization. The script generates motion information according to the
odometry-based motion model. Observations are landmark
detections. Each landmark has a unique ID.