Question

I understand that it is not possible to get magnetic heading readings from the CoreLocation framework on an iPod Touch 4G, but it is possible to produce magnetometer readings using the CoreMotion framework.

I also understand that I need to use CMMotionManager and set the deviceMotionUpdateInterval to achieve this. I can then start and stop the updates with - (void)startMagnetometerUpdates and - (void)stopMagnetometerUpdates respectivley.

Now that I have my raw magnetometer data (x,y,z), how can I use it to achieve a magnetic heading?

I've seen some pretty complicated explanations online but would appreciate a code like example.

EDIT: My mistake, it is not possible to get magnetometer readings on the iPod Touch 4G.

Was it helpful?

Solution

The iPod touch does not have a magnetometer (See apple-devices-with-magnetometer), so whatever you are calling magnetometer data cannot be magnetometer data.

Also from CMMotionManager Class Reference (my emphasis)

A CMMotionManager object is the gateway to the motion services provided by iOS. These services provide an application with accelerometer data, rotation-rate data, magnetometer data, and other device-motion data such as attitude. These types of data originate with a device’s accelerometers and (on some models) its magnetometer and gyroscope.

So you won't be able to produce a magnetic heading.

What you are seeing is motion data from the other sensors that the iPod touch does have.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top