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

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());
// 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
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());
// 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
rc=sqlite3_step(ppStmt);
UASSERT_MSG(rc == SQLITE_DONE, uFormat("DB error: %s", sqlite3_errmsg(_ppDb)).c_str());

View File

@@ -2331,7 +2331,9 @@ Transform Memory::computeIcpTransform(
}
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());
}
}
@@ -2459,7 +2461,9 @@ Transform Memory::computeIcpTransform(
}
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());
}
}
@@ -3148,6 +3152,10 @@ SensorData Memory::getNodeData(int nodeId, bool uncompressedData)
else
{
_dbDriver->getNodeData(nodeId, r);
if(uncompressedData)
{
r.uncompressData();
}
}
}

View File

@@ -2180,6 +2180,7 @@ bool Rtabmap::process(
//==============================================================
// Finalize statistics and log files
//==============================================================
int localGraphSize = 0;
if(_publishStats)
{
statistics_.addStatistic(Statistics::kTimingStatistics_creation(), timeStatsCreation*1000);
@@ -2240,6 +2241,7 @@ bool Rtabmap::process(
statistics_.setConstraints(constraints);
statistics_.setSignatures(signatures);
statistics_.addStatistic(Statistics::kMemoryLocal_graph_size(), poses.size());
localGraphSize = poses.size();
}
//Start trashing
@@ -2271,7 +2273,7 @@ bool Rtabmap::process(
timeEmptyingTrash,
timeRetrievalDbAccess,
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,
_highestHypothesis.first,
(int)signaturesRemoved.size(),
@@ -2286,9 +2288,11 @@ bool Rtabmap::process(
lcHypothesisReactivated,
refUniqueWordsCount,
retrievalId,
0.0f,
0,
rehearsalMaxId,
rehearsalMaxId>0?1:0);
rehearsalMaxId>0?1:0,
localGraphSize,
data.id());
if(_statisticLogsBufferedInRAM)
{
_bufferedLogsF.push_back(logF);

View File

@@ -367,7 +367,9 @@ SensorData::SensorData(
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)
@@ -426,14 +428,27 @@ void SensorData::uncompressDataConst(cv::Mat * imageRaw, cv::Mat * depthRaw, cv:
if(imageRaw && imageRaw->empty())
{
*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())
{
*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())
{
*laserScanRaw = ctLaserScan.getUncompressedData();
if(laserScanRaw->empty())
{
UWARN("Requested laser scan data, but the sensor data (%d) doesn't have laser scan.", this->id());
}
}
}
}