Version 11, last updated by dbenamy at April 27, 2010 11:56 UTC
Hardware
Movement
The platform is a modified power wheels car.
Two Parallax HB-25 motor controllers control the drive motors.
A Hitec HS-805MG servo is connected to the steering wheel with bike gears and chain.
Sensors
Custom shaft encoders are attached to the drive motors to detect their speeds.
2 Logitech Quickcam Pro 5000s for detecting the road. The reason for using 2 is for increased field of view; we don't do real stereo vision.
2 sonar modules are mounted to the front to detect obstacles.
A GPS module to track way points and to navigate part 2.
An HMC6352 digital compass to navigate part 2.
Control
A laptop runs our main control software which is written in python. It reads data directly from the cameras and GPS receiver.
A Basic Stamp (which we call the PID, for peripheral interface device) connects to a serial port and interfaces with the drive motor controllers and sonar sensors.
A custom board built around an Atmel AVR (which we call the PID 2) connects to another serial port and interfaces with the steering servo, shaft encoders, and compass. This didn't need to be a custom board; an Arduino would do the trick here more easily.
A couple of usb to serial converters let us connect all this stuff.
Fun
A car stereo and speakers amplify the laptop's sound so it can talk.
Power
A 12v lawn and garden battery powers the drive motors.
A smaller 6v battery powers the steering servo.
A second 12v battery with only an inverter connected to it powers the laptop via its AC adapter. The laptop can run off of battery, but this gives us more testing time.
Image Processing Algorithm
We pull frames from the webcams at 160 x 120 resolution and attach them to make single 320 x 120 frames. We don't use a higher resolution because the additional data slows things down.
We tweak the image parameters in the logitech control panel, mainly increasing the color saturation. This is to handle shadows and other variations in road color properly. With the initial settings, we were having a tough time getting our algorithm to recognize that both shadowed and sunny road were road while everything else wasn't road. The best we got generally thought that shadows on the road weren't road. You can see this in our first video. Increasing the saturation brings out more blue in the shadowed areas and pretty much fixed this problem.
The algorithm:
- Convert image to hsv, keeping a copy in rgb.
- Look for road by thresholding on the h band.
- When we need the "noise detector", look for strips of pixels with lots of changes in the v band and mark them non-road. This is to handle soil, rocks, and some other areas which the initial thresholding incorrectly marks as road.
- Grow orange areas by thresholding on the r and b bands (high r and low b). This makes the cones grow to fill in the road between them and makes us stay away from them.
- Find the longest run of solid black (road) in each row and assume that's the actual road in that row and anything else we thought was road isn't. So for example if we had:
0 1 1 0 0 1 1 1 1 1 0 1 0 0
we get:
0 0 0 0 0 1 1 1 1 1 0 0 0 0 - Average together the centers of each of those strips for the rows which show the area in front of the robot to get a single location for the center of the road coming up.
For the above row, the center is the 8th pixel so the value is 57%. 50% means the road is right in the middle. - Translate that value to a steering direction.