wbc
wbc::PIDController Class Reference

The PIDController class implements an n-dimensional PID controller. More...

#include <PIDController.hpp>

Inheritance diagram for wbc::PIDController:
wbc::CartesianForcePIDController wbc::JointTorquePIDController

Public Member Functions

 PIDController (uint dimension)
 
virtual ~PIDController ()
 
void update (const double delta_t)
 
void setPID (const PIDCtrlParams &params)
 
const PIDCtrlParamsgetPID ()
 
void setMaxCtrlOutput (const base::VectorXd &max)
 
const base::VectorXd & maxCtrlOutput ()
 
void setDeadZone (const base::VectorXd &dz)
 
const base::VectorXd & deadZone ()
 
void applySaturation (const base::VectorXd &in, const base::VectorXd &max, base::VectorXd &out)
 
void applyDeadZone (const base::VectorXd &in, const base::VectorXd &min, base::VectorXd &out)
 
uint getDimension ()
 
base::VectorXd getControlError ()
 
virtual const base::VectorXd & computeDerivative (const double delta_t)
 

Protected Attributes

PIDCtrlParams pid_params
 
uint dimension
 
base::VectorXd control_error
 
base::VectorXd prev_control_error
 
base::VectorXd dead_zone
 
base::VectorXd max_ctrl_output
 
base::VectorXd integral
 
base::VectorXd derivative
 
base::VectorXd control_output
 
base::VectorXd setpoint
 
base::VectorXd feedback
 

Detailed Description

The PIDController class implements an n-dimensional PID controller.

\[ u = k_p \cdot e + k_i\sum e \cdot dt + k_d\frac{d}{dt}e \]

with integral windup

\[ \sum e \cdot dt \leq w_i \]

and dead zone

\[ e = \left \lbrace \begin{array}{ccc}x_r-x & if & |x_r-x| > d_e \\ \\ 0 & else \end{array}\right. \]

\(u\) - Control output
\(k_p,k_i,k_d\) - Proportional, integral and derivative gain
\(e\) - Control error
\(w_i\) - Integral windup
\(d_e\) - Dead zone
\(x_r,x\) - Reference and actual controlled value

Constructor & Destructor Documentation

◆ PIDController()

wbc::PIDController::PIDController ( uint dimension)

◆ ~PIDController()

virtual wbc::PIDController::~PIDController ( )
inlinevirtual

Member Function Documentation

◆ applyDeadZone()

void wbc::PIDController::applyDeadZone ( const base::VectorXd & in,
const base::VectorXd & min,
base::VectorXd & out )

◆ applySaturation()

void wbc::PIDController::applySaturation ( const base::VectorXd & in,
const base::VectorXd & max,
base::VectorXd & out )

◆ computeDerivative()

const base::VectorXd & wbc::PIDController::computeDerivative ( const double delta_t)
virtual

◆ deadZone()

const base::VectorXd & wbc::PIDController::deadZone ( )
inline

◆ getControlError()

base::VectorXd wbc::PIDController::getControlError ( )
inline

◆ getDimension()

uint wbc::PIDController::getDimension ( )
inline

◆ getPID()

const PIDCtrlParams & wbc::PIDController::getPID ( )
inline

◆ maxCtrlOutput()

const base::VectorXd & wbc::PIDController::maxCtrlOutput ( )
inline

◆ setDeadZone()

void wbc::PIDController::setDeadZone ( const base::VectorXd & dz)

◆ setMaxCtrlOutput()

void wbc::PIDController::setMaxCtrlOutput ( const base::VectorXd & max)

◆ setPID()

void wbc::PIDController::setPID ( const PIDCtrlParams & params)

◆ update()

void wbc::PIDController::update ( const double delta_t)

Compute control output

Member Data Documentation

◆ control_error

base::VectorXd wbc::PIDController::control_error
protected

◆ control_output

base::VectorXd wbc::PIDController::control_output
protected

◆ dead_zone

base::VectorXd wbc::PIDController::dead_zone
protected

◆ derivative

base::VectorXd wbc::PIDController::derivative
protected

◆ dimension

uint wbc::PIDController::dimension
protected

◆ feedback

base::VectorXd wbc::PIDController::feedback
protected

◆ integral

base::VectorXd wbc::PIDController::integral
protected

◆ max_ctrl_output

base::VectorXd wbc::PIDController::max_ctrl_output
protected

◆ pid_params

PIDCtrlParams wbc::PIDController::pid_params
protected

◆ prev_control_error

base::VectorXd wbc::PIDController::prev_control_error
protected

◆ setpoint

base::VectorXd wbc::PIDController::setpoint
protected

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