From 7ef3ae8828b3fb43ad53ec0c5eeda31b02925e15 Mon Sep 17 00:00:00 2001 From: bresch <brescianimathieu@gmail.com> Date: Mon, 12 Mar 2018 11:49:53 +0100 Subject: [PATCH] Multicopter mixer - Recompute safe roll_pitch_scale if not in air-mode If not in air-mode the mixer is not able to apply positive boosting and roll_pitch_scale is recomputed to apply symmetric - reduced - thrust. This has the consequence to cut completely the outputs when the thrust is set to zero. --- src/lib/mixer/mixer_multirotor.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/mixer/mixer_multirotor.cpp b/src/lib/mixer/mixer_multirotor.cpp index 42d97e8e65..398f30a73b 100644 --- a/src/lib/mixer/mixer_multirotor.cpp +++ b/src/lib/mixer/mixer_multirotor.cpp @@ -217,7 +217,6 @@ MultirotorMixer::mix(float *outputs, unsigned space) } else if (max_out > 1.0f) { boost = -(max_out - 1.0f); - } } else { @@ -226,7 +225,13 @@ MultirotorMixer::mix(float *outputs, unsigned space) } if (!_airmode) { - boost = math::min(boost, 0.0f); // Disable positive boosting if not in air-mode + // disable positive boosting if not in air-mode + // boosting is positive when min_out < 0.0 + // roll_pitch_scale is reduced accordingly + if (boost > 0.0f) { + roll_pitch_scale = thrust / (thrust - min_out); + boost = 0.0f; + } } // capture saturation -- GitLab