Fixed the ir problem.

It turns out to be a firmware problem. The arduino communication code
added 1 to bytes to avoid sending null bytes, but the python code on the
other side failed to subtract 1 from the bytes. This makes a big
difference for the analog inputs because each input has two bytes (and a
difference of 1 in the large byte is a significant change).

Separately, we discovered that I had set the IR distance cutoff at 40cm,
where it starts to deviate from the model. We changed it so it now reads
distances up to 80 cm (it is only accurate up to 40cm, but it will
continue to give increasing values for larger distances up to 80cm
(which it displays as 155cm)).

avoid sending null bytes but failing to subtract
Fixes analog input bug
Changed from state machine to behavior-based code. Doesn't work yet.

In particular, the BallManager (keeps track of balls both external to
and internal to the robot) hasn't been coded and several behaviors (some
related to ball collection but most related to scoring) haven't been
written. And none of this code has been tested for syntax errors, let
alone logic errors. But it's been far too long since my last commit....
Merge branch 'master' of git://github.com/gkanwar/maslab-staff-2013 into HEAD
Reverted the change to arduino.py; Tej fixed analog a different way.

He fixed it on the arduino side, so this commit undoes my fix on the
python side.
Created a video recording test file.

This should be incorporated into robot code so we can use the videos
later as vision tests.
Code completed but not tested. Old code should be used for competition.
Simplified ball management algorithm.

Instead of remembering balls and matching newly found balls with old
balls, it is now more of a storage location for vision results (it
always targets the closest ball; it only knows about balls that were
seen in the most recent frame).

This version of the algorithm is probably sufficient (although not as
good), but will be much more reliable and easier to get working by
competition time.
Cleaned up ball manager code.

Removed calls to functions that no longer exist.

Also changed ball manager to remember the target ball after it
disappears until either a) 3 frames pass or b) it sees a new ball.
Reorganized behaviors by type.

There were too many classes in control.py and it was only going to get
worse with the addition of scoring-related behaviors. Now stuff is
pretty easy to find.
Wrote code for wall detection and wall scoring.

Obviously none of it has been tested on the robot. But wall detection
has been tested in cvTest on reference images and seems to work. It runs
quickly as compared to ball detection, but hopefully both are fast
enough. It would really suck to have to optimize them now.

The procedure for scoring balls is
1) approach yellow wall, keeping it centered in view
2) when you get close-ish to the wall, calculate the angle between the
robot and the wall using the IR sensors and use PID to turn
perpendicular (ish) to the wall (still advancing, but more slowly)
3) when a bump sensor triggers, stop, lift the balls, drop the ramp, and
celebrate. Perhaps it needs to play a sound file here?
Python can now talk via espeak (unix text tts program).

Obviously this requires espeak to be installed. sudo apt-get install
espeak.

Will incorporate this into the real code to warn the user when the robot
or the motors are not powered.
Robot should now warn the user if it isn't sufficiently powered.
Modified ForcedMarch to not avoid walls (only Uncrash).

Avoiding walls was potentially problematic because the robot could get
stuck pointing into a corner alternately avoiding the walls on each
side.
Fixed a bunch of bugs; there's still a bug with Arduino communication.

I keep getting "Timeout" and I don't know why. To be debugged....

Separately, these commits don't seem to be showing up on github for some
reason. I really messed something up with my git repo.