Browse Source

L1_Control: constrain the roll to handle floating point errors

master
Andrew Tridgell 12 years ago
parent
commit
97bfd16bd1
  1. 3
      libraries/AP_L1_Control/AP_L1_Control.cpp

3
libraries/AP_L1_Control/AP_L1_Control.cpp

@ -37,8 +37,9 @@ const AP_Param::GroupInfo AP_L1_Control::var_info[] PROGMEM = { @@ -37,8 +37,9 @@ const AP_Param::GroupInfo AP_L1_Control::var_info[] PROGMEM = {
*/
int32_t AP_L1_Control::nav_roll_cd(void)
{
int32_t ret;
float ret;
ret = degrees(atanf(_latAccDem * 0.101972f) * 100.0f); // 0.101972 = 1/9.81
ret = constrain(ret, -9000, 9000);
return ret;
}

Loading…
Cancel
Save