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