From fb53d5621a5f0bb3e9eb31677ab471e1a83d88ab Mon Sep 17 00:00:00 2001 From: James Cotton Date: Sun, 22 Apr 2012 19:01:41 -0500 Subject: [PATCH] Change the magKp term (hardcoded still) for revo complimentary filter so it tracks magnetic north when homelocation is set. --- flight/Modules/Attitude/revolution/attitude.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flight/Modules/Attitude/revolution/attitude.c b/flight/Modules/Attitude/revolution/attitude.c index 401bebf70..fc2ee1aac 100644 --- a/flight/Modules/Attitude/revolution/attitude.c +++ b/flight/Modules/Attitude/revolution/attitude.c @@ -243,7 +243,7 @@ float qmag; float attitudeDt; float mag_err[3]; float magKi = 0.000001f; -float magKp = 0.0001f; +float magKp = 0.01f; static int32_t updateAttitudeComplimentary(bool first_run) { @@ -294,14 +294,17 @@ static int32_t updateAttitudeComplimentary(bool first_run) attitudeSettings.AccelKp = 1; attitudeSettings.AccelKi = 0.9; attitudeSettings.YawBiasRate = 0.23; + magKp = 1; } else if ((attitudeSettings.ZeroDuringArming == ATTITUDESETTINGS_ZERODURINGARMING_TRUE) && (flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMING)) { attitudeSettings.AccelKp = 1; attitudeSettings.AccelKi = 0.9; attitudeSettings.YawBiasRate = 0.23; + magKp = 1; init = 0; } else if (init == 0) { // Reload settings (all the rates) AttitudeSettingsGet(&attitudeSettings); + magKp = 0.01f; init = 1; }