Gazebo Math

API Reference

7.5.1
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::math
30 {
31  // Inline bracket to help doxygen filtering.
32  inline namespace GZ_MATH_VERSION_NAMESPACE {
37  template< typename T>
38  class GZ_MATH_VISIBLE MovingWindowFilter
39  {
41  public: MovingWindowFilter(unsigned int _windowSize = 4);
42 
44  public: virtual ~MovingWindowFilter() = default;
45 
48  public: void Update(const T _val);
49 
52  public: void SetWindowSize(const unsigned int _n);
53 
56  public: unsigned int WindowSize() const;
57 
60  public: bool WindowFilled() const;
61 
64  public: T Value() const;
65 
67  public: unsigned int valWindowSize = 4;
68 
70  public: unsigned int samples = 0;
71 
72  GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
75 
78 
80  public: T sum;
81  GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
82  };
83 
90  } // namespace GZ_MATH_VERSION_NAMESPACE
91 } // namespace gz::math
92 #endif // GZ_MATH_MOVINGWINDOWFILTER_HH_