|
| PIDController (float p, float i, float d, PIDSource *source, PIDOutput *output, float period=0.05) |
| Allocate a PID object with the given constants for P, I, D. More...
|
|
| PIDController (float p, float i, float d, float f, PIDSource *source, PIDOutput *output, float period=0.05) |
| Allocate a PID object with the given constants for P, I, D. More...
|
|
| PIDController (const PIDController &)=delete |
|
PIDController & | operator= (const PIDController)=delete |
|
virtual float | Get () const |
| Return the current PID result This is always centered on zero and constrained the the max and min outs. More...
|
|
virtual void | SetContinuous (bool continuous=true) |
| 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. More...
|
|
virtual void | SetInputRange (float minimumInput, float maximumInput) |
| Sets the maximum and minimum values expected from the input. More...
|
|
virtual void | SetOutputRange (float minimumOutput, float maximumOutput) |
| Sets the minimum and maximum values to write. More...
|
|
virtual void | SetPID (double p, double i, double d) override |
| Set the PID Controller gain parameters. More...
|
|
virtual void | SetPID (double p, double i, double d, double f) |
| Set the PID Controller gain parameters. More...
|
|
virtual double | GetP () const override |
| Get the Proportional coefficient. More...
|
|
virtual double | GetI () const override |
| Get the Integral coefficient. More...
|
|
virtual double | GetD () const override |
| Get the Differential coefficient. More...
|
|
virtual double | GetF () const |
| Get the Feed forward coefficient. More...
|
|
virtual void | SetSetpoint (float setpoint) override |
| Set the setpoint for the PIDController Clears the queue for GetAvgError(). More...
|
|
virtual double | GetSetpoint () const override |
| Returns the current setpoint of the PIDController. More...
|
|
double | GetDeltaSetpoint () const |
| Returns the change in setpoint over time of the PIDController. More...
|
|
virtual float | GetError () const |
| Returns the current difference of the input from the setpoint. More...
|
|
virtual float | GetAvgError () const |
| Returns the current average of the error over the past few iterations. More...
|
|
virtual void | SetPIDSourceType (PIDSourceType pidSource) |
| Sets what type of input the PID controller will use.
|
|
virtual PIDSourceType | GetPIDSourceType () const |
| Returns the type of input the PID controller is using. More...
|
|
virtual void | SetTolerance (float percent) |
|
virtual void | SetAbsoluteTolerance (float absValue) |
|
virtual void | SetPercentTolerance (float percentValue) |
|
virtual void | SetToleranceBuffer (unsigned buf=1) |
|
virtual bool | OnTarget () const |
|
virtual void | Enable () override |
| Begin running the PIDController.
|
|
virtual void | Disable () override |
| Stop running the PIDController, this sets the output to zero before stopping.
|
|
virtual bool | IsEnabled () const override |
| Return true if PIDController is enabled.
|
|
virtual void | Reset () override |
| Reset the previous error,, the integral term, and disable the controller.
|
|
virtual void | InitTable (std::shared_ptr< ITable > table) override |
| Initializes a table for this sendable object. More...
|
|
virtual void | ValueChangedEx (ITable *source, llvm::StringRef key, std::shared_ptr< nt::Value > value, unsigned int flags) |
| Extended version of ValueChanged. More...
|
|
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
double PIDController::CalculateFeedForward |
( |
| ) |
|
|
protectedvirtual |
Calculate the feed forward term.
Both of the provided feed forward calculations are velocity feed forwards. If a different feed forward calculation is desired, the user can override this function and provide his or her own. This function does no synchronization because the PIDController class only calls it in synchronized code, so be careful if calling it oneself.
If a velocity PID controller is being used, the F term should be set to 1 over the maximum setpoint for the output. If a position PID controller is being used, the F term should be set to 1 over the maximum speed for the output measured in setpoint units per this controller's update period (see the default period in this class's constructor).