18 #ifndef _GAZEBO_MOVING_WINDOW_FILTER_HH_ 19 #define _GAZEBO_MOVING_WINDOW_FILTER_HH_ 25 #include <boost/function.hpp> 26 #include <boost/bind.hpp> 27 #include <boost/shared_ptr.hpp> 28 #include <boost/thread/mutex.hpp> 30 #include <gazebo/gazebo_config.h> 58 public:
typename std::vector<T>::iterator
valIter;
92 public:
void Update(T _val);
96 public:
void SetWindowSize(
unsigned int _n);
100 public:
unsigned int GetWindowSize()
const;
104 public:
bool GetWindowFilled()
const;
129 this->
dataPtr->valHistory.clear();
145 if (this->
dataPtr->valIter == this->dataPtr->valHistory.end())
154 if (this->
dataPtr->samples > this->dataPtr->valWindowSize)
159 (*this->
dataPtr->valIter) = _val;
166 (*this->
dataPtr->valIter) = _val;
174 this->
dataPtr->valWindowSize = _n;
175 this->
dataPtr->valHistory.clear();
186 return this->
dataPtr->valWindowSize;
200 return this->
dataPtr->sum /
static_cast<double>(this->
dataPtr->samples);
MovingWindowFilterPrivate< T > * dataPtr
Data pointer.
Definition: MovingWindowFilter.hh:115
T Get()
Get filtered result.
Definition: MovingWindowFilter.hh:198
Forward declarations for the common classes.
Definition: Animation.hh:33
unsigned int GetWindowSize() const
Get the window size.
Definition: MovingWindowFilter.hh:184
bool GetWindowFilled() const
Get whether the window has been filled.
Definition: MovingWindowFilter.hh:191
std::vector< T >::iterator valIter
iterator pointing to current value in buffer
Definition: MovingWindowFilter.hh:58
unsigned int valWindowSize
For moving window smoothed value.
Definition: MovingWindowFilter.hh:52
std::vector< T > valHistory
buffer history of raw values
Definition: MovingWindowFilter.hh:55
T sum
keep track of running sum
Definition: MovingWindowFilter.hh:61
void SetWindowSize(unsigned int _n)
Set window size.
Definition: MovingWindowFilter.hh:172
Definition: MovingWindowFilter.hh:46
MovingWindowFilterPrivate()
Definition: MovingWindowFilter.hh:69
Base class for MovingWindowFilter.
Definition: MovingWindowFilter.hh:82
void Update(T _val)
Update value of filter.
Definition: MovingWindowFilter.hh:136
#define NULL
Definition: CommonTypes.hh:31
unsigned int samples
keep track of number of elements
Definition: MovingWindowFilter.hh:64
virtual ~MovingWindowFilter()
Destructor.
Definition: MovingWindowFilter.hh:127
MovingWindowFilter()
Constructor.
Definition: MovingWindowFilter.hh:120