|
27 | 27 | #include <autoware_planning_msgs/msg/lanelet_primitive.hpp>
|
28 | 28 |
|
29 | 29 | #include <lanelet2_core/geometry/Lanelet.h>
|
| 30 | +#include <lanelet2_core/geometry/Polygon.h> |
30 | 31 | #include <lanelet2_core/primitives/LaneletSequence.h>
|
31 | 32 | #include <lanelet2_routing/Route.h>
|
32 | 33 | #include <lanelet2_routing/RoutingGraph.h>
|
@@ -716,8 +717,9 @@ lanelet::ConstLanelets RouteHandler::getRoadLaneletsAtPose(const Pose & pose) co
|
716 | 717 | const lanelet::BasicPoint2d p{pose.position.x, pose.position.y};
|
717 | 718 | const auto lanelets_at_pose = lanelet_map_ptr_->laneletLayer.search(lanelet::BoundingBox2d(p));
|
718 | 719 | for (const auto & lanelet_at_pose : lanelets_at_pose) {
|
719 |
| - // confirm that the pose is inside the lanelet since "search" does an approximation with boxes |
720 |
| - const auto is_pose_inside_lanelet = lanelet::geometry::inside(lanelet_at_pose, p); |
| 720 | + // confirm that the pose is on the lanelet since "search" does an approximation with boxes |
| 721 | + const auto is_pose_inside_lanelet = |
| 722 | + lanelet::geometry::overlaps(p, lanelet_at_pose.polygon2d().basicPolygon()); |
721 | 723 | if (is_pose_inside_lanelet && isRoadLanelet(lanelet_at_pose))
|
722 | 724 | road_lanelets_at_pose.push_back(lanelet_at_pose);
|
723 | 725 | }
|
@@ -768,8 +770,9 @@ lanelet::ConstLanelets RouteHandler::getShoulderLaneletsAtPose(const Pose & pose
|
768 | 770 | const lanelet::BasicPoint2d p{pose.position.x, pose.position.y};
|
769 | 771 | const auto candidates_at_pose = lanelet_map_ptr_->laneletLayer.search(lanelet::BoundingBox2d(p));
|
770 | 772 | for (const auto & candidate : candidates_at_pose) {
|
771 |
| - // confirm that the pose is inside the lanelet since "search" does an approximation with boxes |
772 |
| - const auto is_pose_inside_lanelet = lanelet::geometry::inside(candidate, p); |
| 773 | + // confirm that the pose is on the lanelet since "search" does an approximation with boxes |
| 774 | + const auto is_pose_inside_lanelet = |
| 775 | + lanelet::geometry::overlaps(p, candidate.polygon2d().basicPolygon()); |
773 | 776 | if (is_pose_inside_lanelet && isShoulderLanelet(candidate))
|
774 | 777 | lanelets_at_pose.push_back(candidate);
|
775 | 778 | }
|
|
0 commit comments