Go to the documentation of this file.
18 #ifndef _GAZEBO_PID_HH_
19 #define _GAZEBO_PID_HH_
36 class GZ_COMMON_VISIBLE
PID
51 public:
PID(
double _p = 0.0,
double _i = 0.0,
double _d = 0.0,
52 double _imax = 0.0,
double _imin = 0.0,
53 double _cmdMax = -1.0,
double _cmdMin = 0.0);
56 public:
virtual ~
PID();
71 public:
void Init(
double _p = 0.0,
double _i = 0.0,
double _d = 0.0,
72 double _imax = 0.0,
double _imin = 0.0,
73 double _cmdMax = -1.0,
double _cmdMin = 0.0);
77 public:
void SetPGain(
double _p);
81 public:
void SetIGain(
double _i);
85 public:
void SetDGain(
double _d);
89 public:
void SetIMax(
double _i);
93 public:
void SetIMin(
double _i);
97 public:
void SetCmdMax(
double _c);
101 public:
void SetCmdMin(
double _c);
105 public:
double GetPGain()
const;
109 public:
double GetIGain()
const;
113 public:
double GetDGain()
const;
117 public:
double GetIMax()
const;
121 public:
double GetIMin()
const;
125 public:
double GetCmdMax()
const;
129 public:
double GetCmdMin()
const;
142 public:
void SetCmd(
double _cmd);
146 public:
double GetCmd();
152 public:
void GetErrors(
double &_pe,
double &_ie,
double &_de);
162 this->pGain = _p.pGain;
163 this->iGain = _p.iGain;
164 this->dGain = _p.dGain;
165 this->iMax = _p.iMax;
166 this->iMin = _p.iMin;
167 this->cmdMax = _p.cmdMax;
168 this->cmdMin = _p.cmdMin;
169 this->pErrLast = _p.pErrLast;
170 this->pErr = _p.pErr;
171 this->iErr = _p.iErr;
172 this->dErr = _p.dErr;
180 public:
void Reset();
183 private:
double pErrLast;
186 private:
double pErr;
189 private:
double iErr;
192 private:
double dErr;
195 private:
double pGain;
198 private:
double iGain;
201 private:
double dGain;
204 private:
double iMax;
207 private:
double iMin;
213 private:
double cmdMax = -1.0;
216 private:
double cmdMin = 0.0;
double GetDGain() const
Get the derivative Gain.
void GetErrors(double &_pe, double &_ie, double &_de)
Return PID error terms for the controller.
void SetCmdMax(double _c)
Set the maximum value for the command.
Forward declarations for the common classes.
Definition: Animation.hh:26
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:47
common
Definition: FuelModelDatabase.hh:37
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].
double GetIMin() const
Get the integral lower limit.
void SetCmd(double _cmd)
Set current target command for this PID controller.
double GetCmd()
Return current command for this PID controller.
PID & operator=(const PID &_p)
Assignment operator.
Definition: PID.hh:157
void SetDGain(double _d)
Set the derivtive Gain.
void SetIMax(double _i)
Set the integral upper limit.
double GetIMax() const
Get the integral upper limit.
void Reset()
Reset the errors and command.
double GetPGain() const
Get the proportional Gain.
void SetPGain(double _p)
Set the proportional Gain.
virtual ~PID()
Destructor.
Generic PID controller class. Generic proportiolnal-integral-derivative controller class that keeps t...
Definition: PID.hh:36
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
void SetIMin(double _i)
Set the integral lower limit.
double Update(double _error, common::Time _dt)
Update the Pid loop with nonuniform time step size.
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:[iMa...
void SetCmdMin(double _c)
Set the maximum value for the command.
double GetIGain() const
Get the integral Gain.
double GetCmdMin() const
Get the maximum value for the command.
void SetIGain(double _i)
Set the integral Gain.
double GetCmdMax() const
Get the maximum value for the command.