diff --git a/libraries/AP_L1_Control/AP_L1_Control.cpp b/libraries/AP_L1_Control/AP_L1_Control.cpp index e4c145ce0c..c3a54bfc18 100644 --- a/libraries/AP_L1_Control/AP_L1_Control.cpp +++ b/libraries/AP_L1_Control/AP_L1_Control.cpp @@ -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; }