Hello everyone. This post is less of a way to learn PID but more of an investigation into a possible method of tuning that involves treating the control loop like a spring. Logistically this works better with a PD loop, which I will explain later. Essentially the equation for a spring is more or less F = - kx. However, when we add in friction it becomes F = -bv - kx. For the sake of consistent notation, I will represent the derivative with respect to time with a ’ for each derivative. Rewriting the equation using this equation we derive mx’’ = -b*x’ - kx. Moving everything to one side obtains the equation mx’’ + bx’ + kx = 0. If we divide everything by the mass we obtain x’’ + Bx’ + wx = 0. An interesting result of this that is explored further in physics is that when B^2 = w^2, then critical damping has been reached. w is in fact a physical quantity that can be measured for a robot. It is equivalent to 2pi/T, where T is the period of the oscillation. Thus, when tuning, we would expect that kP would determine the period of the oscillation and then kD could be accurately determined by measuring the period of oscillation. Thus, once you have reached a large enough kP value to have the loop reach its exit condition, you could determine the period of oscillation and get a very good approximation for your kD value. This all being said, this does not account for any other energy lost by the system so kD will most likely be slightly smaller than the predicted value. I also have no idea how this would play with the I portion of the loop. Any thoughts on that would be greatly appreciated. One final caveat, technically, a damped spring never actually reaches 0, unless it runs for infinite time. However you don’t need your error to be perfectly 0. Thus, a critically damped system will get within the bounds to exit the loop faster than any other path. I would appreciate any thoughts or ideas that you all have, especially on how adding the kI variable would affect all of this. Thank you and I hope this helps!

I would like to add one more thing, technically, because we control the voltage or current instead of the acceleration directly, this should be off by some constant multiplier, but it should be relatively easy to find based on your kP value as it should appear in both.

Just skimming this is really seems like you are reinventing something like Ziegler Nichols. This is probably a useful read for you.

4 Likes