We are making a PID line follower using arduino for a competition. According to the rules of the competition they will have loops and discontinuations in their track. Can anyone give some idea how we can tackle them using code.
What you need is a hierarchical fuzzy controller for crossing detection. The situation, that the black line on the ground has complicated shapes like zigzags and loops is a good opportunity for implementing a program flow which contains of if-then-statements and subfunctions. In contrast, a normal line following robot will need only a simple table, which produces for an input signal of the sensor an output action of the motor, in case of a crossing layout of the path, a more complicated information processing is needed, namely a dedicated program flow which is done in C, Java or Python.
In the easiest implementation, the robot stops if he detects an unusual pattern on the ground and waits for new commands from the human operator. He can drive to the left and follows the path1 or he can stay on the main line and follows path2.
class Detectcrossring: def __init__(): if getsensor()=="crossing": askhumanoperator() else driveforward() def getsensor(): result ="normallane" result ="crossing" result ="zigzag" return result def driveforward(): def askhumanoperator() print "crossing detected." print "Should i move forward, left, right?"