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); distanceToCurrentGoal = currentPose.getDistanceSquared(iter->second);
} }
} }
if(distanceToCurrentGoal > 0.0f) if(distanceToCurrentGoal > 0.0f)
{ {
if(_pathStuckDistance > 0.0f && if(distanceToCurrentGoal >= _pathStuckDistance)
distanceToCurrentGoal >= _pathStuckDistance)
{ {
// we are not approaching the goal // we are not approaching the goal
isStuck = true; isStuck = true;
} if(_pathStuckDistance == 0.0f)
else {
{ _pathStuckDistance = distanceToCurrentGoal;
_pathStuckDistance = distanceToCurrentGoal; }
} }
} }
else else