我想要
[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
解决方法:
从developer.android.com开始:
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加速度计:采样率?全部内容,希望文章能够帮你解决Android加速度计:采样率?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)