Browse Source

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.
master
Gavan Fantom 10 years ago
parent
commit
56de69735f
  1. 7
      dcm.c

7
dcm.c

@ -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 */

Loading…
Cancel
Save