I am learning about PID as a novice to robotics (background in software engineering).

One common problem with PID is that if the PV is below the SP for a long time, integral term will accumulate a large positive value which causes us to overshoot the SP. In particular, after crossing the SP we have to spend time in the negative error region to offset the large positive integral. This overshooting problem seems different from integral windup (which involves bounds on the output) and seems inherent in the integral contribution to PID control.

It occurred to me that this overshooting problem could be solved if we just zero out the integral when the error term changes sign. This prevents us from doing what seems like the silly thing of continuing to increase PV when it is already higher than SP just because historically PV was below SP.

I haven’t seen anyone mention this technique online, so I assume that I am missing something that makes this a bad idea, as it seems very natural to me (another way of stating the intuition is: never move PV farther away from SP).

Please tell me what I’m missing!


Generally, in a well-tuned PID, most of the job is done by the P term, which is responsible for driving PV to SP. Then, D and I serve as corrections: the D term regulates the profile as of how we reach for SP, whereas the I term kicks in essentially when we are already in the neighborhood of SP to attempt to get a 0 steady-state error.

Bearing these basic considerations in mind, having a PID that struggles to reach for SP, thus charging the integral too much, is an indication to fine-tune the P part.

You shouldn't cut out the output of I when the error changes its sign, right because the I part plays its major role exactly when the error continues to oscillate in the closeness of 0, hence when you'll observe sign changes more frequently.

Moreover, when we are around the set-point, the only part of the PID delivering an effort to the plant (e.g. the torque controlling a link against gravity) is the integral term ($e \approx 0 \implies P \cdot e \approx 0$), so we cannot zero it, otherwise we will lose the possibility to control PV (e.g. the link will fall). We may want to use feed-forward in this case, but the same considerations still hold: the model-based open-loop part is not perfect, thus requiring the closed-loop part to guarantee some given control performances. As a result, the I term needs to be always engaged and operative.

In short, we can think of the I part as composed of two contributions:

  1. the biggest portion is responsible for letting the plant stay close to the steady-state when the P part cannot be effective (given $e \approx 0$);
  2. a smaller modulation helps compensate for the final error.

Both contributions cannot be zeroed.

  • $\begingroup$ Hi, your first two paragraphs make sense, but the third contradicts my understanding. The I term increases oscillatory behavior, which is useful when the error has the same sign for too long because the P term is too weak to cross the set point. But the effect from I becomes counterproductive (moving us farther away from set point) if the error has just changed sign, right? It seems that if we zero it out on sign change we preserve the usefulness of I near SP while minimizing extra oscillation. $\endgroup$
    – rampatowl
    Aug 2 '19 at 19:28
  • $\begingroup$ I wasn't very clear. When I said that the error oscillates around 0 I meant in the closeness of 0 (I've modified the answer), that is the error in magnitude remains small and ideally approaches 0 thanks to the effort delivered the integral part. In this condition, only the I term performs useful actions and if you switch it off, by no means PV will go back once SP is overcome. $\endgroup$ Aug 2 '19 at 20:58
  • $\begingroup$ I’m not suggesting to get rid of the I term, just to zero it out each time you flip which side of the setpoint you’re on. You still get the usefulness of the integral (accumulating persistent errors of the same sign to overcome small offsets) without the negative oscillatory effects around SP (eg continuing to increase PV even when it has surpassed SP because you still have a positive integral). $\endgroup$
    – rampatowl
    Aug 2 '19 at 21:09
  • $\begingroup$ When we're around the set-point, the only part of the PID delivering an effort to the plant (e.g. the torque controlling a link against gravity) is the integral term ($e \approx 0 \implies P \cdot e \approx 0$), so you cannot zero it, otherwise you'll lose the control of PV (e.g. the link will fall). You may think of using feed-forward in this case, but it's the same story: if you zero the I term, you don't control the plant. $\endgroup$ Aug 2 '19 at 21:28
  • $\begingroup$ Ah! I completely misunderstood PID: I thought the PID value was the delta of your output, not the actual output. Thank you for your patience! $\endgroup$
    – rampatowl
    Aug 2 '19 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.