编写了一个打印加速度计输出的简单程序。
mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
mSensorManager.registerListener(this,mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_FASTEST);
事实证明:
加速度计输出始终设置为“最低”,具体取决于:
public void onAccuracyChanged(Sensor sensor, int accuracy) { if (collectingData){ accelPrecision.setText("accelerometer accuracy: " + accuracy); } }
加速度计的实际读数非常不准确 - 即使放在 table 上也有大约 2%-5% 的波动
据我所知,在 Nexus S、Nexus One 和 G1 上存在同样的问题
知道如何使模式准确/设置什么
最佳答案
使用过滤器。您正在查看原始数据,因此它当然会波动。类似 weighted average 的东西或 moving average就足够了。
关于android加速度计精度极差,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4609309/