android accelerometer accuracy is extremely poor

亡梦爱人 提交于 2019-12-07 20:12:57

问题


Wrote a simple program that prints out accelerometer output.

mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
mSensorManager.registerListener(this,mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_FASTEST);     

It turns out that:

  1. The accelerometer output is always set to "lowest" as determined by:

    public void onAccuracyChanged(Sensor sensor, int accuracy) {
      if (collectingData){  
         accelPrecision.setText("accelerometer accuracy: " + accuracy);
      }
    }
    
  2. The actual accelerometer readings are very inaccurate - about 2%-5% fluctuations even when it's resting on the table

as far as I can tell it's the same problem on Nexus S, Nexus One and G1

Any idea how it could be made mode accurate / what sets a


回答1:


Use a filter. You are looking at raw data so of course its going to fluctuate. Something like a weighted average or a moving average will suffice.



来源:https://stackoverflow.com/questions/4609309/android-accelerometer-accuracy-is-extremely-poor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!