From bda44fca0298b724e2566f0762736dd5fc8f4b87 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Fri, 28 Feb 2025 00:40:22 +0300 Subject: [PATCH] Remove dt multiplier from acc correction and increase acc weight More classical complementary filter implementation Increase effective accelerometer weight for faster convergence --- flix/estimate.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flix/estimate.ino b/flix/estimate.ino index fa8c306..8bcdf97 100644 --- a/flix/estimate.ino +++ b/flix/estimate.ino @@ -8,7 +8,7 @@ #include "lpf.h" #include "util.h" -#define WEIGHT_ACC 0.5f +#define WEIGHT_ACC 0.003 #define RATES_LFP_ALPHA 0.2 // cutoff frequency ~ 40 Hz LowPassFilter ratesFilter(RATES_LFP_ALPHA); @@ -35,7 +35,7 @@ void applyAcc() { // calculate accelerometer correction Vector up = attitude.rotateVector(Vector(0, 0, 1)); - Vector correction = Vector::angularRatesBetweenVectors(acc, up) * dt * WEIGHT_ACC; + Vector correction = Vector::angularRatesBetweenVectors(acc, up) * WEIGHT_ACC; // apply correction attitude = attitude.rotate(Quaternion::fromAngularRates(correction));