@@ -709,33 +709,43 @@ lanelet::Lanelet createDepartureCheckLanelet(
709
709
const lanelet::ConstLanelets & pull_over_lanes, const route_handler::RouteHandler & route_handler,
710
710
const bool left_side_parking)
711
711
{
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 {
714
715
lanelet::Points3d points;
715
716
const auto & bound = left_side_parking ? (is_outer ? lane.leftBound () : lane.rightBound ())
716
717
: (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
+ }
717
724
for (const auto & pt : bound) {
718
725
points.push_back (lanelet::Point3d (pt));
719
726
}
720
727
return points;
721
728
};
722
729
723
- const auto getMostInnerLane = [&](const lanelet::ConstLanelet & lane) -> lanelet::ConstLanelet {
730
+ const auto getMostInnerLane =
731
+ [&](const lanelet::ConstLanelet & lane) -> std::pair<lanelet::ConstLanelet, bool > {
724
732
const auto getInnerLane =
725
733
left_side_parking ? &RouteHandler::getMostRightLanelet : &RouteHandler::getMostLeftLanelet;
726
734
const auto getOppositeLane = left_side_parking ? &RouteHandler::getRightOppositeLanelets
727
735
: &RouteHandler::getLeftOppositeLanelets;
728
736
const auto inner_lane = (route_handler.*getInnerLane)(lane, true , true );
729
737
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 ());
731
740
};
732
741
733
742
lanelet::Points3d outer_bound_points{};
734
743
lanelet::Points3d inner_bound_points{};
735
744
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 );
739
749
outer_bound_points = combineLanePoints (outer_bound_points, current_outer_bound_points);
740
750
inner_bound_points = combineLanePoints (inner_bound_points, current_inner_bound_points);
741
751
}
0 commit comments