Monado OpenXR Runtime
xrt::auxiliary::math::LowPassIIRVectorFilter< Dim, Scalar > Class Template Reference

A very simple low-pass filter, using a "one-pole infinite impulse response" design (one-pole IIR). More...

#include <math/m_lowpass_float_vector.hpp>

Public Types

using Vector = Eigen::Matrix< Scalar, Dim, 1 >
 

Public Member Functions

 LowPassIIRVectorFilter (Scalar cutoff_hz) noexcept
 Constructor. More...
 
void reset () noexcept
 Reset the filter to newly-created state. More...
 
void addSample (Vector const &sample, std::uint64_t timestamp_ns, Scalar weight=1)
 Filter a sample, with an optional weight. More...
 
Vector const & getState () const noexcept
 Get the filtered value. More...
 
std::uint64_t getTimestampNs () const noexcept
 Get the time of last update. More...
 
bool isInitialized () const noexcept
 Get whether we have initialized state. More...
 

Detailed Description

template<size_t Dim, typename Scalar>
class xrt::auxiliary::math::LowPassIIRVectorFilter< Dim, Scalar >

A very simple low-pass filter, using a "one-pole infinite impulse response" design (one-pole IIR).

Configurable in dimension and scalar type.

Constructor & Destructor Documentation

◆ LowPassIIRVectorFilter()

template<size_t Dim, typename Scalar >
xrt::auxiliary::math::LowPassIIRVectorFilter< Dim, Scalar >::LowPassIIRVectorFilter ( Scalar  cutoff_hz)
inlineexplicitnoexcept

Constructor.

Parameters
cutoff_hzA cutoff frequency in Hertz: signal changes much lower in frequency will be passed through the filter, while signal changes much higher in frequency will be blocked.

Member Function Documentation

◆ addSample()

template<size_t Dim, typename Scalar >
void xrt::auxiliary::math::LowPassIIRVectorFilter< Dim, Scalar >::addSample ( Vector const &  sample,
std::uint64_t  timestamp_ns,
Scalar  weight = 1 
)
inline

Filter a sample, with an optional weight.

Parameters
sampleThe value to filter
timestamp_nsThe time that this sample was measured.
weightAn optional value between 0 and 1. The smaller this value, the less the current sample influences the filter state. For the first call, this is always assumed to be 1.

◆ getState()

template<size_t Dim, typename Scalar >
Vector const & xrt::auxiliary::math::LowPassIIRVectorFilter< Dim, Scalar >::getState ( ) const
inlinenoexcept

Get the filtered value.

◆ getTimestampNs()

template<size_t Dim, typename Scalar >
std::uint64_t xrt::auxiliary::math::LowPassIIRVectorFilter< Dim, Scalar >::getTimestampNs ( ) const
inlinenoexcept

Get the time of last update.

◆ isInitialized()

template<size_t Dim, typename Scalar >
bool xrt::auxiliary::math::LowPassIIRVectorFilter< Dim, Scalar >::isInitialized ( ) const
inlinenoexcept

Get whether we have initialized state.

◆ reset()

template<size_t Dim, typename Scalar >
void xrt::auxiliary::math::LowPassIIRVectorFilter< Dim, Scalar >::reset ( )
inlinenoexcept

Reset the filter to newly-created state.

References xrt::auxiliary::math::detail::LowPassIIR< Value, Scalar >::reset().


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