Class
List
Heirarchy
Modules
Common
Events
Math
Messages
Physics
Rendering
Sensors
Transport
Links
Gazebo Website
Wiki
Tutorials
Download
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
gazebo
common
PID.hh
Go to the documentation of this file.
1
/*
2
* Copyright 2011 Nate Koenig
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
18
#ifndef _GAZEBO_PID_HH_
19
#define _GAZEBO_PID_HH_
20
21
#include "
common/Time.hh
"
22
23
namespace
gazebo
24
{
25
namespace
common
26
{
29
34
class
PID
35
{
43
public
:
PID
(
double
_p = 0.0,
double
_i = 0.0,
double
_d = 0.0,
44
double
_imax = 0.0,
double
_imin = 0.0,
45
double
_cmdMax = 0.0,
double
_cmdMin = 0.0);
46
48
public
:
virtual
~PID
();
49
57
public
:
void
Init
(
double
_p = 0.0,
double
_i = 0.0,
double
_d = 0.0,
58
double
_imax = 0.0,
double
_imin = 0.0,
59
double
_cmdMax = 0.0,
double
_cmdMin = 0.0);
60
63
public
:
void
SetPGain
(
double
_p);
64
67
public
:
void
SetIGain
(
double
_i);
68
71
public
:
void
SetDGain
(
double
_d);
72
75
public
:
void
SetIMax
(
double
_i);
76
79
public
:
void
SetIMin
(
double
_i);
80
83
public
:
void
SetCmdMax
(
double
_c);
84
87
public
:
void
SetCmdMin
(
double
_c);
88
96
public
:
double
Update
(
double
_error,
common::Time
_dt);
97
100
public
:
void
SetCmd
(
double
_cmd);
101
104
public
:
double
GetCmd
();
105
110
public
:
void
GetErrors
(
double
&_pe,
double
&_ie,
double
&_de);
111
115
public
:
PID
&
operator=
(
const
PID
&_p)
116
{
117
if
(
this
== &_p)
118
return
*
this
;
119
120
this->pGain = _p.pGain;
121
this->iGain = _p.iGain;
122
this->dGain = _p.dGain;
123
this->iMax = _p.iMax;
124
this->iMin = _p.iMin;
125
this->cmdMax = _p.cmdMax;
126
127
this->
Reset
();
128
return
*
this
;
129
}
130
132
public
:
void
Reset
();
133
135
private
:
double
pErrLast;
136
138
private
:
double
pErr;
139
141
private
:
double
iErr;
142
144
private
:
double
dErr;
145
147
private
:
double
pGain;
148
150
private
:
double
iGain;
151
153
private
:
double
dGain;
154
156
private
:
double
iMax;
157
159
private
:
double
iMin;
160
162
private
:
double
cmd;
163
165
private
:
double
cmdMax;
166
168
private
:
double
cmdMin;
169
};
171
}
172
}
173
#endif