gregtomasch / USFSMAX_MMC_Module

Test sketches and information to use the improved USFSMAX Module with MMC5983 magnetometer
9 stars 2 forks source link

Is the orientation output using magnetic north or true north? #5

Open teknoman117 opened 2 months ago

teknoman117 commented 2 months ago

I will fully admit, I don't have a great way of testing the accuracy of the resulting heading at the moment. Still working on integrating the USFSMAX (MMC) into my robot where I can check against an RTK GPS.

I updated the magnetic field strength and declination constants for my location in the config. After calibrating the 3D DHI corrector (a few different times), I noticed that the resulting heading seems to mostly correspond with the magnetic heading reported by my phone (I understand that phone compasses are also in general not great).

If I change the declination in the host tool after calibration and restart the USFSMAX, I notice that the reported heading doesn't seem to be affected.

Does the resulting quaternion use magnetic north or "true" north (as defined by declination)? Or does this value only matter during calibration?

kriswiner commented 2 months ago

Perhaps Greg can add something but:

"Does the resulting quaternion use magnetic north or "true" north (as defined by declination)?"

Should be true North such that when the USFSMAX is pointing to true North the yaw should read 0 and the quaternion should read 0, 0, 0, 1.

Changes to the configuration file should take effect after restart. I suggest that you remove all power, wait ten seconds, and then try again.

On Thu, Sep 19, 2024 at 10:44 PM Nathan Lewis @.***> wrote:

I will fully admit, I don't have a great way of testing the accuracy of the resulting heading at the moment. Still working on integrating the USFSMAX (MMC) into my robot where I can check against an RTK GPS.

I updated the magnetic field strength and declination constants for my location in the config. After calibrating the 3D DHI corrector (a few different times), I noticed that the resulting heading seems to mostly correspond with the magnetic heading reported by my phone (I understand that phone compasses are also in general not great).

If I change the declination in the host tool after calibration and restart the USFSMAX, I notice that the reported heading doesn't seem to be affected.

Does the resulting quaternion use magnetic north or "true" north (as defined by declination)? Or does this value only matter during calibration?

— Reply to this email directly, view it on GitHub https://github.com/gregtomasch/USFSMAX_MMC_Module/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKX7JVHY3ZREFI4BNGLZXOY4JAVCNFSM6AAAAABORJTQB6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGUZTOOJSGQ2TKNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

gregtomasch commented 2 months ago

Hi Nathan,

Apologies for the miserably slow response; lengthy tale of woe involving several aspects of life going haywire all at once…

“If I change the declination in the host tool after calibration and restart the USFSMAX, I notice that the reported heading doesn't seem to be affected.” I’m not sure what you are doing here… The declination is hard coded into the host application running on the host microcontroller. If it is changed, it should take effect when the system is rebooted. I recommend a full power-cycle.

The quaternion output from the USFSMAX has the declination applied internally and so heading is referenced to true north…

Best,

Greg

From: Nathan Lewis @.> Sent: Thursday, September 19, 2024 10:45 PM To: gregtomasch/USFSMAX_MMC_Module @.> Cc: Subscribed @.***> Subject: [gregtomasch/USFSMAX_MMC_Module] Is the orientation output using magnetic north or true north? (Issue #5)

I will fully admit, I don't have a great way of testing the accuracy of the resulting heading at the moment. Still working on integrating the USFSMAX (MMC) into my robot where I can check against an RTK GPS.

I updated the magnetic field strength and declination constants for my location in the config. After calibrating the 3D DHI corrector (a few different times), I noticed that the resulting heading seems to mostly correspond with the magnetic heading reported by my phone (I understand that phone compasses are also in general not great).

If I change the declination in the host tool after calibration and restart the USFSMAX, I notice that the reported heading doesn't seem to be affected.

Does the resulting quaternion use magnetic north or "true" north (as defined by declination)? Or does this value only matter during calibration?

— Reply to this email directly, view it on GitHub https://github.com/gregtomasch/USFSMAX_MMC_Module/issues/5 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABL6PMVSDFQPTC73VUEKGKTZXOY4JAVCNFSM6AAAAABORJTQB6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGUZTOOJSGQ2TKNQ . You are receiving this because you are subscribed to this thread. https://github.com/notifications/beacon/ABL6PMXPPRBXADKY64JEYNTZXOY4JA5CNFSM6AAAAABORJTQB6WGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHJORNHZQ.gif Message ID: @. @.> >

teknoman117 commented 1 month ago

Also apologies for my late response - I replied with the wrong sending email so GitHub silently bounced my response 😆

I was changing the declination in the host tool code, recompiling, flashing the new image to my Arduino, and power cycling the whole setup (leaving power disconnected for like 10 seconds).

I did not re-run calibration after this ... my arms were getting tired tumbling my robot around.

Using the ESP32 example as a base, I modified it to run on the Arduino Uno R3 (the pokey 8-bit one, mostly just wrapped strings in F() so that they are in flash and not RAM): https://github.com/teknoman117/USFSMAX_MMC_Module/tree/uno/MMC_USFS_MAX_Module_Uno_Simple_Host_Utility_v0.0

I suppose I should upgrade my uC to something more modern but there are other more pressing issues!

(if it matters it reports firmware 0x4)