30 IIRFilter(
const std::string& error_prefix =
"");
37 IIRFilter(
unsigned int dim, std::vector<double>& fb_coeffs, std::vector<double>& ff_coeffs,
const std::string& error_prefix =
"");
52 bool setParameter(
int dim, std::vector<double>&
A, std::vector<double>&
B);
64 void getParameter(
int &dim, std::vector<double>&A, std::vector<double>& B);
68 void reset(
double initial_input = 0.0);
101 double cutoff_freq,
dt, const_param;
105 setCutOffFreq(_cutoff_freq);
112 prev_value = 1.0/(1+const_param) * prev_value + const_param/(1+const_param) * value;
115 void reset (
const T& value) { prev_value = value; };
119 const_param = 2 *
M_PI * cutoff_freq * dt;
125 #endif // IIRFilter_H
void reset(const T &value)
bool setParameterAsBiquad(const double f_cutoff, const double Q, const double hz)
Simple user interface of setParameter.
void setCutOffFreq(const double f)
std::vector< double > m_ff_coefficients
double executeFilter(double input)
Execute filtering, this method will be obsolated.
std::string m_error_prefix
double passFilter(double input)
passFilter
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] ...
T getCurrentValue() const
void reset(double initial_input=0.0)
FirstOrderLowPassFilter(const double _cutoff_freq, const double _dt, const T init_value)
~FirstOrderLowPassFilter()
std::vector< double > m_fb_coefficients
void getParameter(int &dim, std::vector< double > &A, std::vector< double > &B)
IIRFilter(const std::string &error_prefix="")
Constructor.
std::deque< double > m_previous_values
T passFilter(const T &value)
double getCutOffFreq() const