Does anyone know how to avoid overshoot in closed loop mode?

Hello everyone, I usually get quite acceptable configurations of the PID values but there are occasions in which overshooting situations occur in which the motor exceeds the position that I want and then corrects it.

Does anyone know how the PID values should be modified to remove the overshooting?

Tuning can reduce overshoot, but from what I learned about PID controllers the bottom line is some overshoot is unavoidable. That’s life for PID. It’s ultimately just a rather crude system that kind of works. Google optimally damped system.

1 Like

Hi @Anthony_Douglas thanks for your response.

Do you have any recommendation on how to modify the parameters (Kp, Ki, Kd, Output Ramp, Output Limit, Low Pass Filter ) to reduce overshoot ?

EDIT: After playing with various values I have found that reducing the value of Kp helps a lot to reduce overshooting.

1 Like

There are some guides to PI tuning better than I can produce here. Basically you start low and increase P till it oscillates, then back it off a bit. Then if there is a static error use the I term. D term is rarely used but is actually primarily to reduce overshoot, I think caused by the I term. I don’t think it would work very well here as it tends to be sensitive to noise and I think you probably have a lot of noise, but you can try.

There is such a thing called auto tune, and there are arduino libraries for it but I could never get them working.

1 Like

D is probably what you need, but as I mentioned in this post PID integrator windup reset - #24 by dekutree64 I think SimpleFOC’s D is borked due to “derivative kick” with the constantly changing setpoint. Unfortunately not easy to fix without making it more difficult to fix the angle range/accuracy problem we were discussing in that thread…

1 Like

I’ve never had much luck with the D term, I have to say - its supposed to dampen things, but I’ve observed it rather to have to opposite effect and introduce more oscillation. So usually I’ve left it at 0.

I haven’t looked into the derivative kick issue, I should educate myself :slight_smile:

I would love to fix these things, but as discussed in the other thread it’s non-trivial to do, so I prefer to think about it (collectively) until we have a viable solution…

1 Like

Are the arduino libraries for pid controllers not up to snuff? I found they had issues but not like the ones being described.