Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
tap::algorithms::DiscreteFilter< SIZE, T > Class Template Reference

DiscreteFilter class implements a discrete-time filter using the finite difference equation. More...

#include <discrete_filter.hpp>

Public Member Functions

 DiscreteFilter (std::array< T, SIZE > &naturalResponseCoefficients, std::array< T, SIZE > &forcedResponseCoefficients)
 Constructor for the DiscreteFilter class.
 
filterData (float dat)
 Filters the input data using the finite difference equation.
 
getLastFiltered ()
 Returns the last filtered value.
 
reset ()
 Resets the filter's state to zero, keeps the coefficients

 

Detailed Description

template<uint8_t SIZE, typename T = float>
class tap::algorithms::DiscreteFilter< SIZE, T >

DiscreteFilter class implements a discrete-time filter using the finite difference equation.

Template Parameters
SIZEThe size of the filter coefficients.

This class provides methods to filter input data using the finite difference equation and maintain the internal state of the filter.

Constructor & Destructor Documentation

◆ DiscreteFilter()

template<uint8_t SIZE, typename T = float>
tap::algorithms::DiscreteFilter< SIZE, T >::DiscreteFilter ( std::array< T, SIZE > &  naturalResponseCoefficients,
std::array< T, SIZE > &  forcedResponseCoefficients 
)
inline

Constructor for the DiscreteFilter class.

Parameters
[in]naturalResponseCoefficientsThe coefficients for the natural response (a).
[in]forcedResponseCoefficientsThe coefficients for the forced response (b).

This constructor initializes the filter with the given coefficients and resets the filter state to zero.

Member Function Documentation

◆ filterData()

template<uint8_t SIZE, typename T = float>
T tap::algorithms::DiscreteFilter< SIZE, T >::filterData ( float  dat)
inline

Filters the input data using the finite difference equation.

Parameters
[in]datThe input data to be filtered.
Returns
The filtered output data.

This function implements a discrete-time filter using the finite difference equation. It updates the internal state of the filter based on the input data and returns the filtered output.

$ y(n)=\frac{1}{a_{0}}\left[\sum_{\kappa=0}^{M} b_{\kappa}x(n-\kappa)-\sum_{k=1}^{N}
a_{k}y(n-k)\right]. \qquad{(2)} $

◆ getLastFiltered()

template<uint8_t SIZE, typename T = float>
T tap::algorithms::DiscreteFilter< SIZE, T >::getLastFiltered ( )
inline

Returns the last filtered value.

◆ reset()

template<uint8_t SIZE, typename T = float>
T tap::algorithms::DiscreteFilter< SIZE, T >::reset ( )
inline

Resets the filter's state to zero, keeps the coefficients


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