apollo icon indicating copy to clipboard operation
apollo copied to clipboard

IMU interpolation questions

Open daohu527 opened this issue 6 years ago • 1 comments

I have some doubt about the code below:

bool RTKLocalization::InterpolateIMU(const CorrectedImu &imu1,
                                     const CorrectedImu &imu2,
                                     const double timestamp_sec,
                                     CorrectedImu *imu_msg) {
  if (!(imu1.header().has_timestamp_sec() &&
        imu2.header().has_timestamp_sec())) {
    AERROR << "imu1 and imu2 has no header or no timestamp_sec in header";
    return false;
  }
  if (timestamp_sec - imu1.header().timestamp_sec() <
      std::numeric_limits<double>::min()) {
    AERROR << "[InterpolateIMU1]: the given time stamp[" << timestamp_sec
           << "] is older than the 1st message["
           << imu1.header().timestamp_sec() << "]";
    *imu_msg = imu1;
  } else if (timestamp_sec - imu2.header().timestamp_sec() >
             std::numeric_limits<double>::min()) {
    AERROR << "[InterpolateIMU2]: the given time stamp[" << timestamp_sec
           << "] is newer than the 2nd message["
           << imu2.header().timestamp_sec() << "]";
    *imu_msg = imu1;            // Why not imu2 but imu1

Why not choose imu2 but imu1, if the timestamp_sec is newer than the imu2 message ? https://github.com/ApolloAuto/apollo/blob/3d9c4b270083f09a91e8fdcdc90b6b399ecb581e/modules/localization/rtk/rtk_localization.cc#L418

daohu527 avatar Jan 10 '20 11:01 daohu527

Thank you for point that out. The related fix is already merged to our master branch. [https://github.com/ApolloAuto/apollo/commit/c78f7577d0eedcedbf2e8eb24382630b2c865549] We will close the issue for now. If you have any additional question, please feel free to open a new issue. Our engineer team are more than happy to help that.

Thank you for supporting Apollo!

sjiang2018 avatar Jul 01 '20 23:07 sjiang2018