Monado OpenXR Runtime
Public Member Functions
xrt_fusion::LowPassIIRFilter< Scalar > Class Template Reference

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

#include <tracking/t_lowpass.hpp>

Public Member Functions

 LowPassIIRFilter (Scalar cutoff_hz) noexcept
 Constructor. More...
 
void reset () noexcept
 Reset the filter to just-created state. More...
 
void addSample (Scalar sample, timepoint_ns timestamp_ns, Scalar weight=1)
 Filter a sample, with an optional weight. More...
 
Scalar getState () const noexcept
 Access the filtered value. More...
 
timepoint_ns getTimestampNs () const noexcept
 Access the time of last update. More...
 
bool isInitialized () const noexcept
 Access whether we have initialized state. More...
 

Detailed Description

template<typename Scalar>
class xrt_fusion::LowPassIIRFilter< Scalar >

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

Configurable in scalar type.

Constructor & Destructor Documentation

◆ LowPassIIRFilter()

template<typename Scalar>
xrt_fusion::LowPassIIRFilter< Scalar >::LowPassIIRFilter ( 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<typename Scalar>
void xrt_fusion::LowPassIIRFilter< Scalar >::addSample ( Scalar  sample,
timepoint_ns  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<typename Scalar>
Scalar xrt_fusion::LowPassIIRFilter< Scalar >::getState ( ) const
inlinenoexcept

Access the filtered value.

Referenced by xrt_fusion::SimpleIMUFusion::postCorrect().

◆ getTimestampNs()

template<typename Scalar>
timepoint_ns xrt_fusion::LowPassIIRFilter< Scalar >::getTimestampNs ( ) const
inlinenoexcept

Access the time of last update.

◆ isInitialized()

template<typename Scalar>
bool xrt_fusion::LowPassIIRFilter< Scalar >::isInitialized ( ) const
inlinenoexcept

Access whether we have initialized state.

◆ reset()

template<typename Scalar>
void xrt_fusion::LowPassIIRFilter< Scalar >::reset ( )
inlinenoexcept

Reset the filter to just-created state.


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