Line Follower

Hey I’m trying to figure out line followers. Can someone tell me how to make the line follower turn onto a line and go straight.

You usually need two or three line follower sensors to begin with, arranged side by side. The spacing between them depends on how wide the line you are trying to follow is, how good your control algorithm is, and how responsive your robot is.

The general idea is that each line sensor can tell you whether it is currently seeing line or background, and based on which sensors currently see line, you decide whether to go straight, left, or right.

While (line Following)

If Center only, drive straight
If left and center, slightly right,
If left only, harder right,
If right and center, slightly left,
If right only, Harder left,
If none, FREAK OUT!


You can also add in random wandering behavior when a line is not encountered, and some clever behavior when you encounter a line from nothing.

That is what i have now, but right when i have the robot turn it does the next step because only the middle one is on the line and the other ones aren’t. I just don’t know how to make it keep turning until it is straight. I am using easyc if you could give me a test program to have it turn straight onto a line.

K thanks

Also remember to either continuously move forward or to take a step forward after each course adjustment or you will end up spinning in place or losing the line.

Hey do you know the number that is equal to a white line?

Each sensor result will be different depending on your environment. If you connect you computer to the Cortex and Enable the On Line Window under Tools you should be able to see what the sensors are reading when over the line and when not. This will give you a range that you can use in your programming.

Also be really close to the tiles…just 1-2mm!