mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Fixed calibration/laser not saved when compressed images are not saved to db
This commit is contained in:
@@ -55,7 +55,6 @@ public:
|
|||||||
float timeMirroring;
|
float timeMirroring;
|
||||||
float timeImageDecimation;
|
float timeImageDecimation;
|
||||||
float timeScanFromDepth;
|
float timeScanFromDepth;
|
||||||
float timeDepthFromScan;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rtabmap
|
} // namespace rtabmap
|
||||||
|
|||||||
@@ -1696,7 +1696,7 @@ void DBDriverSqlite3::loadSignaturesQuery(const std::list<int> & ids, std::list<
|
|||||||
rc = sqlite3_prepare_v2(_ppDb, query3.str().c_str(), -1, &ppStmt, 0);
|
rc = sqlite3_prepare_v2(_ppDb, query3.str().c_str(), -1, &ppStmt, 0);
|
||||||
UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error (%s): %s", _version.c_str(), sqlite3_errmsg(_ppDb)).c_str());
|
UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error (%s): %s", _version.c_str(), sqlite3_errmsg(_ppDb)).c_str());
|
||||||
|
|
||||||
|
int calibrationsLoaded = 0;
|
||||||
for(std::list<Signature*>::const_iterator iter=nodes.begin(); iter!=nodes.end(); ++iter)
|
for(std::list<Signature*>::const_iterator iter=nodes.begin(); iter!=nodes.end(); ++iter)
|
||||||
{
|
{
|
||||||
if(calibrationsToLoad.find((*iter)->id())!=calibrationsToLoad.end())
|
if(calibrationsToLoad.find((*iter)->id())!=calibrationsToLoad.end())
|
||||||
@@ -1722,6 +1722,7 @@ void DBDriverSqlite3::loadSignaturesQuery(const std::list<int> & ids, std::list<
|
|||||||
// stereo [fx, fy, cx, cy, baseline, local_transform] (5+12)*float
|
// stereo [fx, fy, cx, cy, baseline, local_transform] (5+12)*float
|
||||||
if(dataSize > 0 && data)
|
if(dataSize > 0 && data)
|
||||||
{
|
{
|
||||||
|
++calibrationsLoaded;
|
||||||
float * dataFloat = (float*)data;
|
float * dataFloat = (float*)data;
|
||||||
if((unsigned int)dataSize % (4+localTransform.size())*sizeof(float) == 0)
|
if((unsigned int)dataSize % (4+localTransform.size())*sizeof(float) == 0)
|
||||||
{
|
{
|
||||||
@@ -1776,6 +1777,7 @@ void DBDriverSqlite3::loadSignaturesQuery(const std::list<int> & ids, std::list<
|
|||||||
UFATAL("Wrong format of the Data.calibration field (size=%d bytes)", dataSize);
|
UFATAL("Wrong format of the Data.calibration field (size=%d bytes)", dataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UWARN("Set %d models to %d", models.size(), (*iter)->id());
|
||||||
(*iter)->sensorData().setCameraModels(models);
|
(*iter)->sensorData().setCameraModels(models);
|
||||||
(*iter)->sensorData().setStereoCameraModel(stereoModel);
|
(*iter)->sensorData().setStereoCameraModel(stereoModel);
|
||||||
}
|
}
|
||||||
@@ -1791,9 +1793,9 @@ void DBDriverSqlite3::loadSignaturesQuery(const std::list<int> & ids, std::list<
|
|||||||
// Finalize (delete) the statement
|
// Finalize (delete) the statement
|
||||||
rc = sqlite3_finalize(ppStmt);
|
rc = sqlite3_finalize(ppStmt);
|
||||||
UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error (%s): %s", _version.c_str(), sqlite3_errmsg(_ppDb)).c_str());
|
UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error (%s): %s", _version.c_str(), sqlite3_errmsg(_ppDb)).c_str());
|
||||||
}
|
|
||||||
|
|
||||||
ULOGGER_DEBUG("Time load calibrations=%fs", timer.ticks());
|
ULOGGER_DEBUG("Time load calibrations (loaded=%d/%d)=%fs", calibrationsLoaded, calibrationsToLoad.size(), timer.ticks());
|
||||||
|
}
|
||||||
|
|
||||||
if(ids.size() != loaded)
|
if(ids.size() != loaded)
|
||||||
{
|
{
|
||||||
@@ -2559,7 +2561,9 @@ void DBDriverSqlite3::saveQuery(const std::list<Signature *> & signatures) const
|
|||||||
if(!(*i)->sensorData().imageCompressed().empty() ||
|
if(!(*i)->sensorData().imageCompressed().empty() ||
|
||||||
!(*i)->sensorData().depthOrRightCompressed().empty() ||
|
!(*i)->sensorData().depthOrRightCompressed().empty() ||
|
||||||
!(*i)->sensorData().laserScanCompressed().empty() ||
|
!(*i)->sensorData().laserScanCompressed().empty() ||
|
||||||
!(*i)->sensorData().userDataCompressed().empty())
|
!(*i)->sensorData().userDataCompressed().empty() ||
|
||||||
|
!(*i)->sensorData().cameraModels().size() ||
|
||||||
|
!(*i)->sensorData().stereoCameraModel().isValidForProjection())
|
||||||
{
|
{
|
||||||
UASSERT((*i)->id() == (*i)->sensorData().id());
|
UASSERT((*i)->id() == (*i)->sensorData().id());
|
||||||
stepSensorData(ppStmt, (*i)->sensorData());
|
stepSensorData(ppStmt, (*i)->sensorData());
|
||||||
|
|||||||
@@ -2056,9 +2056,10 @@ Transform Memory::computeTransform(
|
|||||||
|
|
||||||
if(fromS && toS)
|
if(fromS && toS)
|
||||||
{
|
{
|
||||||
|
UWARN("%d=%d %d=%d", fromId, fromS->sensorData().cameraModels().size(), toId, toS->sensorData().cameraModels().size());
|
||||||
// make sure we have all data needed
|
// make sure we have all data needed
|
||||||
if((_reextractLoopClosureFeatures && _registrationPipeline->isImageRequired()) ||
|
if((_reextractLoopClosureFeatures && _registrationPipeline->isImageRequired()) ||
|
||||||
_registrationPipeline->isScanRequired() ||
|
(_registrationPipeline->isScanRequired()) ||
|
||||||
_registrationPipeline->isUserDataRequired())
|
_registrationPipeline->isUserDataRequired())
|
||||||
{
|
{
|
||||||
getNodeData(fromS->id(), true);
|
getNodeData(fromS->id(), true);
|
||||||
@@ -3379,6 +3380,14 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// just compress laser and user data
|
||||||
|
rtabmap::CompressionThread ctLaserScan(laserScan);
|
||||||
|
rtabmap::CompressionThread ctUserData(data.userDataRaw());
|
||||||
|
ctLaserScan.start();
|
||||||
|
ctUserData.start();
|
||||||
|
ctLaserScan.join();
|
||||||
|
ctUserData.join();
|
||||||
|
|
||||||
s = new Signature(id,
|
s = new Signature(id,
|
||||||
_idMapCount,
|
_idMapCount,
|
||||||
isIntermediateNode?-1:0, // tag intermediate nodes as weight=-1
|
isIntermediateNode?-1:0, // tag intermediate nodes as weight=-1
|
||||||
@@ -3388,23 +3397,25 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
|
|||||||
data.groundTruth(),
|
data.groundTruth(),
|
||||||
stereoCameraModel.isValidForProjection()?
|
stereoCameraModel.isValidForProjection()?
|
||||||
SensorData(
|
SensorData(
|
||||||
cv::Mat(),
|
ctLaserScan.getCompressedData(),
|
||||||
0,
|
maxLaserScanMaxPts,
|
||||||
0,
|
data.laserScanMaxRange(),
|
||||||
cv::Mat(),
|
cv::Mat(),
|
||||||
cv::Mat(),
|
cv::Mat(),
|
||||||
stereoCameraModel,
|
stereoCameraModel,
|
||||||
id,
|
id,
|
||||||
0):
|
0,
|
||||||
|
ctUserData.getCompressedData()):
|
||||||
SensorData(
|
SensorData(
|
||||||
cv::Mat(),
|
ctLaserScan.getCompressedData(),
|
||||||
0,
|
maxLaserScanMaxPts,
|
||||||
0,
|
data.laserScanMaxRange(),
|
||||||
cv::Mat(),
|
cv::Mat(),
|
||||||
cv::Mat(),
|
cv::Mat(),
|
||||||
cameraModels,
|
cameraModels,
|
||||||
id,
|
id,
|
||||||
0));
|
0,
|
||||||
|
ctUserData.getCompressedData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
s->setWords(words);
|
s->setWords(words);
|
||||||
|
|||||||
@@ -740,7 +740,6 @@ void MainWindow::processCameraInfo(const rtabmap::CameraInfo & info)
|
|||||||
_ui->statsToolBox->updateStat("Camera/Time disparity/ms", (float)info.id, (float)info.timeDisparity*1000.0);
|
_ui->statsToolBox->updateStat("Camera/Time disparity/ms", (float)info.id, (float)info.timeDisparity*1000.0);
|
||||||
_ui->statsToolBox->updateStat("Camera/Time mirroring/ms", (float)info.id, (float)info.timeMirroring*1000.0);
|
_ui->statsToolBox->updateStat("Camera/Time mirroring/ms", (float)info.id, (float)info.timeMirroring*1000.0);
|
||||||
_ui->statsToolBox->updateStat("Camera/Time scan from depth/ms", (float)info.id, (float)info.timeScanFromDepth*1000.0);
|
_ui->statsToolBox->updateStat("Camera/Time scan from depth/ms", (float)info.id, (float)info.timeScanFromDepth*1000.0);
|
||||||
_ui->statsToolBox->updateStat("Camera/Time depth from scan/ms", (float)info.id, (float)info.timeDepthFromScan*1000.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom)
|
void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom)
|
||||||
@@ -1643,7 +1642,7 @@ void MainWindow::updateMapCloud(
|
|||||||
else if(_cachedSignatures.contains(iter->first))
|
else if(_cachedSignatures.contains(iter->first))
|
||||||
{
|
{
|
||||||
QMap<int, Signature>::iterator jter = _cachedSignatures.find(iter->first);
|
QMap<int, Signature>::iterator jter = _cachedSignatures.find(iter->first);
|
||||||
if(!jter->sensorData().laserScanCompressed().empty())
|
if(!jter->sensorData().laserScanCompressed().empty() || !jter->sensorData().laserScanRaw().empty())
|
||||||
{
|
{
|
||||||
this->createAndAddScanToMap(iter->first, iter->second, uValue(mapIds, iter->first, -1));
|
this->createAndAddScanToMap(iter->first, iter->second, uValue(mapIds, iter->first, -1));
|
||||||
}
|
}
|
||||||
@@ -1893,7 +1892,8 @@ void MainWindow::createAndAddCloudToMap(int nodeId, const Transform & pose, int
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!iter->sensorData().imageCompressed().empty() && !iter->sensorData().depthOrRightCompressed().empty())
|
if((!iter->sensorData().imageCompressed().empty() || !iter->sensorData().imageRaw().empty()) &&
|
||||||
|
(!iter->sensorData().depthOrRightCompressed().empty() || !iter->sensorData().depthOrRightRaw().empty()))
|
||||||
{
|
{
|
||||||
cv::Mat image, depth;
|
cv::Mat image, depth;
|
||||||
SensorData data = iter->sensorData();
|
SensorData data = iter->sensorData();
|
||||||
@@ -2101,7 +2101,7 @@ void MainWindow::createAndAddScanToMap(int nodeId, const Transform & pose, int m
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!iter->sensorData().laserScanCompressed().empty())
|
if(!iter->sensorData().laserScanCompressed().empty() || !iter->sensorData().laserScanRaw().empty())
|
||||||
{
|
{
|
||||||
cv::Mat scan;
|
cv::Mat scan;
|
||||||
iter->sensorData().uncompressData(0, 0, &scan);
|
iter->sensorData().uncompressData(0, 0, &scan);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>-1377</y>
|
||||||
<width>681</width>
|
<width>681</width>
|
||||||
<height>2010</height>
|
<height>2010</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>6</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page_22">
|
<widget class="QWidget" name="page_22">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
|
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
|
||||||
@@ -3751,7 +3751,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="label_300">
|
<widget class="QLabel" name="label_300">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Downsample step size for laser scans. If you laser scans are created from depth images, use Decimation above instead (faster).</string>
|
<string>Downsample step size for laser scans. If your laser scans are created from depth images, use Decimation above instead (faster).</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|||||||
Reference in New Issue
Block a user