iCub-main
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
iCub::ctrl::Filter Class Reference

IIR and FIR. More...

#include <filters.h>

+ Inheritance diagram for iCub::ctrl::Filter:

Public Member Functions

 Filter (const yarp::sig::Vector &num, const yarp::sig::Vector &den, const yarp::sig::Vector &y0=yarp::sig::Vector(1, 0.0))
 Creates a filter with specified numerator and denominator coefficients.
 
virtual void init (const yarp::sig::Vector &y0)
 Internal state reset.
 
virtual void init (const yarp::sig::Vector &y0, const yarp::sig::Vector &u0)
 Internal state reset for filter with zero gain.
 
void getCoeffs (yarp::sig::Vector &num, yarp::sig::Vector &den)
 Returns the current filter coefficients.
 
void setCoeffs (const yarp::sig::Vector &num, const yarp::sig::Vector &den)
 Sets new filter coefficients.
 
bool adjustCoeffs (const yarp::sig::Vector &num, const yarp::sig::Vector &den)
 Modifies the values of existing filter coefficients without varying their lengths.
 
void getStates (std::deque< yarp::sig::Vector > &u, std::deque< yarp::sig::Vector > &y)
 Returns the current filter states.
 
virtual const yarp::sig::Vector & filt (const yarp::sig::Vector &u)
 Performs filtering on the actual input.
 
virtual const yarp::sig::Vector & output () const
 Return current filter output.
 
- Public Member Functions inherited from iCub::ctrl::IFilter
virtual ~IFilter ()
 Destructor.
 

Protected Attributes

yarp::sig::Vector b
 
yarp::sig::Vector a
 
yarp::sig::Vector y
 
std::deque< yarp::sig::Vector > uold
 
std::deque< yarp::sig::Vector > yold
 
size_t n
 
size_t m
 

Detailed Description

IIR and FIR.

Definition at line 76 of file filters.h.

Constructor & Destructor Documentation

◆ Filter()

Filter::Filter ( const yarp::sig::Vector &  num,
const yarp::sig::Vector &  den,
const yarp::sig::Vector &  y0 = yarp::sig::Vector(1,0.0) 
)

Creates a filter with specified numerator and denominator coefficients.

Parameters
numvector of numerator elements given as increasing power of z^-1.
denvector of denominator elements given as increasing power of z^-1.
y0initial output.
Note
den[0] shall not be 0.

Definition at line 26 of file filters.cpp.

Member Function Documentation

◆ adjustCoeffs()

bool Filter::adjustCoeffs ( const yarp::sig::Vector &  num,
const yarp::sig::Vector &  den 
)

Modifies the values of existing filter coefficients without varying their lengths.

Parameters
numvector of numerator elements given as increasing power of z^-1.
denvector of denominator elements given as increasing power of z^-1.
Returns
true/false on success/fail.
Note
den[0] shall not be 0.
the adjustment is carried out iff num.size() and den.size() match the existing numerator and denominator lengths.

Definition at line 118 of file filters.cpp.

◆ filt()

const Vector & Filter::filt ( const yarp::sig::Vector &  u)
virtual

Performs filtering on the actual input.

Parameters
ureference to the actual input.
Returns
the corresponding output.

Implements iCub::ctrl::IFilter.

Definition at line 140 of file filters.cpp.

◆ getCoeffs()

void Filter::getCoeffs ( yarp::sig::Vector &  num,
yarp::sig::Vector &  den 
)

Returns the current filter coefficients.

Parameters
numvector of numerator elements returned as increasing power of z^-1.
denvector of denominator elements returned as increasing power of z^-1.

Definition at line 91 of file filters.cpp.

◆ getStates()

void Filter::getStates ( std::deque< yarp::sig::Vector > &  u,
std::deque< yarp::sig::Vector > &  y 
)

Returns the current filter states.

Parameters
uthe current input states.
ythe current output states.

Definition at line 132 of file filters.cpp.

◆ init() [1/2]

virtual void iCub::ctrl::Filter::init ( const yarp::sig::Vector &  y0)
virtual

Internal state reset.

Parameters
y0new internal state.

Implements iCub::ctrl::IFilter.

◆ init() [2/2]

virtual void iCub::ctrl::Filter::init ( const yarp::sig::Vector &  y0,
const yarp::sig::Vector &  u0 
)
virtual

Internal state reset for filter with zero gain.

Parameters
y0new internal state.
u0expected next input.
Note
The gain of a digital filter is the sum of the coefficients of its numerator divided by the sum of the coefficients of its denumerator.

◆ output()

virtual const yarp::sig::Vector & iCub::ctrl::Filter::output ( ) const
inlinevirtual

Return current filter output.

Returns
the filter output.

Implements iCub::ctrl::IFilter.

Definition at line 171 of file filters.h.

◆ setCoeffs()

void Filter::setCoeffs ( const yarp::sig::Vector &  num,
const yarp::sig::Vector &  den 
)

Sets new filter coefficients.

Parameters
numvector of numerator elements given as increasing power of z^-1.
denvector of denominator elements given as increasing power of z^-1.
Note
den[0] shall not be 0.
the internal state is reinitialized to the current output.

Definition at line 99 of file filters.cpp.

Member Data Documentation

◆ a

yarp::sig::Vector iCub::ctrl::Filter::a
protected

Definition at line 80 of file filters.h.

◆ b

yarp::sig::Vector iCub::ctrl::Filter::b
protected

Definition at line 79 of file filters.h.

◆ m

size_t iCub::ctrl::Filter::m
protected

Definition at line 86 of file filters.h.

◆ n

size_t iCub::ctrl::Filter::n
protected

Definition at line 85 of file filters.h.

◆ uold

std::deque<yarp::sig::Vector> iCub::ctrl::Filter::uold
protected

Definition at line 83 of file filters.h.

◆ y

yarp::sig::Vector iCub::ctrl::Filter::y
protected

Definition at line 81 of file filters.h.

◆ yold

std::deque<yarp::sig::Vector> iCub::ctrl::Filter::yold
protected

Definition at line 84 of file filters.h.


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