Go to the documentation of this file.
28 #include <ArmarXCore/interface/observers/Filters.h>
55 template <
typename Type>
59 const double sigma = filterSizeInMs / 2.5;
62 double weightedSum = 0;
63 double sumOfWeight = 0;
66 const double sqrt2PI =
sqrt(2 *
M_PI);
69 for (
auto it = map.begin(); it != map.end(); it++)
72 value = VariantPtr::dynamicCast(it->second)->get<
Type>();
73 double diff = 0.001 * (it->first - map.rbegin()->first);
75 double squared = diff * diff;
76 const double gaussValue = exp(-squared / (2 * sigma * sigma)) / (sigma * sqrt2PI);
77 sumOfWeight += gaussValue;
78 weightedSum += gaussValue *
value;
82 result = weightedSum / sumOfWeight;
99 getProperties(
const Ice::Current&
c = Ice::emptyCurrent)
const override;
101 const Ice::Current&
c = Ice::emptyCurrent)
override;
The DatafieldFilter class is the base class for all filters and filter implementation should derive f...
std::deque< std::pair< long, VariantBasePtr > > TimeVariantBaseMap
StringFloatDictionary getProperties(const Ice::Current &c=Ice::emptyCurrent) const override
void setProperties(const StringFloatDictionary &newValues, const Ice::Current &c=Ice::emptyCurrent) override
The GaussianFilter class provides a filter implemtentation with gaussian weighted values for datafiel...
std::shared_ptr< Value > value()
VariantBasePtr calculate(const Ice::Current &c=Ice::emptyCurrent) const override
ParameterTypeList getSupportedTypes(const Ice::Current &c=Ice::emptyCurrent) const override
This filter supports: Int, Long, Float, Double.
VectorXD< D, T > sqrt(const VectorXD< D, T > &a)
GaussianFilter(int filterSizeInMs=200, int windowSize=20)
GaussianFilter.
Type calcGaussianFilteredValue(const TimeVariantBaseMap &map) const