Fixed DBReader odometry ignored

This commit is contained in:
matlabbe
2024-06-25 12:04:37 -07:00
parent 1ab0133f14
commit 7d970ef020
5 changed files with 21 additions and 5 deletions

View File

@@ -82,6 +82,7 @@ public:
virtual bool isCalibrated() const;
virtual std::string getSerial() const;
virtual bool odomProvided() const {return !_odometryIgnored;}
virtual bool getPose(double stamp, Transform & pose, cv::Mat & covariance, double maxWaitTime = 0.06);
const DBDriver * driver() const {return _dbDriver;}

View File

@@ -268,6 +268,12 @@ std::string DBReader::getSerial() const
return "DBReader";
}
bool DBReader::getPose(double stamp, Transform & pose, cv::Mat & covariance, double maxWaitTime)
{
UERROR("DBReader only provides pose when capturing data, it cannot provide asynchronous pose.");
return false;
}
SensorData DBReader::captureImage(SensorCaptureInfo * info)
{
SensorData data = this->getNextData(info);

View File

@@ -462,7 +462,11 @@ void SensorCaptureThread::mainLoop()
Transform pose;
cv::Mat covariance;
if(_odomSensor->getPose(data.stamp()+_poseTimeOffset, pose, covariance, _poseWaitTime>0?_poseWaitTime:0))
if(!info.odomPose.isNull() && _lidar == 0 && _odomSensor == _camera)
{
// Do nothing, we have already the pose
}
else if(_odomSensor->getPose(data.stamp()+_poseTimeOffset, pose, covariance, _poseWaitTime>0?_poseWaitTime:0))
{
info.odomPose = pose;
info.odomCovariance = covariance;