Question

I can't seem to manage to make my compass application function anywhere near as smoothly as Apple's, and I haven't seen any compass applications from independent developers that don't lag and sometimes jump erratically like mine does.

Is there any open source that demonstrates how to achieve such fluidity? Accuracy isn't quite so important, but smooth animation is.

Était-ce utile?

La solution

More general direction advice:

  • Easy: Apply a low pass filter to discard erratic readings.
  • Tricky: The compass updates slower than the gyroscope yaw, so you can measure the drift between compass updates to improve the response. Sample code.
  • Trickier: The proper way to fuse the gyroscope and the compass would be using a Kalman filter, but it isn't trivial. There is a talk about it at http://talkminer.com/viewtalk.jsp?videoid=C7JQ7Rpwn2k
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top