简体   繁体   English

Android加速度计是毫秒还是微秒?

[英]Android accelerometer millisecond or microsecond?

So I'm getting accelerometer data using HTC EVO. 因此,我正在使用HTC EVO获取加速度计数据。 I get values like this for time. 我得到了这样的时间价值。

967454610000 967534902000 967613576000 967692434000 967454610000 967534902000 967613576000 967692434000

The difference between these values is around 80,000,000. 这些值之间的差约为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 ." 文档说:“该值必须是SENSOR_DELAY_NORMAL,SENSOR_DELAY_UI,SENSOR_DELAY_GAME或SENSOR_DELAY_FASTEST之一,或者是事件之间的期望延迟(以微秒为单位) 。”

So I'm using SENSOR_DELAY_UI and I assumed that the times are microsecond. 所以我正在使用SENSOR_DELAY_UI,并且我认为时间是微秒。 That does not make sense tho cause that means that each time interval is about 80 seconds. 这是没有道理的,因为这意味着每个时间间隔约为80秒。 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. 如果它们的单位为纳秒,那将更有意义,这意味着时间间隔约为0.08秒,或者每秒捕获12个数据。 But then it would contradict the documentation. 但这会与文档相矛盾。 Does anyone know what is the time interval? 有谁知道时间间隔?

Thanks a lot! 非常感谢!

So I'm getting accelerometer data using HTC EVO. 因此,我正在使用HTC EVO获取加速度计数据。 I get values like this for time. 我得到了这样的时间价值。

967454610000 967534902000 967613576000 967692434000 967454610000 967534902000 967613576000 967692434000

Are those values obtained from the timestamp member of a SensorEvent instance ? 这些值是从SensorEvent实例timestamp成员获得的吗? 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. 因此,延迟大约不是80,000,000微秒,实际上大约是80,000微秒或0.08秒,每秒发生12.5个事件。

Sensor delay for Android UI is 60,000 micro-seconds. Android UI的传感器延迟为60,000微秒。 Which is 0.06 seconds and hence frequency is 16Hz. 这是0.06秒,因此频率是16Hz。 Similarly for GAME, the delay is 20,000 micro-seconds (50 Hz). 同样,对于GAME,延迟为20,000微秒(50 Hz)。

Specifying a delay constant in microseconds (40,000) should give us 25Hz but it doesn't. 指定一个微秒(40,000)的延迟常数应该给我们25Hz,但事实并非如此。 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. 根据我的实验,将40,000微秒指定为50Hz频率。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM