开发者

Can the accelerometer sensor rate be trust?

I'm doing a shake detection in my app and I saw several examples using time diff to normalize the acceleration delta. Does it mean that the rate used as one of the registerListener arguments (I'm using SensorManager.SENSOR_DELAY_NORMAL) is not constant?

T开发者_如何转开发hanks


The kernel at the heart of Android, and pretty much most linux distributions, is not meant for a true "real-time operating system." There are no real guarantees that deadlines will be met or that every sensor reading will be taken/delivered exactly on time. How much variance you see in sensor reading timestamps could be dependent on number of running processes/threads on the system and countless other factors.

I would say that you can expect most of your sensor readings to arrive pretty close to constant time from one another, but if the exact time of the readings are critical to your application, it is probably a good idea to track the difference in arrival times yourself.

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜