PX4 Firmware
PX4 Autopilot Software http://px4.io
PreFlightChecker Class Reference

#include <PreFlightChecker.hpp>

Collaboration diagram for PreFlightChecker:

Public Member Functions

 PreFlightChecker ()=default
 
 ~PreFlightChecker ()=default
 
void reset ()
 
void update (float dt, const ekf2_innovations_s &innov)
 
void setVehicleCanObserveHeadingInFlight (bool val)
 
void setUsingGpsAiding (bool val)
 
void setUsingFlowAiding (bool val)
 
void setUsingEvPosAiding (bool val)
 
bool hasHeadingFailed () const
 
bool hasHorizVelFailed () const
 
bool hasVertVelFailed () const
 
bool hasHeightFailed () const
 
bool hasFailed () const
 
bool hasHorizFailed () const
 
bool hasVertFailed () const
 

Static Public Member Functions

static bool checkInnovFailed (float innov, float innov_lpf, float test_limit)
 
static bool checkInnov2DFailed (const Vector2f &innov, const Vector2f &innov_lpf, float test_limit)
 
static constexpr float sq (float var)
 

Private Member Functions

bool preFlightCheckHeadingFailed (const ekf2_innovations_s &innov, float alpha)
 
float selectHeadingTestLimit ()
 
bool preFlightCheckHorizVelFailed (const ekf2_innovations_s &innov, float alpha)
 
bool preFlightCheckVertVelFailed (const ekf2_innovations_s &innov, float alpha)
 
bool preFlightCheckHeightFailed (const ekf2_innovations_s &innov, float alpha)
 
void resetPreFlightChecks ()
 

Private Attributes

bool _has_heading_failed {}
 
bool _has_horiz_vel_failed {}
 
bool _has_vert_vel_failed {}
 
bool _has_height_failed {}
 
bool _can_observe_heading_in_flight {}
 
bool _is_using_gps_aiding {}
 
bool _is_using_flow_aiding {}
 
bool _is_using_ev_pos_aiding {}
 
InnovationLpf _filter_vel_n_innov
 Preflight low pass filter N axis velocity innovations (m/sec) More...
 
InnovationLpf _filter_vel_e_innov
 Preflight low pass filter E axis velocity innovations (m/sec) More...
 
InnovationLpf _filter_vel_d_innov
 Preflight low pass filter D axis velocity innovations (m/sec) More...
 
InnovationLpf _filter_hgt_innov
 Preflight low pass filter height innovation (m) More...
 
InnovationLpf _filter_heading_innov
 Preflight low pass filter heading innovation magntitude (rad) More...
 
InnovationLpf _filter_flow_x_innov
 Preflight low pass filter optical flow innovation (rad) More...
 
InnovationLpf _filter_flow_y_innov
 Preflight low pass filter optical flow innovation (rad) More...
 

Static Private Attributes

static constexpr float _innov_lpf_tau_inv = 0.2f
 
static constexpr float _vel_innov_test_lim = 0.5f
 
static constexpr float _hgt_innov_test_lim = 1.5f
 
static constexpr float _nav_heading_innov_test_lim = 0.25f
 
static constexpr float _heading_innov_test_lim = 0.52f
 
static constexpr float _flow_innov_test_lim = 0.1f
 
static constexpr float _vel_innov_spike_lim = 2.0f * _vel_innov_test_lim
 
static constexpr float _hgt_innov_spike_lim = 2.0f * _hgt_innov_test_lim
 
static constexpr float _flow_innov_spike_lim = 2.0f * _flow_innov_test_lim
 

Detailed Description

Definition at line 53 of file PreFlightChecker.hpp.

Constructor & Destructor Documentation

◆ PreFlightChecker()

PreFlightChecker::PreFlightChecker ( )
default

◆ ~PreFlightChecker()

PreFlightChecker::~PreFlightChecker ( )
default

Member Function Documentation

◆ checkInnov2DFailed()

bool PreFlightChecker::checkInnov2DFailed ( const Vector2f &  innov,
const Vector2f &  innov_lpf,
float  test_limit 
)
static

Definition at line 114 of file PreFlightChecker.cpp.

References f(), and sq().

Referenced by hasVertFailed(), preFlightCheckHorizVelFailed(), and TEST_F().

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

◆ checkInnovFailed()

bool PreFlightChecker::checkInnovFailed ( float  innov,
float  innov_lpf,
float  test_limit 
)
static

Definition at line 109 of file PreFlightChecker.cpp.

Referenced by hasVertFailed(), preFlightCheckHeadingFailed(), preFlightCheckHeightFailed(), preFlightCheckVertVelFailed(), and TEST_F().

Here is the caller graph for this function:

◆ hasFailed()

bool PreFlightChecker::hasFailed ( ) const
inline

Definition at line 89 of file PreFlightChecker.hpp.

References hasHorizFailed(), and hasVertFailed().

Referenced by Ekf2::Run().

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

◆ hasHeadingFailed()

bool PreFlightChecker::hasHeadingFailed ( ) const
inline

Definition at line 80 of file PreFlightChecker.hpp.

References _has_heading_failed.

Referenced by Ekf2::Run().

Here is the caller graph for this function:

◆ hasHeightFailed()

bool PreFlightChecker::hasHeightFailed ( ) const
inline

Definition at line 83 of file PreFlightChecker.hpp.

References _has_height_failed.

Referenced by Ekf2::Run().

Here is the caller graph for this function:

◆ hasHorizFailed()

bool PreFlightChecker::hasHorizFailed ( ) const
inline

Definition at line 95 of file PreFlightChecker.hpp.

References _has_heading_failed, and _has_horiz_vel_failed.

Referenced by hasFailed(), and Ekf2::Run().

Here is the caller graph for this function:

◆ hasHorizVelFailed()

bool PreFlightChecker::hasHorizVelFailed ( ) const
inline

Definition at line 81 of file PreFlightChecker.hpp.

References _has_horiz_vel_failed.

Referenced by Ekf2::Run().

Here is the caller graph for this function:

◆ hasVertFailed()

bool PreFlightChecker::hasVertFailed ( ) const
inline

Definition at line 101 of file PreFlightChecker.hpp.

References _has_height_failed, _has_vert_vel_failed, checkInnov2DFailed(), and checkInnovFailed().

Referenced by hasFailed(), and Ekf2::Run().

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

◆ hasVertVelFailed()

bool PreFlightChecker::hasVertVelFailed ( ) const
inline

Definition at line 82 of file PreFlightChecker.hpp.

References _has_vert_vel_failed.

Referenced by Ekf2::Run().

Here is the caller graph for this function:

◆ preFlightCheckHeadingFailed()

bool PreFlightChecker::preFlightCheckHeadingFailed ( const ekf2_innovations_s innov,
float  alpha 
)
private

Definition at line 51 of file PreFlightChecker.cpp.

References _filter_heading_innov, checkInnovFailed(), ekf2_innovations_s::heading_innov, selectHeadingTestLimit(), and InnovationLpf::update().

Referenced by sq(), and update().

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

◆ preFlightCheckHeightFailed()

bool PreFlightChecker::preFlightCheckHeightFailed ( const ekf2_innovations_s innov,
float  alpha 
)
private

Definition at line 102 of file PreFlightChecker.cpp.

References _filter_hgt_innov, _hgt_innov_spike_lim, _hgt_innov_test_lim, checkInnovFailed(), InnovationLpf::update(), and ekf2_innovations_s::vel_pos_innov.

Referenced by sq(), and update().

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

◆ preFlightCheckHorizVelFailed()

bool PreFlightChecker::preFlightCheckHorizVelFailed ( const ekf2_innovations_s innov,
float  alpha 
)
private

Definition at line 72 of file PreFlightChecker.cpp.

References _filter_flow_x_innov, _filter_vel_n_innov, _flow_innov_spike_lim, _flow_innov_test_lim, _is_using_ev_pos_aiding, _is_using_flow_aiding, _is_using_gps_aiding, _vel_innov_spike_lim, _vel_innov_test_lim, checkInnov2DFailed(), ekf2_innovations_s::flow_innov, InnovationLpf::update(), and ekf2_innovations_s::vel_pos_innov.

Referenced by sq(), and update().

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

◆ preFlightCheckVertVelFailed()

bool PreFlightChecker::preFlightCheckVertVelFailed ( const ekf2_innovations_s innov,
float  alpha 
)
private

Definition at line 95 of file PreFlightChecker.cpp.

References _filter_vel_d_innov, _vel_innov_spike_lim, _vel_innov_test_lim, checkInnovFailed(), InnovationLpf::update(), and ekf2_innovations_s::vel_pos_innov.

Referenced by sq(), and update().

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

◆ reset()

void PreFlightChecker::reset ( void  )

Definition at line 120 of file PreFlightChecker.cpp.

References _filter_flow_x_innov, _filter_flow_y_innov, _filter_heading_innov, _filter_hgt_innov, _filter_vel_d_innov, _filter_vel_e_innov, _filter_vel_n_innov, _has_heading_failed, _has_height_failed, _has_horiz_vel_failed, _has_vert_vel_failed, _is_using_ev_pos_aiding, _is_using_flow_aiding, _is_using_gps_aiding, and InnovationLpf::reset().

Referenced by Ekf2::resetPreFlightChecks().

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

◆ resetPreFlightChecks()

void PreFlightChecker::resetPreFlightChecks ( )
private

Referenced by sq().

Here is the caller graph for this function:

◆ selectHeadingTestLimit()

float PreFlightChecker::selectHeadingTestLimit ( )
private

Definition at line 61 of file PreFlightChecker.cpp.

References _can_observe_heading_in_flight, _heading_innov_test_lim, _is_using_ev_pos_aiding, _is_using_gps_aiding, and _nav_heading_innov_test_lim.

Referenced by preFlightCheckHeadingFailed(), and sq().

Here is the caller graph for this function:

◆ setUsingEvPosAiding()

void PreFlightChecker::setUsingEvPosAiding ( bool  val)
inline

Definition at line 78 of file PreFlightChecker.hpp.

References _is_using_ev_pos_aiding.

Referenced by Ekf2::runPreFlightChecks().

Here is the caller graph for this function:

◆ setUsingFlowAiding()

void PreFlightChecker::setUsingFlowAiding ( bool  val)
inline

Definition at line 77 of file PreFlightChecker.hpp.

References _is_using_flow_aiding.

Referenced by Ekf2::runPreFlightChecks().

Here is the caller graph for this function:

◆ setUsingGpsAiding()

void PreFlightChecker::setUsingGpsAiding ( bool  val)
inline

Definition at line 76 of file PreFlightChecker.hpp.

References _is_using_gps_aiding.

Referenced by Ekf2::runPreFlightChecks().

Here is the caller graph for this function:

◆ setVehicleCanObserveHeadingInFlight()

void PreFlightChecker::setVehicleCanObserveHeadingInFlight ( bool  val)
inline

Definition at line 74 of file PreFlightChecker.hpp.

References _can_observe_heading_in_flight.

Referenced by Ekf2::runPreFlightChecks().

Here is the caller graph for this function:

◆ sq()

static constexpr float PreFlightChecker::sq ( float  var)
inlinestatic

Definition at line 127 of file PreFlightChecker.hpp.

References preFlightCheckHeadingFailed(), preFlightCheckHeightFailed(), preFlightCheckHorizVelFailed(), preFlightCheckVertVelFailed(), resetPreFlightChecks(), and selectHeadingTestLimit().

Referenced by checkInnov2DFailed().

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

◆ update()

void PreFlightChecker::update ( float  dt,
const ekf2_innovations_s innov 
)

Definition at line 41 of file PreFlightChecker.cpp.

References _has_heading_failed, _has_height_failed, _has_horiz_vel_failed, _has_vert_vel_failed, _innov_lpf_tau_inv, InnovationLpf::computeAlphaFromDtAndTauInv(), preFlightCheckHeadingFailed(), preFlightCheckHeightFailed(), preFlightCheckHorizVelFailed(), and preFlightCheckVertVelFailed().

Referenced by Ekf2::runPreFlightChecks().

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

Member Data Documentation

◆ _can_observe_heading_in_flight

bool PreFlightChecker::_can_observe_heading_in_flight {}
private

◆ _filter_flow_x_innov

InnovationLpf PreFlightChecker::_filter_flow_x_innov
private

Preflight low pass filter optical flow innovation (rad)

Definition at line 155 of file PreFlightChecker.hpp.

Referenced by preFlightCheckHorizVelFailed(), and reset().

◆ _filter_flow_y_innov

InnovationLpf PreFlightChecker::_filter_flow_y_innov
private

Preflight low pass filter optical flow innovation (rad)

Definition at line 156 of file PreFlightChecker.hpp.

Referenced by reset().

◆ _filter_heading_innov

InnovationLpf PreFlightChecker::_filter_heading_innov
private

Preflight low pass filter heading innovation magntitude (rad)

Definition at line 154 of file PreFlightChecker.hpp.

Referenced by preFlightCheckHeadingFailed(), and reset().

◆ _filter_hgt_innov

InnovationLpf PreFlightChecker::_filter_hgt_innov
private

Preflight low pass filter height innovation (m)

Definition at line 153 of file PreFlightChecker.hpp.

Referenced by preFlightCheckHeightFailed(), and reset().

◆ _filter_vel_d_innov

InnovationLpf PreFlightChecker::_filter_vel_d_innov
private

Preflight low pass filter D axis velocity innovations (m/sec)

Definition at line 152 of file PreFlightChecker.hpp.

Referenced by preFlightCheckVertVelFailed(), and reset().

◆ _filter_vel_e_innov

InnovationLpf PreFlightChecker::_filter_vel_e_innov
private

Preflight low pass filter E axis velocity innovations (m/sec)

Definition at line 151 of file PreFlightChecker.hpp.

Referenced by reset().

◆ _filter_vel_n_innov

InnovationLpf PreFlightChecker::_filter_vel_n_innov
private

Preflight low pass filter N axis velocity innovations (m/sec)

Definition at line 150 of file PreFlightChecker.hpp.

Referenced by preFlightCheckHorizVelFailed(), and reset().

◆ _flow_innov_spike_lim

constexpr float PreFlightChecker::_flow_innov_spike_lim = 2.0f * _flow_innov_test_lim
staticprivate

Definition at line 175 of file PreFlightChecker.hpp.

Referenced by preFlightCheckHorizVelFailed().

◆ _flow_innov_test_lim

constexpr float PreFlightChecker::_flow_innov_test_lim = 0.1f
staticprivate

Definition at line 169 of file PreFlightChecker.hpp.

Referenced by preFlightCheckHorizVelFailed().

◆ _has_heading_failed

bool PreFlightChecker::_has_heading_failed {}
private

Definition at line 139 of file PreFlightChecker.hpp.

Referenced by hasHeadingFailed(), hasHorizFailed(), reset(), and update().

◆ _has_height_failed

bool PreFlightChecker::_has_height_failed {}
private

Definition at line 142 of file PreFlightChecker.hpp.

Referenced by hasHeightFailed(), hasVertFailed(), reset(), and update().

◆ _has_horiz_vel_failed

bool PreFlightChecker::_has_horiz_vel_failed {}
private

Definition at line 140 of file PreFlightChecker.hpp.

Referenced by hasHorizFailed(), hasHorizVelFailed(), reset(), and update().

◆ _has_vert_vel_failed

bool PreFlightChecker::_has_vert_vel_failed {}
private

Definition at line 141 of file PreFlightChecker.hpp.

Referenced by hasVertFailed(), hasVertVelFailed(), reset(), and update().

◆ _heading_innov_test_lim

constexpr float PreFlightChecker::_heading_innov_test_lim = 0.52f
staticprivate

Definition at line 167 of file PreFlightChecker.hpp.

Referenced by selectHeadingTestLimit().

◆ _hgt_innov_spike_lim

constexpr float PreFlightChecker::_hgt_innov_spike_lim = 2.0f * _hgt_innov_test_lim
staticprivate

Definition at line 173 of file PreFlightChecker.hpp.

Referenced by preFlightCheckHeightFailed().

◆ _hgt_innov_test_lim

constexpr float PreFlightChecker::_hgt_innov_test_lim = 1.5f
staticprivate

Definition at line 163 of file PreFlightChecker.hpp.

Referenced by preFlightCheckHeightFailed().

◆ _innov_lpf_tau_inv

constexpr float PreFlightChecker::_innov_lpf_tau_inv = 0.2f
staticprivate

Definition at line 159 of file PreFlightChecker.hpp.

Referenced by update().

◆ _is_using_ev_pos_aiding

bool PreFlightChecker::_is_using_ev_pos_aiding {}
private

◆ _is_using_flow_aiding

bool PreFlightChecker::_is_using_flow_aiding {}
private

Definition at line 146 of file PreFlightChecker.hpp.

Referenced by preFlightCheckHorizVelFailed(), reset(), and setUsingFlowAiding().

◆ _is_using_gps_aiding

bool PreFlightChecker::_is_using_gps_aiding {}
private

◆ _nav_heading_innov_test_lim

constexpr float PreFlightChecker::_nav_heading_innov_test_lim = 0.25f
staticprivate

Definition at line 165 of file PreFlightChecker.hpp.

Referenced by selectHeadingTestLimit().

◆ _vel_innov_spike_lim

constexpr float PreFlightChecker::_vel_innov_spike_lim = 2.0f * _vel_innov_test_lim
staticprivate

◆ _vel_innov_test_lim

constexpr float PreFlightChecker::_vel_innov_test_lim = 0.5f
staticprivate

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