Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(out_of_lane): handle undetected overlap edge cases #790

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,21 @@ lanelet::ConstLanelets calculate_other_lanelets(
const auto lanelets_within_range = lanelet::geometry::findWithin2d(
route_handler.getLaneletMapPtr()->laneletLayer, ego_point,
std::max(params.slow_dist_threshold, params.stop_dist_threshold));
const auto is_overlapped_by_path_lanelets = [&](const auto & l) {
for (const auto & path_ll : path_lanelets) {
if (
boost::geometry::overlaps(
path_ll.polygon2d().basicPolygon(), l.polygon2d().basicPolygon()) ||
boost::geometry::within(path_ll.polygon2d().basicPolygon(), l.polygon2d().basicPolygon()) ||
boost::geometry::within(l.polygon2d().basicPolygon(), path_ll.polygon2d().basicPolygon())) {
return true;
}
}
return false;
};
for (const auto & ll : lanelets_within_range) {
const auto is_path_lanelet = contains_lanelet(path_lanelets, ll.second.id());
const auto is_ignored_lanelet = contains_lanelet(ignored_lanelets, ll.second.id());
const auto is_overlapped_by_path_lanelets = [&](const auto & l) {
for (const auto & path_ll : path_lanelets)
if (boost::geometry::overlaps(
path_ll.polygon2d().basicPolygon(), l.polygon2d().basicPolygon()))
return true;
return false;
};
if (!is_path_lanelet && !is_ignored_lanelet && !is_overlapped_by_path_lanelets(ll.second))
other_lanelets.push_back(ll.second);
}
Expand Down