Class
List
Hierarchy
Modules
Common
Events
Math
Messages
Physics
Rendering
Sensors
Transport
Links
Gazebo Website
Wiki
Tutorials
Download
Report Documentation Issues
•
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 2012 Open Source Robotics Foundation
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
35
class
PID
36
{
44
public
:
PID
(
double
_p = 0.0,
double
_i = 0.0,
double
_d = 0.0,
45
double
_imax = 0.0,
double
_imin = 0.0,
46
double
_cmdMax = 0.0,
double
_cmdMin = 0.0);
47
49
public
:
virtual
~PID
();
50
58
public
:
void
Init
(
double
_p = 0.0,
double
_i = 0.0,
double
_d = 0.0,
59
double
_imax = 0.0,
double
_imin = 0.0,
60
double
_cmdMax = 0.0,
double
_cmdMin = 0.0);
61
64
public
:
void
SetPGain
(
double
_p);
65
68
public
:
void
SetIGain
(
double
_i);
69
72
public
:
void
SetDGain
(
double
_d);
73
76
public
:
void
SetIMax
(
double
_i);
77
80
public
:
void
SetIMin
(
double
_i);
81
84
public
:
void
SetCmdMax
(
double
_c);
85
88
public
:
void
SetCmdMin
(
double
_c);
89
97
public
:
double
Update
(
double
_error,
common::Time
_dt);
98
101
public
:
void
SetCmd
(
double
_cmd);
102
105
public
:
double
GetCmd
();
106
111
public
:
void
GetErrors
(
double
&_pe,
double
&_ie,
double
&_de);
112
116
public
:
PID
&
operator=
(
const
PID
&_p)
117
{
118
if
(
this
== &_p)
119
return
*
this
;
120
121
this->pGain = _p.pGain;
122
this->iGain = _p.iGain;
123
this->dGain = _p.dGain;
124
this->iMax = _p.iMax;
125
this->iMin = _p.iMin;
126
this->cmdMax = _p.cmdMax;
127
128
this->
Reset
();
129
return
*
this
;
130
}
131
133
public
:
void
Reset
();
134
136
private
:
double
pErrLast;
137
139
private
:
double
pErr;
140
142
private
:
double
iErr;
143
145
private
:
double
dErr;
146
148
private
:
double
pGain;
149
151
private
:
double
iGain;
152
154
private
:
double
dGain;
155
157
private
:
double
iMax;
158
160
private
:
double
iMin;
161
163
private
:
double
cmd;
164
166
private
:
double
cmdMax;
167
169
private
:
double
cmdMin;
170
};
172
}
173
}
174
#endif