I am trying to use a magnetometer as a reference vector for yaw drift cancellation in the direction cosine matrix.

Ok, so here's the nuts and bolts. If I measure a three axis magnetic vector in the aircraft frame of reference, the direction cosine matrix allows me to translate that vector back to the earth frame of reference.

Once it is rotated back, what exactly am I looking at? Do I compare the rotated vector to an Earth fixed magnetic field vector (i.e. from the NOAA tables)? If so, I have myself convinced that the rotated vector from the aircraft should exactly match the Earth fixed vector assuming a perfect matrix and compass. Assuming that is the case then any discrepancy between the Earth fixed vector and the rotated vector would be due to yaw drift or compass error.

And

FIGHT!

-Matt

You need to be a member of diydrones to add comments!

## Replies

If you want a solution, then I would expect there to be a robust DCM solution for the use of a magnetometer within a few weeks.

In terms of understanding: Bill Premerlani has documented the mathematics for finding offsets automatically, and created a demonstration program to test the magnetometer algorithms.

We have done an initial integration of the magnetometer code into MatrixPilot trunk, and this was flown at Sparkfun. However, we have discovered some systems issues, and Bill is currently making the code more robust.

Pete