Skip to content

Commit

Permalink
fix edge case
Browse files Browse the repository at this point in the history
Signed-off-by: ladianchad <qhrejddlvltm@gmail.com>
  • Loading branch information
ladianchad committed Jul 5, 2023
1 parent 630a22e commit 287d199
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions teb_local_planner/src/teb_local_planner_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,10 @@ bool TebLocalPlannerROS::pruneGlobalPlan(const geometry_msgs::msg::PoseStamped&
//robot.setData( global_to_plan_transform * global_pose );

double dist_thresh_sq = dist_behind_robot*dist_behind_robot;

if(global_plan.size() == 1){
return true;
}

// iterate plan until a pose close the robot is found
std::vector<geometry_msgs::msg::PoseStamped>::iterator it = global_plan.begin();
Expand All @@ -679,9 +683,7 @@ bool TebLocalPlannerROS::pruneGlobalPlan(const geometry_msgs::msg::PoseStamped&
}
if (erase_end == global_plan.end())
return false;

if (erase_end != global_plan.begin())
global_plan.erase(global_plan.begin(), erase_end);
global_plan.erase(global_plan.begin(), erase_end);
}
catch (const tf2::TransformException& ex)
{
Expand Down

0 comments on commit 287d199

Please sign in to comment.