PIDController Class Reference
#include <PIDController.h>


Public Member Functions | |
| PIDController (float p, float i, float d, 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 float | GetP () |
| virtual float | GetI () |
| virtual float | GetD () |
| virtual void | SetSetpoint (float setpoint) |
| virtual float | GetSetpoint () |
| virtual float | GetError () |
| virtual void | SetTolerance (float percent) |
| virtual bool | OnTarget () |
| virtual void | Enable () |
| virtual void | Disable () |
| virtual bool | IsEnabled () |
| virtual void | Reset () |
Detailed Description
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
Definition at line 24 of file PIDController.h.
Constructor & Destructor Documentation
| 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.
Definition at line 23 of file PIDController.cpp.
| PIDController::~PIDController | ( | ) | [virtual] |
Free the PID object
Definition at line 62 of file PIDController.cpp.
Member Function Documentation
| void PIDController::Disable | ( | ) | [virtual] |
Stop running the PIDController, this sets the output to zero before stopping.
Definition at line 375 of file PIDController.cpp.
| void PIDController::Enable | ( | ) | [virtual] |
Begin running the PIDController
Definition at line 364 of file PIDController.cpp.
| 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
Definition at line 213 of file PIDController.cpp.
| float PIDController::GetD | ( | ) | [virtual] |
Get the Differential coefficient
- Returns:
- differential coefficient
Definition at line 199 of file PIDController.cpp.
| float PIDController::GetError | ( | ) | [virtual] |
Retruns the current difference of the input from the setpoint
- Returns:
- the current error
Definition at line 319 of file PIDController.cpp.
| float PIDController::GetI | ( | ) | [virtual] |
Get the Integral coefficient
- Returns:
- integral coefficient
Definition at line 186 of file PIDController.cpp.
| float PIDController::GetP | ( | ) | [virtual] |
Get the Proportional coefficient
- Returns:
- proportional coefficient
Definition at line 173 of file PIDController.cpp.
| float PIDController::GetSetpoint | ( | ) | [virtual] |
Returns the current setpoint of the PIDController
- Returns:
- the current setpoint
Definition at line 304 of file PIDController.cpp.
| bool PIDController::IsEnabled | ( | ) | [virtual] |
Return true if PIDController is enabled.
Definition at line 388 of file PIDController.cpp.
| void PIDController::Reset | ( | ) | [virtual] |
Reset the previous error,, the integral term, and disable the controller.
Definition at line 402 of file PIDController.cpp.
| 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
Definition at line 231 of file PIDController.cpp.
| 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
Definition at line 247 of file PIDController.cpp.
| 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
Definition at line 265 of file PIDController.cpp.
| 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
Definition at line 158 of file PIDController.cpp.
| void PIDController::SetSetpoint | ( | float | setpoint | ) | [virtual] |
Set the setpoint for the PIDController
- Parameters:
-
setpoint the desired setpoint
Definition at line 279 of file PIDController.cpp.
The documentation for this class was generated from the following files:
Generated on Thu Jan 12 2012 22:35:34 for WPILibC++ by
1.7.1