added integral term reset functionality

This commit is contained in:
Ubuntu 2016-06-14 08:40:31 +00:00
parent fb095d8cfc
commit 31b8bc0777
3 changed files with 12 additions and 0 deletions

View File

@ -98,6 +98,13 @@ void PID::SetTunings(double Kp, double Ki, double Kd)
kd = (0 - kd); kd = (0 - kd);
} }
} }
/* ResetI() *******************************************************************
* Resets the build up integral term of the PID
******************************************************************************/
void PID::ResetI() {
ITerm = 0;
}
/* SetSampleTime(...) ********************************************************* /* SetSampleTime(...) *********************************************************
* sets the period, in Milliseconds, at which the calculation is performed * sets the period, in Milliseconds, at which the calculation is performed

View File

@ -35,6 +35,10 @@ class PID
void SetTunings(double, double, // * While most users will set the tunings once in the void SetTunings(double, double, // * While most users will set the tunings once in the
double); // constructor, this function gives the user the option double); // constructor, this function gives the user the option
// of changing tunings during runtime for Adaptive control // of changing tunings during runtime for Adaptive control
void ResetI(); // * Resets Integral term of PID: Useful especially for multicopters.
// * This allows to reset this term when the multicopter descends to
// * the ground and contionues the flight again later.
void SetControllerDirection(int); // * Sets the Direction, or "Action" of the controller. DIRECT void SetControllerDirection(int); // * Sets the Direction, or "Action" of the controller. DIRECT
// means the output will increase when error is positive. REVERSE // means the output will increase when error is positive. REVERSE
// means the opposite. it's very unlikely that this will be needed // means the opposite. it's very unlikely that this will be needed

View File

@ -16,6 +16,7 @@ SetMode KEYWORD2
Compute KEYWORD2 Compute KEYWORD2
SetOutputLimits KEYWORD2 SetOutputLimits KEYWORD2
SetTunings KEYWORD2 SetTunings KEYWORD2
ResetI KEYWORD2
SetControllerDirection KEYWORD2 SetControllerDirection KEYWORD2
SetSampleTime KEYWORD2 SetSampleTime KEYWORD2
GetKp KEYWORD2 GetKp KEYWORD2