signal_processing.h
Go to the documentation of this file.
1 #ifndef SIGNAL_PROCESSING_H
2 #define SIGNAL_PROCESSING_H
3 
4 #include <argos3/core/utility/math/general.h>
5 
6 namespace argos {
7 
8  /****************************************/
9  /****************************************/
10 
14  class CStats {
15 
16  public:
17 
18  CStats();
19 
24  inline Real GetMean() const {
25  return m_fMean;
26  }
27 
34  Real GetVariance() const;
35 
42  inline Real GetStdDev() const {
43  return Sqrt(GetVariance());
44  }
45 
50  void Append(Real f_value);
51 
52  private:
53 
54  UInt64 m_unCounter;
55  Real m_fMean;
56  Real m_fSumOfSquareDiff;
57  };
58 
59  /****************************************/
60  /****************************************/
61 
67 
68  public:
69 
74  CRCLowPassFilter(Real f_smoothing_factor);
75 
81  Real Filter(Real f_input);
82 
86  void Reset();
87 
88  private:
89 
90  Real m_fSmoothingFactor;
91  Real m_fPreviousOutput;
92  bool m_bInitialized;
93  };
94 
95  /****************************************/
96  /****************************************/
97 
98 }
99 
100 #endif
101 
Real Filter(Real f_input)
Applies the filter to the given value.
#define Sqrt
Definition: general.h:64
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
Real GetVariance() const
Returns the variance of the signal.
void Reset()
Resets the filter.
Real GetStdDev() const
Returns the std deviation of the signal.
A simple infinite-impulse response filter for real-valued signals.
Real GetMean() const
Returns the mean of the signal.
void Append(Real f_value)
Appends a new piece of data and recalculates the statistics.
unsigned long long UInt64
64-bit unsigned integer.
Definition: datatypes.h:107
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
CRCLowPassFilter(Real f_smoothing_factor)
Class constructor.
Calculates the mean, variance, and std deviation of a real-valued signal.