Android加速度计:采样率?
作者:互联网
我想要
[1]提高手机加速度计的采样率.
(SENSOR_DELAY_FASTEST在Nexus4上的Xperia / 180Hz上最大约为100Hz,
我希望延迟工作时间约为1毫秒或更短.
[2]如果[1]不可能,我可以使速率恒定.
mSensorManager.registerListener(this, mAccelerometer,10000);//10000 in microsec
上面的代码没有给我10ms的延迟.我知道这只是Android的一个建议.
我知道手机内的这些加速度计能够提供更小的延迟.它在数据表中提到过.他们的任何方法或驱动器/ ADC编程也是如此[1]或[2].
我正在使用ADT工具.还有其他任何工具吗?
P.S:我读过
Android: How to increase Accelerometer Sampling Rate?
Impossibility to change the rate of the accelerometer
解决方法:
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的一个建议.
标签:android-sensors,rate,android,sampling,accelerometer 来源: https://codeday.me/bug/20190823/1695919.html