Compass give me crazy data, is calibration needed or it's the sensor broken?

后端 未结 6 420
时光说笑
时光说笑 2020-12-18 23:23

I\'m working with android sensor data. My application use

SensorManager.getRotationMatrixFromVector(
            mRotationMatrix , event.values);

6条回答
  •  情书的邮戳
    2020-12-19 00:14

    If you definitely haven't changed anything in your code, and it still works fine on other devices, it would suggest a problem with that particular device.

    While your app is running (i.e. the compass is in use), you should be able to wave it in a figure of 8 in order to automatically recalibrate the compass. You should also make sure you aren't standing next to any large lumps of metal etc. that might interfere with readings.

    You can override the onAccuracyChanged() method of SensorEventListener to flash up a message to the user when the compass requires recalibration (probably when accuracy drops to SENSOR_STATUS_ACCURACY_LOW).

    In my experience of playing with the compass on android phones, they can be pretty unreliable...

提交回复
热议问题