Right-Edge Line Tracking
Modify your program to track the right side of the line using the lineTrackRight command block. Try it!What do you notice? How is this different from the original program?
The robot tracks the right side of the line. When the color sensor sees black it turns to the right. When the color sensor sees white, it turns toward the left. |
Line Tracking Threshold
When the robot is line tracking, the color sensor goes into a special "grayscale mode", where it provides the amount of reflected light from the surface under it. Dark surfaces absorb light, while bright surfaces reflect it.Real Robot users
Virtual Robot users
To calculate the perfect threshold value for your environment:
Turning Ratio
The last two boxes of the lineTrackLeft and lineTrackRight commands are motor speeds, and affect how sharply the robot will turn toward and away from the black line. Try it!
To test out your robot in this activity, a line tracking course
that has
a straight portion and a curved portion is recommended.
Below is an example what the course could look:
Part1 : Modify your program so that the second box is set to 100 and the third box is set to 0. Download and run your program on a line tracking course that includes both straight and curved portions.
The robot turns very sharply, overshooting the line on the straight portions of the course. |
Part2 : Modify your program so that the second box is set to 50 and the third box is set to 40. Download and run your program on the same line tracking course.
The robot turns much more gradually, which works well on the straight portions of the course, but fails to track the curved portions. |
Mini Challenge 1: Line Track for Distance
Program your robot to track the line conditionally!
|
How did you make your other Repeated Decisions Behaviors stop at a certain point?.
Use a repeatUntil Loop Block, set to use the value of the motor encoder, instead of a repeatForever Loop Block.
Did you know?
How the lineTrack Command Blocks work
The lineTrackRight and lineTrackLeft Command Blocks contain a
built-in conditional behavior that allows the robot to track
the edge of a line.
The same conditional behavior can be created using an If/Else Conditional Block. |