CLHeading accuracy

I had a vague idea for an app that would rely on CoreLocation, so I spent an hour playing with CoreLocation. What I discovered is that, on my iPhone 7 Plus, CLHeading usually reports a compass accuracy of 20 degrees, sometimes as high as 25 degrees, and never less than 10 degrees (which is rare). I think I would need that to be at most 5 degrees to be worth pursuing what I'm thinking about.


Am I asking too much of CoreLocation? Is there some trick I need to do to calibrate the compass for better accuracy? How do the apps that show the location of objects in the night sky, for example, do it, with the (lack of) accuracy I'm seeing reported? (Or is the reported accuracy overly pessimistic? I don't have a real compass to compare with.)

Answered by rjuniyer in 237823022

Hi Jeremy,


If you want to see the raw compass data you can use CoreMotion, and it will tell you about your acceleromenter, gyroscope, and compass states, all in a number of formats, and at a variety of accuracies and sampling speeds. This should give you a lot more accuracy than the CLHeading, which is primarily used for navigation apps.

Accepted Answer

Hi Jeremy,


If you want to see the raw compass data you can use CoreMotion, and it will tell you about your acceleromenter, gyroscope, and compass states, all in a number of formats, and at a variety of accuracies and sampling speeds. This should give you a lot more accuracy than the CLHeading, which is primarily used for navigation apps.

CLHeading accuracy
 
 
Q