CS 154 - Lab Projects
Marissa Anderson . Matt Livianu . Eric Wu
Week 3 - Feb 17, 2003
This week we refined the lego design even more, to make Flamebot travel in a more or less straight line and follow walls. The front bump sensor was inefficient, so we changed to a design with two bump sensors on the front, so we can follow walls more efficiently. The rear caster wheel's wobble and bumping into walls would shift the balance of the heavy handyboard, causing the 'bot to go in interesting directions. We think we've fixed that behavior by modifying the caster wheel and duct-taping the board to its base.
Unfortunately, we discovered (after an hour of trying to test it) that our first DC fan was broken, so we were unable to test with all our components. We have fried two 5V fans thusfar, only to find that the 12V fan we
thought was broken, actually functions just fine!
We discovered that the light sensors are wildly inaccurate and require quite a bit of calibration. Flamebot would often miss the candle completely and stop itself in a random patch of light. Sometimes it would find the candle, then lose it and stop itself, wondering what to do next. When we programmed it to try re-finding the candle once it lost its threshold, it started backing away from the candle rather than moving to extinguish it!
The light sensors are mounted on the front, allowing Flamebot to "home in" on the candle once it sees it. We found, as did Mayol, Tordoff and Murray, that "raising the sensor away from the body reduces the degree of occlusion" (3726). However, we couldn't raise the sensors too high, as they could break or tip Flamebot. If Flamebot thinks it has found light, then it tries to home in on it.
It realizes, usually, after some time moving towards the bright spot,
that it has not found the candle. Usually, the bright spot is a reflection
off of the table or from the overhead lights. When it realizes it has been
tricked, Flamebot continues its search for the holy candle.
The robot is controlled by 2 processes running in parallel, runAround and
homeIn. runAround wanders the maze attempting to follow walls until
either of the light sensors finds an unusually bright spot. The average
brightness is determined by sampling the light sensors 10 times over the
course of the first 2 seconds it runs in the maze. Bright spots are areas
where the light sensors register readings under 0.8 times the average
brightness, where lower readings indicate brighter light.
homeIn works by trying to keep the candle centered between the two light
sensors, which both point forward about an inch apart. First, the robot
turns right until it thinks the left sensor is pointed directly at the
candle. Then, it turns left until the right sensor is pointed at the
candle. After measuring the time it takes to line up the right sensor
with the candle, it then turns right again for half that amount of time,
theoretically leaving the candle directly between the sensors. Flamebot
then advances a short amount and attempts to repeat the process until the
brightness level on both sensors is high enough that the fan can be
turned on. If the fan fails to extinguish the flame, then the robot
advances a small amount again and repeats the process. Occasionally in
the process of advancing towards the candle, the robot manages to turn far
enough away that both sensors or no longer below the threshold level
indicating the presence of the candle. In this case, the robot backs up
and looks for the candle again. If it fails to find it, then control
returns to the runAround function.
The environment is perhaps a bit more hostile than we had anticipated.
The crack between the tables and the wall occasionally cause Flamebot to
get hopelessly stuck. More interestingly, one of the walls of the maze is
reflective. If Flamebot has a dark enough threshold setting, then the
reflection of the candle on that wall occasionally is taken to be the real
The castor wheel still pulls to one direction or the other when we want it
to go straight. Over long distances, this isn't a big issue - after all,
since we're bumping into walls to navigate anyway, the difference between
bumping into a wall every foot or every 2 feet is pretty minor. However,
when trying to to minor adjustments, such as in the homeIn function when
advancing on the candle, the castor wheel becomes a major source of error.
Making turns of under 5 degrees with any degree of accuracy is pretty much
impossible with the castor wheel needing to turn entirely around. We've
made adjustments for this problem by using different speeds on the wheels
when advancing in order to turn slightly, in hopes of nullifying the tilt
from the castor wheel. From a distance, it looks just like it works, even
though the wheel's not right. From a bit closer, the other problems with
the wheels come into play.
We have finally scrapped the castor wheel, opting instead for the end of
a thin rod (3 mm in diameter) which drags along the surface. This
potentially could cause problems if the rod gets stuck in a small crack,
but flameBot now travels straight when both motors are powered equally and
homeIn works much more efficiently, especially in right and left
In retrospect, our gear ratio is too low, but it's too late now to really
rebuild the chassis. In the process of strengthening the chassis so the
robot doesn't fall apart every time it hits a wall, we've made it so that
minor adjustments are pretty much impossible. We still don't generate
enough torque to be able to make minor movements. The minimum speed on
Flamebot is about 10 (out of 100). Speeds lower than 10 aren't guaranteed
to turn the wheels at all, which is problematic when you're calculating
movement based on how long the motors run. Unfortunately, at speeds of 10
and more, short turns have a tendency to skid when they stop. The
corrective action for this was pretty much to use a nasty hack that
attempts to correct for the skidding that we expect to happen.
The fan has proven to be problematic through this entire project. The
first fan couldn't handle the 9.6V coming from the HandyBoard, and the
newer fan which can is also big enough to make the robot extremely
top-heavy. Weights need to be added to the rear of the chassis to keep
the robot from tipping forward each time it goes in reverse. This extra
weight probably messes up a lot of the nasty hacks used in the homeIn
function to keep some semblance of accuracy. Also, with the fan mounted
directly above the light sensors, we've had some trouble getting the angle
right for the candle to end up at the focus of both the light sensors and
Finally, the light sensors aren't the most reliable in the world. Our
original plan to find the candle by minimizing the sum of the sensors (or
maximizing the brightness) failed because the two sensors give out wildly
different readings for the same light level. Also, the flickering candle
isn't the best target for these sensors, since the homeIn function counts
on a light source being consistently the same brightness, which clearly
isn't true. We've tried to make up for this by inching forward towards
the light slowly and trying to correct the orientation of the robot at
each step, as well as backing up when the robot turns too far.
It is also of utmost importance to remember that hot wax is liquid and
pours easily on to delicate fingers.
Testing the fan, but alas, it did not work.
Flamebot ready for action!
Isn't it cute.
We released it carefully into its new habitat.
It, of course, decided to miss the candle right away. Doh!
Finally we got the robot to find the candle, but part of its behavior made it back away from the candle too much, so it seemed to be "afraid" of the light.