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=-1.0, double _cmdMin=0.0) |
| Constructor, zeros out Pid values when created and initialize Pid-gains and integral term limits:[iMax:iMin]-[I1:I2]. More...
|
|
virtual | ~PID () |
| Destructor. More...
|
|
double | GetCmd () |
| Return current command for this PID controller. More...
|
|
double | GetCmdMax () const |
| Get the maximum value for the command. More...
|
|
double | GetCmdMin () const |
| Get the maximum value for the command. More...
|
|
double | GetDGain () const |
| Get the derivative Gain. More...
|
|
void | GetErrors (double &_pe, double &_ie, double &_de) |
| Return PID error terms for the controller. More...
|
|
double | GetIGain () const |
| Get the integral Gain. More...
|
|
double | GetIMax () const |
| Get the integral upper limit. More...
|
|
double | GetIMin () const |
| Get the integral lower limit. More...
|
|
double | GetPGain () const |
| Get the proportional Gain. More...
|
|
void | Init (double _p=0.0, double _i=0.0, double _d=0.0, double _imax=0.0, double _imin=0.0, double _cmdMax=-1.0, double _cmdMin=0.0) |
| Initialize PID-gains and integral term limits:[iMax:iMin]-[I1:I2]. More...
|
|
PID & | operator= (const PID &_p) |
| Assignment operator. More...
|
|
void | Reset () |
| Reset the errors and command. More...
|
|
void | SetCmd (double _cmd) |
| Set current target command for this PID controller. More...
|
|
void | SetCmdMax (double _c) |
| Set the maximum value for the command. More...
|
|
void | SetCmdMin (double _c) |
| Set the maximum value for the command. More...
|
|
void | SetDGain (double _d) |
| Set the derivtive Gain. More...
|
|
void | SetIGain (double _i) |
| Set the integral Gain. More...
|
|
void | SetIMax (double _i) |
| Set the integral upper limit. More...
|
|
void | SetIMin (double _i) |
| Set the integral lower limit. More...
|
|
void | SetPGain (double _p) |
| Set the proportional Gain. More...
|
|
double | Update (double _error, common::Time _dt) |
| Update the Pid loop with nonuniform time step size. More...
|
|
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.
§ PID()
PID |
( |
double |
_p = 0.0 , |
|
|
double |
_i = 0.0 , |
|
|
double |
_d = 0.0 , |
|
|
double |
_imax = 0.0 , |
|
|
double |
_imin = 0.0 , |
|
|
double |
_cmdMax = -1.0 , |
|
|
double |
_cmdMin = 0.0 |
|
) |
| |
Constructor, zeros out Pid values when created and initialize Pid-gains and integral term limits:[iMax:iMin]-[I1:I2].
Disable command clamping by setting _cmdMin to a value larger than _cmdMax. Command clamping is disabled by default.
- 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. |
[in] | _cmdMax | Output max value. |
[in] | _cmdMin | Output min value. |
§ ~PID()
§ GetCmd()
Return current command for this PID controller.
- Returns
- the command value
§ GetCmdMax()
double GetCmdMax |
( |
| ) |
const |
Get the maximum value for the command.
- Returns
- The maximum value
§ GetCmdMin()
double GetCmdMin |
( |
| ) |
const |
Get the maximum value for the command.
- Returns
- The maximum value
§ GetDGain()
double GetDGain |
( |
| ) |
const |
Get the derivative Gain.
- Returns
- The derivative gain value
§ GetErrors()
void 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. |
§ GetIGain()
double GetIGain |
( |
| ) |
const |
Get the integral Gain.
- Returns
- The integral gain value
§ GetIMax()
Get the integral upper limit.
- Returns
- The integral upper limit value
§ GetIMin()
Get the integral lower limit.
- Returns
- The integral lower limit value
§ GetPGain()
double GetPGain |
( |
| ) |
const |
Get the proportional Gain.
- Returns
- The proportional gain value
§ Init()
void Init |
( |
double |
_p = 0.0 , |
|
|
double |
_i = 0.0 , |
|
|
double |
_d = 0.0 , |
|
|
double |
_imax = 0.0 , |
|
|
double |
_imin = 0.0 , |
|
|
double |
_cmdMax = -1.0 , |
|
|
double |
_cmdMin = 0.0 |
|
) |
| |
Initialize PID-gains and integral term limits:[iMax:iMin]-[I1:I2].
Disable command clamping by setting _cmdMin to a value larger than _cmdMax. Command clamping is disabled by default.
- 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. |
[in] | _cmdMax | Output max value. |
[in] | _cmdMin | Output min value. |
§ operator=()
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 PID::Reset().
§ Reset()
§ SetCmd()
void SetCmd |
( |
double |
_cmd | ) |
|
Set current target command for this PID controller.
- Parameters
-
§ SetCmdMax()
void SetCmdMax |
( |
double |
_c | ) |
|
Set the maximum value for the command.
- Parameters
-
§ SetCmdMin()
void SetCmdMin |
( |
double |
_c | ) |
|
Set the maximum value for the command.
- Parameters
-
§ SetDGain()
void SetDGain |
( |
double |
_d | ) |
|
Set the derivtive Gain.
- Parameters
-
[in] | _p | dertivative gain value |
§ SetIGain()
void SetIGain |
( |
double |
_i | ) |
|
Set the integral Gain.
- Parameters
-
[in] | _p | integral gain value |
§ SetIMax()
void SetIMax |
( |
double |
_i | ) |
|
Set the integral upper limit.
- Parameters
-
[in] | _p | integral upper limit value |
§ SetIMin()
void SetIMin |
( |
double |
_i | ) |
|
Set the integral lower limit.
- Parameters
-
[in] | _p | integral lower limit value |
§ SetPGain()
void SetPGain |
( |
double |
_p | ) |
|
Set the proportional Gain.
- Parameters
-
[in] | _p | proportional gain value |
§ Update()
Update the Pid loop with nonuniform time step size.
- Parameters
-
The documentation for this class was generated from the following file: