I am preparing a line following robot for a competition. I’ve read the topic “PID Control” given in “Pololu AVR C/C++ Library User’s Guide”. I would like to know how the qtr_read_line() function works when the 3pi robot is over an intersection or over a 90 degree turn. What value will the qtr_read_line() function return when the 3pi robot is in a similar situation (i.e., when more than one sensor is over the line at the same time)?
The output of the readLine() function is basically an average sensor location weighted by the sensor readings. This tells you where the line is when you are over a line, but the result is not necessarily very useful when your robot is over something more complex than a line, such as an intersection or multiple lines. The Pololu AVR library command reference gives the formula that readLine() uses to compute the line location, so you can pick a few sample sensor readings and compute for yourself what the result will be.
One thing you can do is look at the value of each sensor individually to determine if something weird is going on before deciding whether to trust the output of readLine(). For example, if you are getting very low reflectance from sensor 0 and from sensor 4 (or from all five sensors, as you would if you were crossing an intersection), you can choose to ignore the result of readLine() and do something else instead.