3 Rearranged formulae for better clarity edited Nov 13 '14 at 18:35 pericynthion 13655 bronze badges You can use the principle of proportional error control. Do the IR sensors have an analog output? If so, you can build an entirely analog control loop using op amps. If not, it's probably easier to use a microcontroller to do the control digitally, with a pair of motor controllers to handle the output. Either way, you want to arrange that the commanded motor speeds are as follows: $$V_1 = V_{nom} + k_p (d + d_{nom})$$$$V_1 = V_{nom} + k_p (d - d_{nom})$$ $$V_2 = V_{nom} + k_p (d - d_{nom})$$$$V_2 = V_{nom} - k_p (d - d_{nom})$$ Where $$V_1$$ and $$V_2$$ are the commanded motor speeds or voltages, k_p is the proportional gain (this can be adjusted to trade off responsiveness and residual error against stability), d is the measured distance from the wall and d_nom is the nominal distance. More complicated control loops could involve integral and derivative terms; the latter could be implemented by using distance sensors at the front and rear of the vehicle so that their difference is proportional to the rate of approach or closure. But I think a simple proportional controller as describe should work just fine. You can use the principle of proportional error control. Do the IR sensors have an analog output? If so, you can build an entirely analog control loop using op amps. If not, it's probably easier to use a microcontroller to do the control digitally, with a pair of motor controllers to handle the output. Either way, you want to arrange that the commanded motor speeds are as follows: $$V_1 = V_{nom} + k_p (d + d_{nom})$$ $$V_2 = V_{nom} + k_p (d - d_{nom})$$ Where $$V_1$$ and $$V_2$$ are the commanded motor speeds or voltages, k_p is the proportional gain (this can be adjusted to trade off responsiveness and residual error against stability), d is the measured distance from the wall and d_nom is the nominal distance. More complicated control loops could involve integral and derivative terms; the latter could be implemented by using distance sensors at the front and rear of the vehicle so that their difference is proportional to the rate of approach or closure. But I think a simple proportional controller as describe should work just fine. You can use the principle of proportional error control. Do the IR sensors have an analog output? If so, you can build an entirely analog control loop using op amps. If not, it's probably easier to use a microcontroller to do the control digitally, with a pair of motor controllers to handle the output. Either way, you want to arrange that the commanded motor speeds are as follows: $$V_1 = V_{nom} + k_p (d - d_{nom})$$ $$V_2 = V_{nom} - k_p (d - d_{nom})$$ Where $$V_1$$ and $$V_2$$ are the commanded motor speeds or voltages, k_p is the proportional gain (this can be adjusted to trade off responsiveness and residual error against stability), d is the measured distance from the wall and d_nom is the nominal distance. More complicated control loops could involve integral and derivative terms; the latter could be implemented by using distance sensors at the front and rear of the vehicle so that their difference is proportional to the rate of approach or closure. But I think a simple proportional controller as describe should work just fine. 2 Corrected inline latex delimiters for robotics SE edited Nov 13 '14 at 18:20 pericynthion 13655 bronze badges You can use the principle of proportional error control. Do the IR sensors have an analog output? If so, you can build an entirely analog control loop using op amps. If not, it's probably easier to use a microcontroller to do the control digitally, with a pair of motor controllers to handle the output. Either way, you want to arrange that the commanded motor speeds are as follows: $$V_1 = V_{nom} + k_p (d + d_{nom})$$ $$V_2 = V_{nom} + k_p (d - d_{nom})$$ Where \$V_1\$$$V_1$$ and \$V_2\$$$V_2$$ are the commanded motor speeds or voltages, k_p is the proportional gain (this can be adjusted to trade off responsiveness and residual error against stability), d is the measured distance from the wall and d_nom is the nominal distance. More complicated control loops could involve integral and derivative terms; the latter could be implemented by using distance sensors at the front and rear of the vehicle so that their difference is proportional to the rate of approach or closure. But I think a simple proportional controller as describe should work just fine. You can use the principle of proportional error control. Do the IR sensors have an analog output? If so, you can build an entirely analog control loop using op amps. If not, it's probably easier to use a microcontroller to do the control digitally, with a pair of motor controllers to handle the output. Either way, you want to arrange that the commanded motor speeds are as follows: $$V_1 = V_{nom} + k_p (d + d_{nom})$$ $$V_2 = V_{nom} + k_p (d - d_{nom})$$ Where \$V_1\$ and \$V_2\$ are the commanded motor speeds or voltages, k_p is the proportional gain (this can be adjusted to trade off responsiveness and residual error against stability), d is the measured distance from the wall and d_nom is the nominal distance. More complicated control loops could involve integral and derivative terms; the latter could be implemented by using distance sensors at the front and rear of the vehicle so that their difference is proportional to the rate of approach or closure. But I think a simple proportional controller as describe should work just fine. You can use the principle of proportional error control. Do the IR sensors have an analog output? If so, you can build an entirely analog control loop using op amps. If not, it's probably easier to use a microcontroller to do the control digitally, with a pair of motor controllers to handle the output. Either way, you want to arrange that the commanded motor speeds are as follows: $$V_1 = V_{nom} + k_p (d + d_{nom})$$ $$V_2 = V_{nom} + k_p (d - d_{nom})$$ Where $$V_1$$ and $$V_2$$ are the commanded motor speeds or voltages, k_p is the proportional gain (this can be adjusted to trade off responsiveness and residual error against stability), d is the measured distance from the wall and d_nom is the nominal distance. More complicated control loops could involve integral and derivative terms; the latter could be implemented by using distance sensors at the front and rear of the vehicle so that their difference is proportional to the rate of approach or closure. But I think a simple proportional controller as describe should work just fine. Post Migrated Here from electronics.stackexchange.com occurred Nov 13 '14 at 18:14 1 answered Nov 13 '14 at 18:11 pericynthion 13655 bronze badges You can use the principle of proportional error control. Do the IR sensors have an analog output? If so, you can build an entirely analog control loop using op amps. If not, it's probably easier to use a microcontroller to do the control digitally, with a pair of motor controllers to handle the output. Either way, you want to arrange that the commanded motor speeds are as follows: $$V_1 = V_{nom} + k_p (d + d_{nom})$$ $$V_2 = V_{nom} + k_p (d - d_{nom})$$ Where \$V_1\$ and \$V_2\$ are the commanded motor speeds or voltages, k_p is the proportional gain (this can be adjusted to trade off responsiveness and residual error against stability), d is the measured distance from the wall and d_nom is the nominal distance. More complicated control loops could involve integral and derivative terms; the latter could be implemented by using distance sensors at the front and rear of the vehicle so that their difference is proportional to the rate of approach or closure. But I think a simple proportional controller as describe should work just fine.