From 1f81101994ae4729c51f85c8208f3cd5be8fd1ea Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Wed, 10 Aug 2022 11:20:54 +0200 Subject: [PATCH] mc_att_control_main: do not jump throttle scaling when taking off 2fbb70d9ca94f442de1345221be18ba738cda952 made the lowest possible throttle value commanded by stick in Stabilized mode before taking off 0. The real world problem with this is that when takeoff is detected then the entire throttle scaling range jumps from [0, MPC_MANTHR_MIN] to [MPC_MANTHR_MIN, MPC_MANTHR_MIN]. As a result whenever MPC_MANTHR_MIN is not zero there is a thrust jump on every takeoff just at the moment takeoff is detected even when the stick is moved continuously. Because of this I suggest to revert to having a higher throttle value from the beginning on because it's less complicated and there's no obvious value in starting out with zero thrust if anyways not possible to go back to zero for safety once takeoff is detected. --- src/modules/mc_att_control/mc_att_control_main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/mc_att_control/mc_att_control_main.cpp b/src/modules/mc_att_control/mc_att_control_main.cpp index 4f119ffadea..d783c21bba9 100644 --- a/src/modules/mc_att_control/mc_att_control_main.cpp +++ b/src/modules/mc_att_control/mc_att_control_main.cpp @@ -96,17 +96,15 @@ MulticopterAttitudeControl::parameters_updated() float MulticopterAttitudeControl::throttle_curve(float throttle_stick_input) { - const float throttle_min = _landed ? 0.0f : _param_mpc_manthr_min.get(); - // throttle_stick_input is in range [0, 1] switch (_param_mpc_thr_curve.get()) { case 1: // no rescaling to hover throttle - return math::gradual(throttle_stick_input, 0.f, 1.f, throttle_min, _param_mpc_thr_max.get()); + return math::gradual(throttle_stick_input, 0.f, 1.f, _param_mpc_manthr_min.get(), _param_mpc_thr_max.get()); default: // 0 or other: rescale to hover throttle at 0.5 stick return math::gradual3(throttle_stick_input, 0.f, .5f, 1.f, - throttle_min, _param_mpc_thr_hover.get(), _param_mpc_thr_max.get()); + _param_mpc_manthr_min.get(), _param_mpc_thr_hover.get(), _param_mpc_thr_max.get()); } }