Engineering APSC1299 Line Following and the Sumovore Robot

 

Robot

Line Following and the Sumovore Robot

written by Dan Peirce B.Sc.

If one searches the web one will see that there are a variety of different types of line following robots. Some only have one sensor that follows one edge of the line. Some have just two sensors set up to straddle the line. Some have sensors in a cross pattern to pick up T intersections and X intersections. It depends on the application.

The Sumovore Robot

When the sumovore is purchased by itself it only has 4 sensors (the center sensor is not included but comes with the MCU brainboard kit). The discrete brainboard that comes with the sumovore wires the two left sensors in parallel and the two right sensors in parallel. This is essentially equivalent to two larger sensors; one sensor on the left and one sensor on the right. If black is seen on the left the robot turns left and if the line is seen on the right the robot turns right. If the robot does not see the line the assumption is that the line is still in the center and it goes straight ahead.

When the PIC brainboard is purchased the fifth sensor is in the bag and all the sensors are treated independently. This gives more possibilities. The line following part of the program that comes pre-installed in the PIC  is functionally is the same as linef_mod01_m.c although it was written in a language called JAL (just another language). It is quite possible that there was no free C compiler for the PIC16F877A when that JAL program was written. Note that linef_mod01_m.c actually ignores the center sensor. It does however treat the other sensors independently and because of this the robot can take a different action if the sensor is seen on the outside left or the inside left sensor.

It may well be possible to use a variety of different strategies for line following but here is one strategy and the rational behind it.

Line Following Algorithm

When the line is seen in the center the one can use the simple two sensors straddling the line approach. After all many robots only have two sensors and that is fine if there are no crossed lines and no abrupt turns. This simple approach is turn left if the line is seen on the left and turn right if the line is seen on the right. There is no need to consider the outermost sensors as long and the center sensor can see the line! So keep it simple and use the simple approach when possible.

If the line is no longer seen in the center then one needs to know where the line is and move accordingly. If the line is still seen by one of the inner sensors than a simple turn can may still work but if the line is seen by one of the outermost sensors a more drastic correction is probably needed before the line is lost all together. The spin works in this more drastic case.

If the strategy outlined above is followed the robot should be able to navigate crossed lines and sharp angles up to but not including 90 degrees. For 90 degree turns and sharper angles more will be required. Since the pattern of sensors on the sumovore is a simple line, history is now required (note if the sensors were in a 5 by 5 grid this would not be the case because more information would be available). The robot needs to be able to remember if it saw a line on the left or right recently if it looses the line altogether. If the line was not seen on the left or right recently then it would seem the robot must be at a gap. If the robot saw the line on the left more recently than on the right then that would be an indication that there is a 90 degree (or less) turn to the left (or to the right if it was recently seen on the right).