我要
[1] 提高手机加速度计的采样率。 (SENSOR_DELAY_FASTEST 在 Xperia 上给出最大大约 100Hz/在 Nexus4 上为 180Hz, 对于我的工作,我希望延迟大约为 1 毫秒或更短。
[2] 如果 [1] 不可能我可以让 Rate 保持不变吗。
mSensorManager.registerListener(this, mAccelerometer,10000);//10000 in microsec
上面的代码不会给我 10 毫秒的延迟。我知道这只是对 Android 的建议。
我知道手机中的这些加速度计能够提供更小的延迟。他们的数据表中提到了这一点。他们的任何方法或驱动程序/ADC 编程也是如此 [1] 或 [2]。 我正在使用 ADT 工具。还有其他工具可以做到这一点吗?
P.S: 我读过
最佳答案
The data delay (or sampling rate) controls the interval at which sensor events are sent to your application via the onSensorChanged() callback method. The default data delay is suitable for monitoring typical screen orientation changes and uses a delay of 200,000 microseconds. You can specify other data delays, such as SENSOR_DELAY_GAME (20,000 microsecond delay), SENSOR_DELAY_UI (60,000 microsecond delay), or SENSOR_DELAY_FASTEST (0 microsecond delay). As of Android 3.0 (API Level 11) you can also specify the delay as an absolute value (in microseconds).
但是您应该知道,您以微秒为单位指定的绝对值只是对 Android 的建议。
关于安卓加速度计 : Sampling Rate?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17663191/