Search This Blog

Saturday, January 6, 2018

Line Following Algorithm






What is Line following?

Ever wondered what line following is in the robotics language?!.  Its a method by which a robot navigates from one position to another by following a line. This line is usually a white line against a darker background or a black line against a brighter background. Colleges and universities conduct these "Line following" event as a competition held against many other college students. Students participate in such events with a robot they have designed. The robots execute the program on these tracks prepared specially for the event.An assessment will be made based on the time taken and how well the bot followed line, without missing a part of it. If you think you should be participating in such an even, go ahead and read the description below.

How to make a bot follow the line?

Its important to have a line sensor to track and detect the line. The line sensor is usually made using IR sensors. The position\number of these sensors depends on the complexity of the track to be solved.You can try out various position and numbers to make your robot efficient for following a line.There is no fixed layout for the best performance, as this varies based on the track. But its a trend to follow the "Straight line Array" layout.

A micro controller is very much required to read the line sensor output for the position of the robot.Once the position of the robot on the line  is read, a decision has to be made to move the robot so that the line is in the center of the robot. Its always necessary to make sure that the line is on the center of the robot(Line sensor) this will enable the robot to move on the track.

Below are some cases which is encountered while following the line and actions to be taken.

S1,S2,S3,S4 are the line sensor elements.

This is the most basic position encountered while following a line.As seen in the pic, the sensor s2 and s3 gets activated as they lie directly on the line. This indicates that the line is at the center of the robot, and hence the robot can simply move forward.To move forward we need to make both motors M1 and M2 to rotate in the forward directions.

















Detecting a line deviating towards right.The sensor s3 and s4 gets activated as they lie directly on the line. This indicates that the line is at the right of the robot. Now the robot has to align itself so that the line is at the center of the robot and then move forward till the next deviation.To align the robot to the line, the robot has to make a right turn. To turn right, the motor M1 should move forward and speed of M2 should either be reduced or stopped based on the angle of the turn.















 


Detecting a line deviating towards Left.The sensor s1 and s2 gets activated as they lie directly on the line. This indicates that the line is at the left of the robot. Now the robot has to align itself so that the line is at the center of the robot and then move forward till the next deviation.To align the robot to the line, the robot has to make a left turn. To turn left, the motor M2 should move forward and speed of M1 should either be reduced or stopped based on the angle of the turn.




















Detecting a sharp right deviation.The sensor s2,s3 and s4 gets activated as they lie directly on the line. This indicates that the line is at the sharp right of the robot. Now the robot has to align itself so that the line is at the center of the robot and then move forward till the next deviation.To align the robot to the line, the robot has to make a sharp right turn. To make a sharp right turn, the motor M1 should move forward and M2 should be reversed.

The sensors being activated in such case depends on the position of the robot. Alternatively, only s4 or only s3 and s4 may be activated for such scenario.










Detecting a sharp left deviation.The sensor s2,s3 and s1 gets activated as they lie directly on the line. This indicates that the line is at the sharp left of the robot. Now the robot has to align itself so that the line is at the center of the robot and then move forward till the next deviation.To align the robot to the line, the robot has to make a sharp left turn. To make a sharp left turn, the motor M2 should move forward and M1 should be reversed.

The sensors being activated in such case depends on the position of the robot. Alternatively, only s1 or only s1 and s2 may be activated for such scenario.



No comments:

Post a Comment