From 7da799d154f6f3c5f0c1a92cbad4288f83c90650 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 6 Nov 2012 19:02:01 -0800 Subject: Scale control signals with thrust for low thrust --- apps/systemlib/mixer/mixer_multirotor.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/apps/systemlib/mixer/mixer_multirotor.cpp b/apps/systemlib/mixer/mixer_multirotor.cpp index 0e714ed50..a3577245d 100644 --- a/apps/systemlib/mixer/mixer_multirotor.cpp +++ b/apps/systemlib/mixer/mixer_multirotor.cpp @@ -161,6 +161,28 @@ MultirotorMixer::mix(float *outputs, unsigned space) float max = 0.0f; float fixup_scale; + 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; + + if (thrust <= min_thrust) { + output_factor = 0.0f; + } 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 = max_thrust; + } else if (thrust >= endpoint_full_control) { + output_factor = max_thrust/(endpoint_full_control-max_thrust); + } + + roll *= output_factor; + pitch *= output_factor; + 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