Onboard-SDK icon indicating copy to clipboard operation
Onboard-SDK copied to clipboard

Mismatched timestamp types causes issues with VGA stereo on M300

Open Isokratia opened this issue 4 years ago • 1 comments

The timestamp in ImageInfoType is 64-bit and the timestamp in StereoVGAImgData is 32-bit

typedef struct ImageInfoType {
    RawImageInfoType rawInfo;
    uint16_t dataId;
    uint16_t sequence;
    CamPositionType dataType;
    uint64_t timeStamp;   // <----
  } ImageInfoType;
  typedef struct StereoVGAImgData
  {
      uint32_t frame_index;
      uint32_t time_stamp; // <----
      uint8_t  num_imgs;
      uint8_t  direction;
      // @note VGA imgs always come in pair
      VGAImage img_vec[2];
  } StereoVGAImgData; // pack(1)

This causes time-sync comparison issues in dji_advanced_sensing.cpp:289 when the incoming timestamp from ImageInfoType is larger than 32-bits (the 32-bit int is promoted to 64-bit for the comparison and the two don't match). The time-sync check on the stereo images fails and the VGA stereo pairs don't get published.

(stereoVGAImg.time_stamp == info.timeStamp) should be (stereoVGAImg.time_stamp == static_cast<uint32_t>(info.timeStamp)), which fixes the issue.

Isokratia avatar May 27 '21 08:05 Isokratia

Agent comment from kyle.cai in Zendesk ticket #48287:

Dear developer ,

Thank you for contacting DJI.

We will submit it for review again, thanks for your feedback.

Thank you for your understanding and support, hope you have a nice day.

Best Regards, DJI SDK Support Team

°°°

dji-dev avatar May 28 '21 03:05 dji-dev