libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::foundation::PidController Class Reference

Stateful PID controller with integral clamping and a low-pass filtered derivative term. More...

#include <pid.hpp>

Public Member Functions

 PidController (PidConfig config={})
double update (double error, double dt)
 Update the controller using error for both the proportional and derivative signals.
double update (double error, double dt, double deriv_signal)
void reset ()
 Clear accumulated integral and derivative state.
void setGains (double kp, double ki, double kd)
 Replace only the proportional, integral, and derivative gains.
double getIntegral () const
double getDerivative () const

Detailed Description

Stateful PID controller with integral clamping and a low-pass filtered derivative term.

Definition at line 68 of file pid.hpp.

Constructor & Destructor Documentation

◆ PidController()

libstp::foundation::PidController::PidController ( PidConfig config = {})
explicit

Member Function Documentation

◆ getDerivative()

double libstp::foundation::PidController::getDerivative ( ) const
inlinenodiscard

Definition at line 89 of file pid.hpp.

◆ getIntegral()

double libstp::foundation::PidController::getIntegral ( ) const
inlinenodiscard

Definition at line 88 of file pid.hpp.

◆ reset()

void libstp::foundation::PidController::reset ( )

Clear accumulated integral and derivative state.

◆ setGains()

void libstp::foundation::PidController::setGains ( double kp,
double ki,
double kd )

Replace only the proportional, integral, and derivative gains.

◆ update() [1/2]

double libstp::foundation::PidController::update ( double error,
double dt )

Update the controller using error for both the proportional and derivative signals.

◆ update() [2/2]

double libstp::foundation::PidController::update ( double error,
double dt,
double deriv_signal )

Update with separate derivative signal (derivative-on-measurement). P and I terms use error, D term uses deriv_signal.


The documentation for this class was generated from the following file:
  • /home/runner/work/raccoon-lib/raccoon-lib/modules/libstp-foundation/include/foundation/pid.hpp