This question already has an answer here:
I have a two-wheeled (two DC motors) robot that needs to follow the wall beside the robot.
The issue is that the DC motors spin at different rates (because they are not identical, of course), so the robot does not go straight when the same voltage is provided to each motor.
How can I use IR distance sensors (and op-amps) to keep the distance from the wall constant?
(the robot must travel parallel to the wall)