mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-04 09:07:47 +08:00
Fixed smallMovement when rehearsal is not trigdered at the same time
This commit is contained in:
+23
-8
@@ -1522,16 +1522,31 @@ bool Rtabmap::process(
|
|||||||
Transform t;
|
Transform t;
|
||||||
if(_memory->isIncremental())
|
if(_memory->isIncremental())
|
||||||
{
|
{
|
||||||
const std::multimap<int, Link> & links = signature->getLinks();
|
// Check small motion if current node is not an intermediate node already
|
||||||
if(links.size() && links.begin()->second.type() == Link::kNeighbor)
|
if(signature->getWeight() >= 0)
|
||||||
{
|
{
|
||||||
const Signature * s = _memory->getSignature(links.begin()->second.to());
|
// It should contain only the query and its first (non-intermediate) neighbor (smaller id)
|
||||||
UASSERT(s!=0);
|
std::map<int, int> neighbors = _memory->getNeighborsId(signature->id(), 2, 0, true, true, true, true);
|
||||||
// Check small motion if current node is not an intermediate node already
|
if(neighbors.size() == 2)
|
||||||
if(signature->getWeight() >= 0)
|
|
||||||
{
|
{
|
||||||
t = links.begin()->second.transform();
|
int nid = neighbors.begin()->first;
|
||||||
linkedToIntermediateNode = s->getWeight() == -1;
|
const std::multimap<int, Link> & links = signature->getLinks();
|
||||||
|
if(links.find(nid) != links.end())
|
||||||
|
{
|
||||||
|
// direct neighbor
|
||||||
|
t = links.find(nid)->second.transform();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use optimized poses to check how far it is from the latest non-intermediate node
|
||||||
|
std::map<int, Transform>::iterator niter = _optimizedPoses.find(nid);
|
||||||
|
if(niter != _optimizedPoses.end())
|
||||||
|
{
|
||||||
|
t = niter->second.inverse() * _mapCorrection * signature->getPose();
|
||||||
|
}
|
||||||
|
// not direct link, it means there are intermediate nodes
|
||||||
|
linkedToIntermediateNode = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user