ros-android / android_sensors_driver

ROS Driver for Android Sensors
76 stars 65 forks source link

Strange IMU time stamp #24

Open Anas-Alhashimi opened 9 years ago

Anas-Alhashimi commented 9 years ago

Hello, This request is based on the discussion here :http://answers.ros.org/question/203408/strange-imu-stamp-time/?answer=203412#post-id-203412.

In short the driver is publishing incorrect time stamp! I used mobile Sony Z2. Martin sugested this Regarding the wrong timestamp: Since your timestamp is almost exactly twice the actual value, I suspect that ImuPublisher.java#L173-L175 are responsible. The code assumes that event.timestamp is in nanoseconds of uptime, but some devices (e.g., the Nexus 4) instead put the exact timestamp (since 1970-01-01) in there.

Regards Anas

chadrockey commented 9 years ago

Looks like this wasn't specified very clearly in the Android docs (and must be inconsistent across devices).

http://developer.android.com/reference/android/hardware/SensorEvent.html

I'll merge a pull request that detects this and does the right thing for each case, but I don't have time to work on this on my own.