Gazebo Math
API Reference
7.5.1
insert_drive_file
Tutorials
library_books
Classes
toc
Namespaces
insert_drive_file
Files
launch
Gazebo Website
Index
List
Hierarchy
Members: All
Members: Functions
Members: Variables
Members: Typedefs
Members: Enumerations
Members: Enumerator
List
Members
Functions
Typedefs
Variables
Enumerations
Enumerator
src
gz-math
include
gz
math
gz/math/PID.hh
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2016 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
#ifndef GZ_MATH_PID_HH_
18
#define GZ_MATH_PID_HH_
19
20
#include <chrono>
21
#include <
gz/math/Helpers.hh
>
22
#include <gz/math/config.hh>
23
#include <gz/utils/ImplPtr.hh>
24
25
namespace
gz::math
26
{
27
// Inline bracket to help doxygen filtering.
28
inline
namespace
GZ_MATH_VERSION_NAMESPACE {
29
//
36
// cppcheck-suppress class_X_Y
37
class
GZ_MATH_VISIBLE
PID
38
{
56
public
:
PID
(
const
double
_p = 0.0,
57
const
double
_i = 0.0,
58
const
double
_d = 0.0,
59
const
double
_imax = -1.0,
60
const
double
_imin = 0.0,
61
const
double
_cmdMax = -1.0,
62
const
double
_cmdMin = 0.0,
63
const
double
_cmdOffset = 0.0);
64
82
public
:
void
Init
(
const
double
_p = 0.0,
83
const
double
_i = 0.0,
84
const
double
_d = 0.0,
85
const
double
_imax = -1.0,
86
const
double
_imin = 0.0,
87
const
double
_cmdMax = -1.0,
88
const
double
_cmdMin = 0.0,
89
const
double
_cmdOffset = 0.0);
90
93
public
:
void
SetPGain
(
const
double
_p);
94
97
public
:
void
SetIGain
(
const
double
_i);
98
101
public
:
void
SetDGain
(
const
double
_d);
102
105
public
:
void
SetIMax
(
const
double
_i);
106
109
public
:
void
SetIMin
(
const
double
_i);
110
113
public
:
void
SetCmdMax
(
const
double
_c);
114
117
public
:
void
SetCmdMin
(
const
double
_c);
118
122
public
:
void
SetCmdOffset
(
const
double
_c);
123
126
public
:
double
PGain
()
const
;
127
130
public
:
double
IGain
()
const
;
131
134
public
:
double
DGain
()
const
;
135
138
public
:
double
IMax
()
const
;
139
142
public
:
double
IMin
()
const
;
143
146
public
:
double
CmdMax
()
const
;
147
150
public
:
double
CmdMin
()
const
;
151
154
public
:
double
CmdOffset
()
const
;
155
167
public
:
double
Update
(
const
double
_error,
168
double
_errorRate,
169
const
std::chrono::duration<double>
&_dt);
170
178
public
:
double
Update
(
const
double
_error,
179
const
std::chrono::duration<double>
&_dt);
180
183
public
:
void
SetCmd
(
const
double
_cmd);
184
187
public
:
double
Cmd
()
const
;
188
193
public
:
void
Errors
(
double
&_pe,
double
&_ie,
double
&_de)
const
;
194
196
public
:
void
Reset
();
197
199
GZ_UTILS_IMPL_PTR(dataPtr)
200
};
201
}
// namespace GZ_MATH_VERSION_NAMESPACEH
202
}
// namespace gz::math
203
#endif
// GZ_MATH_PID_HH_