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(utils): remove lane chagne specific code #3781

Merged
Merged
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
24 changes: 4 additions & 20 deletions planning/behavior_path_planner/src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1937,7 +1937,7 @@ double getDistanceToCrosswalk(

lanelet::ConstLanelet current_lanelet;
if (!lanelet::utils::query::getClosestLanelet(lanelets, current_pose, &current_lanelet)) {
return std::numeric_limits<double>::max();
return std::numeric_limits<double>::infinity();
}

double distance = 0;
Expand All @@ -1946,24 +1946,8 @@ double getDistanceToCrosswalk(
if (llt == current_lanelet) {
is_after_current_lanelet = true;
}
// check lane change tag
bool is_lane_change_yes = false;
const auto right_line = llt.rightBound();
if (right_line.hasAttribute(lanelet::AttributeNamesString::LaneChange)) {
const auto attr = right_line.attribute(lanelet::AttributeNamesString::LaneChange);
if (attr.value() == std::string("yes")) {
is_lane_change_yes = true;
}
}
const auto left_line = llt.leftBound();
if (left_line.hasAttribute(lanelet::AttributeNamesString::LaneChange)) {
const auto attr = left_line.attribute(lanelet::AttributeNamesString::LaneChange);
if (attr.value() == std::string("yes")) {
is_lane_change_yes = true;
}
}

if (is_after_current_lanelet && !is_lane_change_yes) {
if (is_after_current_lanelet) {
const auto conflicting_crosswalks = overall_graphs.conflictingInGraph(llt, 1);
if (!(conflicting_crosswalks.empty())) {
// create centerline
Expand All @@ -1975,7 +1959,7 @@ double getDistanceToCrosswalk(
}

// create crosswalk polygon and calculate distance
double min_distance_to_crosswalk = std::numeric_limits<double>::max();
double min_distance_to_crosswalk = std::numeric_limits<double>::infinity();
for (const auto & crosswalk : conflicting_crosswalks) {
lanelet::CompoundPolygon2d lanelet_crosswalk_polygon = crosswalk.polygon2d();
Polygon2d polygon;
Expand Down Expand Up @@ -2010,7 +1994,7 @@ double getDistanceToCrosswalk(
distance += lanelet::utils::getLaneletLength3d(llt);
}

return std::numeric_limits<double>::max();
return std::numeric_limits<double>::infinity();
}

double getSignedDistance(
Expand Down