Browse Source

AP_Motors: Change from division to multiplication

apm_2208
murata 3 years ago committed by Andrew Tridgell
parent
commit
6d4a923cce
  1. 2
      libraries/AP_Motors/AP_MotorsCoax.cpp
  2. 2
      libraries/AP_Motors/AP_MotorsMatrix.cpp
  3. 2
      libraries/AP_Motors/AP_MotorsSingle.cpp

2
libraries/AP_Motors/AP_MotorsCoax.cpp

@ -153,7 +153,7 @@ void AP_MotorsCoax::output_armed_stabilizing() @@ -153,7 +153,7 @@ void AP_MotorsCoax::output_armed_stabilizing()
if (is_zero(rp_thrust_max)) {
rp_scale = 1.0f;
} else {
rp_scale = constrain_float((1.0f - MIN(fabsf(yaw_thrust), 0.5f * (float)_yaw_headroom / 1000.0f)) / rp_thrust_max, 0.0f, 1.0f);
rp_scale = constrain_float((1.0f - MIN(fabsf(yaw_thrust), 0.5f * (float)_yaw_headroom * 0.001f)) / rp_thrust_max, 0.0f, 1.0f);
if (rp_scale < 1.0f) {
limit.roll = true;
limit.pitch = true;

2
libraries/AP_Motors/AP_MotorsMatrix.cpp

@ -295,7 +295,7 @@ void AP_MotorsMatrix::output_armed_stabilizing() @@ -295,7 +295,7 @@ void AP_MotorsMatrix::output_armed_stabilizing()
// calculate the maximum yaw control that can be used
// todo: make _yaw_headroom 0 to 1
float yaw_allowed_min = (float)_yaw_headroom / 1000.0f;
float yaw_allowed_min = (float)_yaw_headroom * 0.001f;
// increase yaw headroom to 50% if thrust boost enabled
yaw_allowed_min = _thrust_boost_ratio * 0.5f + (1.0f - _thrust_boost_ratio) * yaw_allowed_min;

2
libraries/AP_Motors/AP_MotorsSingle.cpp

@ -162,7 +162,7 @@ void AP_MotorsSingle::output_armed_stabilizing() @@ -162,7 +162,7 @@ void AP_MotorsSingle::output_armed_stabilizing()
if (is_zero(rp_thrust_max)) {
rp_scale = 1.0f;
} else {
rp_scale = constrain_float((1.0f - MIN(fabsf(yaw_thrust), (float) _yaw_headroom / 1000.0f)) / rp_thrust_max, 0.0f, 1.0f);
rp_scale = constrain_float((1.0f - MIN(fabsf(yaw_thrust), (float) _yaw_headroom * 0.001f)) / rp_thrust_max, 0.0f, 1.0f);
if (rp_scale < 1.0f) {
limit.roll = true;
limit.pitch = true;

Loading…
Cancel
Save