Skip to content

Commit 9293608

Browse files
committed
change inside to overlaps to check point inside lanelet
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
1 parent 76db48e commit 9293608

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

planning/route_handler/src/route_handler.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <autoware_planning_msgs/msg/lanelet_primitive.hpp>
2828

2929
#include <lanelet2_core/geometry/Lanelet.h>
30+
#include <lanelet2_core/geometry/Polygon.h>
3031
#include <lanelet2_core/primitives/LaneletSequence.h>
3132
#include <lanelet2_routing/Route.h>
3233
#include <lanelet2_routing/RoutingGraph.h>
@@ -716,8 +717,9 @@ lanelet::ConstLanelets RouteHandler::getRoadLaneletsAtPose(const Pose & pose) co
716717
const lanelet::BasicPoint2d p{pose.position.x, pose.position.y};
717718
const auto lanelets_at_pose = lanelet_map_ptr_->laneletLayer.search(lanelet::BoundingBox2d(p));
718719
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());
721723
if (is_pose_inside_lanelet && isRoadLanelet(lanelet_at_pose))
722724
road_lanelets_at_pose.push_back(lanelet_at_pose);
723725
}
@@ -768,8 +770,9 @@ lanelet::ConstLanelets RouteHandler::getShoulderLaneletsAtPose(const Pose & pose
768770
const lanelet::BasicPoint2d p{pose.position.x, pose.position.y};
769771
const auto candidates_at_pose = lanelet_map_ptr_->laneletLayer.search(lanelet::BoundingBox2d(p));
770772
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());
773776
if (is_pose_inside_lanelet && isShoulderLanelet(candidate))
774777
lanelets_at_pose.push_back(candidate);
775778
}

0 commit comments

Comments
 (0)