librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

D435i Aligning IMU and RGB Frames

Open JBBee opened this issue 7 years ago • 11 comments


Required Info
Camera Model D435i
Firmware Version 05.11.01.00
Operating System & Version Win 10
Kernel Version (Linux Only)
Platform
SDK Version 2.17.1
Language C++
Segment AR

Issue Description

I'm capturing RGB and Depth frames at 30 fps using one pipe and then using a second pipe with a callback to capture accelerometer and gyro readings at 63 and 200 hz. I'm then trying to align the IMU frame timestamps with the timestamp of the RGB frame. However, the timestamps of the IMU readings are in the hardware clock domain and the timestamps of the RGB frames are in the system time domain. How do I align the two using their timestamps?

Thanks.

JBBee avatar Feb 04 '19 13:02 JBBee

You need to enable frame metadata to get hardware timestamp for the color stream: Enable hardware timestamps on Windows / Enable hardware timestamp on Linux

dorodnic avatar Feb 04 '19 14:02 dorodnic

This worked, so now both the color stream and IMU stream are in the hardware clock domain. But there appears to be a large offset between the two timestamps even when collected concurrently. Are they timestamped using the same clock, or how do I compare the two values?

Thanks.

JBBee avatar Feb 06 '19 02:02 JBBee

@JBBee - yes, they should have the same clock. It is reasonable for them to have some offset. You should expect the IMU data to be ~40 ms ahead of depth data. This is due to IMU having ~2ms latency, while UVC frames have roughly at least one frame of latency (and more on Windows). If you see the situation being other way around (IMU lagging behind depth) - it is probably a rare firmware bug we are investigating right now. To clarify, if you get motion_frame and depth_frame in the same frameset, you should expect motion_frame.timestamp < depth_frame.timestamp. - Actually, I'm not so sure about the last part, because when using wait_for_frames the pipeline will most likely try to synchronize between them. However, if you add printfs to callback example you should see this effect.

dorodnic avatar Feb 06 '19 08:02 dorodnic

@dorodnic I'm actually collecting the IMU samples using a second pipe with a callback, and I'm getting timestamp differences between the IMU samples and the color frames such as 4.12596e+06. Is this because they're collected on a different pipes?

JBBee avatar Feb 06 '19 14:02 JBBee

Hmm... And both are hardware timestamps? That's strange. Using two pipelines with callbacks (or one with wait for frames and one with callbacks) should not introduce any problems. What about when starting streaming in the RealSense Viewer? You can see timestamps of each stream under (i) icon of each stream.

dorodnic avatar Feb 06 '19 14:02 dorodnic

Thank you. Did you try this with later pre-release? There are some issues with 2.18 and 5.11.1 firmware, but it would be interesting to check with newer viewer. This looks like something we have encountered and already resolved (note that the FPS is also completely wrong)

dorodnic avatar Feb 06 '19 18:02 dorodnic

The timestamps are still different with that pre-release. Should I try downgrading the firmware?

JBBee avatar Feb 06 '19 19:02 JBBee

Could you please share the exact Windows build you are using? Downgrading firmware is probably not recommended, but we are all waiting for the new firmware to be released for several weeks now (should be published any day now) and it might help with this problem.

dorodnic avatar Feb 07 '19 06:02 dorodnic

Ok great, I'll lookout for the new firmware. I'm using Win 10 build 1703.

JBBee avatar Feb 07 '19 13:02 JBBee


Hello @JBBee,

New firmware has been released, please see latest RealSense Camera Firmware located here:

https://downloadcenter.intel.com/download/28568/Latest-Firmware-for-Intel-RealSense-D400-Product-Family?product=128255

Windows Device Firmware Update Tool (required to upgrade firmware):

https://downloadcenter.intel.com/download/27514/Windows-Device-Firmware-Update-Tool-and-Latest-Firmware-for-Intel-RealSense-D400-Product-Family?v=t

Also please use latest LibRealSense Release:

https://github.com/IntelRealSense/librealsense

Please update ticket with your results. Thank you!

Hi @RealSenseCustomerSupport

After following the instructions to enable frame metadata I ran it with this latest firmware release and the timestamps now match.

Thank you!

JBBee avatar Mar 01 '19 21:03 JBBee