mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-07 03:30:36 +08:00
Airspeed Selector: enable airspeed_validated in control modules (#12887)
* FW attitude controller, FW position controller and VTOL attitude controller subscribe to airspeed_validated topic * add possibility to switch off the airspeed valid checks * remove airspeed valid checks from commander * clean up of VTOL transition logic * Airspeed Selector: remove dynamic allocation of airspeed validators (depending on number of connected sensors) but do it statically for the maximum number allowed. Check for number of connected sensors not only during start up, but always when vehicle is disarmed. * Airspeed Selector: change work queue from lp to att_pos_ctrl as this module is safety-critical * add airspeed selector to px4_fmu-v2 defaults
This commit is contained in:
committed by
Daniel Agar
parent
a46581987c
commit
ebdc29bc5f
@@ -109,10 +109,23 @@ AirspeedValidator::get_wind_estimator_states(uint64_t timestamp)
|
||||
return wind_est;
|
||||
}
|
||||
|
||||
void
|
||||
AirspeedValidator::set_airspeed_scale_manual(float airspeed_scale_manual)
|
||||
{
|
||||
_airspeed_scale_manual = airspeed_scale_manual;
|
||||
_wind_estimator.enforce_airspeed_scale(1.0f / airspeed_scale_manual); // scale is inverted inside the wind estimator
|
||||
}
|
||||
|
||||
void
|
||||
AirspeedValidator::update_EAS_scale()
|
||||
{
|
||||
_EAS_scale = 1.0f / math::constrain(_wind_estimator.get_tas_scale(), 0.75f, 1.25f);
|
||||
if (_wind_estimator.is_estimate_valid()) {
|
||||
_EAS_scale = 1.0f / math::constrain(_wind_estimator.get_tas_scale(), 0.5f, 2.0f);
|
||||
|
||||
} else {
|
||||
_EAS_scale = _airspeed_scale_manual;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@@ -186,7 +199,7 @@ AirspeedValidator::check_load_factor(float accel_z)
|
||||
{
|
||||
// Check if the airpeed reading is lower than physically possible given the load factor
|
||||
|
||||
bool bad_number_fail = false; // disable this for now
|
||||
const bool bad_number_fail = false; // disable this for now
|
||||
|
||||
if (_in_fixed_wing_flight) {
|
||||
|
||||
@@ -214,7 +227,7 @@ void
|
||||
AirspeedValidator::update_airspeed_valid_status(const uint64_t timestamp)
|
||||
{
|
||||
|
||||
bool bad_number_fail = false; // disable this for now
|
||||
const bool bad_number_fail = false; // disable this for now
|
||||
|
||||
// Check if sensor data is missing - assume a minimum 5Hz data rate.
|
||||
const bool data_missing = (timestamp - _time_last_airspeed) > 200_ms;
|
||||
|
||||
@@ -98,8 +98,9 @@ public:
|
||||
}
|
||||
|
||||
void set_wind_estimator_beta_gate(uint8_t gate_size) { _wind_estimator.set_beta_gate(gate_size); }
|
||||
void set_wind_estimator_scale_estimation_on(bool scale_estimation_on) {_wind_estimator_scale_estimation_on = scale_estimation_on;}
|
||||
void set_airspeed_scale(float airspeed_scale_manual) { _wind_estimator.enforce_airspeed_scale(1.0f / airspeed_scale_manual);} // scale is inverted inside the wind estimator
|
||||
void set_wind_estimator_scale_estimation_on(bool scale_estimation_on) { _wind_estimator_scale_estimation_on = scale_estimation_on;}
|
||||
|
||||
void set_airspeed_scale_manual(float airspeed_scale_manual);
|
||||
|
||||
// setters for failure detection tuning parameters
|
||||
void set_tas_innov_threshold(float tas_innov_threshold) { _tas_innov_threshold = tas_innov_threshold; }
|
||||
@@ -115,6 +116,7 @@ private:
|
||||
|
||||
// wind estimator parameter
|
||||
bool _wind_estimator_scale_estimation_on{false}; ///< online scale estimation (IAS-->CAS/EAS) is on
|
||||
float _airspeed_scale_manual{1.0f}; ///< manually entered airspeed scale
|
||||
|
||||
// general states
|
||||
bool _in_fixed_wing_flight{false}; ///< variable to bypass innovation and load factor checks
|
||||
|
||||
Reference in New Issue
Block a user