Documente Academic
Documente Profesional
Documente Cultură
The LineFollow2 program is a basic "Two State" line follower that uses a simple "zig-zag"
method of line following where the robot is constantly turning back and forth as it sees
either side of the color boundary. The robot is always either turning left or right (the two
states), so it is never actually straight, even when the line is straight. Before using this
program, you will want to calibrate the sensor (on the robot) for the lighting conditions of
the surface and line you are using. To get the best start for the line following, start the
robot with the sensor near the right edge of the line.
The LineFollow5 program uses a somewhat more complex "Five State" method of following
the line with the goal of going straighter and smoother (and therefore faster). When the
robot gets aligned with the color boundary that it is trying to follow, the robot will go
straight as far as it can and make small corrections left and right to try to stay on the
boundary without zigzagging as much. You will want to calibrate the sensor (on the robot)
for the lighting conditions of the surface and line you are using. To get the best start for the
line following, start the robot with the sensor near the right edge of the line.
Using the built-in NXT Calibrate program, you will use the on-screen prompts to sample two light readings,
with the robot on the actual surface to be used and the sensor in its actual position on the robot.
Challenge:
The standard NXT kit comes with only one light sensor, but if you have two light sensors,
then it is possible to make a different kind of line following strategy that is sometimes more
reliable than with one sensor. If you have two light sensors, try placing them on either side
of the line so that they both see white when the robot is centered over the line. Then an
example "Five State" strategy would be:
1.
2.
When the left sensor sees some black (e.g. 25-75%), make a slight left turn.
3.
When the left sensor sees all black (e.g. < 25%), make a hard left turn.
4.
When the right sensor sees some black, make a slight right turn.
5.
When the right sensor sees all black, make a hard right turn.
The programming will be trickier because you must test both sensors. Note that for
calibration, you only need to calibrate one sensor, and this same calibration will be used for
the other sensor as well.