bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitsim::control::PIController Class Reference

A PI controller whose output is limited to [-limit, limit], with anti-windup and a feedforward term. More...

#include <pi_controller.h>

Public Member Functions

 PIController (real_t kp, real_t ki, real_t limit)
real_t update (real_t error, real_t dt, real_t feedforward=0.0)
 The output for the error after a step of dt [s].
void reset ()
 Forget the integral.
real_t kp () const noexcept
real_t ki () const noexcept
real_t limit () const noexcept
real_t integral () const noexcept

Detailed Description

A PI controller whose output is limited to [-limit, limit], with anti-windup and a feedforward term.

The output is \(u = u_{ff} + K_p e + K_i \int e\, dt\). While the output is at its limit the integral stops growing; otherwise it would wind up and make the controller overshoot once the error changes sign. The feedforward \(u_{ff}\) is the part of the output that can be predicted without feedback, such as the voltage a motor needs for a speed.

Constructor & Destructor Documentation

◆ PIController()

bitsim::control::PIController::PIController ( real_t kp,
real_t ki,
real_t limit )
Parameters
kpThe proportional gain
kiThe integral gain
limitThe largest output, in either direction

Member Function Documentation

◆ integral()

real_t bitsim::control::PIController::integral ( ) const
inlinenoexcept

◆ ki()

real_t bitsim::control::PIController::ki ( ) const
inlinenoexcept

◆ kp()

real_t bitsim::control::PIController::kp ( ) const
inlinenoexcept

◆ limit()

real_t bitsim::control::PIController::limit ( ) const
inlinenoexcept

◆ reset()

void bitsim::control::PIController::reset ( )
inline

Forget the integral.

◆ update()

real_t bitsim::control::PIController::update ( real_t error,
real_t dt,
real_t feedforward = 0.0 )

The output for the error after a step of dt [s].


The documentation for this class was generated from the following files: