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);
75 void SetPID(
const double dKp,
const double dKi,
const double dKd);
76 void SetPID(
const double dKp,
const double dKi,
const double dKd,
const double dKff);
100 double GetContinuousInputEnabled()
const;
121 double m_dMaxIEffort;
125 double m_dOutputRampRate;
126 double m_dLastControlOutput;
128 double m_dOutputFilter;
129 double m_dMaxSetpointDifference;
130 double m_dMinimumContinuousInput;
131 double m_dMaximumContinuousInput;
132 bool m_bControllerIsContinuous;
133 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:336
bool GetReversed() const
Accessor for if the controller outputs are set to be negated or reversed.
Definition PIDController.cpp:697
void CheckGainSigns()
To operate correctly, all PID parameters require the same sign.
Definition PIDController.cpp:710
double GetOutputFilter() const
Accessor for the exponential rolling sum filter strength. Used to reduce sharp output oscillations or...
Definition PIDController.cpp:682
double GetSetpoint() const
Accessor for the current setpoint that the controller is trying to reach.
Definition PIDController.cpp:622
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:430
void SetPID(const double dKp, const double dKi, const double dKd)
Mutator for PID gains of the controller.
Definition PIDController.cpp:374
double GetIntegral() const
Accessor for integral gain of the PID controller.
Definition PIDController.cpp:580
void SetIntegral(const double dKi)
Configure the integral gain parameter. This is used for overcoming disturbances, and ensuring that th...
Definition PIDController.cpp:302
double GetFeedforward() const
Accessor for feedforward gain of the PID controller.
Definition PIDController.cpp:608
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:445
double GetProportional() const
Accessor for proportional gain of the PID controller.
Definition PIDController.cpp:566
void SetOutputRampRate(const double dOutputRampRate)
Mutator for the maximum rate that the output can change per iteration.
Definition PIDController.cpp:518
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:533
void SetTolerance(const double dTolerance)
Mutator for the tolerance of the controller. This is used to determine if the.
Definition PIDController.cpp:461
double GetDerivative() const
Accessor for derivative gain of the PID controller.
Definition PIDController.cpp:594
double GetOutputRampRate() const
Accessor the the maximum allowed output ramp rate of the PID controller.
Definition PIDController.cpp:667
void SetFeedforward(const double dKff)
Configure the feedforward gain parameter. This is excellent for velocity, rate, and other continuous ...
Definition PIDController.cpp:355
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:233
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:477
double GetMaxIntegralEffort() const
Accessor for the maximum contribution of the integral term within the controller. 0 = disabled.
Definition PIDController.cpp:653
void SetProportional(const double dKp)
Configure the proportional gain parameter. This quickly responds to changes in setpoint,...
Definition PIDController.cpp:283
void SetSetpoint(const double dSetpoint)
Mutator for the setpoint for the PID controller.
Definition PIDController.cpp:414
void DisableContinuousInput()
Disable continuous input wraparound of the PID controller.
Definition PIDController.cpp:250
void Reset()
Resets the controller. This erases the integral term buildup, and removes derivative term on the next...
Definition PIDController.cpp:264
double GetMaxSetpointDifference() const
Accessor for the maximum allowable difference the setpoint can be from the actual....
Definition PIDController.cpp:638
void SetDirection(const bool bReversed=false)
Set the operating direction of the PID controller. Set true to reverse PID output.
Definition PIDController.cpp:552
double Calculate(const double dActual, const double dSetpoint)
Calculate the next control output given the current actual and a setpoint.
Definition PIDController.cpp:77
This namespace stores classes, functions, and structs that are used to implement different controller...
Definition PIDController.cpp:26