Browse Source

AP_Motors: get_compensation_gain gets div-by-zero check

mission-4.1.18
Randy Mackay 10 years ago
parent
commit
bae1722946
  1. 5
      libraries/AP_Motors/AP_Motors_Class.cpp

5
libraries/AP_Motors/AP_Motors_Class.cpp

@ -368,6 +368,11 @@ void AP_Motors::update_throttle_low_comp() @@ -368,6 +368,11 @@ void AP_Motors::update_throttle_low_comp()
float AP_Motors::get_compensation_gain() const
{
// avoid divide by zero
if (_lift_max <= 0.0f) {
return 1.0f;
}
float ret = 1.0f / _lift_max;
// air density ratio is increasing in density / decreasing in altitude

Loading…
Cancel
Save