Arduino-PID-Library icon indicating copy to clipboard operation
Arduino-PID-Library copied to clipboard

Changing sign Derivative factor

Open DavyEHB opened this issue 5 years ago • 1 comments

I compared different versions of the PID library. I noticed that the sign of the derivative factor changes between the versions. In the code on your website http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/

/*Compute PID Output*/
   Output = kp * error + ki * errSum **+** kd * dErr;

http://brettbeauregard.com/blog/wp-content/uploads/2011/03/pidalgorithm.png Also includes the addition of the derivative.

v 1.2.1 Here you subtract the derivative.

      /*Compute Rest of PID Output*/
      output += outputSum **-** kd * dInput;

Quite confusing to me. Since it is negative, won't it counteract the response? Could you explain the logic for this?

Kind regards.

DavyEHB avatar Apr 24 '20 12:04 DavyEHB

I think what you are looking for is explained in the following post: http://brettbeauregard.com/blog/2011/04/improving-the-beginner%e2%80%99s-pid-derivative-kick/

AnderbergE avatar Apr 28 '20 09:04 AnderbergE