fw_pos_control_l1: if using air data (baro) copy every cycle

- vehicle_air_data won't necessary have an update every iteration and these adjusted throttle values aren't stored
 - this only would have worked in the past because the vast majority of systems were using the ms5611 barometer with a publication rate that's faster than the controller
This commit is contained in:
Daniel Agar
2020-07-17 17:14:45 -04:00
committed by GitHub
parent e3d31a881e
commit bdb4251fa4
@@ -1756,7 +1756,7 @@ FixedwingPositionControl::tecs_update_pitch_throttle(float alt_sp, float airspee
if (_param_fw_thr_alt_scl.get() > FLT_EPSILON) {
vehicle_air_data_s air_data;
if (_vehicle_air_data_sub.update(&air_data)) {
if (_vehicle_air_data_sub.copy(&air_data)) {
if (PX4_ISFINITE(air_data.baro_pressure_pa) && PX4_ISFINITE(_param_fw_thr_alt_scl.get())) {
// scale throttle as a function of sqrt(p0/p) (~ EAS -> TAS at low speeds and altitudes ignoring temperature)
const float eas2tas = sqrtf(CONSTANTS_STD_PRESSURE_PA / air_data.baro_pressure_pa);