mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-07 02:27:47 +08:00
Fixed nodes weight not modified in db when deleted
This commit is contained in:
@@ -321,6 +321,8 @@ int main(int argc, char * argv[])
|
||||
memory.close(false);
|
||||
return 0;
|
||||
}
|
||||
memory.emptyTrash();
|
||||
memory.joinTrashThread();
|
||||
|
||||
if(isWholeGraphConnected || removeAllOrphanNodes)
|
||||
{
|
||||
@@ -354,6 +356,7 @@ int main(int argc, char * argv[])
|
||||
totalBefore, ids.size(), posesOut.size());
|
||||
// Not all graph is connected anymore while it was before reduction:
|
||||
// that means we created orphan nodes, remove them
|
||||
int transferred = 0;
|
||||
for(std::map<int, Transform>::iterator iter=poses.lower_bound(0); iter!=poses.end(); ++iter)
|
||||
{
|
||||
if(posesOut.find(iter->first) == posesOut.end())
|
||||
@@ -366,8 +369,13 @@ int main(int argc, char * argv[])
|
||||
printf("Removed %d from WM/LTM.\n", iter->first);
|
||||
}
|
||||
wm.erase(iter->first);
|
||||
++transferred;
|
||||
}
|
||||
}
|
||||
if(transferred>0) {
|
||||
memory.emptyTrash();
|
||||
memory.joinTrashThread();
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("[Warning] After graph reduction, the global graph is not all "
|
||||
@@ -454,11 +462,15 @@ int main(int argc, char * argv[])
|
||||
int transferred = 0;
|
||||
for(auto id:ids)
|
||||
{
|
||||
if(wm.find(id) == wm.end()) {
|
||||
if(wm.find(id) == wm.end() && memory.getWorkingMem().find(id) != memory.getWorkingMem().end()) {
|
||||
memory.deleteLocation(id, 0, /*keepLinkedInDb*/ true);
|
||||
++transferred;
|
||||
}
|
||||
}
|
||||
if(transferred>0) {
|
||||
memory.emptyTrash();
|
||||
memory.joinTrashThread();
|
||||
}
|
||||
printf("Restoring Working Memory... done! Transferred %d nodes.\n", transferred);
|
||||
|
||||
printf("Saving all changes to database...\n");
|
||||
|
||||
Reference in New Issue
Block a user