mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
core: added rtabmap::deleteLocation(id)
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@920 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -1413,31 +1413,44 @@ void Memory::deleteLastLocation()
|
||||
Signature * lastSignature = _lastSignature;
|
||||
if(lastSignature)
|
||||
{
|
||||
UDEBUG("deleting last location %d", lastSignature->id());
|
||||
const std::set<int> & neighbors = lastSignature->getNeighbors();
|
||||
this->deleteLocation(lastSignature->id());
|
||||
}
|
||||
}
|
||||
|
||||
void Memory::deleteLocation(int locationId)
|
||||
{
|
||||
UASSERT_MSG(this->isInSTM(locationId), "Deleting location outside the STM is not implemented!");
|
||||
Signature * location = _getSignature(locationId);
|
||||
if(location)
|
||||
{
|
||||
UDEBUG("deleting location %d", location->id());
|
||||
const std::set<int> & neighbors = location->getNeighbors();
|
||||
for(std::set<int>::const_iterator iter=neighbors.begin(); iter!=neighbors.end(); ++iter)
|
||||
{
|
||||
Signature * s = _getSignature(*iter);
|
||||
if(s)
|
||||
{
|
||||
s->removeNeighbor(lastSignature->id());
|
||||
_lastSignature = s;
|
||||
s->removeNeighbor(location->id());
|
||||
if(location == _lastSignature)
|
||||
{
|
||||
_lastSignature = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const std::set<int> & child = lastSignature->getChildLoopClosureIds();
|
||||
const std::set<int> & child = location->getChildLoopClosureIds();
|
||||
for(std::set<int>::const_iterator iter=child.begin(); iter!=child.end(); ++iter)
|
||||
{
|
||||
Signature * s = _getSignature(*iter);
|
||||
if(s)
|
||||
{
|
||||
s->removeLoopClosureId(lastSignature->id());
|
||||
s->setWeight(s->getWeight() + lastSignature->getWeight());
|
||||
s->removeLoopClosureId(location->id());
|
||||
s->setWeight(s->getWeight() + location->getWeight());
|
||||
}
|
||||
}
|
||||
lastSignature->setWeight(0);
|
||||
location->setWeight(0);
|
||||
|
||||
this->moveToTrash(lastSignature, false);
|
||||
this->moveToTrash(location, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1209,13 +1209,20 @@ void Rtabmap::setWorkingDirectory(std::string path)
|
||||
|
||||
void Rtabmap::deleteLastLocation()
|
||||
{
|
||||
|
||||
if(_memory)
|
||||
{
|
||||
_memory->deleteLastLocation();
|
||||
}
|
||||
}
|
||||
|
||||
void Rtabmap::deleteLocation(int locationId)
|
||||
{
|
||||
if(_memory)
|
||||
{
|
||||
_memory->deleteLocation(locationId);
|
||||
}
|
||||
}
|
||||
|
||||
void Rtabmap::rejectLastLoopClosure()
|
||||
{
|
||||
UDEBUG("_lcHypothesisId=%d", _lcHypothesisId);
|
||||
@@ -1236,7 +1243,6 @@ void Rtabmap::rejectLastLoopClosure()
|
||||
|
||||
void Rtabmap::process(const cv::Mat & image, int id, std::multimap<int, cv::KeyPoint> * words)
|
||||
{
|
||||
|
||||
this->process(Image(image, id), words);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user