Skip to content

Commit

Permalink
fix(behavior_path_planner): extract backward obstacles correctly (aut…
Browse files Browse the repository at this point in the history
…owarefoundation#3719)

Signed-off-by: Takayuki Murooka <[email protected]>
  • Loading branch information
takayuki5168 authored May 15, 2023
1 parent 8f4b385 commit a3c94fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion planning/behavior_path_planner/src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ std::vector<PolygonPoint> generatePolygonInsideBounds(
}

std::vector<PolygonPoint> inside_poly;
bool has_intersection = false; // NOTE: between obstacle polygon and bound
for (int i = 0; i < static_cast<int>(full_polygon.size()); ++i) {
const auto & curr_poly = full_polygon.at(i);
const auto & prev_poly = full_polygon.at(i == 0 ? full_polygon.size() - 1 : i - 1);
Expand All @@ -249,6 +250,7 @@ std::vector<PolygonPoint> generatePolygonInsideBounds(
bound, intersection->first, intersection->second);
const auto intersect_point =
PolygonPoint{intersection->second, intersection->first, lon_dist, 0.0};
has_intersection = true;

if (is_prev_outside && !is_curr_outside) {
inside_poly.push_back(intersect_point);
Expand All @@ -261,7 +263,10 @@ std::vector<PolygonPoint> generatePolygonInsideBounds(
continue;
}

return inside_poly;
if (has_intersection) {
return inside_poly;
}
return std::vector<PolygonPoint>{};
}

std::vector<geometry_msgs::msg::Point> convertToGeometryPoints(
Expand Down

0 comments on commit a3c94fd

Please sign in to comment.