mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-14 23:40:20 +08:00
Merge branch 'master' of github.com:introlab/rtabmap into devel
This commit is contained in:
+20
-11
@@ -3527,17 +3527,6 @@ bool Rtabmap::computePath(const Transform & targetPose)
|
|||||||
}
|
}
|
||||||
UINFO("Time getting links = %fs", timer.ticks());
|
UINFO("Time getting links = %fs", timer.ticks());
|
||||||
|
|
||||||
int nearestId = rtabmap::graph::findNearestNode(nodes, targetPose);
|
|
||||||
UINFO("Nearest node found=%d ,%fs", nearestId, timer.ticks());
|
|
||||||
if(nearestId > 0)
|
|
||||||
{
|
|
||||||
if(_localRadius != 0.0f && targetPose.getDistance(nodes.at(nearestId)) > _localRadius)
|
|
||||||
{
|
|
||||||
UWARN("Cannot plan farther than %f m from the graph! (distance=%f m from node %d)",
|
|
||||||
_localRadius, targetPose.getDistance(nodes.at(nearestId)), nearestId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int currentNode = 0;
|
int currentNode = 0;
|
||||||
if(_memory->isIncremental())
|
if(_memory->isIncremental())
|
||||||
{
|
{
|
||||||
@@ -3558,6 +3547,26 @@ bool Rtabmap::computePath(const Transform & targetPose)
|
|||||||
currentNode = graph::findNearestNode(_optimizedPoses, _lastLocalizationPose);
|
currentNode = graph::findNearestNode(_optimizedPoses, _lastLocalizationPose);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nearestId;
|
||||||
|
if(!_lastLocalizationPose.isNull() && _lastLocalizationPose.getDistance(targetPose) < _localRadius)
|
||||||
|
{
|
||||||
|
// target can be reached from the current node
|
||||||
|
nearestId = currentNode;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nearestId = rtabmap::graph::findNearestNode(nodes, targetPose);
|
||||||
|
}
|
||||||
|
UINFO("Nearest node found=%d ,%fs", nearestId, timer.ticks());
|
||||||
|
if(nearestId > 0)
|
||||||
|
{
|
||||||
|
if(_localRadius != 0.0f && targetPose.getDistance(nodes.at(nearestId)) > _localRadius)
|
||||||
|
{
|
||||||
|
UWARN("Cannot plan farther than %f m from the graph! (distance=%f m from node %d)",
|
||||||
|
_localRadius, targetPose.getDistance(nodes.at(nearestId)), nearestId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
UINFO("Computing path from location %d to %d", currentNode, nearestId);
|
UINFO("Computing path from location %d to %d", currentNode, nearestId);
|
||||||
UTimer timer;
|
UTimer timer;
|
||||||
_path = uListToVector(rtabmap::graph::computePath(nodes, links, currentNode, nearestId));
|
_path = uListToVector(rtabmap::graph::computePath(nodes, links, currentNode, nearestId));
|
||||||
|
|||||||
Reference in New Issue
Block a user