Reset stuck when moving toward the goal

This commit is contained in:
Mathieu Labbe
2016-07-11 17:40:34 -04:00
parent 38c3e3600d
commit c24079884d

View File

@@ -3889,17 +3889,17 @@ void Rtabmap::updateGoalIndex()
distanceToCurrentGoal = currentPose.getDistanceSquared(iter->second);
}
}
if(distanceToCurrentGoal > 0.0f)
{
if(_pathStuckDistance > 0.0f &&
distanceToCurrentGoal >= _pathStuckDistance)
if(distanceToCurrentGoal >= _pathStuckDistance)
{
// we are not approaching the goal
isStuck = true;
}
else
{
_pathStuckDistance = distanceToCurrentGoal;
if(_pathStuckDistance == 0.0f)
{
_pathStuckDistance = distanceToCurrentGoal;
}
}
}
else