MinMaxFilter.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
10 *
11 * ArmarX is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @package ArmarX::
20 * @author Mirko Waechter ( mirko.waechter at kit dot edu)
21 * @date 2015
22 * @copyright http://www.gnu.org/licenses/gpl.txt
23 * GNU General Public License
24 */
25 
26 #pragma once
27 
28 #include "DatafieldFilter.h"
29 #include <ArmarXCore/interface/observers/Filters.h>
31 
32 namespace armarx::filters
33 {
34 
35 
36  /**
37  * @class MaxFilter
38  * @ingroup ObserverFilters
39  * @brief The MaxFilter class provides a simple filter by calculating the
40  * average value of a window for datafields of type float, int and double.
41  */
42  class MaxFilter :
43  public DatafieldFilter,
44  public MaxFilterBase
45  {
46  public:
47  MaxFilter();
48 
49  // DatafieldFilterBase interface
50  public:
51  VariantBasePtr calculate(const Ice::Current& c = Ice::emptyCurrent) const override;
52 
53  /**
54  * @brief This filter supports: Int, Long, Float, Double
55  * @return List of VariantTypes
56  */
57  ParameterTypeList getSupportedTypes(const Ice::Current& c = Ice::emptyCurrent) const override;
58  private:
59  template <typename Type>
60  static Type CalcMax(const TimeVariantBaseMap& map)
61  {
62  double curMax = std::numeric_limits<double>::min();
63  for (auto v : map)
64  {
65  VariantPtr v2 = VariantPtr::dynamicCast(v.second);
66  Type val = v2->get<Type>();
67 
68  if (val > curMax)
69  {
70  curMax = val;
71  }
72  }
73  return curMax;
74  }
75  };
76 
77 }
armarx::DatafieldFilter
The DatafieldFilter class is the base class for all filters and filter implementation should derive f...
Definition: DatafieldFilter.h:45
armarx::filters::MaxFilter::MaxFilter
MaxFilter()
Definition: MinMaxFilter.cpp:28
armarx::filters::MaxFilter::calculate
VariantBasePtr calculate(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: MinMaxFilter.cpp:32
armarx::TimeVariantBaseMap
std::deque< std::pair< long, VariantBasePtr > > TimeVariantBaseMap
Definition: DatafieldFilter.h:36
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
IceInternal::Handle<::armarx::VariantBase >
armarx::filters
Definition: AverageFilter.h:31
InvalidTypeException.h
DatafieldFilter.h
armarx::filters::MaxFilter::getSupportedTypes
ParameterTypeList getSupportedTypes(const Ice::Current &c=Ice::emptyCurrent) const override
This filter supports: Int, Long, Float, Double.
Definition: MinMaxFilter.cpp:63
armarx::aron::similarity::FloatSimilarity::Type
Type
The Type enum.
Definition: FloatSimilarity.h:8
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
min
T min(T t1, T t2)
Definition: gdiam.h:42
armarx::filters::MaxFilter
The MaxFilter class provides a simple filter by calculating the average value of a window for datafie...
Definition: MinMaxFilter.h:42