From 270f6d87cd1b7905f7c68e08589a42fdbfe53145 Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Mon, 6 Oct 2014 17:47:16 +0200 Subject: [PATCH] OP-1516 changed handling of integrals in acrop --- flight/modules/Stabilization/innerloop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flight/modules/Stabilization/innerloop.c b/flight/modules/Stabilization/innerloop.c index 7501eed7e..0ce96edc8 100644 --- a/flight/modules/Stabilization/innerloop.c +++ b/flight/modules/Stabilization/innerloop.c @@ -293,10 +293,10 @@ static void stabilizationInnerloopTask() StabilizationBankMaximumRateToArray(stabSettings.stabBank.MaximumRate)[t] ); pid_scaler ascaler = create_pid_scaler(t); - float factor = 1.0f - (fabsf(stickinput[t]) * stabSettings.stabBank.AcroInsanityFactor); - ascaler.i *= factor; // this prevents Integral from getting too high while controlled manually + ascaler.i *= boundf(1.0f - (1.5f * fabsf(stickinput[t])), 0.0f, 1.0f); // this prevents Integral from getting too high while controlled manually float arate = pid_apply_setpoint(&stabSettings.innerPids[t], &ascaler, rate[t], gyro_filtered[t], dT); - actuatorDesiredAxis[t] = (1.0f - factor) * stickinput[t] + factor * arate; + float factor = fabsf(stickinput[t]) * stabSettings.stabBank.AcroInsanityFactor; + actuatorDesiredAxis[t] = factor * stickinput[t] + (1.0f - factor) * arate; } break; case STABILIZATIONSTATUS_INNERLOOP_DIRECT: