Testing a DIYDrones magnetometer in HK's GCS

Testing a DIYDrones magnetometer in HK's GCS from Pete Hollands on Vimeo.


I test the DIY Drones magnetometer ( HMC5843 magnetometer breakout board ) using Happy Killmore's Ground Control Station connected using SERIAL_UDB_EXTRA telemetry format, to a UAV DevBoard V3 running
MatrixPilot (revision 729 of trunk).

photos:
picasaweb.google.com/​peter.hollands/​Twinstar2Build#55476230528302...

UAVDevBoard / MatrixPilot:
code.google.com/​p/​gentlenav/​wiki/​Home?tm=6

HK GCS:
code.google.com/​p/​happykillmore-gcs/​

DIY Drones Store:
store.diydrones.com/​HMC5843_Triple_Axis_Magnetometer_p/​br-hmc5843...

Self Calibrating Mathematics, and software to integrate via I2c written by William Premerlani:-
diydrones.com/​profile/​WilliamPremerlani

Source Code:
code.google.com/​p/​gentlenav/​source/​browse/​trunk/​libUDB/​magne...



Views: 584

Comment by ionut on December 6, 2010 at 3:19pm
What happens when you throw a GPS in?Which one will become the boss:the magnetometer or the GPS?

Developer
Comment by Pete Hollands on December 6, 2010 at 3:32pm
The magnetometer is the "boss" of heading in that it is used to calibrate the gyros's view of the yaw of the plane. (In accurate vocabulary, the magnetometer is used to calibrate the yaw of the plane in the Earth Coordinate System which is held in the Direction Cosine Matrix). If the magnetometer fails, MatrixPilot will fall back to calibrating the gyro yaw information (DCM yaw) using the wind corrected, GPS heading. If the magnetometer comes back on-line, it will use the magnetometer again.
Comment by Dale on December 6, 2010 at 5:50pm
That was a useful demo, thanks. I've gotta get playing on this again.
Comment by Rana on December 6, 2010 at 6:44pm
Hi Pete !

What a great safety precaution you have taken ! It's a great inspiration for everyone here.

Pete, are you able to see the model in the right side GE window ? Actually I am not.

Regards

Rana
Comment by Paul Mather on December 6, 2010 at 9:02pm
Pete, thanks for the video!!!

Please download my new version 1.0.18 which might handle the output speed a bit better. Not sure what the Hz is on the UDB but I was seeing some serious lag with the 50Hz output of the APM. This latest version handles the high speed much metter.

Also, do you think I should have a "set as north" type button to calibrate the 3D model for the direction you're flying? Sort of a heading offset that I could handle internally?
Comment by Paul Mather on December 6, 2010 at 9:07pm
Also, Pete, I think you were the one asking about which messages I'm adding for MAVlink? As of my GCS v1.0.17, it supports messages #27, #30, #32, #34, #39, #42 and #46.

Developer
Comment by Pete Hollands on December 7, 2010 at 12:34am
@Rana, The Google Earth Model in Happy's GCS stopped working for me on that revision. I'll try a newer revision later today.

@HK Personally, I don't think we need a North Calibration offset in the GCS. The MatrixPIlot magnetometer options allows the user to dial in an offset (Declination also known as Variation) to allow for the fact that magnetic North is not aligned with true North.

Thanks for the Mavlink message list. I'll take a look at that later.
Comment by Bryan Cuervo on December 7, 2010 at 5:55am
Hi Pete,

Have you experienced any error (deviation) based on where you place the magnetometer or when the motor is running?
I was thinking of running a test where everything is hooked up outside of the plane and there is a serial connection with a terminal program running. Bill's Mag Demo is running and spitting out the post processed data from the Mag in "serial-debug". Then I would move the plane around the set up and turn the motor on and off and see from the terminal info if there was any magnetic deviation.
Do you think all of this is necessary from your experience?
Thanks and thanks for the great video tutorials. I've watched them all!

Bryan
Comment by Paul Mather on December 7, 2010 at 6:58am
Pete, 1.0.21 has a "Zero Yaw" button.... it was really easy for me to add. I also support MAVlink #35 (Channel Raw) as of 1.0.21....

Developer
Comment by Pete Hollands on December 7, 2010 at 7:25am
Bryan,

Good question. I personally have only just started testing out the magnetometer.
I think it would be good to run some tests. Only a few people have so far been using the magnetometer.

I think we can categorize the deviation into two types:-
1) "Steady State Deviation" relative to the magnetometer
2) "Variable Deviation" relative to the magnetometer position.

I believe, but I'm not quite sure, that Bill has type 1), Steady State Deviation, covered off in his mathematics and code. Bill wrote a good overview of Maths behind Magnetometer calibration in this document. So if you read that, you will see that the plane was meant to continuously re-calibrate the magnetometer's "offsets", every time the plane turns in any direction, by using the accurate yet transient information provided by the gyros. Bill uses the terminology of "offsets" rather than deviation, and so I have not quite worked out whether they are effectively the same thing. I have not personally verified that the code fully implements the ideas in Bill's mathematics.

The electric engine magnetism is going to be harder to deal with. It's constantly changing over time.
There are two aspects to the changing magnetism in an electic motor:-
a) Changes during every revolution
b) Changes as a result of throttling up and down.
I thought that I had read that the PixHawk team over sampled their magnetometer (they are also using the HMC 5843 )at at least twice the rate of their electric motor, to overcome some of the issues. I just looked for that information again, and could not find it. So I may have got that wrong.

When you fly with the magnetometer, SERIAL_UDB_EXTRA transmits the calculated magnetic vector in the earth frame of reference ( ma:, mb:, mc:) . This is then translated into the Google Earth (GE) representation (by flan.pyw), and you will find that you can switch on a GE later to show the horizontal (compass style) magnetic vector. So it is then fairly easy to see if it is moving around during flight when the engines go on and off. e.g. Look for a swing in the magnetic vector and / or the plane's reported orientation between paths of full throttle, and gliding (throttle off).

If you are doing tests, then you should know that the MAVLink branch of matrix pilot with telemetry set to SERIAL_MAVLINK will graph the raw magnetometer data for you in real time in QGroundCotnrol (i.e. in the reference of the plane / UDB board) at 4 times / second. You could easily move that up to 8 times / second or possibly faster. The vector will be correct, although the actual milligaus figure is about by 1.3. (I don't think it's worth doing the floating point arithmetic in the dspic). See my video demo of Mavlink for instructions. (The magnetic values were static in that demo, but they now work in the latest release).

Well I hope that helps you a little further down this journey. Best wishes, Pete

Comment

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

Join DIY Drones

© 2014   Created by Chris Anderson.

Badges  |  Report an Issue  |  Terms of Service