diff --git a/libraries/APM_Control/AP_AutoTune.cpp b/libraries/APM_Control/AP_AutoTune.cpp index 14b14b618fb27..87c84ee94a1c3 100644 --- a/libraries/APM_Control/AP_AutoTune.cpp +++ b/libraries/APM_Control/AP_AutoTune.cpp @@ -179,7 +179,7 @@ void AP_AutoTune::update(AP_PIDInfo &pinfo, float scaler, float angle_err_deg) // filter actuator without I term so we can take ratios without // accounting for trim offsets. We first need to include the I and // clip to 45 degrees to get the right value of the real surface - const float clipped_actuator = constrain_float(pinfo.FF + pinfo.P + pinfo.D + pinfo.I, -45, 45) - pinfo.I; + const float clipped_actuator = constrain_float(pinfo.FF + pinfo.P + pinfo.D + pinfo.DFF + pinfo.I, -45, 45) - pinfo.I; const float actuator = actuator_filter.apply(clipped_actuator); const float actual_rate = rate_filter.apply(pinfo.actual); diff --git a/libraries/APM_Control/AP_PitchController.cpp b/libraries/APM_Control/AP_PitchController.cpp index 85689d1dce10d..1c02fdb0a86bf 100644 --- a/libraries/APM_Control/AP_PitchController.cpp +++ b/libraries/APM_Control/AP_PitchController.cpp @@ -218,13 +218,14 @@ float AP_PitchController::_get_rate_out(float desired_rate, float scaler, bool d pinfo.P *= deg_scale; pinfo.I *= deg_scale; pinfo.D *= deg_scale; + pinfo.DFF *= deg_scale; // fix the logged target and actual values to not have the scalers applied pinfo.target = desired_rate; pinfo.actual = degrees(rate_y); // sum components - float out = pinfo.FF + pinfo.P + pinfo.I + pinfo.D; + float out = pinfo.FF + pinfo.P + pinfo.I + pinfo.D + pinfo.DFF; if (ground_mode) { // when on ground suppress D and half P term to prevent oscillations out -= pinfo.D + 0.5*pinfo.P; diff --git a/libraries/APM_Control/AP_RollController.cpp b/libraries/APM_Control/AP_RollController.cpp index 2ec7efd6c1ae2..8717828cda403 100644 --- a/libraries/APM_Control/AP_RollController.cpp +++ b/libraries/APM_Control/AP_RollController.cpp @@ -206,13 +206,14 @@ float AP_RollController::_get_rate_out(float desired_rate, float scaler, bool di pinfo.P *= deg_scale; pinfo.I *= deg_scale; pinfo.D *= deg_scale; + pinfo.DFF *= deg_scale; // fix the logged target and actual values to not have the scalers applied pinfo.target = desired_rate; pinfo.actual = degrees(rate_x); // sum components - float out = pinfo.FF + pinfo.P + pinfo.I + pinfo.D; + float out = pinfo.FF + pinfo.P + pinfo.I + pinfo.D + pinfo.DFF; if (ground_mode) { // when on ground suppress D term to prevent oscillations out -= pinfo.D + 0.5*pinfo.P; diff --git a/libraries/APM_Control/AP_YawController.cpp b/libraries/APM_Control/AP_YawController.cpp index af60641e062be..f99333aca1e7e 100644 --- a/libraries/APM_Control/AP_YawController.cpp +++ b/libraries/APM_Control/AP_YawController.cpp @@ -344,6 +344,7 @@ float AP_YawController::get_rate_out(float desired_rate, float scaler, bool disa pinfo.P *= deg_scale; pinfo.I *= deg_scale; pinfo.D *= deg_scale; + pinfo.DFF *= deg_scale; pinfo.limit = limit_I; // fix the logged target and actual values to not have the scalers applied @@ -351,7 +352,7 @@ float AP_YawController::get_rate_out(float desired_rate, float scaler, bool disa pinfo.actual = degrees(rate_z); // sum components - float out = pinfo.FF + pinfo.P + pinfo.I + pinfo.D; + float out = pinfo.FF + pinfo.P + pinfo.I + pinfo.D + pinfo.DFF; // remember the last output to trigger the I limit _last_out = out;