![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
control for robotic arm that can play chess using a granular gripper
Dependencies: Encoder mbed HIDScope Servo MODSERIAL
Fork of chessRobot by
Diff: PID/PID.cpp
- Revision:
- 58:0ef7bb34fe29
- Parent:
- 57:43f707648f2b
- Child:
- 60:20945383ad1b
diff -r 43f707648f2b -r 0ef7bb34fe29 PID/PID.cpp --- a/PID/PID.cpp Mon Oct 12 11:46:47 2015 +0200 +++ b/PID/PID.cpp Mon Oct 12 11:52:47 2015 +0200 @@ -35,8 +35,8 @@ error = *mySetpoint - input; // get error for proportional ITerm += (ki*error); // Error for integral (with ki included) // check for integrator windup - if(errSum> outMax) errSum=outMax; - else if(errSum<outMin) errSum=outMin; + if(ITerm> outMax) ITerm=outMax; + else if(ITerm<outMin) ITerm=outMin; dErr = (error - lastErr); // get error for derivative // (could still be tuned for derivative kick) @@ -80,8 +80,8 @@ if(*myOutput > outMax) *myOutput = outMax; else if(*myOutput < outMin) *myOutput = outMin; - if(errSum > outMax) errSum= outMax; - else if(errSum < outMin) errSum= outMin; + if(ITerm > outMax) ITerm= outMax; + else if(ITerm < outMin) ITerm= outMin; } } @@ -98,7 +98,7 @@ lastInput = *myInput; ITerm = *myOutput; lastErr = 0; - if(errSum> outMax) errSum=outMax; - else if(errSum<outMin) errSum=outMin; + if(ITerm> outMax) ITerm=outMax; + else if(ITerm<outMin) ITerm=outMin; } \ No newline at end of file