26-05-2012, 12:43 PM
Toeing the Line
Toeing the Line.pdf (Size: 869.45 KB / Downloads: 58)
Abstract
Following lines is an essential part of robot navigation in a First LEGO League robotics
competition. However, programming a robot to follow a line is not an easy task. This project
compares several algorithms that robots can use for line following. I hypothesized that robots
that were programmed to stay closer to the line and stop less for corrections would be faster and
more accurate. For the experiment, a basic LEGO robot used six different algorithms to follow a
winding black line, and the robot’s speed and accuracy on each run were recorded. My
hypothesis proved to be incorrect. The results showed that algorithms programmed to
continuously search for the line were more accurate than those that tried not to lose the line. It
was also found that the faster algorithms sacrificed accuracy for speed.
Introduction
First LEGO League is a worldwide competition in which teams build LEGO robots to
complete a series of missions under a time limit. One of the biggest problems our team faced
involved getting the robot from place to place quickly and accurately. There were lines on the
field leading to various mission objectives, and we were allowed the use of two light sensors.
Following those lines sounds like a pretty easy task, right? Wrong! Our robot persisted in
leaving the line. Our navigation failures inspired me to use this science project as an opportunity
to improve our chances for next year.
Purpose
Which one of six specific algorithms will allow a robot with one or two light sensors to
follow a winding black line on a white background most accurately and most quickly?
A light sensor outputs a number from 0 to 100 depending on how much light enters the
lens. In this way, the light sensor can “see” a small area on the floor. When the sensor is over a
black line, it reads a lower number than when it is over a white background. If it “sees” an area
that is part black and part white (e.g. when it is over the very edge of the line), it registers an inbetween,
or “gray” value.
The six algorithms tested in this experiment use one or two light sensors. Algorithms 1-5
start centered over the line, with the back of the robot flush with the beginning of the line.
Algorithm 6 begins on the side of the line, with the back light sensor flush with the beginning of
the line. Algorithms 1, 3, and 6 follow the side of the line, and although they are described as
following only the left side of the line, they are tested on both sides.
Programming the robot:
1. In RoboLab, create a program for each algorithm; for algorithms that follow the side of the
line, create two programs. (See Figures 1-9)
2. Download the first five programs to the RCX using the IR tower.
Building the robot:
1. Assemble the following using LEGO parts, according to the instructions in the Roverbot
section of the Constructopedia (Robotics Invention System 2.0 Constructopedia, 10):
• 1x Driving base (See Figure 10)
• 4x Front wheel attachments (See Figure 11)
• 2x Light sensor attachments
2. Attach the wheels to the driving base. (See Figure 12)
3. Attach one light sensor to the front of the robot using a yellow double-peg. (See Figure 13)
4. Set aside the other light sensor and the following additional pieces, which will be used to
make necessary modifications for certain algorithms:
• 1x Yellow double-peg
• 2x Long black pegs
• 2x Long pegs with axle connector at one end
• 2x Half-peg/half-axles
• 1x Axle (6 pegs long)
• 4x 1x1 conical bricks
Setting up the test area:
1. Create a line in two parts using black electrical tape on poster board. (See Figures 14-15)
2. Tape the two sections together on the back with packing tape, making sure that the lines on
the two boards line up. (See Figure 16)
3. Place the line on the table.
4. Place the halogen lamps on opposite sides of the table.
5. Turn on the halogen lamps and the shop light above the table.
6. Plug the extension cord into an outlet near the table.
7. Plug the AC/DC adapter into the robot, and plug the other end into the extension cord.