Following the black line in autonomous


In autonomous mode, if you want the robot to follow the black line, do you need two colour sensors? I have tried it with one and the robot just swerves from side to side and eventually looses the black line or follows another. Thanks


One color sensor should work. It should be pointed directly down.

There are two motor parameters and a threshold that must be set properly (refer to the help on line tracking). The threshold should be the average of the color sensor reading on and off the line. One of the motor settings is for the steering speed and the other is for the overall speed. By default the overall speed is “0” and this will result in the robot continuously searching back and forth. Try reducing the first motor parameter and/or increasing the second.

If you are trying to track on the VEX gaming field you will run into troubles with the black lines. We paper a section over with butcher paper to block the VEX black lines and use our own tape for the tracking line.


With ringmaster they were pretty successful following the line across the field. Who made the difference between the left and right Motors not that much so that when you came across the black lines going the other way on the field it wasn’t that much of an issue. In this game you’re never really going to travel that far from the starting position so that kind of position detection I don’t think it’s going to be as necessary. If need to straighten out the robot just have it hit the wall!!!


Thanks. We want to track the black line on the VEX gaming field.
I saw a robot last year that had two colour sensors and it followed the black line very steadily.
Where is the ‘help on line tracking’?


BTW, the color sensor you are using should be set up under Devices as “greyscale” mode.

Another hint on determining the threshold is to write a simple forever loop program that just prints to the brain display the color sensor value. It will print out two numbers, the first is the “greyscale” value and I think the second is the “hue” value. Place the sensor over the background and record the approximate value, then place it over the line and record it also. Add them together to get the “threshold”.

When you mount the color sensor, don’t mount it too low. It depends on the white LED in one of its three lens to illuminate the line. If is is too close to the ground the LED beam may not shine on that part that the sensor sees.