compass calibration

2019-08-02 21:16发布

问题:

So i have been building an AR engine that makes use of the magnetic compass and phone orientation ect.. In the process i built a free stupid AR Compass and in testing i realize that 90% of the time it works GREAT! but occassionally the magnetic compass sensor stops responding.. every doc i have found talks about the user makeing a figure 8 with their device to recalibrate the compass.. and this works SOMETIMES but not always.. is there a way to reset the compass programmatically? testing on ice cream sandwhich nexus prime!

eliddell

回答1:

The compass cannot be reset programmatically because of the way calibration works.

The compass works by detecting small changes in the magnetic field around it. When you wave it in a figure of 8 pattern, the changes are to fast and too much, which resets it. This causes it to recalibrate. However, there are some cases in which recalibration will not help. These are usually when you are standing next to high voltage power lines, or next to a piece of metal, or are inside a car that has a lot of static in it (especially the area next to the dashboard),