mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 06:13:34 +08:00
FW rate controller: Don't constrain airspeed for scaling to maximum airspeed (#24622)
* don't constrain airspeed for scaling to maximum airspeed Signed-off-by: RomanBapst <bapstroman@gmail.com> * fix max function Signed-off-by: RomanBapst <bapstroman@gmail.com> * remove hardcoded max Signed-off-by: RomanBapst <bapstroman@gmail.com> --------- Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
@@ -179,10 +179,16 @@ float FixedwingRateControl::get_airspeed_and_update_scaling()
|
||||
*
|
||||
* Forcing the scaling to this value allows reasonable handheld tests.
|
||||
*/
|
||||
const float airspeed_constrained = constrain(constrain(airspeed, _param_fw_airspd_stall.get(),
|
||||
_param_fw_airspd_max.get()), 0.1f, 1000.0f);
|
||||
|
||||
_airspeed_scaling = (_param_fw_arsp_scale_en.get()) ? (_param_fw_airspd_trim.get() / airspeed_constrained) : 1.0f;
|
||||
|
||||
if (_param_fw_arsp_scale_en.get()) {
|
||||
const float min_airspeed = math::max(_param_fw_airspd_stall.get(), 0.1f);
|
||||
const float airspeed_constrained = math::max(airspeed, min_airspeed);
|
||||
_airspeed_scaling = _param_fw_airspd_trim.get() / airspeed_constrained;
|
||||
|
||||
} else {
|
||||
_airspeed_scaling = 1.0f;
|
||||
}
|
||||
|
||||
return airspeed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user