Skip to content

Commit

Permalink
fix(lane_change): current lane obj treated as target lane obj (autowa…
Browse files Browse the repository at this point in the history
…refoundation#5214)

Signed-off-by: Muhammad Zulfaqar Azmi <[email protected]>
  • Loading branch information
zulfaqar-azmi-t4 committed Oct 5, 2023
1 parent 7a5f092 commit 5405655
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,16 @@ LaneChangeTargetObjectIndices NormalLaneChange::filterObject(
lanelet::utils::getLateralDistanceToClosestLanelet(current_lanes, current_pose);
std::vector<std::optional<lanelet::BasicPolygon2d>> target_backward_polygons;
for (const auto & target_backward_lane : target_backward_lanes) {
// Check to see is target_backward_lane is in current_lanes
// Without this check, current lane object might be treated as target lane object
const auto is_current_lane = [&](const lanelet::ConstLanelet & current_lane) {
return current_lane.id() == target_backward_lane.id();
};

if (std::any_of(current_lanes.begin(), current_lanes.end(), is_current_lane)) {
continue;
}

lanelet::ConstLanelets lanelet{target_backward_lane};
auto lane_polygon =
utils::lane_change::createPolygon(lanelet, 0.0, std::numeric_limits<double>::max());
Expand Down

0 comments on commit 5405655

Please sign in to comment.