laboshinl / loam_velodyne

Laser Odometry and Mapping (Loam) is a realtime method for state estimation and mapping using a 3D lidar.
http://wiki.ros.org/loam_velodyne
Other
1.71k stars 952 forks source link

Questions about the interpolation of laser point. #159

Open cpkingw opened 4 years ago

cpkingw commented 4 years ago

It seems that _scanTime is the timestamp of the previous laser frame, because the update of the _scanTime or _sweepStart in the reset() is behind the the interpolation of laser point via projectPointToStartOfSweep(). When doing interpolation of point in current laser frame, Shouldn't it be the timestamp of the current frame?

void BasicScanRegistration::interpolateIMUStateFor(const float &relTime, IMUState &outputState)
{
  double timeDiff = toSec(_scanTime - _imuHistory[_imuIdx].stamp) + relTime;
  while (_imuIdx < _imuHistory.size() - 1 && timeDiff > 0) {
    _imuIdx++;
    timeDiff = toSec(_scanTime - _imuHistory[_imuIdx].stamp) + relTime;
  }
  ...
}
void BasicScanRegistration::reset(const Time& scanTime)
{
  _scanTime = scanTime;

  // re-initialize IMU start index and state
  _imuIdx = 0;
  if (hasIMUData()) {
    interpolateIMUStateFor(0, _imuStart);
  }

  // clear internal cloud buffers at the beginning of a sweep
  if (true/*newSweep*/) {
    _sweepStart = scanTime;
    ...
  }
}
arshhhly commented 3 years ago

I think it is a mistake.

gackes commented 3 years ago

Have you solved the problem? I have the same doubt. @cpkingw

cpkingw commented 3 years ago

Have you solved the problem? I have the same doubt. @cpkingw

I think you can try to update the _scanTime in projectPointToStartOfSweep() firstly by adding scanTime as a new argument like processScanlines(scanTime, _laserCloudScans)