Skip to content

Commit

Permalink
fix(utils): fix invalid insertion
Browse files Browse the repository at this point in the history
Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota authored and takayuki5168 committed Oct 25, 2023
1 parent a35e012 commit 2a62b9d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion planning/behavior_path_planner/src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,7 @@ std::vector<lanelet::ConstPoint3d> getBoundWithIntersectionAreas(
const auto shared_point_itr_last =
std::find_if(expanded_bound.rbegin(), expanded_bound.rend(), [&](const auto & p) {
return std::any_of(
intersection_bound.begin(), intersection_bound.end(),
intersection_bound.rbegin(), intersection_bound.rend(),
[&](const auto & point) { return point.id() == p.id(); });
});

Expand All @@ -1748,6 +1748,13 @@ std::vector<lanelet::ConstPoint3d> getBoundWithIntersectionAreas(
continue;
}

// TODO(Satoshi OTA): remove this guard.
if (
std::distance(intersection_bound.begin(), trim_point_itr_last) <
std::distance(intersection_bound.begin(), trim_point_itr_init)) {
continue;
}

std::vector<lanelet::ConstPoint3d> tmp_bound{};

tmp_bound.insert(tmp_bound.end(), expanded_bound.begin(), shared_point_itr_init);
Expand Down

0 comments on commit 2a62b9d

Please sign in to comment.