From 42ac4018b8e2e30a88f2ed13c466da8896b187d1 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Thu, 23 Feb 2012 10:59:00 -0600 Subject: [PATCH] Woops. Fix really nasty bug in vbar mode I introduced. Also fix small bug in scoping of gyro gain that made it not work. --- flight/Modules/Stabilization/stabilization.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flight/Modules/Stabilization/stabilization.c b/flight/Modules/Stabilization/stabilization.c index c49a36a17..dbd905fd6 100644 --- a/flight/Modules/Stabilization/stabilization.c +++ b/flight/Modules/Stabilization/stabilization.c @@ -333,11 +333,11 @@ static void stabilizationTask(void* parameters) // Command signal is composed of stick input added to the gyro and virtual flybar float gyro_gain = 1.0f; if (vbar_gyros_suppress) { - float gyro_gain = (1.0f - fabs(rateDesiredAxis[i])); + gyro_gain = (1.0f - fabs(rateDesiredAxis[i])); gyro_gain = (gyro_gain < 0) ? 0 : gyro_gain; } float command = rateDesiredAxis[i] - gyro_gain * ( - vbar_integral[i] * pids[PID_VBAR_ROLL + i].i - + vbar_integral[i] * pids[PID_VBAR_ROLL + i].i + gyro_filtered[i] * pids[PID_VBAR_ROLL + i].p); actuatorDesiredAxis[i] = bound(command);