Skip to content

Commit f703927

Browse files
committed
feat(utils): use geometry distance
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent ffab4c8 commit f703927

File tree

1 file changed

+5
-4
lines changed
  • planning/behavior_path_planner/src/utils/avoidance

1 file changed

+5
-4
lines changed

planning/behavior_path_planner/src/utils/avoidance/utils.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -134,22 +134,23 @@ bool isWithinCrosswalk(
134134
const std::shared_ptr<const lanelet::routing::RoutingGraphContainer> & overall_graphs)
135135
{
136136
using Point = boost::geometry::model::d2::point_xy<double>;
137-
using boost::geometry::correct;
138-
using boost::geometry::within;
139137

140138
const auto & p = object.object.kinematics.initial_pose_with_covariance.pose.position;
141139
const Point p_object{p.x, p.y};
142140

141+
// get conflicting crosswalk crosswalk
143142
constexpr int PEDESTRIAN_GRAPH_ID = 1;
144143
const auto conflicts =
145144
overall_graphs->conflictingInGraph(object.overhang_lanelet, PEDESTRIAN_GRAPH_ID);
146145

146+
constexpr double THRESHOLD = 1.0;
147147
for (const auto & crosswalk : conflicts) {
148148
auto polygon = crosswalk.polygon2d().basicPolygon();
149149

150-
correct(polygon);
150+
boost::geometry::correct(polygon);
151151

152-
if (within(p_object, polygon)) {
152+
// ignore objects arround the crosswalk
153+
if (boost::geometry::distance(p_object, polygon) < THRESHOLD) {
153154
return true;
154155
}
155156
}

0 commit comments

Comments
 (0)