mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-05 01:07:49 +08:00
Always publish goals to move_base even if the goal didn't have change (the map may have changed).
This commit is contained in:
+5
-16
@@ -1066,34 +1066,23 @@ void CoreWrapper::process(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Transform updatedGoalPose = rtabmap_.getPose(rtabmap_.getPathCurrentGoalId());
|
currentMetricGoal_ = rtabmap_.getPose(rtabmap_.getPathCurrentGoalId());
|
||||||
if(!updatedGoalPose.isNull())
|
if(!currentMetricGoal_.isNull())
|
||||||
{
|
{
|
||||||
// Adjust the target pose relative to last node
|
// Adjust the target pose relative to last node
|
||||||
bool lastPoseModified = false;
|
|
||||||
if(rtabmap_.getPathCurrentGoalId() == rtabmap_.getPath().back().first && rtabmap_.getLocalOptimizedPoses().size())
|
if(rtabmap_.getPathCurrentGoalId() == rtabmap_.getPath().back().first && rtabmap_.getLocalOptimizedPoses().size())
|
||||||
{
|
{
|
||||||
if(latestNodeWasReached_ ||
|
if(latestNodeWasReached_ ||
|
||||||
rtabmap_.getLocalOptimizedPoses().rbegin()->second.getDistance(currentMetricGoal_) < rtabmap_.getGoalReachedRadius() ||
|
rtabmap_.getLocalOptimizedPoses().rbegin()->second.getDistance(currentMetricGoal_) < rtabmap_.getGoalReachedRadius() ||
|
||||||
rtabmap_.getPathTransformToGoal().getNorm() < rtabmap_.getGoalReachedRadius())
|
rtabmap_.getPathTransformToGoal().getNorm() < rtabmap_.getGoalReachedRadius())
|
||||||
{
|
{
|
||||||
if(!latestNodeWasReached_)
|
|
||||||
{
|
|
||||||
lastPoseModified = true;
|
|
||||||
}
|
|
||||||
latestNodeWasReached_ = true;
|
latestNodeWasReached_ = true;
|
||||||
updatedGoalPose *= rtabmap_.getPathTransformToGoal();
|
currentMetricGoal_ *= rtabmap_.getPathTransformToGoal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// detect if the goal has changed or local map
|
// publish next goal with updated currentMetricGoal_
|
||||||
// has changed so much that current goal drifted
|
publishCurrentGoal(stamp);
|
||||||
if(lastPoseModified || currentMetricGoal_.getDistance(updatedGoalPose) > rtabmap_.getGoalReachedRadius())
|
|
||||||
{
|
|
||||||
currentMetricGoal_ = updatedGoalPose;
|
|
||||||
|
|
||||||
publishCurrentGoal(stamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// publish local path
|
// publish local path
|
||||||
publishLocalPath(stamp);
|
publishLocalPath(stamp);
|
||||||
|
|||||||
Reference in New Issue
Block a user