Help ! About zed-open-capture

Hi, I am using zed 2i to collect some data for ORB_SLAM using zed-open-capture

my code like this:

  const sl_oc::sensors::data::Imu imuData = sensCap->getLastIMUData(2000);
  // imuDatas is a std::deque, store the imu data in order
  imuDatas.push_back(imuData);

And then I found out there is so many data.timestamp less than the frist imu data.
My code like this:

    auto start_t = imuDatas[0].timestamp;
    int count = 0;
    for(auto &imuData : imuDatas) {
        data.imuDatas.push_back(imuData);
        if(start_t > imuData.timestamp) {
            std::cout << "smaller" << std::endl;
            count += 1;
        }
    }
    std::cout << count << std::endl;

cout is 5475, but imuDatas size is 8730
Then I did some experiments,test sensor example is no problem. And finally I found out if i remove this code

videoCap->enableSensorSync(sensCap);

imu data timestamp will be correct. So the question is

  1. Did I make a mistake in my code?
  2. Or my code is right. this situation is normal.
  3. If this is normal,Is the data wrong of timestamp or out of order?

Hi @tkal
we are going to test and fix this behavior as soon as possible.

Hi @tkal
I debugged the code and I can say that there is nothing wrong with the driver.
What is not correct is the check that you are doing here:

When you start the camera and you enable synchronization the driver uses the first 50 sensors’ data to calculate the offset between the image timestamp and the sensors timestamp and the scaling factor between the two timestamps (they have different sources, so they cannot be perfectly scaled).

After this “tuning time”, the sensors’ timestamp is fixed by applying the initial offset and the scaling factor.

For this reason, if you compare all the timestamp values with the first obtained timestamp you find no valid information.

Please try to ignore the first 50 or 60 sensor samples and try to perform the same comparison, you will see that everything works as expected.