PX4 Firmware
PX4 Autopilot Software http://px4.io
InnovationLpf Class Referencefinal

First order "alpha" IIR digital filter with input saturation. More...

#include <InnovationLpf.hpp>

Collaboration diagram for InnovationLpf:

Public Member Functions

 InnovationLpf ()=default
 
 ~InnovationLpf ()=default
 
void reset (float val=0.f)
 
float update (float val, float alpha, float spike_limit)
 Update the filter with a new value and returns the filtered state The new value is constained by the limit set in setSpikeLimit. More...
 

Static Public Member Functions

static float computeAlphaFromDtAndTauInv (float dt, float tau_inv)
 Helper function to compute alpha from dt and the inverse of tau. More...
 

Private Attributes

float _x {}
 current state of the filter More...
 

Detailed Description

First order "alpha" IIR digital filter with input saturation.

Definition at line 40 of file InnovationLpf.hpp.

Constructor & Destructor Documentation

◆ InnovationLpf()

InnovationLpf::InnovationLpf ( )
default

◆ ~InnovationLpf()

InnovationLpf::~InnovationLpf ( )
default

Member Function Documentation

◆ computeAlphaFromDtAndTauInv()

static float InnovationLpf::computeAlphaFromDtAndTauInv ( float  dt,
float  tau_inv 
)
inlinestatic

Helper function to compute alpha from dt and the inverse of tau.

Parameters
dtsampling time in seconds
tau_invinverse of the time constant of the filter
Returns
alpha, the normalized weight of a new measurement

Definition at line 72 of file InnovationLpf.hpp.

References math::constrain(), and f().

Referenced by PreFlightChecker::update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void InnovationLpf::reset ( float  val = 0.f)
inline

Definition at line 46 of file InnovationLpf.hpp.

References _x.

Referenced by PreFlightChecker::reset().

Here is the caller graph for this function:

◆ update()

float InnovationLpf::update ( float  val,
float  alpha,
float  spike_limit 
)
inline

Update the filter with a new value and returns the filtered state The new value is constained by the limit set in setSpikeLimit.

Parameters
valnew input
alphanormalized weight of the new input
spike_limitthe amplitude of the saturation at the input of the filter
Returns
filtered output

Definition at line 56 of file InnovationLpf.hpp.

References _x, and math::constrain().

Referenced by PreFlightChecker::preFlightCheckHeadingFailed(), PreFlightChecker::preFlightCheckHeightFailed(), PreFlightChecker::preFlightCheckHorizVelFailed(), and PreFlightChecker::preFlightCheckVertVelFailed().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _x

float InnovationLpf::_x {}
private

current state of the filter

Definition at line 78 of file InnovationLpf.hpp.

Referenced by reset(), and update().


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