luxonis / depthai-ros

Official ROS Driver for DepthAI Sensors.
MIT License
239 stars 173 forks source link

[BUG] Inaccurate OAK-D PoE Timestamps using ROS2 #314

Closed ahmadchalhoub closed 10 months ago

ahmadchalhoub commented 1 year ago

I am working on an application where I want to use synchronized frames from an OAK-D PoE camera with data from other sensors, and I want to do so using the ApproximateTimeSynchronizer from ROS2.

In order to get the camera frames, I am running the camera.launch.py file from the depthai_ros_driver package as described here: https://github.com/luxonis/depthai-ros, using the following command: $ ros2 launch depthai_ros_driver camera.launch.py

I have a ROS2 subscriber that subscribes to the /oak/rgb/image_raw as well as my other component's topics and tries to synchronize their data using the ApproximateTimeSynchronizer function (http://docs.ros.org/en/lunar/api/message_filters/html/python/index.html).

However, it seems like the obtained timestamps from the OAK-D W Pro PoE camera are way off (around 3 hours off), and thus I am unable to synchronize its data with my other sensors. For example, I was running my script at 05/15/2023, 6:05 PM EST, and was getting the following timestamps shown in the terminal output attached below (timestamps from camera correspond to 5/15/2023, 3:08:12 PM EST):

[INFO] [1684188318.417862401] [synchronizer_node]: Image timestamp: builtin_interfaces.msg.Time(sec=1684177692, nanosec=660969639)
[INFO] [1684188318.459652729] [synchronizer_node]: Image timestamp: builtin_interfaces.msg.Time(sec=1684177692, nanosec=760955192)
[INFO] [1684188318.565478575] [synchronizer_node]: Image timestamp: builtin_interfaces.msg.Time(sec=1684177692, nanosec=860940821)
[INFO] [1684188318.662675663] [synchronizer_node]: Image timestamp: builtin_interfaces.msg.Time(sec=1684177692, nanosec=960926841)
[INFO] [1684188318.765815299] [synchronizer_node]: Image timestamp: builtin_interfaces.msg.Time(sec=1684177693, nanosec=60912661)
[INFO] [1684188318.874016110] [synchronizer_node]: Image timestamp: builtin_interfaces.msg.Time(sec=1684177693, nanosec=160898581)
[INFO] [1684188318.964620293] [synchronizer_node]: Image timestamp: builtin_interfaces.msg.Time(sec=1684177693, nanosec=260884501)
[INFO] [1684188319.073699239] [synchronizer_node]: Image timestamp: builtin_interfaces.msg.Time(sec=1684177693, nanosec=360870469)

Is there any configuration I need to do to the OAK-D W Pro PoE camera so that I get my local timestamps? Thanks.

Serafadam commented 1 year ago

Hi, could you provide more information according to bug report template?

Serafadam commented 10 months ago

Closing due to inactivity, please reopen if there are still questions.