We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9b4ca0e commit a0eb0d6Copy full SHA for a0eb0d6
PID_v1.cpp
@@ -82,9 +82,15 @@ bool PID::Compute()
82
/*Compute Rest of PID Output*/
83
output += outputSum - kd * dInput;
84
85
- if(output > outMax) output = outMax;
86
- else if(output < outMin) output = outMin;
87
- *myOutput = output;
+ if(output > outMax){
+ outputSum -= output - outMax; // backcalculate integral to feasability
+ output = outMax;
88
+ }
89
+ else if(output < outMin) {
90
+ outputSum += outMin - output; // backcalculate integral to feasability
91
+ output = outMin;
92
93
+ *myOutput = output;
94
95
/*Remember some variables for next time*/
96
lastInput = input;
0 commit comments