How to handle Y junctions with QTRX-MD-13RC?

I have developed a line following robot using your QTRX-MD-13RC sensor and QTRSensors.h Arduino library. It perfectly follows the line (straight lines, curved lines and 90 degree turns). However, when it encounters Y junctions, behavior is unpredictable. Sometimes it follows LSRB algorithm but not always. Can you advise me what changes I should do to your sample code for dealing with Y junctions?


I recommend carefully considering what happens when the robot first encounters one of these junctions and trying to determine what makes it unique from other intersections/scenarios.

The specifics of how to implement something like that will depend on your particular course and robot. However, as an example, a Y junction might be the only type of intersection where the robot’s middle 3 or 4 sensors are all seeing the line at the same time. If that’s the case, you could probably have your code check to see if all of those sensors are over the line at the same time, and if so, it can break out of the normal line following code and run a quick routine to put in on whichever course you want (e.g. stop following the line, turn slightly to the left, then continue following the line).