Added missing signature info in republished data

This commit is contained in:
matlabbe
2022-10-30 13:59:08 -07:00
parent d70924a3a4
commit 86f66cc8b8
2 changed files with 20 additions and 9 deletions

View File

@@ -4250,7 +4250,7 @@ bool Rtabmap::process(
std::stringstream stream; std::stringstream stream;
for(std::multimap<int, int>::iterator iter=missingIds.begin(); iter!=missingIds.end() && loaded<(int)_maxRepublished; ++iter) for(std::multimap<int, int>::iterator iter=missingIds.begin(); iter!=missingIds.end() && loaded<(int)_maxRepublished; ++iter)
{ {
statistics_.addSignatureData(_memory->getNodeData(iter->second, true, true, true, true)); statistics_.addSignatureData(getSignatureCopy(iter->second, true, true, true, true, true, true));
_nodesToRepublish.erase(iter->second); _nodesToRepublish.erase(iter->second);
++loaded; ++loaded;
stream << iter->second << " "; stream << iter->second << " ";

View File

@@ -1947,6 +1947,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
signature = _cachedSignatures.value(rehearsalMerged); signature = _cachedSignatures.value(rehearsalMerged);
} }
int newIdIsTemporary = 0;
if(signature.id()!=0) if(signature.id()!=0)
{ {
// make sure data are uncompressed // make sure data are uncompressed
@@ -1976,6 +1977,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
if(smallMovement || fastMovement) if(smallMovement || fastMovement)
{ {
_cachedSignatures.insert(0, signature); // zero means temporary _cachedSignatures.insert(0, signature); // zero means temporary
newIdIsTemporary = stat.refImageId();
} }
else else
{ {
@@ -2020,7 +2022,13 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
} }
} }
_cachedWordsCount.insert(std::make_pair(iter->first, (float)count)); _cachedWordsCount.insert(std::make_pair(iter->first, (float)count));
UINFO("Added %d node data to cache", iter->first); UINFO("Added node data %d [map=%d] to cache", iter->first, iter->second.mapId());
_currentMapIds.insert(std::make_pair(iter->first, iter->second.mapId()));
if(!iter->second.getGroundTruthPose().isNull())
{
_currentGTPosesMap.insert(std::make_pair(iter->first, iter->second.getGroundTruthPose()));
}
} }
} }
@@ -2610,14 +2618,17 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
std::vector<int> missingIds; std::vector<int> missingIds;
for(std::map<int, Transform>::const_iterator iter=stat.poses().begin(); iter!=stat.poses().end(); ++iter) for(std::map<int, Transform>::const_iterator iter=stat.poses().begin(); iter!=stat.poses().end(); ++iter)
{ {
QMap<int, Signature>::iterator ster = _cachedSignatures.find(iter->first); if(newIdIsTemporary != iter->first)
if(ster == _cachedSignatures.end() ||
(ster.value().getWeight() >=0 && // ignore intermediate nodes
ster.value().sensorData().imageCompressed().empty() &&
ster.value().sensorData().depthOrRightCompressed().empty() &&
ster.value().sensorData().laserScanCompressed().empty()))
{ {
missingIds.push_back(iter->first); QMap<int, Signature>::iterator ster = _cachedSignatures.find(iter->first);
if(ster == _cachedSignatures.end() ||
(ster.value().getWeight() >=0 && // ignore intermediate nodes
ster.value().sensorData().imageCompressed().empty() &&
ster.value().sensorData().depthOrRightCompressed().empty() &&
ster.value().sensorData().laserScanCompressed().empty()))
{
missingIds.push_back(iter->first);
}
} }
} }
if(!missingIds.empty()) if(!missingIds.empty())