PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <WindEstimator.hpp>
Public Member Functions | |
WindEstimator ()=default | |
~WindEstimator ()=default | |
WindEstimator (const WindEstimator &)=delete | |
WindEstimator & | operator= (const WindEstimator &)=delete |
WindEstimator (WindEstimator &&)=delete | |
WindEstimator & | operator= (WindEstimator &&)=delete |
void | update (uint64_t time_now) |
void | fuse_airspeed (uint64_t time_now, float true_airspeed, const matrix::Vector3f &velI, const matrix::Vector2f &velIvar) |
void | fuse_beta (uint64_t time_now, const matrix::Vector3f &velI, const matrix::Quatf &q_att) |
void | get_wind (float wind[2]) |
bool | is_estimate_valid () |
bool | check_if_meas_is_rejected (uint64_t time_now, float innov, float innov_var, uint8_t gate_size, uint64_t &time_meas_rejected, bool &reinit_filter) |
float | get_tas_scale () |
float | get_tas_innov () |
float | get_tas_innov_var () |
float | get_beta_innov () |
float | get_beta_innov_var () |
void | get_wind_var (float wind_var[2]) |
bool | get_wind_estimator_reset () |
void | set_wind_p_noise (float wind_sigma) |
void | set_tas_scale_p_noise (float tas_scale_sigma) |
void | set_tas_noise (float tas_sigma) |
void | set_beta_noise (float beta_var) |
void | set_tas_gate (uint8_t gate_size) |
void | set_beta_gate (uint8_t gate_size) |
void | enforce_airspeed_scale (float scale) |
Private Types | |
enum | { w_n = 0, w_e, tas } |
Private Member Functions | |
bool | initialise (const matrix::Vector3f &velI, const matrix::Vector2f &velIvar, const float tas_meas) |
void | run_sanity_checks () |
Private Attributes | |
matrix::Vector3f | _state |
state vector More... | |
matrix::Matrix3f | _P |
state covariance matrix More... | |
float | _tas_innov {0.0f} |
true airspeed innovation More... | |
float | _tas_innov_var {0.0f} |
true airspeed innovation variance More... | |
float | _beta_innov {0.0f} |
sideslip innovation More... | |
float | _beta_innov_var {0.0f} |
sideslip innovation variance More... | |
bool | _initialised {false} |
True: filter has been initialised. More... | |
float | _wind_p_var {0.1f} |
wind process noise variance More... | |
float | _tas_scale_p_var {0.0001f} |
true airspeed scale process noise variance More... | |
float | _tas_var {1.4f} |
true airspeed measurement noise variance More... | |
float | _beta_var {0.5f} |
sideslip measurement noise variance More... | |
uint8_t | _tas_gate {3} |
airspeed fusion gate size More... | |
uint8_t | _beta_gate {1} |
sideslip fusion gate size More... | |
uint64_t | _time_last_airspeed_fuse = 0 |
timestamp of last airspeed fusion More... | |
uint64_t | _time_last_beta_fuse = 0 |
timestamp of last sideslip fusion More... | |
uint64_t | _time_last_update = 0 |
timestamp of last covariance prediction More... | |
uint64_t | _time_rejected_beta = 0 |
timestamp of when sideslip measurements have consistently started to be rejected More... | |
uint64_t | _time_rejected_tas |
timestamp of when true airspeed measurements have consistently started to be rejected More... | |
bool | _wind_estimator_reset = false |
wind estimator was reset in this cycle More... | |
float | _enforced_airspeed_scale {-1.0f} |
by default we want to estimate the true airspeed scale factor (see enforce_airspeed_scale(...) ) More... | |
Definition at line 45 of file WindEstimator.hpp.
|
private |
Enumerator | |
---|---|
w_n | |
w_e | |
tas |
Definition at line 98 of file WindEstimator.hpp.
|
default |
|
default |
|
delete |
|
delete |
bool WindEstimator::check_if_meas_is_rejected | ( | uint64_t | time_now, |
float | innov, | ||
float | innov_var, | ||
uint8_t | gate_size, | ||
uint64_t & | time_meas_rejected, | ||
bool & | reinit_filter | ||
) |
Definition at line 353 of file WindEstimator.cpp.
Referenced by fuse_airspeed(), fuse_beta(), and is_estimate_valid().
|
inline |
Definition at line 95 of file WindEstimator.hpp.
References _enforced_airspeed_scale.
Referenced by AirspeedValidator::set_airspeed_scale_manual().
void WindEstimator::fuse_airspeed | ( | uint64_t | time_now, |
float | true_airspeed, | ||
const matrix::Vector3f & | velI, | ||
const matrix::Vector2f & | velIvar | ||
) |
Definition at line 140 of file WindEstimator.cpp.
References _initialised, _P, _state, _tas_gate, _tas_innov, _tas_innov_var, _tas_var, _time_last_airspeed_fuse, _time_rejected_tas, check_if_meas_is_rejected(), f(), initialise(), math::max(), run_sanity_checks(), tas, matrix::Matrix< Type, M, N >::transpose(), w_e, and w_n.
Referenced by AirspeedValidator::update_wind_estimator().
void WindEstimator::fuse_beta | ( | uint64_t | time_now, |
const matrix::Vector3f & | velI, | ||
const matrix::Quatf & | q_att | ||
) |
Definition at line 216 of file WindEstimator.cpp.
References _beta_gate, _beta_innov, _beta_innov_var, _beta_var, _initialised, _P, _state, _time_last_beta_fuse, _time_rejected_beta, check_if_meas_is_rejected(), f(), initialise(), matrix::Vector< Type, M >::length(), run_sanity_checks(), tas, matrix::Matrix< Type, M, N >::transpose(), w_e, and w_n.
Referenced by AirspeedValidator::update_wind_estimator(), and AirspeedModule::update_wind_estimator_sideslip().
|
inline |
Definition at line 77 of file WindEstimator.hpp.
References _beta_innov.
Referenced by AirspeedValidator::get_wind_estimator_states(), and AirspeedModule::update_wind_estimator_sideslip().
|
inline |
Definition at line 78 of file WindEstimator.hpp.
References _beta_innov_var.
Referenced by AirspeedValidator::get_wind_estimator_states(), and AirspeedModule::update_wind_estimator_sideslip().
|
inline |
Definition at line 75 of file WindEstimator.hpp.
References _tas_innov.
Referenced by AirspeedValidator::check_airspeed_innovation(), AirspeedValidator::get_wind_estimator_states(), and AirspeedModule::update_wind_estimator_sideslip().
|
inline |
Definition at line 76 of file WindEstimator.hpp.
References _tas_innov_var.
Referenced by AirspeedValidator::check_airspeed_innovation(), AirspeedValidator::get_wind_estimator_states(), and AirspeedModule::update_wind_estimator_sideslip().
|
inline |
Definition at line 74 of file WindEstimator.hpp.
Referenced by AirspeedValidator::get_wind_estimator_states(), AirspeedValidator::update_EAS_scale(), and AirspeedModule::update_wind_estimator_sideslip().
|
inline |
Definition at line 63 of file WindEstimator.hpp.
References _state, w_e, and w_n.
Referenced by AirspeedValidator::get_wind_estimator_states(), and AirspeedModule::update_wind_estimator_sideslip().
|
inline |
Definition at line 84 of file WindEstimator.hpp.
References _wind_estimator_reset.
Referenced by AirspeedValidator::check_airspeed_innovation().
|
inline |
Definition at line 79 of file WindEstimator.hpp.
References _P.
Referenced by AirspeedValidator::get_wind_estimator_states(), and AirspeedModule::update_wind_estimator_sideslip().
|
private |
Definition at line 42 of file WindEstimator.cpp.
References _P, _state, _time_rejected_beta, _time_rejected_tas, _wind_estimator_reset, f(), matrix::Matrix< Type, M, N >::setZero(), tas, matrix::Matrix< Type, M, N >::transpose(), w_e, and w_n.
Referenced by fuse_airspeed(), and fuse_beta().
|
inline |
Definition at line 69 of file WindEstimator.hpp.
References _initialised, and check_if_meas_is_rejected().
Referenced by AirspeedValidator::update_EAS_scale().
|
delete |
|
delete |
|
private |
Definition at line 310 of file WindEstimator.cpp.
References _enforced_airspeed_scale, _initialised, _P, _state, f(), ISFINITE, math::max(), tas, w_e, and w_n.
Referenced by fuse_airspeed(), and fuse_beta().
|
inline |
Definition at line 91 of file WindEstimator.hpp.
References _beta_gate.
Referenced by AirspeedModule::update_params().
|
inline |
Definition at line 89 of file WindEstimator.hpp.
References _beta_var.
Referenced by AirspeedModule::update_params().
|
inline |
Definition at line 90 of file WindEstimator.hpp.
References _tas_gate.
Referenced by AirspeedModule::update_params().
|
inline |
Definition at line 88 of file WindEstimator.hpp.
References _tas_var.
Referenced by AirspeedModule::update_params().
|
inline |
Definition at line 87 of file WindEstimator.hpp.
References _tas_scale_p_var.
Referenced by AirspeedModule::update_params().
|
inline |
Definition at line 86 of file WindEstimator.hpp.
References _wind_p_var.
Referenced by AirspeedModule::update_params().
void WindEstimator::update | ( | uint64_t | time_now | ) |
Definition at line 97 of file WindEstimator.cpp.
References _initialised, _P, _tas_scale_p_var, _time_last_update, _wind_estimator_reset, _wind_p_var, dt, and f().
Referenced by AirspeedValidator::update_wind_estimator(), and AirspeedModule::update_wind_estimator_sideslip().
|
private |
sideslip fusion gate size
Definition at line 120 of file WindEstimator.hpp.
Referenced by fuse_beta(), and set_beta_gate().
|
private |
sideslip innovation
Definition at line 110 of file WindEstimator.hpp.
Referenced by fuse_beta(), and get_beta_innov().
|
private |
sideslip innovation variance
Definition at line 111 of file WindEstimator.hpp.
Referenced by fuse_beta(), and get_beta_innov_var().
|
private |
sideslip measurement noise variance
Definition at line 118 of file WindEstimator.hpp.
Referenced by fuse_beta(), and set_beta_noise().
|
private |
by default we want to estimate the true airspeed scale factor (see enforce_airspeed_scale(...) )
Definition at line 130 of file WindEstimator.hpp.
Referenced by enforce_airspeed_scale(), and run_sanity_checks().
|
private |
True: filter has been initialised.
Definition at line 113 of file WindEstimator.hpp.
Referenced by fuse_airspeed(), fuse_beta(), is_estimate_valid(), run_sanity_checks(), and update().
|
private |
state covariance matrix
Definition at line 105 of file WindEstimator.hpp.
Referenced by fuse_airspeed(), fuse_beta(), get_wind_var(), initialise(), run_sanity_checks(), and update().
|
private |
state vector
Definition at line 104 of file WindEstimator.hpp.
Referenced by fuse_airspeed(), fuse_beta(), get_tas_scale(), get_wind(), initialise(), and run_sanity_checks().
|
private |
airspeed fusion gate size
Definition at line 119 of file WindEstimator.hpp.
Referenced by fuse_airspeed(), and set_tas_gate().
|
private |
true airspeed innovation
Definition at line 107 of file WindEstimator.hpp.
Referenced by fuse_airspeed(), and get_tas_innov().
|
private |
true airspeed innovation variance
Definition at line 108 of file WindEstimator.hpp.
Referenced by fuse_airspeed(), and get_tas_innov_var().
|
private |
true airspeed scale process noise variance
Definition at line 116 of file WindEstimator.hpp.
Referenced by set_tas_scale_p_noise(), and update().
|
private |
true airspeed measurement noise variance
Definition at line 117 of file WindEstimator.hpp.
Referenced by fuse_airspeed(), and set_tas_noise().
|
private |
timestamp of last airspeed fusion
Definition at line 122 of file WindEstimator.hpp.
Referenced by fuse_airspeed().
|
private |
timestamp of last sideslip fusion
Definition at line 123 of file WindEstimator.hpp.
Referenced by fuse_beta().
|
private |
timestamp of last covariance prediction
Definition at line 124 of file WindEstimator.hpp.
Referenced by update().
|
private |
timestamp of when sideslip measurements have consistently started to be rejected
Definition at line 125 of file WindEstimator.hpp.
Referenced by fuse_beta(), and initialise().
|
private |
timestamp of when true airspeed measurements have consistently started to be rejected
Definition at line 126 of file WindEstimator.hpp.
Referenced by fuse_airspeed(), and initialise().
|
private |
wind estimator was reset in this cycle
Definition at line 129 of file WindEstimator.hpp.
Referenced by get_wind_estimator_reset(), initialise(), and update().
|
private |
wind process noise variance
Definition at line 115 of file WindEstimator.hpp.
Referenced by set_wind_p_noise(), and update().