LocalGuidance
A library that generates velocity references to follow a path.
robot_utils::DiscretePidEigen Class Reference

#include <DiscretePidEigen.hpp>

Public Types

typedef Eigen::MatrixXd MatrixXd
 

Public Member Functions

 DiscretePidEigen (const MatrixXd &pGains, const MatrixXd &iGains, const MatrixXd &dGains, const MatrixXd &cmdMax, const MatrixXd &cmdMin)
 
virtual ~DiscretePidEigen ()
 
void init (const MatrixXd &pGains, const MatrixXd &iGains, const MatrixXd &dGains, const MatrixXd &cmdMax, const MatrixXd &cmdMin)
 
void setPGains (const MatrixXd &pGains)
 
void setIGains (const MatrixXd &iGains)
 
void setDGains (const MatrixXd &dGains)
 
void setCmdMax (const MatrixXd &cmdMax)
 
void setCmdMin (const MatrixXd &cmdMin)
 
void setDFilterGain (const double &dFilterGain)
 
MatrixXd getPGains () const
 
MatrixXd getIGains () const
 
MatrixXd getDGains () const
 
MatrixXd getCmdMax () const
 
MatrixXd getCmdMin () const
 
MatrixXd getCmd () const
 
double getDFilterGain () const
 
template<typename Derived >
void update (const Eigen::MatrixBase< Derived > &error, Eigen::MatrixBase< Derived > &command, double dt)
 
void reset ()
 

Private Attributes

double dFilterGain_
 
MatrixXd pErrLast_
 
MatrixXd pErrSecondLast_
 
MatrixXd pErr_
 
MatrixXd dErr_
 
MatrixXd pGains_
 
MatrixXd iGains_
 
MatrixXd dGains_
 
MatrixXd cmdMax_
 
MatrixXd cmdMin_
 
MatrixXd cmdLast_
 
MatrixXd cmdSecondLast_
 

Detailed Description

Proportional-integral-derivative class for use with eigen types. The controller acts element-wise.

Member Typedef Documentation

◆ MatrixXd

typedef Eigen::MatrixXd robot_utils::DiscretePidEigen::MatrixXd

Constructor & Destructor Documentation

◆ DiscretePidEigen()

robot_utils::DiscretePidEigen::DiscretePidEigen ( const MatrixXd pGains,
const MatrixXd iGains,
const MatrixXd dGains,
const MatrixXd cmdMax,
const MatrixXd cmdMin 
)

Constructor. For arguments, see the init method.

◆ ~DiscretePidEigen()

virtual robot_utils::DiscretePidEigen::~DiscretePidEigen ( )
inlinevirtual

Member Function Documentation

◆ getCmd()

MatrixXd robot_utils::DiscretePidEigen::getCmd ( ) const
inline

◆ getCmdMax()

MatrixXd robot_utils::DiscretePidEigen::getCmdMax ( ) const
inline

◆ getCmdMin()

MatrixXd robot_utils::DiscretePidEigen::getCmdMin ( ) const
inline

◆ getDFilterGain()

double robot_utils::DiscretePidEigen::getDFilterGain ( ) const
inline

◆ getDGains()

MatrixXd robot_utils::DiscretePidEigen::getDGains ( ) const
inline

◆ getIGains()

MatrixXd robot_utils::DiscretePidEigen::getIGains ( ) const
inline

◆ getPGains()

MatrixXd robot_utils::DiscretePidEigen::getPGains ( ) const
inline

◆ init()

void robot_utils::DiscretePidEigen::init ( const MatrixXd pGains,
const MatrixXd iGains,
const MatrixXd dGains,
const MatrixXd cmdMax,
const MatrixXd cmdMin 
)

Initializes the controller. All parameters need to have the same dimension, otherwise an error is thrown. For zero integral action, the respective element in iGains should be set zero.

Parameters
[in]pGainsproportional controller gains
[in]iGainsintegrator controller gains
[in]dGainsderivative controller gains
[in]cmdMaxmaximum output values of the controller
[in]cmdMinminimum output values of the controller (must be less than cmdMax)

◆ reset()

void robot_utils::DiscretePidEigen::reset ( )

Resets the PID controller. All errors get set to zero (including integrator state). Note that this may cause a jump in the control action.

◆ setCmdMax()

void robot_utils::DiscretePidEigen::setCmdMax ( const MatrixXd cmdMax)

◆ setCmdMin()

void robot_utils::DiscretePidEigen::setCmdMin ( const MatrixXd cmdMin)

◆ setDFilterGain()

void robot_utils::DiscretePidEigen::setDFilterGain ( const double &  dFilterGain)

◆ setDGains()

void robot_utils::DiscretePidEigen::setDGains ( const MatrixXd dGains)

◆ setIGains()

void robot_utils::DiscretePidEigen::setIGains ( const MatrixXd iGains)

◆ setPGains()

void robot_utils::DiscretePidEigen::setPGains ( const MatrixXd pGains)

◆ update()

template<typename Derived >
void robot_utils::DiscretePidEigen::update ( const Eigen::MatrixBase< Derived > &  error,
Eigen::MatrixBase< Derived > &  command,
double  dt 
)
inline

Updates the PID controller, should be called each time step. All parameters need to have the same dimension, otherwise an error is thrown.

Parameters
[in]errorcurrent error = (actual value - desired value) as input to the controller
[out]commandto be applied to the system
[in]dtcontrol update step (time elapsed from last update call) [s]

Member Data Documentation

◆ cmdLast_

MatrixXd robot_utils::DiscretePidEigen::cmdLast_
private

◆ cmdMax_

MatrixXd robot_utils::DiscretePidEigen::cmdMax_
private

◆ cmdMin_

MatrixXd robot_utils::DiscretePidEigen::cmdMin_
private

◆ cmdSecondLast_

MatrixXd robot_utils::DiscretePidEigen::cmdSecondLast_
private

◆ dErr_

MatrixXd robot_utils::DiscretePidEigen::dErr_
private

◆ dFilterGain_

double robot_utils::DiscretePidEigen::dFilterGain_
private

◆ dGains_

MatrixXd robot_utils::DiscretePidEigen::dGains_
private

◆ iGains_

MatrixXd robot_utils::DiscretePidEigen::iGains_
private

◆ pErr_

MatrixXd robot_utils::DiscretePidEigen::pErr_
private

◆ pErrLast_

MatrixXd robot_utils::DiscretePidEigen::pErrLast_
private

◆ pErrSecondLast_

MatrixXd robot_utils::DiscretePidEigen::pErrSecondLast_
private

◆ pGains_

MatrixXd robot_utils::DiscretePidEigen::pGains_
private

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