stereolabs/zed-open-capture

[Question] How to get the synchronized IMU and image data?

chengfzy opened this issue · 13 comments

I use this SDK to record IMU and image data, and found the timestamp betwwen the IMU and image are not synchronized correctly? Is there example to explain how to obtain the synchronized record?

IMU data run at 400 Hz that is faster than the maximum rate of the image data.
We provide an example that explains how to get the IMU data sample nearest to each image frame:
https://github.com/stereolabs/zed-open-capture/blob/master/examples/zed_oc_sync_example.cpp

Does the syncrhonization service will modify the system(PC) time clock?

No, it doesn't. We do not modify the system clock

How to syncrhonize the IMU(or Camera) timestamp to system(PC) timestamp, I add system timestamp in IMU data, and found obvious gap between them
2021-08-25_10:32:15

Here the problem is when you get the system timestamp with respect to IMU timestamp.
The IMU timestamp is set as soon as the IMU data "reaches the grabber", and it's processed in order to fix it with the timestamp reported by the IMU sensor itself.
I suppose that you are getting the system timestamp just before or after calling the getLastIMUData function... so a little latency is expected and it is expected to be variable data.

This is the code where the IMU timestamp is set:
https://github.com/stereolabs/zed-open-capture/blob/master/src/sensorcapture.cpp#L373-L391

The eventual drift between IMU timestamp and system timestamp is fixed here:
https://github.com/stereolabs/zed-open-capture/blob/master/src/sensorcapture.cpp#L393-L394

I don't getting the system timestamp after calling the getLastIMUData function. I modify some code in SDK, after the IMU Raw data is obtained in https://github.com/stereolabs/zed-open-capture/blob/master/src/sensorcapture.cpp#L371, I use getWallTimestamp to record the system timestamp, then add to imu data. This plot is just the difference between sensor timestamp and the system timestamp.

OK, indeed the IMU timestamp and the system timestamp drift in time, that's why a scaling factor must be applied (L393-L394)

Thanks for your quick reply.
Another question, is any function to adjust the frequency of IMU, my device is ZED mini. I found the IMU frequency is 800Hz, it's too high for our apllication.

No, the IMU frequency is hard-coded at FW level. If you need a lower frequency you should use a thread that discards data samples that are not required

I found the norm of acceleration in 3 axies if not equal, or approximat to the graivity(9.81), the calculated value is large than 10, Is the acc scale setting right? The conclusion is the same if using ZED Sensor Viewer. BTW, what't the difference between this library and official SDK with CUDA, does the official SDK also using this library for obtaining sensor data?

I found the norm of acceleration in 3 axies if not equal, or approximat to the graivity(9.81), the calculated value is large than 10, Is the acc scale setting right? The conclusion is the same if using ZED Sensor Viewer. BTW, what't the difference between this library and official SDK with CUDA, does the official SDK also using this library for obtaining sensor data?

I got same issue and it's still unsolved.

The data provided by the camera sensors are the same using the SDK and the Open Capture driver.
The only difference is that the SDK applies calibration filters (if you retrieve calibrated data), while the Open Capture driver outputs only raw data.

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment otherwise it will be automatically closed in 5 days