Hi,
I'm receiving DATA X,Y,Z from the AK8963C, and calibrated it using MAGMASTER, and visualiser which is interesting.
I need help to write a routine (Oshonsoft) for converting the X and Y to give 360DEG, please. I gather that the Z is used in a more advanced program for tilt, which would be good, but later perhaps. I'm not sure if quadrants or Octants are most suitable.
In 1/ (TXT FILE) I haven't been able to get past the first quadrant, which works, from 0 to 41DEG.
Here are three equation examples that I've collected.
C.
1/ See attached TXT file.
-------------------------------------------------------------------------------------------------------------------------------------------------------
2/ Here is a Honeywell equation:
To account for the tangent function being valid over 180° and not allowing the y=0 division calculation, the following equations can be used:
Azimuth (x=0, y<0) = 90.0
Azimuth (x=0, y>0) = 270.0
Azimuth (x<0) = 180 - [arcTan(y/x)]*180/¹
Azimuth (x>0, y<0) = - [arcTan(y/x)]*180/¹
Azimuth (x>0, y>0) = 360 - [arcTan(y/x)]*180/¹
__________________________________________________________________________________________________________-
3/ https://www.embedded.com/design/other/4216719/Performing-efficient-arctangent-approximation
I'm receiving DATA X,Y,Z from the AK8963C, and calibrated it using MAGMASTER, and visualiser which is interesting.
I need help to write a routine (Oshonsoft) for converting the X and Y to give 360DEG, please. I gather that the Z is used in a more advanced program for tilt, which would be good, but later perhaps. I'm not sure if quadrants or Octants are most suitable.
In 1/ (TXT FILE) I haven't been able to get past the first quadrant, which works, from 0 to 41DEG.
Here are three equation examples that I've collected.
C.
1/ See attached TXT file.
-------------------------------------------------------------------------------------------------------------------------------------------------------
2/ Here is a Honeywell equation:
To account for the tangent function being valid over 180° and not allowing the y=0 division calculation, the following equations can be used:
Azimuth (x=0, y<0) = 90.0
Azimuth (x=0, y>0) = 270.0
Azimuth (x<0) = 180 - [arcTan(y/x)]*180/¹
Azimuth (x>0, y<0) = - [arcTan(y/x)]*180/¹
Azimuth (x>0, y>0) = 360 - [arcTan(y/x)]*180/¹
__________________________________________________________________________________________________________-
3/ https://www.embedded.com/design/other/4216719/Performing-efficient-arctangent-approximation
Attachments
-
1.3 KB Views: 4
Last edited: