hmmmm of course you have to work with what sensor feedback you have in your design....but here's one approach out of many. We have not tried this, but here goes:
Let's say you can calculate slip ratio.
1) Pick the ratio you want as the "set point"
2) find the slip ratio you currently have.
3) the difference is your error
4) pick a multiplier (Kp, the proportional gain in controllese)
Kp*error becomes the input to you motors, but limit it to -1.<0.<1.
or...Kp*error could be a delta to the last pass motor pwm (better? worse? dunno)
So, the choice of Kp is critical! too big and you get wildly big swings in pwm (unstable control system) and too small and you get no effect. As a swag, I'd guess that an error of twice the slip would need 100% drive...something like 1./slip_ratio_set_point...just guessing
As for the integral term, (the I in PI) keep a running sum of the error and choose a Ki, the term becomes Ki*(sum_error). Add it to Kp*error for your overall output
Output_to_motor = Kp*error + Ki*(sum_error)
The integral part is tricky. It is good for trimming out long-term biases, but you need to limit how big you want the sum_error to grow or you will experience "integrator wind-up" - really big Integral terms in your output that can adversely effect you controller. Add the fact that this is not a continuously running process - you will be starting and stopping, and and you can guess how wind-up could mess with your driver's head!
My recommendation would be to try only the P part first and add the I if you really have to. Also, Google PID controller...there's a wealth of better descriptions out there.
This approach will always drive you to
some slip... interesting...even when you want to stop?!?
Eric
PS heh - our programming is never done 'til our last match at the Championship
