AC_InputManager: Change from division to multiplication

This commit is contained in:
murata 2022-03-12 02:30:57 +09:00 committed by Andrew Tridgell
parent 08a1ad3c39
commit 12957c835a

View File

@ -67,20 +67,20 @@ float AC_InputManager_Heli::get_pilot_desired_collective(int16_t control_in)
// calculate stabilize collective value which scales pilot input to reduced collective range // calculate stabilize collective value which scales pilot input to reduced collective range
// code implements a 3-segment curve with knee points at 40% and 60% throttle input // code implements a 3-segment curve with knee points at 40% and 60% throttle input
if (control_in < 400){ // control_in ranges from 0 to 1000 if (control_in < 400){ // control_in ranges from 0 to 1000
slope_low = _heli_stab_col_min / 100.0f; slope_low = _heli_stab_col_min * 0.01f;
slope_high = _heli_stab_col_low / 100.0f; slope_high = _heli_stab_col_low * 0.01f;
slope_range = 0.4f; slope_range = 0.4f;
slope_run = control_in / 1000.0f; slope_run = control_in * 0.001f;
} else if(control_in <600){ // control_in ranges from 0 to 1000 } else if(control_in <600){ // control_in ranges from 0 to 1000
slope_low = _heli_stab_col_low / 100.0f; slope_low = _heli_stab_col_low * 0.01f;
slope_high = _heli_stab_col_high / 100.0f; slope_high = _heli_stab_col_high * 0.01f;
slope_range = 0.2f; slope_range = 0.2f;
slope_run = (control_in - 400) / 1000.0f; // control_in ranges from 0 to 1000 slope_run = (control_in - 400) * 0.001f; // control_in ranges from 0 to 1000
} else { } else {
slope_low = _heli_stab_col_high / 100.0f; slope_low = _heli_stab_col_high * 0.01f;
slope_high = _heli_stab_col_max / 100.0f; slope_high = _heli_stab_col_max * 0.01f;
slope_range = 0.4f; slope_range = 0.4f;
slope_run = (control_in - 600) / 1000.0f; // control_in ranges from 0 to 1000 slope_run = (control_in - 600) * 0.001f; // control_in ranges from 0 to 1000
} }
scalar = (slope_high - slope_low)/slope_range; scalar = (slope_high - slope_low)/slope_range;
@ -95,7 +95,7 @@ float AC_InputManager_Heli::get_pilot_desired_collective(int16_t control_in)
} }
if (_acro_col_expo <= 0.0f) { if (_acro_col_expo <= 0.0f) {
acro_col_out = control_in / 1000.0f; // control_in ranges from 0 to 1000 acro_col_out = control_in * 0.001f; // control_in ranges from 0 to 1000
} else { } else {
// expo variables // expo variables
float col_in, col_in3, col_out; float col_in, col_in3, col_out;