Compass?

Hi all!

I’m trying to draw a compass in browser using Navio+ board magnetometer (also later to add gyro and accel values to compensate positioning).
I’m getting those type of values from board making a full rotation around:
Mag: -35.742 +27.253 -3.111
Mag: -34.491 +25.998 -2.247
Mag: -35.385 +26.177 -2.420
Mag: -35.206 +27.432 -2.938
Mag: -35.206 +28.150 -3.976
Mag: -28.058 +31.377 -4.667
Mag: -24.126 +30.660 -3.630
Mag: -16.620 +28.508 -3.630
Mag: -15.012 +31.556 -3.457
Mag: -13.761 +29.584 -1.901
Mag: -13.939 +22.950 -2.074
Mag: -5.897 +13.089 -1.901
Mag: -8.936 +11.475 -3.111
Mag: -10.008 +9.682 -3.457
Mag: -18.407 +8.427 -2.938
Mag: -26.271 +8.427 -4.321
Mag: -27.879 +10.041 -2.074
Mag: -29.845 +9.144 -3.284
Mag: -32.704 +15.240 -3.284
Mag: -35.921 +24.922 -3.976

There are many many examples of how to actually calculate heading, but none for Navio+ magnetometer…

I’m wondering if someone can help out here? Maybe it’s worth adding such example into Navio examples?

Thank you very much in advance!

1 Like

Well, after spending a few more hours… I think this post requires to be changed to: "How to get values for: Yaw, Pitch, Roll using Navio+ Python library?"
Thank you very much and sorry for inconvenience !

Sergey,

Any sample code for calculating heading will do (even for other compass chip), as they all basically operate with normalized measurements. But to get reliable readings read about hard and soft iron calibration.

We have an AHRS example in C++ that does calculate roll, pitch and yaw. It should be fairly easy to port it to python.

Hi,

Yes! You absolutely right! I’ve found it later yesterday just before going to sleep!
Thanks a lot!

hi
seregus. do you have the code in python about ahrs ?