Public Member Functions | Private Attributes | List of all members
IIRFilter Class Reference

#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
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
dimdimension of the filter
fb_coeffscoeeficients of feedback
ff_coeffscoefficients of feedforward

Definition at line 4 of file TorqueFilter/IIRFilter.cpp.

IIRFilter::~IIRFilter ( )
inline

Destructor.

Definition at line 41 of file TorqueFilter/IIRFilter.h.

Member Function Documentation

double IIRFilter::executeFilter ( double  input)
inline

Execute filtering, this method will be obsolated.

Definition at line 73 of file TorqueFilter/IIRFilter.h.

void IIRFilter::getParameter ( int dim,
std::vector< double > &  A,
std::vector< double > &  B 
)

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.

bool IIRFilter::setParameterAsBiquad ( const double  f_cutoff,
const double  Q,
const double  hz 
)

Simple user interface of setParameter.

Parameters
f_cutoffcut off frequency
Qquality factor: 1/2 = no overshoot, 1/sqrt(2) = Butterworth
hzsampling rate

Definition at line 69 of file TorqueFilter/IIRFilter.cpp.

Member Data Documentation

int IIRFilter::m_dimension
private

Definition at line 85 of file TorqueFilter/IIRFilter.h.

std::string IIRFilter::m_error_prefix
private

Definition at line 91 of file TorqueFilter/IIRFilter.h.

std::vector<double> IIRFilter::m_fb_coefficients
private

Definition at line 86 of file TorqueFilter/IIRFilter.h.

std::vector<double> IIRFilter::m_ff_coefficients
private

Definition at line 87 of file TorqueFilter/IIRFilter.h.

bool IIRFilter::m_initialized
private

Definition at line 90 of file TorqueFilter/IIRFilter.h.

std::deque<double> IIRFilter::m_previous_values
private

Definition at line 88 of file TorqueFilter/IIRFilter.h.


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


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:52