FIRST LEGO League Line Following

The Techno Guards came from the FIRST LEGO League Team: the Lego Guards. In fact, most of the current members of our FTC team were on the Power Puzzle team that was the Northern California 1st Place Championship team, who also won the World Festival 1st place Engineering - Programming award.

Thanks to the team's winning that award at the World Festival we've received a bunch of information requests about some of the things that we did. In particular, the team gets asked about the line following routine that the judges talked a lot about.

There are several files attached and a rather detailed description (from our coach) of the line following discovery trail. One of the files is the printout of the actual code we used for the robot in the Power Puzzle Challenge. However, we heartily recommend that you read about and understand the  concepts and discovery trail behind it. we recently looked for the actual code (3 years later) and cannot locate it (it's all in RobotC now for FTC and we haven't  looked at NXT-G very much).

Please remember, it's way more important that your team have and enjoy their own discoveries than that every team can follow a line same way we did!


The Lego Guards' Line Following

(Written by our coach in 2008)

The Lego Guards figured out the concept behind their line following routines in the summer before the challenge was released and have continually tweaked and adjusted it throughout the year (it was better at the World Festival in April than it was in January when they won the State Championship). Karl, Gavin, and Robin (our programmers) went through a lot of iterations and discoveries to make the concept work.

Generally, this was their discovery path:

- The first part of my job (as the coach) was to make sure they understood what tools they had to work with: We talked about the three types of signals (digital, analog, and text) and I made sure they understood the purpose and possible inputs and outputs of ALL of the blocks in the NXT-G software (sounds boring? - it wasn't - it only took about an hour). If they didn't understand what a block did, they stopped and plugged it into a program on a simple robot to try it until they did. During the course of that time they learned that light sensors put out a value signal of 0 to 100 (depending on how much black or white they see), and that motors used a speed that could be set between 0 and 100 (They learned a lot of other stuff that time - but those related numbers stood out to them).

- The next thing they noticed was mechanical - putting a light sensor at the front of the robot, roughly in line with a rear mounted drive wheel means that the other drive wheel, moving forward or back, moves that light sensor left or right. Detail:  Picture a square with the lower left corner pinned down - if the lower right corner is moved up or down, then the upper left corner moves left or right. 

- Knowing that, they realized that if they put two motors at the lower corners, moved one at a constant speed, and adjusted the other and it would move forward/back relative to the other and adjust the sensor in the upper  left or right simultaneously.  Their first version of a line follower started the left-rear motor moving forward at 50%, then went into a loop where the output of the front-left light sensor was directly fed into the input of the right-rear motor speed. The loop was exited when left motor's revolution count was high enough - then they stopped both motors.

- They added things to adjust the amount of variation (smoothing) and adjust the speed. At one point, right before the state competition, they had about 12 different MyBlocks for different types of following (left or right sensor, follow on the left or right, reason to stop) and they realized that they couldn't remember what was what or manage it safely. Finally, they decided to build a MyBlock that took all the settings and light sensor values and calculated a speed for the variable motor, then used that block within three others based on stop type (Follow_until_distance, Follow_until_time, Follow_until_dark) - and those had parameters that let them put the speed, light sensor id, smoothing, etc.


The NXT-G program listed below was written by me (the coach) it is not one that the team used during the season (the first two files). But, the blocks (however minimal they are) are where the team actually started. The documentation within describes all the pieces that they came up with, but it doesn't go into detail on how they accomplished it.


Lego Guards Basic Line Following.jpg183.9 KB
Basic Follow Program.rbt_.zip109.26 KB
LineFollowBlocks.pdf915.07 KB
Power Puzzle Documented Programs.pdf3.62 MB