Skip to content

Commit

Permalink
Fixed map empty on start if there is no global loop closure yet in lo…
Browse files Browse the repository at this point in the history
…calization mode when RGBD/OptimizeFromGraphEnd is true
  • Loading branch information
matlabbe committed Apr 6, 2024
1 parent d794669 commit 92edae3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions corelib/src/Rtabmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,13 @@ bool Rtabmap::process(
{
iter->second = mapCorrectionInv * iter->second;
}

std::map<int, Transform> nodesOnly(_optimizedPoses.lower_bound(1), _optimizedPoses.end());
_lastLocalizationNodeId = graph::findNearestNode(nodesOnly, _lastLocalizationPose);
UWARN("Transformed map accordingly to last localization pose saved in database (%s=true)! nearest id = %d of last pose = %s",
Parameters::kRGBDOptimizeFromGraphEnd().c_str(),
_lastLocalizationNodeId,
_lastLocalizationPose.prettyPrint().c_str());
}
}

Expand Down Expand Up @@ -4343,6 +4350,7 @@ bool Rtabmap::process(
}
else
{
UDEBUG("Clearing _lastLocalizationNodeId(%d)", _lastLocalizationNodeId);
_lastLocalizationNodeId = 0;
}
}
Expand Down

0 comments on commit 92edae3

Please sign in to comment.