iosaccelerometercllocationmanagermagnetometercmmotionmanager

iOS - Interpreting the CLHeading's x,y,z values


I am trying to get meaningful "device orientation" information from the values I read from the CLHeading class which I get from the updates of CLLocationManager object. This class contains three values, x,y,z which are in microteslas and as I understand from the docs, this is the vector pointing to the magnetic north of the earth with the device's magnetic bias filtered out. Now, what I want to be sure is, in which coordinate system do we have these readings? Are they relative to the device's own coordinate system which is shown in the following picture:

coords
(source: apple.com)

Which is used by the Core Motion framework?

Additionally, is there a robust,established way by which I can get the frame axis vectors in the picture above? According to my readings, iOS does not provide this with the exception of "attitude" of the device, which is provided as (pitch,yaw,roll) angles of the device which are updated by the Core Motion framework's startDeviceMotionUpdatesUsingReferenceFrame method. But I found that these angle values are very unreliable, since they are fluctating even as the device stands still. I need the device's orientation data as precise as possible, since I am going to use the data for the calibration of a system of cameras.

Thanks in advance.


Solution

  • According to my experiences from the moment I asked this question, it seems that yes, the magnetic North vector is in the device's own coordinate system, as well as the gravity vector obtained from the accelerometer.