mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 01:50:24 +08:00
Neighbor link refining: set small variance if small displacement and variance=1
This commit is contained in:
@@ -1012,23 +1012,34 @@ bool Rtabmap::process(
|
|||||||
|
|
||||||
// Update optimizedPoses with the newly added node
|
// Update optimizedPoses with the newly added node
|
||||||
Transform newPose;
|
Transform newPose;
|
||||||
if(signature->getLinks().size() == 1 &&
|
if(_poseScanMatching &&
|
||||||
!smallDisplacement &&
|
signature->getLinks().size() == 1 &&
|
||||||
_memory->isIncremental()) // ignore pose matching in localization mode
|
_memory->isIncremental() && // ignore pose matching in localization mode
|
||||||
|
rehearsedId == 0) // don't do it if rehearsal happened
|
||||||
{
|
{
|
||||||
int oldId = signature->getLinks().begin()->first;
|
int oldId = signature->getLinks().begin()->first;
|
||||||
const Signature * oldS = _memory->getSignature(oldId);
|
const Signature * oldS = _memory->getSignature(oldId);
|
||||||
UASSERT(oldS != 0);
|
UASSERT(oldS != 0);
|
||||||
|
|
||||||
|
Transform guess = signature->getLinks().begin()->second.transform();
|
||||||
|
|
||||||
|
if(smallDisplacement)
|
||||||
|
{
|
||||||
|
if(signature->getLinks().begin()->second.transVariance() == 1)
|
||||||
|
{
|
||||||
|
// set small variance
|
||||||
|
UDEBUG("Set small variance. The robot is not moving.");
|
||||||
|
_memory->updateLink(signature->id(), oldId, guess, 0.0001, 0.0001);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//============================================================
|
//============================================================
|
||||||
// Scan matching
|
// Scan matching
|
||||||
//============================================================
|
//============================================================
|
||||||
if(_poseScanMatching &&
|
if(!signature->sensorData().laserScanCompressed().empty())
|
||||||
!signature->sensorData().laserScanCompressed().empty() &&
|
|
||||||
rehearsedId == 0) // don't do it if rehearsal happened
|
|
||||||
{
|
{
|
||||||
UINFO("Odometry correction by scan matching");
|
UINFO("Odometry correction by scan matching");
|
||||||
Transform guess = signature->getLinks().begin()->second.transform();
|
|
||||||
double variance = 1.0;
|
double variance = 1.0;
|
||||||
int inliers = 0;
|
int inliers = 0;
|
||||||
float inliersRatio = 0;
|
float inliersRatio = 0;
|
||||||
@@ -1077,6 +1088,7 @@ bool Rtabmap::process(
|
|||||||
}
|
}
|
||||||
timeScanMatching = timer.ticks();
|
timeScanMatching = timer.ticks();
|
||||||
ULOGGER_INFO("timeScanMatching=%fs", timeScanMatching);
|
ULOGGER_INFO("timeScanMatching=%fs", timeScanMatching);
|
||||||
|
}
|
||||||
|
|
||||||
UASSERT(oldS->hasLink(signature->id()));
|
UASSERT(oldS->hasLink(signature->id()));
|
||||||
UASSERT(uContains(_optimizedPoses, oldId));
|
UASSERT(uContains(_optimizedPoses, oldId));
|
||||||
|
|||||||
Reference in New Issue
Block a user