mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-09-25 15:36:01 +08:00
fix(fw_latlon_control): compensate TECS min airspeed for load factor (#27441)
* fix(fw_latlon_control): compensate TECS min airspeed for load factor TECS was given the load factor but not the minimum airspeed, derived from the performance model. TECS itself does the eas/tas conversion (altitude compensation) but not load factor or weight compensation, which is the responsibility of the performance model. Use set_equivalent_airspeed_min to update the latter, compensated for load factor, whenever attitude updates. Currently it is only called on param change, so TECS has a min airspeed based on outdated load factor and flap setpoint. * fix(fw_latlon_control): do not update tecs min airspeed on param update As we are updating it on every attitude sample now we can and should remove this -- as this calculates the load factor based on the attitude setpoint but the newly added continuous update is based on the actual attitude, the two would conflict and introduce spikes.
This commit is contained in:
@@ -95,7 +95,6 @@ FwLateralLongitudinalControl::parameters_update()
|
||||
_tecs.set_max_sink_rate(_param_fw_t_sink_max.get());
|
||||
_tecs.set_min_sink_rate(_performance_model.getMinimumSinkRate(_air_density));
|
||||
_tecs.set_equivalent_airspeed_trim(_performance_model.getCalibratedTrimAirspeed());
|
||||
_tecs.set_equivalent_airspeed_min(_performance_model.getMinimumCalibratedAirspeed(getLoadFactor(), _flaps_setpoint));
|
||||
_tecs.set_equivalent_airspeed_max(_performance_model.getMaximumCalibratedAirspeed());
|
||||
_tecs.set_throttle_damp(_param_fw_t_thr_damping.get());
|
||||
_tecs.set_integrator_gain_throttle(_param_fw_t_thr_integ.get());
|
||||
@@ -608,9 +607,14 @@ void FwLateralLongitudinalControl::updateAttitude() {
|
||||
_long_control_state.pitch_rad = euler_angles.theta();
|
||||
_yaw = euler_angles.psi();
|
||||
|
||||
// load factor due to banking
|
||||
const float load_factor_from_bank_angle = 1.0f / max(cosf(euler_angles.phi()), FLT_EPSILON);
|
||||
|
||||
// Used to compensate for higher induced drag during banking
|
||||
_tecs.set_load_factor(load_factor_from_bank_angle);
|
||||
// Used to give underspeed mitigation the correct minimum airspeed
|
||||
_tecs.set_equivalent_airspeed_min(
|
||||
_performance_model.getMinimumCalibratedAirspeed(load_factor_from_bank_angle, _flaps_setpoint)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user