Wednesday, November 17, 2010

Nov. 17 Line Follower Algorithms / Beginners

Each week I meet with 2 friends, so they can learn about Lego Robot one of them recently bought.
Today we accidently found a simple algorithm that looks for the line and then follows it.
The line follower allows lots of algorithms.  First two friends downloaded, tried and looked at existing NXT-G programs. In the end they could somewhat follow the program, but could not make even minor changes successfully to the program. 
Today we started with basics. Motors block; Loop testing light sensor or looping forever;  If-then-else branch block.

[Picture of algorithm goes here]
The idea was:
Step 1: Go when see white, stop when see black. 
Loop while see white
Then stop
Step 2: Loop forever
If-then-else branch for light sensor:
IF white
THEN: forwards
ELSE: turn x degrees

We found when it found the line when x was around 45 degrees, the robot would follow the edge of the  line if it was on the correct edge for the direction it should go in. Since blue was seen as black, it lost the line at the blue box.

The Video shows the attempts starting with 90 degrees, then 45 degrees, then 25 degrees.

[VIDEO(S) COMING]

No comments:

Post a Comment