feat(fw_perf_model): Warn in FW_R_LIM is infeasible due to empty airspeed range (#27547)

* feat(fw_perf_model): warn in max bank infeasible due to empty airspeed range

* style(fw_perf_model): refer explicitly to max airspeed param

and only implicitly to max bank, so users will be inclined to adjust the
former.

* docs(fw-tuning): add section on roll compensation and effect on airspeed limits

* docs(fw-tuning): fix LaTeX

 - wrap text in \text{} so it does not render as if it were variable
   names
 - fix incorrect double escaping which made \sqrt{} and \frac{} not
   render
 - replace \over with \frac - the latter is nicer and handles more edge
   cases

* docs(fw-tuning): fix typo

In the above equation (supposed to be rearranged) there is only C_L, no C_D.

* docs(fw-tuning): correct mistake

only stall and min airspeed are load factor (due to bank) compensated in
the performance model, not trim.
This commit is contained in:
Balduin authored and GitHub committed 2026-06-04 16:35:48 +02:00
1 parent 5368e5f1fd
commit a1fa38025e
3 files changed
+46 -12

No files matched your search

@@ -218,6 +218,31 @@ bool PerformanceModel::runSanityChecks() const
ret = false;
}
const float max_bank_loadfactor = 1 / cosf(math::radians(_param_fw_r_lim.get()));
const float min_airspd_at_max_bank = getMinimumCalibratedAirspeed(max_bank_loadfactor, /*flaps_setpoint = */0.0f);
if (min_airspd_at_max_bank > _param_fw_airspd_max.get()) {
// Flying the maximum bank angle requires an airspeed above FW_AIRSPD_MAX.
// To mitigate, choose between these (or a combination):
// - Allow higher airspeeds (formula from getMinimumCalibratedAirspeed):
// FW_AIRSPD_MAX >= FW_AIRSPD_MIN * sqrt(WEIGHT_GROSS/WEIGHT_BASE) * sqrt(1/cos(FW_R_LIM))
// - Decrease max bank angle (same inequality, solved for FW_R_LIM):
// FW_R_LIM <= acos((FW_AIRSPD_MIN/FW_AIRSPD_MAX)**2 * (WEIGHT_GROSS/WEIGHT_BASE))
// If flying with a range of weight ratios, take the worst case (heaviest) for both these formulas.
/* EVENT
* @description
* - <param>FW_AIRSPD_MIN</param>: {1:.1}
* - <param>FW_AIRSPD_MAX</param>: {2:.1}
* - <param>FW_R_LIM</param>: {3:.1}
*/
events::send<float, float, float>(events::ID("fixedwing_position_control_conf_invalid_maxbank_infeasible"), events::Log::Error,
"Invalid configuration: FW_AIRSPD_MAX too low to sustain max bank angle",
_param_fw_airspd_min.get(), _param_fw_airspd_max.get(), _param_fw_r_lim.get());
ret = false;
}
return ret;
}
@@ -137,7 +137,8 @@ private:
(ParamFloat<px4::params::FW_THR_MIN>) _param_fw_thr_min,
(ParamFloat<px4::params::FW_THR_ASPD_MIN>) _param_fw_thr_aspd_min,
(ParamFloat<px4::params::FW_THR_ASPD_MAX>) _param_fw_thr_aspd_max,
(ParamFloat<px4::params::FW_AIRSPD_FLP_SC>) _param_fw_airspd_flp_sc
(ParamFloat<px4::params::FW_AIRSPD_FLP_SC>) _param_fw_airspd_flp_sc,
(ParamFloat<px4::params::FW_R_LIM>) _param_fw_r_lim
)
/**