Team,

The above picture shows an interesting side effect of magnetometer misalignment: complete reversal of the measured horizontal component of the earth's magnetic field.

The effect was discovered by Peter Hollands during his analysis of the data from one of Ric Kuebler's flights. Ric was using the UAV DevBoard (UDB) with MatrixPilot autopilot software. The airplane icons in the picture indicate the estimated orientation of the plane. The blue arrows indicate the estimated direction of the horizontal component of the measured magnetic field, in the earth frame of reference.

The magnetometer is mounted separately from the UDB. It turns out that there was a small roll misalignment of the magnetometer in Ric's setup. Ric aligned his magnetometer more carefully, and the flipping disappeared on subsequent flights. But there was a nagging issue.

Because of the large vertical component of the earth's magnetic field in many parts of the world, magnetometer-based yaw information is particularly vulnerable to misalignment. In my neighborhood, the vertical magnetic field is three times as large as the horizontal field. As a result, a little bit of mechanical misalignment of the magnetometer, and certain attitudes of the aircraft can cause complete flipping of the measured magnetic field.

It is not all that easy to align a separately mounted magnetometer. Even a 5 degree misalignment is too much. I wondered if there might be a way to solve the problem with software....

While I was analyzing the data from Ric's flight, on a hunch, I plotted the measured horizontal magnetic field against the heading:

The plot told me two things. First, it told me that there was a misalignment issue. But it also told me how much the misalignment was. If that could be determined from the flight data from a post-flight analysis, it should be possible to figure it out in flight as well. So I set out to find a way to determine magnetometer misalignment in flight, and automatically compensate for it. The theory, implementation, and testing are reported here.

The method works much better than I originally thought it might. It will automatically and exactly compensate for any amount of roll, pitch, and yaw misalignment between a magnetometer and its partner IMU, including 180 degrees.

Best regards,

Bill Premerlani

 



Views: 6946

Comment by MariusN on October 18, 2011 at 5:59am

In theory you only need 3 points, but in practice, due to measurement noise, it would be preferable to have an overdetermined system that you can then solve by least squares or by a recursive algorithm such as a Kalman filter or the fixed-gain observer that he is proposing.


Developer
Comment by Pete Hollands on October 18, 2011 at 6:11am
Ionut: The magnetometer measures a vector, not a point.
So I dont see how 3 points measured in both coordinates can be applied.
Comment by MariusN on October 18, 2011 at 6:21am

Bill, you might be interested to read the paper "Magnetometer Autocalibration Leveraging Measurement Locus Constraints" by Prof. Egziabher in the AIAA Journal of Aircraft, Vol.44, No.4. The algorithm he proposes solves for hard iron bias, scale factor error, and misalignment simultaneously, without the need for body angular rate information. Where the angular rate is really necessary is in the estimation of soft iron errors, and I'm thinking that your algorithm could be adapted to do just that.

Comment by ionut on October 18, 2011 at 7:19am

Pete you are right.Magnetometer provides a scaled measure of the compounded magnetic field in its coordinate frame.From this you extract an compass.

There are electromagnetic devices that can offer 3d position and orientation.http://www.ndigital.com/medical/technology-em.php

 

I thought this magnetometer works similar.But it seems like not.


T3
Comment by William Premerlani on October 18, 2011 at 7:46am

Hi Ionut and Marius,

Thanks for your comments. You two seem to be creative and well-informed, I would love to figure out a way that we might work together on some interesting problem together. What say you?

Regarding Horn's method, I have used it in the past, and it was on my list of candidate solutions for this problem. There were three reasons that I prefer the method that I implemented.

1. Horn's method requires two sets of points (vectors) that have a correspondence with each other. In other words, you cannot compare apples with oranges. They have to be the same vectors measured in two different ways. In this problem, one set would have to be the "known" earth magnetic field vector transformed into the body frame by the direction cosine matrix, and the other set would be measured magnetometer vectors. The problem with that is that I did not want to ask the users to somehow specify the vertical component of the earth magnetic field. Its tough enough for them to get the declination angle. I did figure out a way to determine the earth magnetic field from the measurements, but it seemed to me that it would not be very accurate, so I never tried it.

2. I prefer methods that use pairs of points without throwing any of them away. It simplifies implementation. Horn's method requires 3 points, and they can not be co-linear. I did not want to have to worry about special casing anything. And the method that I am using does not have any problem when the aircraft is not rotating, in which case all the vectors are identical, and provide no useful information.

3. The method that I am using exploits all of the data coming in, without much memory storage. And the pairs of points automatically get weighted by their information content.

Best regards,

Bill


T3
Comment by William Premerlani on October 18, 2011 at 8:10am

Ionut and Marius,

One more advantage of the method I came up with: it is able to detect and adjust for yaw misalignment of the magnetometer, even when there is yaw error in the direction cosine matrix. It seems to me that Horn's method would attribute yaw error in the direction cosine matrix to misalignment of the magnetometer. If you used Horn's method, you would wind up losing yaw lock if you used the yaw information, and would not be able to detect yaw misalignment if you did not.

Best regards,

Bill

Comment by ionut on October 18, 2011 at 12:17pm

Mr.Premerlani unfortunately I don't think I'm up to the task because I lack solid algebra and physics skills.(not my field not even remote).I used some of these techniques in medical field.

Regarding magnetometers I think that magnetometer can offer limited information just by reading earth magnetic field.You will need multiple magnetic fields to extract position and orientation using a magnetometer.

Also I think there is a delay between magneto reading and gyro reading :(.


T3
Comment by William Premerlani on October 18, 2011 at 12:36pm

Hi ionut,

You are absolutely right, there is a delay between magneto reading and gyro reading. I have already taken care of that to a "gnat's eyelash". You might want to read my report. I figured out ways to get very high performance out of inexpensive gyros and magnetometers. I pulled out all the stops to be able to maintain high accuracy of orientation estimation during sustained (indefinite), high rate rotations (500 degree/second) around any axis. Two techniques in my bag of tricks was to automatically calibrate the gyro gains, and to account for magnetometer reporting latency.

As part of the testing, I spun the IMU and magnetometer at 78 RPM, and blinked an LED to create a visual pattern that I used to determine the group delay of the magnetometer. One of the pictures from the research is shown at the top of this reply.

Best regards,

Bill

 


T3
Comment by William Premerlani on October 18, 2011 at 12:47pm

Ionut,

In case you don't get around to reading my report, and are wondering how to account for magnetometer delay.

First, you have to determine what the delay is. That is easy enough to do with a camera: spin the IMU and magnetometer. Use the mag readings to implement yaw lock. Flash an LED when the heading passes a certain location. Plot the angular position of the flash versus rotation rate. From that you can figure out the magnetometer group delay.

Once you know the magnetometer group delay, its easy to account for it. It just like pretriggering a scope. You take a snapshot of the direction cosine matrix prior to receiving the magnetometer data. You wind up orientation information that matches in time with magnetometer information.

Then, to prove that it all works, you repeat the spin test. If you have everything working right, then the angular location of the LED blink does not move as speed varies.

In some ways it is like using a timing light to adjust the ignition timing of your motorcycle.

Best regards,

Bill

 

Comment by Bill Donovan on October 21, 2011 at 7:13am

Bill,

Your point about the strength of the magnetic field being stronger vertically than laterally can definitely be a pain. I've spent a few seasons in Antarctica flying UAVs (http://meridianuas.blogspot.com/) and all I can say is strange things happen with magnetometers down there. If you look at the mag declination map, we were in the spot that looks like a cowlick. Our decision was to take it out of the loop completely, but still record the data. Basically when we performed our hard and soft iron calibrations things looked good while the airplane was level. Then when you tilt the airplane even just a few degrees the flux values change wildly. The data from flight looked "OK", but it was not nearly trustworthy enough. Not a big surprise that a mag sucks in a place with a 140deg mag declination.

One question I have for you is, are you using the magnetometer in the attitude estimation?

Regards,

Bill Donovan

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2017   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service