# IS THERE ANY SOLUTION FOR THE MAGNETOMETER DISTURBANCE using DCM

Hello ,

I'm using the DCM algorithm but the correct yaw cannot be always exact because there is magnetic disturbance . Yes a calibrated magnetometer works well but how do we detect when we are near a magnetic disturbance like for example a cell phone and use only the gyro data and completly ignore the magnetometer for a while

For a EKF (Extended Kalman Filter ) it is "simple" because we estimate the state and have a variance for the magnetometer  . But in DCM, how can we solve this.
I tried to use a history of the old magnetometer data here in my example

code

/* for (int i=0;i<30;i+=3)
{
mag_history_moy_x+=mag_history[i];
mag_history_moy_y+=mag_history[i+1];
mag_history_moy_z+=mag_history[i+2];
}

mag_history_moy_x/=11; mag_history_moy_y/=11; mag_history_moy_z/=11;
/* for(int i=0;i<30;i+=3)
{

Serial.println(mag_history[i+2]);
}
Serial.println( mag_history_moy_z);
Serial.println("#");*/

/*if( fabs(Omega[2]) < 0.01 )
{
if(abs(mag_history_moy_x-mag_x) > 5 || abs(mag_history_moy_y-mag_y) > 5 || abs(mag_history_moy_z-mag_z) > 5)
{
//this is a perturbation
mag_weight=0.0f;
update_mag=false;
}
}
else
{ //is turning
mag_weight=1.0f;
update_mag=true;
}
*/

/*if( fabs(Omega[2]) < 0.01 )
{
Kp_YAW=0.1;
}*/

code

Views: 120

1

2

3

4

5

6

7

8

9

10

## Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

24 members

1355 members

207 members

52 members

719 members