Generic PID controller class.
More...
#include <common/common.hh>
|
| PID (double _p=0.0, double _i=0.0, double _d=0.0, double _imax=0.0, double _imin=0.0, double _cmdMax=0.0, double _cmdMin=0.0) |
| Constructor, zeros out Pid values when created and initialize Pid-gains and integral term limits:[iMax:iMin]-[I1:I2].
|
|
virtual | ~PID () |
| Destructor.
|
|
double | GetCmd () |
| Return current command for this PID controller.
|
|
void | GetErrors (double &_pe, double &_ie, double &_de) |
| Return PID error terms for the controller.
|
|
void | Init (double _p=0.0, double _i=0.0, double _d=0.0, double _imax=0.0, double _imin=0.0, double _cmdMax=0.0, double _cmdMin=0.0) |
| Initialize PID-gains and integral term limits:[iMax:iMin]-[I1:I2].
|
|
PID & | operator= (const PID &_p) |
| Assignment operator.
|
|
void | Reset () |
| Reset the errors and command.
|
|
void | SetCmd (double _cmd) |
| Set current target command for this PID controller.
|
|
void | SetCmdMax (double _c) |
| Set the maximum value for the command.
|
|
void | SetCmdMin (double _c) |
| Set the maximum value for the command.
|
|
void | SetDGain (double _d) |
| Set the derivtive Gain.
|
|
void | SetIGain (double _i) |
| Set the integral Gain.
|
|
void | SetIMax (double _i) |
| Set the integral upper limit.
|
|
void | SetIMin (double _i) |
| Set the integral lower limit.
|
|
void | SetPGain (double _p) |
| Set the proportional Gain.
|
|
double | Update (double _error, common::Time _dt) |
| Update the Pid loop with nonuniform time step size.
|
|
Generic PID controller class.
Generic proportiolnal-integral-derivative controller class that keeps track of PID-error states and control inputs given the state of a system and a user specified target state.
gazebo::common::PID::PID |
( |
double |
_p = 0.0 , |
|
|
double |
_i = 0.0 , |
|
|
double |
_d = 0.0 , |
|
|
double |
_imax = 0.0 , |
|
|
double |
_imin = 0.0 , |
|
|
double |
_cmdMax = 0.0 , |
|
|
double |
_cmdMin = 0.0 |
|
) |
| |
Constructor, zeros out Pid values when created and initialize Pid-gains and integral term limits:[iMax:iMin]-[I1:I2].
- Parameters
-
[in] | _p | The proportional gain. |
[in] | _i | The integral gain. |
[in] | _d | The derivative gain. |
[in] | _imax | The integral upper limit. |
[in] | _imin | The integral lower limit. |
virtual gazebo::common::PID::~PID |
( |
| ) |
|
|
virtual |
double gazebo::common::PID::GetCmd |
( |
| ) |
|
Return current command for this PID controller.
- Returns
- the command value
void gazebo::common::PID::GetErrors |
( |
double & |
_pe, |
|
|
double & |
_ie, |
|
|
double & |
_de |
|
) |
| |
Return PID error terms for the controller.
- Parameters
-
[in] | _pe | The proportional error. |
[in] | _ie | The integral error. |
[in] | _de | The derivative error. |
void gazebo::common::PID::Init |
( |
double |
_p = 0.0 , |
|
|
double |
_i = 0.0 , |
|
|
double |
_d = 0.0 , |
|
|
double |
_imax = 0.0 , |
|
|
double |
_imin = 0.0 , |
|
|
double |
_cmdMax = 0.0 , |
|
|
double |
_cmdMin = 0.0 |
|
) |
| |
Initialize PID-gains and integral term limits:[iMax:iMin]-[I1:I2].
- Parameters
-
[in] | _p | The proportional gain. |
[in] | _i | The integral gain. |
[in] | _d | The derivative gain. |
[in] | _imax | The integral upper limit. |
[in] | _imin | The integral lower limit. |
PID& gazebo::common::PID::operator= |
( |
const PID & |
_p | ) |
|
|
inline |
Assignment operator.
- Parameters
-
[in] | _p | a reference to a PID to assign values from |
- Returns
- reference to this instance
References Reset().
void gazebo::common::PID::Reset |
( |
| ) |
|
Reset the errors and command.
Referenced by operator=().
void gazebo::common::PID::SetCmd |
( |
double |
_cmd | ) |
|
Set current target command for this PID controller.
- Parameters
-
void gazebo::common::PID::SetCmdMax |
( |
double |
_c | ) |
|
Set the maximum value for the command.
- Parameters
-
void gazebo::common::PID::SetCmdMin |
( |
double |
_c | ) |
|
Set the maximum value for the command.
- Parameters
-
void gazebo::common::PID::SetDGain |
( |
double |
_d | ) |
|
Set the derivtive Gain.
- Parameters
-
[in] | _p | dertivative gain value |
void gazebo::common::PID::SetIGain |
( |
double |
_i | ) |
|
Set the integral Gain.
- Parameters
-
[in] | _p | integral gain value |
void gazebo::common::PID::SetIMax |
( |
double |
_i | ) |
|
Set the integral upper limit.
- Parameters
-
[in] | _p | integral upper limit value |
void gazebo::common::PID::SetIMin |
( |
double |
_i | ) |
|
Set the integral lower limit.
- Parameters
-
[in] | _p | integral lower limit value |
void gazebo::common::PID::SetPGain |
( |
double |
_p | ) |
|
Set the proportional Gain.
- Parameters
-
[in] | _p | proportional gain value |
double gazebo::common::PID::Update |
( |
double |
_error, |
|
|
common::Time |
_dt |
|
) |
| |
Update the Pid loop with nonuniform time step size.
- Parameters
-
_in] | _error Error since last call (p_state - p_target). |
_in] | _dt Change in time since last update call. Normally, this is called at every time step, The return value is an updated command to be passed to the object being controlled. |
- Returns
- the command value
The documentation for this class was generated from the following file: