fixed issue 10

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1544 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2014-07-11 19:03:11 +00:00
parent e2c612dffd
commit 8da1d61a71
2 changed files with 5 additions and 3 deletions

View File

@@ -755,7 +755,7 @@ std::map<int, int> Memory::getNeighborsId(int signatureId,
for(std::list<int>::iterator jter = curentMarginList.begin(); jter!=curentMarginList.end(); ++jter)
{
if(ids.insert(std::pair<int, int>(*jter, m)).second)
if(ids.find(*jter) == ids.end())
{
//UDEBUG("Added %d with margin %d", *jter, m);
// Look up in STM/WM if all ids are here, if not... load them from the database
@@ -768,6 +768,8 @@ std::map<int, int> Memory::getNeighborsId(int signatureId,
const std::map<int, Transform> * childLoopClosureIds = &tmpChildLoopClosureIds;
if(s)
{
ids.insert(std::pair<int, int>(*jter, m));
neighborIds = &s->getNeighbors();
if(!ignoreLoopIds)
@@ -778,6 +780,8 @@ std::map<int, int> Memory::getNeighborsId(int signatureId,
}
else if(maxCheckedInDatabase == -1 || (maxCheckedInDatabase > 0 && _dbDriver && nbLoadedFromDb < maxCheckedInDatabase))
{
ids.insert(std::pair<int, int>(*jter, m));
UTimer timer;
_dbDriver->loadNeighbors(*jter, tmpNeighborIds);
if(!ignoreLoopIds)

View File

@@ -1962,8 +1962,6 @@ void Rtabmap::optimizeCurrentMap(
if(!_optimizeFromGraphEnd && ids.size() > 1)
{
UTimer timer;
UDEBUG("Optimize from the first location (%d) instead of the last (%d) "
"in the local graph. Recomputing neighbors depth...");
int first = ids.begin()->first;
ids = _memory->getNeighborsId(first, 0, lookInDatabase?-1:0, true);