Brick
Loading...
Searching...
No Matches
PID< T, U > Class Template Reference
Inheritance diagram for PID< T, U >:

Public Types

using kPType = units::Divided<U, T>
using kIType = units::Multiplied<kPType, units::Time>
using kDType = units::Divided<kPType, units::Time>

Public Member Functions

 PID (kPType kP, kIType kI, kDType kD, T deadband, units::Time on_target_time)
 PID controller object constructor.
void reset () override
 Resets the internal state of the PID controller.
U update (const double &state, const double &reference, const units::Time &dt=10_ms) override
 Updates the control loop output.
bool get_on_target ()
 Gets the on target state of the PID controller.
Public Member Functions inherited from Feedback< T, U >
virtual U update (const T &state, const T &reference, const units::Time &dt)=0
 Updates the control loop output.
U get_output ()
 Gets the last saved output value.
U get_last_error ()
 Gets the last saved error.
T get_reference ()
 Gets the currently stored reference state.
T get_state ()
 Gets the currently stored state.

Public Attributes

kPType kP_
kIType kI_
kDType kD_
T deadband_
units::Time on_target_time_
Public Attributes inherited from Feedback< T, U >
U output_min_
U output_max_

Additional Inherited Members

Protected Attributes inherited from Feedback< T, U >
T reference_
T state_
T last_error_
U output_

Constructor & Destructor Documentation

◆ PID()

template<typename T, typename U>
PID< T, U >::PID ( kPType kP,
kIType kI,
kDType kD,
T deadband,
units::Time on_target_time )
inline

PID controller object constructor.

Parameters
kPthe proportional constant for the controller
kIthe integral constant for the controller
kDthe derivative constant for the controller
deadbandthe deadband where the loop decides it is on target
on_target_timethe time where the loops decides it is on target

Member Function Documentation

◆ reset()

template<typename T, typename U>
void PID< T, U >::reset ( )
inlineoverridevirtual

Resets the internal state of the PID controller.

Implements Feedback< T, U >.

◆ update()

template<typename T, typename U>
U PID< T, U >::update ( const double & state,
const double & reference,
const units::Time & dt = 10_ms )
inlineoverride

Updates the control loop output.

Parameters
statethe current state the PID controller is at
referencethe target state for the PID controller
dtthe timestep since the last time this method was called
Returns
the controller output

The documentation for this class was generated from the following file:
  • core/math/controls/pid.h