Browse Source

AC_AttControl: get_throttle_avg_max always returns value in 0 to 1 range

throttle_avg_max is the total average throttle level (expressed as a number from 0 to 1) that the motors can safely be raised to in order to maintain attitude control.  This level can be higher than the pilot's or autopilot provided throttle level.
Previously passing in a negative throttle_in could result in a negative throttle_avg_max being returned.
master
Randy Mackay 9 years ago
parent
commit
24044e5611
  1. 1
      libraries/AC_AttitudeControl/AC_AttitudeControl_Multi.cpp

1
libraries/AC_AttitudeControl/AC_AttitudeControl_Multi.cpp

@ -203,6 +203,7 @@ float AC_AttitudeControl_Multi::get_throttle_boosted(float throttle_in) @@ -203,6 +203,7 @@ float AC_AttitudeControl_Multi::get_throttle_boosted(float throttle_in)
// throttle value should be 0 ~ 1
float AC_AttitudeControl_Multi::get_throttle_avg_max(float throttle_in)
{
throttle_in = constrain_float(throttle_in, 0.0f, 1.0f);
return MAX(throttle_in, throttle_in*MAX(0.0f,1.0f-_throttle_rpy_mix)+_motors.get_throttle_hover()*_throttle_rpy_mix);
}

Loading…
Cancel
Save