#include <IIRFilter.h>
Public Member Functions | |
double | executeFilter (double input) |
Execute filtering, this method will be obsolated. More... | |
void | getParameter (int &dim, std::vector< double > &A, std::vector< double > &B) |
IIRFilter (const std::string &error_prefix="") | |
Constructor. More... | |
IIRFilter (unsigned int dim, std::vector< double > &fb_coeffs, std::vector< double > &ff_coeffs, const std::string &error_prefix="") | |
Constructor, this constructure will be obsolated. More... | |
double | passFilter (double input) |
passFilter More... | |
void | reset (double initial_input=0.0) |
bool | setParameter (int dim, std::vector< double > &A, std::vector< double > &B) |
Set parameters Y[n] = B[0] * X[n] + B[1] * X[n-1] + ... + B[dim] * X[n-dim] - A[1] * Y[n-1] ... - A[dim] * Y[n-dim] A[0] would be 1.0. More... | |
bool | setParameterAsBiquad (const double f_cutoff, const double Q, const double hz) |
Simple user interface of setParameter. More... | |
~IIRFilter () | |
Destructor. More... | |
Private Attributes | |
int | m_dimension |
std::string | m_error_prefix |
std::vector< double > | m_fb_coefficients |
std::vector< double > | m_ff_coefficients |
bool | m_initialized |
std::deque< double > | m_previous_values |
Infinite Impulse Filter y[n] = sum(0, dim, ff_coeffs[i] * x[n - i]) + sum(1, dim, fb_coeffs[i] * y[n - i])
Definition at line 24 of file TorqueFilter/IIRFilter.h.
IIRFilter::IIRFilter | ( | const std::string & | error_prefix = "" | ) |
Constructor.
Definition at line 28 of file TorqueFilter/IIRFilter.cpp.
IIRFilter::IIRFilter | ( | unsigned int | dim, |
std::vector< double > & | fb_coeffs, | ||
std::vector< double > & | ff_coeffs, | ||
const std::string & | error_prefix = "" |
||
) |
Constructor, this constructure will be obsolated.
dim | dimension of the filter |
fb_coeffs | coeeficients of feedback |
ff_coeffs | coefficients of feedforward |
Definition at line 4 of file TorqueFilter/IIRFilter.cpp.
|
inline |
Destructor.
Definition at line 41 of file TorqueFilter/IIRFilter.h.
|
inline |
Execute filtering, this method will be obsolated.
Definition at line 73 of file TorqueFilter/IIRFilter.h.
Definition at line 84 of file TorqueFilter/IIRFilter.cpp.
double IIRFilter::passFilter | ( | double | input | ) |
passFilter
Definition at line 110 of file TorqueFilter/IIRFilter.cpp.
void IIRFilter::reset | ( | double | initial_input = 0.0 | ) |
Definition at line 100 of file TorqueFilter/IIRFilter.cpp.
bool IIRFilter::setParameter | ( | int | dim, |
std::vector< double > & | A, | ||
std::vector< double > & | B | ||
) |
Set parameters Y[n] = B[0] * X[n] + B[1] * X[n-1] + ... + B[dim] * X[n-dim] - A[1] * Y[n-1] ... - A[dim] * Y[n-dim] A[0] would be 1.0.
How to generete parameter by octave butterworth filter (dimension = 2, cutoff_freq = 8Hz) [B, A] = butter(2, 2 * 0.004 * 8) ;;; dimension=2, 2 * dt * cutoff_freq
Definition at line 33 of file TorqueFilter/IIRFilter.cpp.
Simple user interface of setParameter.
f_cutoff | cut off frequency |
Q | quality factor: 1/2 = no overshoot, 1/sqrt(2) = Butterworth |
hz | sampling rate |
Definition at line 69 of file TorqueFilter/IIRFilter.cpp.
|
private |
Definition at line 85 of file TorqueFilter/IIRFilter.h.
|
private |
Definition at line 91 of file TorqueFilter/IIRFilter.h.
|
private |
Definition at line 86 of file TorqueFilter/IIRFilter.h.
|
private |
Definition at line 87 of file TorqueFilter/IIRFilter.h.
|
private |
Definition at line 90 of file TorqueFilter/IIRFilter.h.
|
private |
Definition at line 88 of file TorqueFilter/IIRFilter.h.