@@ -650,14 +650,14 @@ std::optional<size_t> getOverlappedLaneletId(const std::vector<DrivableLanes> &
650
650
651
651
for (const auto & lanelet : lanelets) {
652
652
for (const auto & target_lanelet : target_lanelets) {
653
- std::vector<Point2d > intersections{};
653
+ std::vector<Polygon2d > intersections{};
654
654
boost::geometry::intersection (
655
- lanelet.polygon2d ().basicPolygon (), target_lanelet.polygon2d ().basicPolygon (),
656
- intersections);
655
+ toPolygon2d (lanelet), toPolygon2d (target_lanelet), intersections);
657
656
658
- // if only one point intersects, it is assumed not to be overlapped
659
- if (intersections.size () > 1 ) {
660
- return true ;
657
+ for (const auto & polygon : intersections) {
658
+ if (boost::geometry::area (polygon) > 1e-3 ) {
659
+ return true ;
660
+ }
661
661
}
662
662
}
663
663
}
@@ -1463,11 +1463,10 @@ std::pair<std::vector<lanelet::ConstPoint3d>, bool> getBoundWithFreeSpaceAreas(
1463
1463
throw std::domain_error (" invalid case." );
1464
1464
}
1465
1465
1466
- const auto goal_is_in_freespace = boost::geometry::within (
1467
- to2D (toLaneletPoint (route_handler->getGoalPose ().position ).basicPoint ()),
1468
- to2D (polygon).basicPolygon ());
1469
-
1470
- return std::make_pair (expanded_bound, is_driving_freespace || goal_is_in_freespace);
1466
+ const auto skip_post_process = route_case == RouteCase::INIT_POS_IS_IN_FREESPACE ||
1467
+ route_case == RouteCase::GOAL_POS_IS_IN_FREESPACE ||
1468
+ is_driving_freespace;
1469
+ return std::make_pair (expanded_bound, skip_post_process);
1471
1470
}
1472
1471
1473
1472
std::vector<geometry_msgs::msg::Point > postProcess (
@@ -1569,7 +1568,9 @@ std::vector<geometry_msgs::msg::Point> postProcess(
1569
1568
// Insert a start point
1570
1569
processed_bound.push_back (start_point);
1571
1570
1572
- return findNearestSegmentIndexFromLateralDistance (tmp_bound, start_point);
1571
+ const auto p_tmp =
1572
+ geometry_msgs::build<Pose>().position (start_point).orientation (front_pose.orientation );
1573
+ return findNearestSegmentIndexFromLateralDistance (tmp_bound, p_tmp, M_PI_2);
1573
1574
}();
1574
1575
1575
1576
// Get Closest segment for the goal point
@@ -1579,8 +1580,10 @@ std::vector<geometry_msgs::msg::Point> postProcess(
1579
1580
findNearestSegmentIndexFromLateralDistance (tmp_bound, goal_pose, M_PI_2);
1580
1581
const auto goal_point =
1581
1582
calcLongitudinalOffsetGoalPoint (tmp_bound, goal_pose, goal_start_idx, vehicle_length);
1582
- const size_t goal_idx =
1583
- std::max (goal_start_idx, findNearestSegmentIndexFromLateralDistance (tmp_bound, goal_point));
1583
+ const auto p_tmp =
1584
+ geometry_msgs::build<Pose>().position (goal_point).orientation (goal_pose.orientation );
1585
+ const size_t goal_idx = std::max (
1586
+ goal_start_idx, findNearestSegmentIndexFromLateralDistance (tmp_bound, p_tmp, M_PI_2));
1584
1587
1585
1588
return std::make_pair (goal_idx, goal_point);
1586
1589
}();
0 commit comments