Our robot has a line follower algorithm. The light sensors work great.
The idea is that the robot follows the line until the sonar distance is below a threshold
The problem is that the sensor often returns nonsense values , which causes the robot to either overshoot or underrun.
We have tried various techniques to filter out bad values. For example, we tried reading three values in a row and picking the center value. What we found is that once it is in this mode all the reads return the same incorrect value. A stand alone program which puts the sonar sensor values on the display works fine. We also tried a second sonar sensor.
I'm wondering if use of the hitechnic board driver is interferring with the sonar sensor reads? Or is the fact that all the motors are running somehow interrering?
I didn't find the right solution from the internet.