From 7880e2e6180914ef49e0c2ed665a24a14eca50f3 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Thu, 11 Jul 2019 11:29:53 +0200 Subject: [PATCH] Airspeed Selector: two fixes: -use temperature measurement from differential pressure sensor for TAS converison -first apply scale and then fuse wind estimator in airspeed validator with this TAS, not the raw TAS Signed-off-by: Silvan Fuhrer --- src/lib/AirspeedValidator/AirspeedValidator.cpp | 4 ++-- src/modules/airspeed_selector/airspeed_selector_main.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/AirspeedValidator/AirspeedValidator.cpp b/src/lib/AirspeedValidator/AirspeedValidator.cpp index b245054b516b..32003c65494f 100644 --- a/src/lib/AirspeedValidator/AirspeedValidator.cpp +++ b/src/lib/AirspeedValidator/AirspeedValidator.cpp @@ -61,11 +61,11 @@ AirspeedValidator::update_airspeed_validator(struct airspeed_validator_update_da } update_wind_estimator_params(); + update_EAS_scale(); + update_EAS_TAS(input_data.air_pressure_pa, input_data.air_temperature_celsius); update_wind_estimator(input_data.timestamp, input_data.airspeed_true_raw, input_data.lpos_valid, input_data.lpos_vx, input_data.lpos_vy, input_data.lpos_vz, input_data.lpos_evh, input_data.lpos_evv, input_data.att_q); - update_EAS_scale(); - update_EAS_TAS(input_data.air_pressure_pa, input_data.air_temperature_celsius); update_in_fixed_wing_flight(input_data.in_fixed_wing_flight); check_airspeed_innovation(input_data.timestamp, input_data.vel_test_ratio, input_data.mag_test_ratio); check_load_factor(input_data.accel_z); diff --git a/src/modules/airspeed_selector/airspeed_selector_main.cpp b/src/modules/airspeed_selector/airspeed_selector_main.cpp index 5c6769891fa4..b337e6f445af 100644 --- a/src/modules/airspeed_selector/airspeed_selector_main.cpp +++ b/src/modules/airspeed_selector/airspeed_selector_main.cpp @@ -284,7 +284,6 @@ AirspeedModule::Run() input_data.att_q[2] = _vehicle_attitude.q[2]; input_data.att_q[3] = _vehicle_attitude.q[3]; input_data.air_pressure_pa = _vehicle_air_data.baro_pressure_pa; - input_data.air_temperature_celsius = _vehicle_air_data.baro_temp_celcius; input_data.accel_z = _sensor_bias.accel_z; input_data.vel_test_ratio = _estimator_status.vel_test_ratio; input_data.mag_test_ratio = _estimator_status.mag_test_ratio; @@ -298,6 +297,7 @@ AirspeedModule::Run() input_data.airspeed_indicated_raw = airspeed_raw.indicated_airspeed_m_s; input_data.airspeed_true_raw = airspeed_raw.true_airspeed_m_s; input_data.airspeed_timestamp = airspeed_raw.timestamp; + input_data.air_temperature_celsius = airspeed_raw.air_temperature_celsius; /* update in_fixed_wing_flight for the current airspeed sensor validator */ /* takeoff situation is active from start till one of the sensors' IAS or groundspeed_EAS is above stall speed */ @@ -368,11 +368,11 @@ void AirspeedModule::update_params() _param_west_airspeed_scale.set(_airspeed_validator[_valid_airspeed_index].get_EAS_scale()); _param_west_airspeed_scale.commit_no_notification(); - mavlink_log_critical(&_mavlink_log_pub, "Airspeed: estimated scale: %1.2f. Saved in as ARSPV_ARSP_SCALE.", - (double)_airspeed_validator[_valid_airspeed_index].get_EAS_scale()); + mavlink_and_console_log_info(&_mavlink_log_pub, "Airspeed: estimated scale (ARSPV_ARSP_SCALE): %1.2f", + (double)_airspeed_validator[_valid_airspeed_index].get_EAS_scale()); } else { - mavlink_log_critical(&_mavlink_log_pub, "Airspeed: can't estimate scale as no valid sensor."); + mavlink_and_console_log_info(&_mavlink_log_pub, "Airspeed: can't estimate scale as no valid sensor."); } }