From 0b5da8b5998878064ed67be7992b7c413c443ee5 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 7 Nov 2012 16:24:12 -0800 Subject: Got rid of the control limitation at high throttle --- apps/systemlib/mixer/mixer_multirotor.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'apps/systemlib/mixer/mixer_multirotor.cpp') diff --git a/apps/systemlib/mixer/mixer_multirotor.cpp b/apps/systemlib/mixer/mixer_multirotor.cpp index a3577245d..52d79e369 100644 --- a/apps/systemlib/mixer/mixer_multirotor.cpp +++ b/apps/systemlib/mixer/mixer_multirotor.cpp @@ -161,20 +161,21 @@ MultirotorMixer::mix(float *outputs, unsigned space) float max = 0.0f; float fixup_scale; + /* use an output factor to prevent too strong control signals at low throttle */ float min_thrust = 0.05f; float max_thrust = 1.0f; - float output_factor = 0.0f; float startpoint_full_control = 0.20f; - float endpoint_full_control = 0.80f; + float output_factor; + /* keep roll, pitch and yaw control to 0 below min thrust */ if (thrust <= min_thrust) { output_factor = 0.0f; + /* linearly increase the output factor from 0 to 1 between min_thrust and startpoint_full_control */ } else if (thrust < startpoint_full_control && thrust > min_thrust) { - output_factor = (thrust/max_thrust)/startpoint_full_control; - } else if (thrust >= startpoint_full_control && thrust < endpoint_full_control) { + output_factor = (thrust/max_thrust)/(startpoint_full_control-min_thrust); + /* and then stay at full control */ + } else { output_factor = max_thrust; - } else if (thrust >= endpoint_full_control) { - output_factor = max_thrust/(endpoint_full_control-max_thrust); } roll *= output_factor; @@ -182,7 +183,6 @@ MultirotorMixer::mix(float *outputs, unsigned space) yaw *= output_factor; - /* perform initial mix pass yielding un-bounded outputs */ for (unsigned i = 0; i < _rotor_count; i++) { float tmp = roll * _rotors[i].roll_scale + -- cgit v1.2.3