Quote:
Originally Posted by Justin Buist
Here's the crux of simple PID calculation code:
Code:
double error = target-current;
double errorChange = error-lastError;
double correction = Kp*error + Ki*errorSum + Kd*errorChange;
lastError = error;
return correction;
|
There's a line of code missing: errorSum += error