Cheetah Software  1.0
deriv_lp_filter< T > Class Template Reference

#include <filters.h>

+ Inheritance diagram for deriv_lp_filter< T >:
+ Collaboration diagram for deriv_lp_filter< T >:

Public Member Functions

 deriv_lp_filter (T w_c, T t_s)
 
virtual ~deriv_lp_filter (void)
 
virtual void input (T input_value)
 
virtual T output (void)
 
virtual void clear (void)
 
- Public Member Functions inherited from filter< T >
 filter (void)
 
virtual ~filter (void)
 

Private Attributes

Lpf_in_prev [2]
 
Lpf_out_prev [2]
 
Lpf_in1
 
Lpf_in2
 
Lpf_in3
 
Lpf_out1
 
Lpf_out2
 
lpf_out
 

Detailed Description

template<typename T>
class deriv_lp_filter< T >

Definition at line 65 of file filters.h.

Constructor & Destructor Documentation

template<typename T >
deriv_lp_filter< T >::deriv_lp_filter ( w_c,
t_s 
)

Definition at line 148 of file filters.cpp.

References moving_average_filter< T >::clear().

148  {
149  Lpf_in_prev[0] = 0;
150  Lpf_in_prev[1] = 0;
151  Lpf_out_prev[0] = 0;
152  Lpf_out_prev[1] = 0;
153  Lpf_in1 = 0;
154  Lpf_in2 = 0;
155  Lpf_in3 = 0;
156  Lpf_out1 = 0;
157  Lpf_out2 = 0;
158  T a = 1.4142;
159  T den = 4 + 2 * a * w_c * t_s + t_s * t_s * w_c * w_c;
160 
161  Lpf_in1 = 2 * t_s * w_c * w_c / den;
162  Lpf_in2 = 0;
163  Lpf_in3 = -2. * t_s * w_c * w_c / den;
164  Lpf_out1 = -1. * (-8 + t_s * t_s * w_c * w_c * 2) / den;
165  Lpf_out2 = -1. * (4 - 2 * a * w_c * t_s + t_s * t_s * w_c * w_c) / den;
166  lpf_out = 0.0;
167  clear();
168 }
T Lpf_out_prev[2]
Definition: filters.h:75
T Lpf_in_prev[2]
Definition: filters.h:74
virtual void clear(void)
Definition: filters.cpp:204

+ Here is the call graph for this function:

template<typename T >
deriv_lp_filter< T >::~deriv_lp_filter ( void  )
virtual

Definition at line 171 of file filters.cpp.

171 {}

Member Function Documentation

template<typename T >
void deriv_lp_filter< T >::clear ( void  )
virtual

Implements filter< T >.

Definition at line 204 of file filters.cpp.

204  {
205  Lpf_in_prev[1] = 0;
206  Lpf_in_prev[0] = 0;
207  Lpf_out_prev[1] = 0;
208  Lpf_out_prev[0] = 0;
209 }
T Lpf_out_prev[2]
Definition: filters.h:75
T Lpf_in_prev[2]
Definition: filters.h:74
template<typename T >
void deriv_lp_filter< T >::input ( input_value)
virtual

Implements filter< T >.

Definition at line 174 of file filters.cpp.

174  {
175  // static int i(0);
176  lpf_out = Lpf_in1 * lpf_in + Lpf_in2 * Lpf_in_prev[0] +
177  Lpf_in3 * Lpf_in_prev[1] + // input component
178  Lpf_out1 * Lpf_out_prev[0] +
179  Lpf_out2 * Lpf_out_prev[1]; // output component
180 
181  // printf("%i th filter (%f): %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n",i,
182  // lpf_out,
183  // Lpf_in1, lpf_in, Lpf_in2,
184  // Lpf_in_prev[0], Lpf_in3, Lpf_in_prev[1],
185  // Lpf_out1, Lpf_out_prev[0], Lpf_out2, Lpf_out_prev[1]);
186 
187  // if(lpf_out>100){
188  // exit(0);
189  // }
190 
191  Lpf_in_prev[1] = Lpf_in_prev[0];
192  Lpf_in_prev[0] = lpf_in;
193  Lpf_out_prev[1] = Lpf_out_prev[0];
194  Lpf_out_prev[0] = lpf_out;
195  // ++i;
196 }
T Lpf_out_prev[2]
Definition: filters.h:75
T Lpf_in_prev[2]
Definition: filters.h:74
template<typename T >
T deriv_lp_filter< T >::output ( void  )
virtual

Implements filter< T >.

Definition at line 199 of file filters.cpp.

199  {
200  return lpf_out;
201 }

Member Data Documentation

template<typename T >
T deriv_lp_filter< T >::Lpf_in1
private

Definition at line 76 of file filters.h.

template<typename T >
T deriv_lp_filter< T >::Lpf_in2
private

Definition at line 76 of file filters.h.

template<typename T >
T deriv_lp_filter< T >::Lpf_in3
private

Definition at line 76 of file filters.h.

template<typename T >
T deriv_lp_filter< T >::Lpf_in_prev[2]
private

Definition at line 74 of file filters.h.

template<typename T >
T deriv_lp_filter< T >::lpf_out
private

Definition at line 77 of file filters.h.

template<typename T >
T deriv_lp_filter< T >::Lpf_out1
private

Definition at line 76 of file filters.h.

template<typename T >
T deriv_lp_filter< T >::Lpf_out2
private

Definition at line 76 of file filters.h.

template<typename T >
T deriv_lp_filter< T >::Lpf_out_prev[2]
private

Definition at line 75 of file filters.h.


The documentation for this class was generated from the following files: