Android 加速度计是毫秒还是微秒?
所以我使用 HTC EVO 获取加速计数据。我得到这样的时间值。
967454610000 967534902000 967613576000 967692434000
这些值之间的差异约为 80,000,000。 文档说: “该值必须是 SENSOR_DELAY_NORMAL、SENSOR_DELAY_UI、SENSOR_DELAY_GAME 或 SENSOR_DELAY_FASTEST 之一。或者,事件之间所需的延迟(以微秒为单位)。”
所以我使用 SENSOR_DELAY_UI 并且我假设时间是微秒。这是没有意义的,因为这意味着每个时间间隔约为 80 秒。如果它们以纳秒为单位会更有意义,这意味着时间间隔约为 0.08 秒或每秒捕获 12 个数据。但这样就会与文档相矛盾。有谁知道时间间隔是多少?
多谢!
So I'm getting accelerometer data using HTC EVO. I get values like this for time.
967454610000
967534902000
967613576000
967692434000
The difference between these values is around 80,000,000.
The documentation says:
"The value must be one of SENSOR_DELAY_NORMAL, SENSOR_DELAY_UI, SENSOR_DELAY_GAME, or SENSOR_DELAY_FASTEST. or, the desired delay between events in microsecond."
So I'm using SENSOR_DELAY_UI and I assumed that the times are microsecond. That does not make sense tho cause that means that each time interval is about 80 seconds. It would make more sense if they were in nanoseconds which would mean the time interval is about .08 seconds or 12 data was captured in every second. But then it would contradict the documentation. Does anyone know what is the time interval?
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这些值是从
timestamp
成员获取的SensorEvent
实例?如果是这样,根据文档,这些时间以纳秒为单位。因此,延迟不是大约 80,000,000 微秒,而是实际上大约 80,000 微秒,即 0.08 秒,频率为每秒 12.5 个事件。Are those values obtained from the
timestamp
member of aSensorEvent
instance? If so, those times are in nanoseconds according to the documentation. So the delay isn't about 80,000,000 microseconds, it's actually about 80,000 microseconds, or 0.08 seconds, giving a frequency of 12.5 events per second.Android UI 的传感器延迟为 60,000 微秒。
即 0.06 秒,因此频率为 16Hz。
同样,对于 GAME,延迟为 20,000 微秒 (50 Hz)。
指定以微秒 (40,000) 为单位的延迟常数应该为我们提供 25Hz,但事实并非如此。根据文档,这只是最小延迟的提示,传感器管理器将比这更快地提供值。根据我的实验,指定 40,000 微秒会产生 50Hz 频率。
Sensor delay for Android UI is 60,000 micro-seconds.
Which is 0.06 seconds and hence frequency is 16Hz.
Similarly for GAME, the delay is 20,000 micro-seconds (50 Hz).
Specifying a delay constant in microseconds (40,000) should give us 25Hz but it doesn't. According to documentation, this is just a hint for minimum delay and sensor manager will deliver values faster than that. According to my experiment, specifying 40,000 microseconds gives 50Hz frequency.