@@ -603,14 +603,14 @@ std::optional<size_t> getOverlappedLaneletId(const std::vector<DrivableLanes> &
603
603
604
604
for (const auto & lanelet : lanelets) {
605
605
for (const auto & target_lanelet : target_lanelets) {
606
- std::vector<Point2d > intersections{};
606
+ std::vector<Polygon2d > intersections{};
607
607
boost::geometry::intersection (
608
- lanelet.polygon2d ().basicPolygon (), target_lanelet.polygon2d ().basicPolygon (),
609
- intersections);
608
+ toPolygon2d (lanelet), toPolygon2d (target_lanelet), intersections);
610
609
611
- // if only one point intersects, it is assumed not to be overlapped
612
- if (intersections.size () > 1 ) {
613
- return true ;
610
+ for (const auto & polygon : intersections) {
611
+ if (boost::geometry::area (polygon) > 1e-3 ) {
612
+ return true ;
613
+ }
614
614
}
615
615
}
616
616
}
@@ -1523,7 +1523,9 @@ std::vector<geometry_msgs::msg::Point> postProcess(
1523
1523
// Insert a start point
1524
1524
processed_bound.push_back (start_point);
1525
1525
1526
- return findNearestSegmentIndexFromLateralDistance (tmp_bound, start_point);
1526
+ const auto p_tmp =
1527
+ geometry_msgs::build<Pose>().position (start_point).orientation (front_pose.orientation );
1528
+ return findNearestSegmentIndexFromLateralDistance (tmp_bound, p_tmp, M_PI_2);
1527
1529
}();
1528
1530
1529
1531
// Get Closest segment for the goal point
@@ -1533,8 +1535,10 @@ std::vector<geometry_msgs::msg::Point> postProcess(
1533
1535
findNearestSegmentIndexFromLateralDistance (tmp_bound, goal_pose, M_PI_2);
1534
1536
const auto goal_point =
1535
1537
calcLongitudinalOffsetGoalPoint (tmp_bound, goal_pose, goal_start_idx, vehicle_length);
1536
- const size_t goal_idx =
1537
- std::max (goal_start_idx, findNearestSegmentIndexFromLateralDistance (tmp_bound, goal_point));
1538
+ const auto p_tmp =
1539
+ geometry_msgs::build<Pose>().position (goal_point).orientation (goal_pose.orientation );
1540
+ const size_t goal_idx = std::max (
1541
+ goal_start_idx, findNearestSegmentIndexFromLateralDistance (tmp_bound, p_tmp, M_PI_2));
1538
1542
1539
1543
return std::make_pair (goal_idx, goal_point);
1540
1544
}();
0 commit comments