ORB_SLAM3: fixed error if left image is color. SensorCaptureThread: stop thread if data cannot be captured (e.g., end of dataset) instead of skipping indefinitly with error log.

This commit is contained in:
matlabbe
2024-05-26 18:04:07 -07:00
parent 8b372b52ac
commit 99cb02fdff
2 changed files with 11 additions and 11 deletions

View File

@@ -336,8 +336,7 @@ void SensorCaptureThread::mainLoop()
data = _lidar->takeData(&info); data = _lidar->takeData(&info);
if(data.stamp() == 0.0) if(data.stamp() == 0.0)
{ {
UERROR("Could not capture scan! Skipping this frame!"); UWARN("Could not capture scan!");
return;
} }
else else
{ {
@@ -347,8 +346,7 @@ void SensorCaptureThread::mainLoop()
cameraData = _camera->takeData(); cameraData = _camera->takeData();
if(cameraData.stamp() == 0.0) if(cameraData.stamp() == 0.0)
{ {
UERROR("Could not capture image! Skipping this frame!"); UWARN("Could not capture image!");
return;
} }
else else
{ {
@@ -390,8 +388,7 @@ void SensorCaptureThread::mainLoop()
data = _camera->takeData(&info); data = _camera->takeData(&info);
if(data.stamp() == 0.0) if(data.stamp() == 0.0)
{ {
UERROR("Could not capture image! Skipping this frame!"); UWARN("Could not capture image!");
return;
} }
else else
{ {
@@ -451,10 +448,9 @@ void SensorCaptureThread::mainLoop()
data.setLaserScan(scanDeskewed); data.setLaserScan(scanDeskewed);
} }
} }
else else if(!data.laserScanRaw().empty())
{ {
UWARN("Failed to get poses for stamps %f and %f! Skipping this frame!", firstStamp+_poseTimeOffset, lastStamp+_poseTimeOffset); UWARN("Failed to get poses for stamps %f and %f! Lidar won't be deskewed!", firstStamp+_poseTimeOffset, lastStamp+_poseTimeOffset);
return;
} }
} }
else if(!data.laserScanRaw().empty()) else if(!data.laserScanRaw().empty())

View File

@@ -447,8 +447,12 @@ Transform OdometryORBSLAM3::computeTransform(
if(stereo) if(stereo)
{ {
localTransform = data.stereoCameraModels()[0].localTransform(); localTransform = data.stereoCameraModels()[0].localTransform();
cv::Mat leftMono = data.imageRaw();
Tcw = orbslam_->TrackStereo(data.imageRaw(), data.rightRaw(), data.stamp(), orbslamImus_); if(data.imageRaw().channels() == 3) {
leftMono = cv::Mat();
cv::cvtColor(data.imageRaw(), leftMono, CV_BGR2GRAY);
}
Tcw = orbslam_->TrackStereo(leftMono, data.rightRaw(), data.stamp(), orbslamImus_);
orbslamImus_.clear(); orbslamImus_.clear();
} }
else else