Monado OpenXR Runtime
Public Types | Public Member Functions
xrt_fusion::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 <tracking/t_lowpass_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 just-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
 Access the filtered value. More...
 
std::uint64_t getTimestampNs () const noexcept
 Access the time of last update. More...
 
bool isInitialized () const noexcept
 Access whether we have initialized state. More...
 

Detailed Description

template<size_t Dim, typename Scalar>
class xrt_fusion::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_fusion::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_fusion::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_fusion::LowPassIIRVectorFilter< Dim, Scalar >::getState ( ) const
inlinenoexcept

Access the filtered value.

◆ getTimestampNs()

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

Access the time of last update.

◆ isInitialized()

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

Access whether we have initialized state.

◆ reset()

template<size_t Dim, typename Scalar>
void xrt_fusion::LowPassIIRVectorFilter< Dim, Scalar >::reset ( )
inlinenoexcept

Reset the filter to just-created state.


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