The weighting mechanism to only consider accelerations roughly

in line with gravity wasn't working too well. Let's consider
all readings equally for now.
This commit is contained in:
2014-05-17 12:35:20 +00:00
parent 9d5e6da3bf
commit 56de69735f

7
dcm.c
View File

@@ -173,11 +173,13 @@ bool dcm_renormalise(float *v)
void dcm_drift_correction(float x, float y, float z)
{
float mag;
float weight;
float error[3];
int i;
#if DCM_WEIGHT
float mag;
mag = (1.0/fisqrt(x*x+y*y+z*z)) / GRAVITY;
mag = 1-mag;
@@ -190,6 +192,9 @@ void dcm_drift_correction(float x, float y, float z)
weight = 0.0;
if (weight > 1.0)
weight = 1.0;
#else
weight = 1.0;
#endif
/* error = cross product of dcm last row and acceleration vector */
/* third row = cross product of first two rows */