Magnetometer

https://groups.google.com/forum/m/#!topic/uavdevboard/8wK9qk65xDo

Magnetic declination

https://groups.google.com/forum/m/#!topic/uavdevboard/MqzXKiuaGAQ Level plane with initializing

Regarding location of any IMU in general, including UDB in particular, there are two sensors to think about, the gyros and the accelerometers.

As far as the gyros are concerned, there are no restrictions at all on location, since the rotation rate is the same at any location on the plane.

It is only the accelerometers that you need to think about, because of unaccounted for centrifugal effects. The acceleration of the IMU is equal to the acceleration of the center of gravity, plus the centrifugal acceleration of the IMU with respect to the center of gravity, due to rotation of the plane.

The only location where the accelerometers do not experience an unaccounted for centrifugal effect is the center of gravity. So, ideally, that is where you would mount the IMU.

However, the unaccounted centrifugal acceleration is usually small, so you can get away with mounting an IMU anywhere on the plane, as long as it is not too far from center of gravity.

Most of the error arises from yaw rate. The unaccounted for acceleration in meters/sec/sec is W*W*R, where W is the yaw rate in radians per second, and R is distance from center of gravity in meters.

Mounting the IMU in front of or behind center of gravity will generate pitch error. Mounting the IMU off the side will generate roll error. But as long as you keep the offset less than about 12 inches, you should be fine.

For example, lets suppose you put your plane into a continuous tight turn at 60 degrees/sec (6 seconds for a full turn). That is about 1 radian per second. Suppose you mount the IMU 12 inches off center radially. That will generate an acceleration on the IMU of about 0.333 meters/sec/sec, or about 0.0333 g, which will generate an equivalent tilt error of about 2 degree. Nothing to worry about.

Notice that I keep using the phrase "unaccounted for centrifugal effect". That is because there is already a centrifugal compensation computation to account for centrifugal effects, that assumes the IMU is mounted at the center of gravity.

Actually, it is theoretically possible to account for the acceleration effect of mounting the IMU very far away from the center of gravity, all you need to know is the 3D location of the IMU with respect to center of gravity. But as far as I know, none of the popular autopilots let you do that.

magnetometer nulling

MatrixPilot_NASA_challenge branch : turn off magnetometer auto nulling and alignment during ground tests. to use this feature, #define GROUND_TEST (1)

https://code.google.com/p/gentlenav/source/detail?r=2755

19 march 2014 - 1
https://groups.google.com/forum/#!topic/uavdevboard-dev/bKoOlP2uIBU

Polishing up the magnetometer performance is on my list of things to do. When I do, I will have more complete answers to questions raised here. But in the meantime, I will share a few observations:

1. Some magnetometers have large built-in offsets. For those, it would probably be better to create a manual, ground-based procedure for determining a starting point for the offsets, and store them somehow. I plan to do that.

2. The magnetometer software has automated offset and alignment computations that run all of the time when the magnetometer is used. These algorithms do not work at all on the bench. They require the orientation of the aircraft to change once in a while. On the bench, the algorithms will diverge. Basically, we should turn off these algorithms when aircraft is not changing orientation, because it is not possible to compute offset or alignment under those conditions.

3. Regarding orientation of magnetometer, I can only speak to the UDB, I am not sure about AUAV3. Regarding UDB, you can either mount the mag separately or you can mount it on the UDB. If you mount it separately, you specify both the orientation of the UDB and the orientation of the mag. There is a veritable banquet of UDB orientation options, only a few mag orientation options. If you mount the mag directly to the UDB, you only have to specify which mag you are using. Regarding AUAV3, I am not sure, when I get around to testing AUAV3, I will look into it. Possibly the same holds true for AUAV3 as for UDB: for separately mounted mag, you specify orientation of AUAV3 and orientation of mag. For the mag built into AUAV3, you specify only the orientation of the AUAV3. But I don't know that for sure, its my speculation.

2
Bill, Mark,

This is my view on the current status of the magnetometer sensors, and their integration in MatrixPilot.

The original HMC5843 from 3DR (now out of production) worked reasonably well. It worked. I used it for the automatic takeoff and landing T3 competition. I think Phil also used it for his winning entry. That was External, and at the time we were attaching it to the UDB4, I believe. Bill did some super work, and I think it was originally based on that chip. So the end to end solution worked.

My next use of a magnetometer was actually testing the on board mag (HMC5883L) on the AUAV3. I got poor results. There were bad in the Google Earth view of the magnetometer vectors. They could be out by 90 degrees either side of North. I did some substantial ground testing in my garden, and captured the telemetry and analysed it, before deciding something was quite wrong.

So I bought a similar external 3DR magnetometer HMC5883L, and tested that on my UDB4, by replacing the original HMC5843. It has the same results as the AUAV3. So I concluded that the HMC5883L did not work well.

I then did some serious data collection on the external HMC5883L on the UDB4. And that resulted in my creating a 3D Python program to view the raw magnetometer vectors. (as shown in this video, which I think you have both seem). I could see that the offsets were large. And when I try to use the default MP code, it only auto adjust the offset by a small amount each time. It was going to take many many dances with the plane in my hand, twirling it around, to get the offsets to adjust. (May be 20 minutes).

There are probably two things that would be useful to improve the HMC5883L

1) It would be nice to know if other people have such huge offsets for that chip. Or do I just have a duff chip, or one that has been exposed to sever magnetisms

2) I would like to hard code the starting point for my offset for my chip (since I have measured it all in detail already). And then see if Bill's auto offset algorithm works fine with the initial hard coded offset as a starter.

That is as far as I got. I expect that in the summer, I will get back into the project again, with real coding and flying, and can then progress this issue, if no one has moved it on further.

Best wishes, Pete