Skip to content

Commit 18b9a71

Browse files
committed
fix(goal_planner): invert lane boundary of neighbor opposite lanelets when generating departure check lane
Signed-off-by: Author Name <[email protected]>
1 parent ece3809 commit 18b9a71

File tree

1 file changed

+17
-7
lines changed
  • planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src

1 file changed

+17
-7
lines changed

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/util.cpp

+17-7
Original file line numberDiff line numberDiff line change
@@ -709,33 +709,43 @@ lanelet::Lanelet createDepartureCheckLanelet(
709709
const lanelet::ConstLanelets & pull_over_lanes, const route_handler::RouteHandler & route_handler,
710710
const bool left_side_parking)
711711
{
712-
const auto getBoundPoints =
713-
[&](const lanelet::ConstLanelet & lane, const bool is_outer) -> lanelet::Points3d {
712+
const auto getBoundPoints = [&](
713+
const lanelet::ConstLanelet & lane, const bool is_outer,
714+
const bool invert) -> lanelet::Points3d {
714715
lanelet::Points3d points;
715716
const auto & bound = left_side_parking ? (is_outer ? lane.leftBound() : lane.rightBound())
716717
: (is_outer ? lane.rightBound() : lane.leftBound());
718+
if (invert) {
719+
for (const auto & pt : bound.invert()) {
720+
points.push_back(lanelet::Point3d(pt));
721+
}
722+
return points;
723+
}
717724
for (const auto & pt : bound) {
718725
points.push_back(lanelet::Point3d(pt));
719726
}
720727
return points;
721728
};
722729

723-
const auto getMostInnerLane = [&](const lanelet::ConstLanelet & lane) -> lanelet::ConstLanelet {
730+
const auto getMostInnerLane =
731+
[&](const lanelet::ConstLanelet & lane) -> std::pair<lanelet::ConstLanelet, bool> {
724732
const auto getInnerLane =
725733
left_side_parking ? &RouteHandler::getMostRightLanelet : &RouteHandler::getMostLeftLanelet;
726734
const auto getOppositeLane = left_side_parking ? &RouteHandler::getRightOppositeLanelets
727735
: &RouteHandler::getLeftOppositeLanelets;
728736
const auto inner_lane = (route_handler.*getInnerLane)(lane, true, true);
729737
const auto opposite_lanes = (route_handler.*getOppositeLane)(inner_lane);
730-
return opposite_lanes.empty() ? inner_lane : opposite_lanes.front();
738+
return std::make_pair(
739+
opposite_lanes.empty() ? inner_lane : opposite_lanes.front(), !opposite_lanes.empty());
731740
};
732741

733742
lanelet::Points3d outer_bound_points{};
734743
lanelet::Points3d inner_bound_points{};
735744
for (const auto & lane : pull_over_lanes) {
736-
const auto current_outer_bound_points = getBoundPoints(lane, true);
737-
const auto most_inner_lane = getMostInnerLane(lane);
738-
const auto current_inner_bound_points = getBoundPoints(most_inner_lane, false);
745+
const auto current_outer_bound_points = getBoundPoints(lane, true, false);
746+
const auto most_inner_lane_info = getMostInnerLane(lane);
747+
const auto current_inner_bound_points =
748+
getBoundPoints(most_inner_lane_info.first, false, most_inner_lane_info.second);
739749
outer_bound_points = combineLanePoints(outer_bound_points, current_outer_bound_points);
740750
inner_bound_points = combineLanePoints(inner_bound_points, current_inner_bound_points);
741751
}

0 commit comments

Comments
 (0)