i want to fix direction not north

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i want to fix direction not north

Jump to solution
768 Views
timronaldo
Contributor II

Hi. i am user of K64F, sensor fusion.

 

after some test, i knew that the magnetometer has a slight error to point a north. ( about 8 degree (yaw))

 

so i want to fix a direction receiving from magnetometer , not real north

(For example, I want to designate the power up direction is north.)

 

Question 1 :  it is right way to use magnetometer offset compensation? like FXOS8700CQ_Mag_Calibration function in  FXOS8700CQ - Bare metal example project

 

 

 

i tried to test a FXOS8700CQ_Mag_Calibration function

when i push button, OnNMI works and FXOS8700CQ_Mag_Calibration function execute.

but it didn't work. mag raw data was stopped.

 

 

Question 2 :  i is problem about timing or I have to redesign a code?

 

Thank you.

Labels (1)
0 Kudos
1 Solution
471 Views
michaelestanley
NXP Employee
NXP Employee

Tim,

I'll have to let Tomas comment on your project-specific questions, as I haven't looked at his code.  But with regard to Question 1:  Magnetic calibration works by mapping a 3D ellipsoid of magnetic measurements into a 3D sphere.  Freescale's routines do this by performing something called a total least squares fit.  This attempts to minimize radial error in the mapping.  But at the end of the day, it can leave uncorrected some amount of pure rotation in the magnetic distortion.  That's why you still see some error even after correction.  The error results from fundamental assumptions in the mag cal routines, and there is nothing you can do in those routines to account for it.  The fix is to simply apply a fixed, final 3D rotation to the computed device orientation to account for the error.

Mike

View solution in original post

0 Kudos
1 Reply
472 Views
michaelestanley
NXP Employee
NXP Employee

Tim,

I'll have to let Tomas comment on your project-specific questions, as I haven't looked at his code.  But with regard to Question 1:  Magnetic calibration works by mapping a 3D ellipsoid of magnetic measurements into a 3D sphere.  Freescale's routines do this by performing something called a total least squares fit.  This attempts to minimize radial error in the mapping.  But at the end of the day, it can leave uncorrected some amount of pure rotation in the magnetic distortion.  That's why you still see some error even after correction.  The error results from fundamental assumptions in the mag cal routines, and there is nothing you can do in those routines to account for it.  The fix is to simply apply a fixed, final 3D rotation to the computed device orientation to account for the error.

Mike

0 Kudos