Skip to content

Commit a31d445

Browse files
committed
Merge branch 'humble' of https://github.com/ros-navigation/navigation2 into humble
2 parents c22085e + b71caaf commit a31d445

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

‎nav2_theta_star_planner/src/theta_star_planner.cpp‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,20 @@ nav_msgs::msg::Path ThetaStarPlanner::createPlan(
9595

9696
// Corner case of start and goal beeing on the same cell
9797
unsigned int mx_start, my_start, mx_goal, my_goal;
98-
planner_->costmap_->worldToMap(start.pose.position.x, start.pose.position.y, mx_start, my_start);
99-
planner_->costmap_->worldToMap(goal.pose.position.x, goal.pose.position.y, mx_goal, my_goal);
98+
if (!planner_->costmap_->worldToMap(
99+
start.pose.position.x, start.pose.position.y, mx_start, my_start))
100+
{
101+
RCLCPP_WARN(logger_, "Start Coordinates were outside map bounds");
102+
return global_path;
103+
}
104+
105+
if (!planner_->costmap_->worldToMap(
106+
goal.pose.position.x, goal.pose.position.y, mx_goal, my_goal))
107+
{
108+
RCLCPP_WARN(logger_, "Goal Coordinates were outside map bounds");
109+
return global_path;
110+
}
111+
100112
if (mx_start == mx_goal && my_start == my_goal) {
101113
if (planner_->costmap_->getCost(mx_start, my_start) == nav2_costmap_2d::LETHAL_OBSTACLE) {
102114
RCLCPP_WARN(logger_, "Failed to create a unique pose path because of obstacles");

0 commit comments

Comments
 (0)