Gazebo Math
API Reference
7.4.0
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
include
gz
math
gz/math/MovingWindowFilter.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_MOVINGWINDOWFILTER_HH_
18
#define GZ_MATH_MOVINGWINDOWFILTER_HH_
19
20
#include <memory>
21
#include <vector>
22
23
#include <gz/math/config.hh>
24
#include <gz/math/Export.hh>
25
#include <
gz/math/Vector3.hh
>
26
27
#include <gz/utils/SuppressWarning.hh>
28
29
namespace
gz
30
{
31
namespace
math
32
{
33
// Inline bracket to help doxygen filtering.
34
inline
namespace
GZ_MATH_VERSION_NAMESPACE {
39
template
<
typename
T>
40
class
GZ_MATH_VISIBLE
MovingWindowFilter
41
{
43
public
:
MovingWindowFilter
(
unsigned
int
_windowSize = 4);
44
46
public
:
virtual
~MovingWindowFilter
() =
default
;
47
50
public
:
void
Update
(
const
T _val);
51
54
public
:
void
SetWindowSize
(
const
unsigned
int
_n);
55
58
public
:
unsigned
int
WindowSize
()
const
;
59
62
public
:
bool
WindowFilled
()
const
;
63
66
public
: T
Value
()
const
;
67
69
public
:
unsigned
int
valWindowSize = 4;
70
72
public
:
unsigned
int
samples = 0;
73
74
GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
76
public
:
std::vector<T>
valHistory
;
77
79
public
:
typename
std::vector<T>::iterator
valIter
;
80
82
public
: T
sum
;
83
GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
84
};
85
86
using
MovingWindowFilteri
=
MovingWindowFilter<int>
;
87
using
MovingWindowFilterf
=
MovingWindowFilter<float>
;
88
using
MovingWindowFilterd
=
MovingWindowFilter<double>
;
89
using
MovingWindowFilterVector3i
=
MovingWindowFilter<Vector3i>
;
90
using
MovingWindowFilterVector3f
=
MovingWindowFilter<Vector3f>
;
91
using
MovingWindowFilterVector3d
=
MovingWindowFilter<Vector3d>
;
92
}
93
}
// namespace math
94
}
// namespace gz
95
#endif