fixed sensor data not loaded on 0.10.0 database version

This commit is contained in:
Mathieu Labbe
2015-06-06 19:20:38 -04:00
parent bd9fb1027b
commit 7d72aa83bc
4 changed files with 37 additions and 10 deletions
+4 -4
View File
@@ -2608,6 +2608,10 @@ void DBDriverSqlite3::stepSensorData(sqlite3_stmt * ppStmt,
} }
UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error: %s", sqlite3_errmsg(_ppDb)).c_str()); UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error: %s", sqlite3_errmsg(_ppDb)).c_str());
// scan_max_pts
rc = sqlite3_bind_int(ppStmt, index++, sensorData.laserScanMaxPts());
UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error: %s", sqlite3_errmsg(_ppDb)).c_str());
// scan // scan
if(!sensorData.laserScanCompressed().empty()) if(!sensorData.laserScanCompressed().empty())
{ {
@@ -2619,10 +2623,6 @@ void DBDriverSqlite3::stepSensorData(sqlite3_stmt * ppStmt,
} }
UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error: %s", sqlite3_errmsg(_ppDb)).c_str()); UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error: %s", sqlite3_errmsg(_ppDb)).c_str());
// scan_max_pts
rc = sqlite3_bind_int(ppStmt, index++, sensorData.laserScanMaxPts());
UASSERT_MSG(rc == SQLITE_OK, uFormat("DB error: %s", sqlite3_errmsg(_ppDb)).c_str());
//step //step
rc=sqlite3_step(ppStmt); rc=sqlite3_step(ppStmt);
UASSERT_MSG(rc == SQLITE_DONE, uFormat("DB error: %s", sqlite3_errmsg(_ppDb)).c_str()); UASSERT_MSG(rc == SQLITE_DONE, uFormat("DB error: %s", sqlite3_errmsg(_ppDb)).c_str());
+10 -2
View File
@@ -2331,7 +2331,9 @@ Transform Memory::computeIcpTransform(
} }
else else
{ {
msg = "Depths 3D empty?!?"; msg = uFormat("Depths 3D empty?!? (new[%d]=%d old[%d]=%d)",
newS.id(), newS.sensorData().depthOrRightRaw().total(),
oldS.id(), oldS.sensorData().depthOrRightRaw().total());
UERROR(msg.c_str()); UERROR(msg.c_str());
} }
} }
@@ -2459,7 +2461,9 @@ Transform Memory::computeIcpTransform(
} }
else else
{ {
msg = "Depths 2D empty?!?"; msg = uFormat("Depths 2D empty?!? (new[%d]=%d old[%d]=%d)",
newS.id(), newS.sensorData().laserScanRaw().total(),
oldS.id(), oldS.sensorData().laserScanRaw().total());
UERROR(msg.c_str()); UERROR(msg.c_str());
} }
} }
@@ -3148,6 +3152,10 @@ SensorData Memory::getNodeData(int nodeId, bool uncompressedData)
else else
{ {
_dbDriver->getNodeData(nodeId, r); _dbDriver->getNodeData(nodeId, r);
if(uncompressedData)
{
r.uncompressData();
}
} }
} }
+7 -3
View File
@@ -2180,6 +2180,7 @@ bool Rtabmap::process(
//============================================================== //==============================================================
// Finalize statistics and log files // Finalize statistics and log files
//============================================================== //==============================================================
int localGraphSize = 0;
if(_publishStats) if(_publishStats)
{ {
statistics_.addStatistic(Statistics::kTimingStatistics_creation(), timeStatsCreation*1000); statistics_.addStatistic(Statistics::kTimingStatistics_creation(), timeStatsCreation*1000);
@@ -2240,6 +2241,7 @@ bool Rtabmap::process(
statistics_.setConstraints(constraints); statistics_.setConstraints(constraints);
statistics_.setSignatures(signatures); statistics_.setSignatures(signatures);
statistics_.addStatistic(Statistics::kMemoryLocal_graph_size(), poses.size()); statistics_.addStatistic(Statistics::kMemoryLocal_graph_size(), poses.size());
localGraphSize = poses.size();
} }
//Start trashing //Start trashing
@@ -2271,7 +2273,7 @@ bool Rtabmap::process(
timeEmptyingTrash, timeEmptyingTrash,
timeRetrievalDbAccess, timeRetrievalDbAccess,
timeAddLoopClosureLink); timeAddLoopClosureLink);
std::string logI = uFormat("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", std::string logI = uFormat("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
_loopClosureHypothesis.first, _loopClosureHypothesis.first,
_highestHypothesis.first, _highestHypothesis.first,
(int)signaturesRemoved.size(), (int)signaturesRemoved.size(),
@@ -2286,9 +2288,11 @@ bool Rtabmap::process(
lcHypothesisReactivated, lcHypothesisReactivated,
refUniqueWordsCount, refUniqueWordsCount,
retrievalId, retrievalId,
0.0f, 0,
rehearsalMaxId, rehearsalMaxId,
rehearsalMaxId>0?1:0); rehearsalMaxId>0?1:0,
localGraphSize,
data.id());
if(_statisticLogsBufferedInRAM) if(_statisticLogsBufferedInRAM)
{ {
_bufferedLogsF.push_back(logF); _bufferedLogsF.push_back(logF);
+16 -1
View File
@@ -367,7 +367,9 @@ SensorData::SensorData(
void SensorData::uncompressData() void SensorData::uncompressData()
{ {
uncompressData(&_imageRaw, &_depthOrRightRaw, &_laserScanRaw); uncompressData(_imageCompressed.empty()?0:&_imageRaw,
_depthOrRightCompressed.empty()?0:&_depthOrRightRaw,
_laserScanCompressed.empty()?0:&_laserScanRaw);
} }
void SensorData::uncompressData(cv::Mat * imageRaw, cv::Mat * depthRaw, cv::Mat * laserScanRaw) void SensorData::uncompressData(cv::Mat * imageRaw, cv::Mat * depthRaw, cv::Mat * laserScanRaw)
@@ -426,14 +428,27 @@ void SensorData::uncompressDataConst(cv::Mat * imageRaw, cv::Mat * depthRaw, cv:
if(imageRaw && imageRaw->empty()) if(imageRaw && imageRaw->empty())
{ {
*imageRaw = ctImage.getUncompressedData(); *imageRaw = ctImage.getUncompressedData();
if(imageRaw->empty())
{
UWARN("Requested raw image data, but the sensor data (%d) doesn't have image.", this->id());
}
} }
if(depthRaw && depthRaw->empty()) if(depthRaw && depthRaw->empty())
{ {
*depthRaw = ctDepth.getUncompressedData(); *depthRaw = ctDepth.getUncompressedData();
if(depthRaw->empty())
{
UWARN("Requested depth/right image data, but the sensor data (%d) doesn't have depth/right image.", this->id());
}
} }
if(laserScanRaw && laserScanRaw->empty()) if(laserScanRaw && laserScanRaw->empty())
{ {
*laserScanRaw = ctLaserScan.getUncompressedData(); *laserScanRaw = ctLaserScan.getUncompressedData();
if(laserScanRaw->empty())
{
UWARN("Requested laser scan data, but the sensor data (%d) doesn't have laser scan.", this->id());
}
} }
} }
} }