Pitt-RAS / micromouse-2016

7 stars 6 forks source link

Remove derivative kick #34

Closed QuentinTorg closed 8 years ago

QuentinTorg commented 8 years ago

We need to make sure that our PID controller does not suffer from PID kick as described here: http://brettbeauregard.com/blog/2011/04/improving-the-beginner’s-pid-derivative-kick/

With our constantly changing set points in most instances of our PID loop, we are bound to run into trouble once we start trying to incorporate KD tuning.

We will probably need to alter the input parameters of the PID function to have a 'set point' and a 'current reading' instead of passing in pre calculated errors. This will let us calculate the derivative of the input instead of the derivative of the error, eliminating derivative kick issues.

xaviertorgerson commented 8 years ago

Do you think it is important that we make a new PID controller for every motion calc? Do you think our program will more naturally transition between two different motions if we maintain the same PID instance but change the set points? When we reinstantiate we lose our I term and D term. The integral of error is only for each motion (not that it would always be useful for the next motion, we may want to force clear) and the derivative term for the first reading after reinstantiating is always the change from 0, not from the last reading, so it could cause a new kind of derivative spike. I'm proposing universal PID controllers for each motor independent of the specific motion. We can now change the setpoints and KI, KD, KP on the fly. This might not solve any huge apparent problems but I think it is the right way to do it. Tell me if I'm missing anything.