244 double output = pid->Kp * error + pid->ITerm - pid->Kd * dInput; |
244 double output = pid->Kp * error + pid->ITerm - pid->Kd * dInput; |
245 if (output > pid->outMax) |
245 if (output > pid->outMax) |
246 output = pid->outMax; |
246 output = pid->outMax; |
247 else if (output < pid->outMin) |
247 else if (output < pid->outMin) |
248 output = pid->outMin; |
248 output = pid->outMin; |
|
249 *pid->myOutput = output; |
249 |
250 |
250 /* |
251 /* |
251 * Remember some variables for the next time |
252 * Remember some variables for the next time |
252 */ |
253 */ |
253 pid->lastInput = input; |
254 pid->lastInput = input; |