Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
robot_controllers::PID Class Reference

#include <pid.h>

Public Member Functions

bool init (const ros::NodeHandle &nh)
 initialize gain settings from ROS parameter values More...
 
 PID (double p, double i, double d, double i_max, double i_min)
 Constructor. More...
 
 PID ()
 Constructor. Starts all gains and limits at zero. More...
 
void reset ()
 Reset integral wind-up term. More...
 
double update (double error, double dt)
 Run PID calculation and return control result. More...
 
double update (double error, double error_dot, double dt)
 Run PID calculation and return control result. More...
 

Protected Member Functions

bool checkGains ()
 Checks and fixes gain settings. More...
 

Protected Attributes

double d_gain_
 derivative gain More...
 
double error_last_
 Last error value, used for calculating error_dot when not provided. More...
 
double i_gain_
 integral gain More...
 
double i_max_
 integral gain min and max limits More...
 
double i_min_
 
double i_term_
 integral wind-up term More...
 
double p_gain_
 proportial gain More...
 

Detailed Description

Definition at line 45 of file pid.h.

Constructor & Destructor Documentation

robot_controllers::PID::PID ( double  p,
double  i,
double  d,
double  i_max,
double  i_min 
)

Constructor.

Parameters
pproportional gain
iintegral gain
dderivative gain
i_maxintegral wind-up max value
i_minintegral wind-up min value

Definition at line 47 of file pid.cpp.

robot_controllers::PID::PID ( )

Constructor. Starts all gains and limits at zero.

Definition at line 58 of file pid.cpp.

Member Function Documentation

bool robot_controllers::PID::checkGains ( )
protected

Checks and fixes gain settings.

Returns
true is gains are ok, false if gains are invalid

Definition at line 92 of file pid.cpp.

bool robot_controllers::PID::init ( const ros::NodeHandle nh)

initialize gain settings from ROS parameter values

Definition at line 68 of file pid.cpp.

void robot_controllers::PID::reset ( )

Reset integral wind-up term.

Definition at line 140 of file pid.cpp.

double robot_controllers::PID::update ( double  error,
double  dt 
)

Run PID calculation and return control result.

Parameters
errorerror term (goal-actual)
dttimestep used for calculating derivative term and integral windup
Returns
calculated PID command

PID derivate term is calculated from change in error value and dt

Definition at line 146 of file pid.cpp.

double robot_controllers::PID::update ( double  error,
double  error_dot,
double  dt 
)

Run PID calculation and return control result.

Parameters
errorerror term (goal-actual)
error_dotvalue that is used for derivative term calculation
dttimestep used for integral windup
Returns
calculated PID command

Definition at line 164 of file pid.cpp.

Member Data Documentation

double robot_controllers::PID::d_gain_
protected

derivative gain

Definition at line 99 of file pid.h.

double robot_controllers::PID::error_last_
protected

Last error value, used for calculating error_dot when not provided.

Definition at line 107 of file pid.h.

double robot_controllers::PID::i_gain_
protected

integral gain

Definition at line 97 of file pid.h.

double robot_controllers::PID::i_max_
protected

integral gain min and max limits

Definition at line 101 of file pid.h.

double robot_controllers::PID::i_min_
protected

Definition at line 101 of file pid.h.

double robot_controllers::PID::i_term_
protected

integral wind-up term

Definition at line 104 of file pid.h.

double robot_controllers::PID::p_gain_
protected

proportial gain

Definition at line 95 of file pid.h.


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


robot_controllers
Author(s): Michael Ferguson
autogenerated on Sun Sep 27 2020 03:22:39