11#ifndef PID_CONTROLLER_H
12#define PID_CONTROLLER_H
60 PIDController(
const double dKp,
const double dKi,
const double dKd,
const double dKff = 0.0);
61 double Calculate(
const double dActual,
const double dSetpoint);
76 void SetPID(
const double dKp,
const double dKi,
const double dKd);
77 void SetPID(
const double dKp,
const double dKi,
const double dKd,
const double dKff);
100 double GetContinuousInputEnabled()
const;
121 double m_dMaxIEffort;
124 double m_dLastActual;
125 double m_dOutputRampRate;
126 double m_dLastControlOutput;
127 double m_dOutputFilter;
128 double m_dMaxSetpointDifference;
129 double m_dMinimumContinuousInput;
130 double m_dMaximumContinuousInput;
131 bool m_bControllerIsContinuous;
132 bool m_bFirstCalculation;
This class encapsulates the fundamental principles of Proportional-Integral-Derivative (PID) control ...
Definition PIDController.h:50
void SetDerivative(const double dKd)
Configure the derivative gain parameter. This acts as a brake or dampener on the control effort....
Definition PIDController.cpp:341
bool GetReversed() const
Accessor for if the controller outputs are set to be negated or reversed.
Definition PIDController.cpp:686
void CheckGainSigns()
To operate correctly, all PID parameters require the same sign.
Definition PIDController.cpp:699
double GetOutputFilter() const
Accessor for the exponential rolling sum filter strength. Used to reduce sharp output oscillations or...
Definition PIDController.cpp:671
double GetSetpoint() const
Accessor for the current setpoint that the controller is trying to reach.
Definition PIDController.cpp:611
void SetMaxSetpointDifference(const double dMaxSetpointDifference)
Mutator for the maximum allowable distance of the setpoint from the actual value. This doesn't limit ...
Definition PIDController.cpp:435
void SetPID(const double dKp, const double dKi, const double dKd)
Mutator for PID gains of the controller.
Definition PIDController.cpp:379
double GetIntegral() const
Accessor for integral gain of the PID controller.
Definition PIDController.cpp:569
void SetIntegral(const double dKi)
Configure the integral gain parameter. This is used for overcoming disturbances, and ensuring that th...
Definition PIDController.cpp:307
double GetFeedforward() const
Accessor for feedforward gain of the PID controller.
Definition PIDController.cpp:597
void SetMaxIntegralEffort(const double dMaxIEffort)
Mutator for the max value of the integral term during PID calculation. This is useful for preventing ...
Definition PIDController.cpp:450
double GetProportional() const
Accessor for proportional gain of the PID controller.
Definition PIDController.cpp:555
void SetOutputRampRate(const double dOutputRampRate)
Mutator for the maximum rate that the output can change per iteration.
Definition PIDController.cpp:507
void SetOutputFilter(const double dStrength)
Set a filter on the output to reduce sharp oscillations. 0.1 is likely a good starting point.
Definition PIDController.cpp:522
double GetDerivative() const
Accessor for derivative gain of the PID controller.
Definition PIDController.cpp:583
double GetOutputRampRate() const
Accessor the the maximum allowed output ramp rate of the PID controller.
Definition PIDController.cpp:656
void SetFeedforward(const double dKff)
Configure the feedforward gain parameter. This is excellent for velocity, rate, and other continuous ...
Definition PIDController.cpp:360
void EnableContinuousInput(const double dMinimumInput, const double dMaximumInput)
Enables continuous wraparound of PID controller input. Use for setpoints that exists on a circle....
Definition PIDController.cpp:238
void SetOutputLimits(const double dMinEffort, const double dMaxEffort)
Mutator for setting the minimum and maximum allowable values of the control output from the controlle...
Definition PIDController.cpp:466
double GetMaxIntegralEffort() const
Accessor for the maximum contribution of the integral term within the controller. 0 = disabled.
Definition PIDController.cpp:642
void SetProportional(const double dKp)
Configure the proportional gain parameter. This quickly responds to changes in setpoint,...
Definition PIDController.cpp:288
void SetSetpoint(const double dSetpoint)
Mutator for the setpoint for the PID controller.
Definition PIDController.cpp:419
void DisableContinuousInput()
Disable continuous input wraparound of the PID controller.
Definition PIDController.cpp:255
void Reset()
Resets the controller. This erases the integral term buildup, and removes derivative term on the next...
Definition PIDController.cpp:269
double Calculate()
Calculates the control output using the last provided setpoint and actual.
Definition PIDController.cpp:219
double GetMaxSetpointDifference() const
Accessor for the maximum allowable difference the setpoint can be from the actual....
Definition PIDController.cpp:627
void SetDirection(const bool bReversed=false)
Set the operating direction of the PID controller. Set true to reverse PID output.
Definition PIDController.cpp:541
This namespace stores classes, functions, and structs that are used to implement different controller...
Definition PIDController.cpp:26