intel / ros2_intel_realsense

This project is deprecated and no more maintained. Please visit https://github.com/IntelRealSense/realsense-ros for ROS2 wrapper.
Apache License 2.0
141 stars 96 forks source link

Time Stamp issue when system with heavy load #84

Open challenzhou opened 5 years ago

challenzhou commented 5 years ago

When launch RealSense node with other modules, the time interval is not stable and the frames sometimes out of order, log as below:

Timestamp interval: 33.388916 Timestamp interval: 33.354736 Timestamp interval: 33.381836 Timestamp interval: 33.323975 Timestamp interval: 33.374756 Timestamp interval: 133.653320 Timestamp interval: -100.312744 Timestamp interval: 155.536621 Timestamp interval: -122.171387 Timestamp interval: 33.446777 Timestamp interval: 99.965576 Timestamp interval: 33.382324 Timestamp interval: 66.683838 Timestamp interval: 33.668457 Timestamp interval: -66.988770 Timestamp interval: 100.058594 Timestamp interval: 53.513428 Timestamp interval: 49.924805 Timestamp interval: 38.312012 Timestamp interval: 0.833740 Timestamp interval: 24.228760 Timestamp interval: 33.336182

ruffsl commented 4 years ago

I think this might have to do with the fact that the timestamp published with the frame message is not that captured by the device, but the system's clock at which the publish frame callback is reached:

https://github.com/intel/ros2_intel_realsense/blob/47b313c0ceb3b9c977211ebdb095c3c8ab9cad1f/realsense_ros/src/rs_d435.cpp#L60-L63

This is ill advised; conventionally, ROS drivers attempt to preserve timestamps recorded from the sensor itself, not from the operating system. I assume the realsense SDK can return sensor timestamps?