#include <PIDController.h>
|
| PIDController (float p, float i, float d, PIDSource *source, PIDOutput *output, float period=0.05) |
|
| PIDController (float p, float i, float d, float f, PIDSource *source, PIDOutput *output, float period=0.05) |
|
virtual | ~PIDController () |
|
virtual float | Get () |
|
virtual void | SetContinuous (bool continuous=true) |
|
virtual void | SetInputRange (float minimumInput, float maximumInput) |
|
virtual void | SetOutputRange (float mimimumOutput, float maximumOutput) |
|
virtual void | SetPID (float p, float i, float d) |
|
virtual void | SetPID (float p, float i, float d, float f) |
|
virtual float | GetP () |
|
virtual float | GetI () |
|
virtual float | GetD () |
|
virtual float | GetF () |
|
virtual void | SetSetpoint (float setpoint) |
|
virtual float | GetSetpoint () |
|
virtual float | GetError () |
|
virtual void | SetTolerance (float percent) |
|
virtual void | SetAbsoluteTolerance (float absValue) |
|
virtual void | SetPercentTolerance (float percentValue) |
|
virtual bool | OnTarget () |
|
virtual void | Enable () |
|
virtual void | Disable () |
|
virtual bool | IsEnabled () |
|
virtual void | Reset () |
|
virtual void | InitTable (ITable *table) |
|
Class implements a PID Control Loop.
Creates a separate thread which reads the given PIDSource and takes care of the integral calculations, as well as writing the given PIDOutput
PIDController::PIDController |
( |
float |
Kp, |
|
|
float |
Ki, |
|
|
float |
Kd, |
|
|
PIDSource * |
source, |
|
|
PIDOutput * |
output, |
|
|
float |
period = 0.05 |
|
) |
| |
Allocate a PID object with the given constants for P, I, D
- Parameters
-
Kp | the proportional coefficient |
Ki | the integral coefficient |
Kd | the derivative coefficient |
source | The PIDSource object that is used to get values |
output | The PIDOutput object that is set to the output value |
period | the loop time for doing calculations. This particularly effects calculations of the integral and differental terms. The default is 50ms. |
PIDController::PIDController |
( |
float |
Kp, |
|
|
float |
Ki, |
|
|
float |
Kd, |
|
|
float |
Kf, |
|
|
PIDSource * |
source, |
|
|
PIDOutput * |
output, |
|
|
float |
period = 0.05 |
|
) |
| |
Allocate a PID object with the given constants for P, I, D
- Parameters
-
Kp | the proportional coefficient |
Ki | the integral coefficient |
Kd | the derivative coefficient |
source | The PIDSource object that is used to get values |
output | The PIDOutput object that is set to the output value |
period | the loop time for doing calculations. This particularly effects calculations of the integral and differental terms. The default is 50ms. |
PIDController::~PIDController |
( |
| ) |
|
|
virtual |
void PIDController::Calculate |
( |
| ) |
|
|
protected |
Read the input, calculate the output accordingly, and write to the output. This should only be called by the Notifier indirectly through CallCalculate and is created during initialization.
void PIDController::Disable |
( |
| ) |
|
|
virtual |
void PIDController::Enable |
( |
| ) |
|
|
virtual |
float PIDController::Get |
( |
| ) |
|
|
virtual |
Return the current PID result This is always centered on zero and constrained the the max and min outs
- Returns
- the latest calculated output
float PIDController::GetD |
( |
| ) |
|
|
virtual |
Get the Differential coefficient
- Returns
- differential coefficient
float PIDController::GetError |
( |
| ) |
|
|
virtual |
Retruns the current difference of the input from the setpoint
- Returns
- the current error
float PIDController::GetF |
( |
| ) |
|
|
virtual |
Get the Feed forward coefficient
- Returns
- Feed forward coefficient
float PIDController::GetI |
( |
| ) |
|
|
virtual |
Get the Integral coefficient
- Returns
- integral coefficient
float PIDController::GetP |
( |
| ) |
|
|
virtual |
Get the Proportional coefficient
- Returns
- proportional coefficient
float PIDController::GetSetpoint |
( |
| ) |
|
|
virtual |
Returns the current setpoint of the PIDController
- Returns
- the current setpoint
bool PIDController::IsEnabled |
( |
| ) |
|
|
virtual |
void PIDController::Reset |
( |
| ) |
|
|
virtual |
Reset the previous error,, the integral term, and disable the controller.
void PIDController::SetContinuous |
( |
bool |
continuous = true | ) |
|
|
virtual |
Set the PID controller to consider the input to be continuous, Rather then using the max and min in as constraints, it considers them to be the same point and automatically calculates the shortest route to the setpoint.
- Parameters
-
continuous | Set to true turns on continuous, false turns off continuous |
void PIDController::SetInputRange |
( |
float |
minimumInput, |
|
|
float |
maximumInput |
|
) |
| |
|
virtual |
Sets the maximum and minimum values expected from the input.
- Parameters
-
minimumInput | the minimum value expected from the input |
maximumInput | the maximum value expected from the output |
void PIDController::SetOutputRange |
( |
float |
minimumOutput, |
|
|
float |
maximumOutput |
|
) |
| |
|
virtual |
Sets the minimum and maximum values to write.
- Parameters
-
minimumOutput | the minimum value to write to the output |
maximumOutput | the maximum value to write to the output |
void PIDController::SetPID |
( |
float |
p, |
|
|
float |
i, |
|
|
float |
d |
|
) |
| |
|
virtual |
Set the PID Controller gain parameters. Set the proportional, integral, and differential coefficients.
- Parameters
-
p | Proportional coefficient |
i | Integral coefficient |
d | Differential coefficient |
void PIDController::SetPID |
( |
float |
p, |
|
|
float |
i, |
|
|
float |
d, |
|
|
float |
f |
|
) |
| |
|
virtual |
Set the PID Controller gain parameters. Set the proportional, integral, and differential coefficients.
- Parameters
-
p | Proportional coefficient |
i | Integral coefficient |
d | Differential coefficient |
f | Feed forward coefficient |
void PIDController::SetSetpoint |
( |
float |
setpoint | ) |
|
|
virtual |
Set the setpoint for the PIDController
- Parameters
-
setpoint | the desired setpoint |
The documentation for this class was generated from the following files: