00001 #ifndef __SMOOTH_DERIVATIVE_H__ 00002 #define __SMOOTH_DERIVATIVE_H__ 00003 00004 #include <iostream> 00005 #include <vector> 00006 00007 00008 class SmoothDerivative 00009 { 00010 public: 00011 SmoothDerivative(); 00012 SmoothDerivative(std::vector<double> xA, std::vector<double> smoothingA, double frequencyA); 00013 virtual ~SmoothDerivative(); 00014 void OnExecute(std::vector<double> xA, std::vector<double> &xDotA); 00015 bool Initialize(std::vector<double> xA, std::vector<double> smoothingA, double frequencyA); 00016 bool isInitialized; 00017 00018 // private: 00019 00020 protected: 00021 00022 struct MiddleSteps 00023 { 00024 double m_xDot; 00025 double m_smooth; 00026 double m_xPrevSample; 00027 double m_xPrevTransition; 00028 unsigned int m_numTicks; 00029 unsigned int m_numTicksPrev; 00030 unsigned int m_numTransitions; 00031 double m_delta; 00032 double m_innovation; 00033 double m_regression; 00034 00035 }; 00036 00037 std::vector<MiddleSteps> xDotCalc; 00038 00039 unsigned int m_size; 00040 double m_freq; 00041 std::vector<double> m_smoothing; 00042 }; 00043 00044 00045 #endif