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

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

Constructor & Destructor Documentation

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.

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

Member Function Documentation

MatrixXd robot_utils::DiscretePidEigen::getCmd ( ) const
inline
MatrixXd robot_utils::DiscretePidEigen::getCmdMax ( ) const
inline
MatrixXd robot_utils::DiscretePidEigen::getCmdMin ( ) const
inline
double robot_utils::DiscretePidEigen::getDFilterGain ( ) const
inline
MatrixXd robot_utils::DiscretePidEigen::getDGains ( ) const
inline
MatrixXd robot_utils::DiscretePidEigen::getIGains ( ) const
inline
MatrixXd robot_utils::DiscretePidEigen::getPGains ( ) const
inline
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)
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.

void robot_utils::DiscretePidEigen::setCmdMax ( const MatrixXd cmdMax)
void robot_utils::DiscretePidEigen::setCmdMin ( const MatrixXd cmdMin)
void robot_utils::DiscretePidEigen::setDFilterGain ( const double &  dFilterGain)
void robot_utils::DiscretePidEigen::setDGains ( const MatrixXd dGains)
void robot_utils::DiscretePidEigen::setIGains ( const MatrixXd iGains)
void robot_utils::DiscretePidEigen::setPGains ( const MatrixXd pGains)
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

MatrixXd robot_utils::DiscretePidEigen::cmdLast_
private
MatrixXd robot_utils::DiscretePidEigen::cmdMax_
private
MatrixXd robot_utils::DiscretePidEigen::cmdMin_
private
MatrixXd robot_utils::DiscretePidEigen::cmdSecondLast_
private
MatrixXd robot_utils::DiscretePidEigen::dErr_
private
double robot_utils::DiscretePidEigen::dFilterGain_
private
MatrixXd robot_utils::DiscretePidEigen::dGains_
private
MatrixXd robot_utils::DiscretePidEigen::iGains_
private
MatrixXd robot_utils::DiscretePidEigen::pErr_
private
MatrixXd robot_utils::DiscretePidEigen::pErrLast_
private
MatrixXd robot_utils::DiscretePidEigen::pErrSecondLast_
private
MatrixXd robot_utils::DiscretePidEigen::pGains_
private

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