|
Re: How to get robot to drive straigth using shaft encoders
I can't guarantee a "best" way to do it, but I can tell you a simple way. When you want to start going straight, set both the left and right encoder counts to zero. Every so often, perhaps in the Default_Routine() for convenience, read them both and compute the difference (or more likely the sum, as they will probably be counting in opposite directions). When the result is positive, tweak one side's motors to run a little slower and the other side a little faster than otherwise commanded. When the result is negative, do the opposite.
|