We are trying to us ultrasonics to follow the side barrier on the field by a set distance. We initially created a basic program using if statements to drive and turn based on the distance from the wall and gyro heading. Does anyone know how we would be able to implement PID or some other sort of closed loop control to follow the wall? Do we need to use multiple ultrasonics? Is the gyro necessary? Or is there a different method for maintaining a set distance from the wall that you would recommend?
Any help or suggestions would be appreciated.