5

With iOS5 the update frequencey of the Compass raw data reading, CLHeading, dropped dramatically. This rendered my augmented reality app unusable, because it depends on a close-to-real-time reading of the raw compass data.

Therefore I'm now trying to switch to CoreMotion. This provides more frequently updated magnetometer data:

cmManager = [[CMMotionManager alloc] init];    
[cmManager startMagnetometerUpdates];

I can then access the magneticField data anytime I want during the game:

CMMagneticField magneticField = cmManager.magnetometerData.magneticField;

The problem I have is the following: The data in CMMagneticField are in a different unit then CLHeading x/y/z data.

I would like to convert the CMMagneticField x/y/z data to the same units as CLHeading / CLHeadingComponentValue are - in order to be able to use my existing AR code.

Here a few readings:

7.3     /  17.64 /  -39.58          CLHeadingComponentValue X/Y/Z
-103.12 /  88.51 /  -20.05          CMMagneticField 

-10.81  /  -34.9 /  -18.6          CLHeadingComponentValue X/Y/Z
-121.00 /   33.29 /  3.1           CMMagneticField    

-20.8  /  -38.0 /   -4.0          CLHeadingComponentValue X/Y/Z
-132.9 /   32.2 /  14.4           CMMagneticField
jscs
  • 63,694
  • 13
  • 151
  • 195
fukus
  • 51
  • 3

1 Answers1

0

The only reference in documentation related to this is that CLHeadingComponentValue reported is normalized to the range -128 to +128. But to me it seems that some other sort of calibration is applied.

adig
  • 4,009
  • 1
  • 23
  • 23