File tree 1 file changed +10
-3
lines changed
planning/mission_planner/src/lanelet2_plugins
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,6 @@ void DefaultPlanner::map_callback(const HADMapBin::ConstSharedPtr msg)
186
186
lanelet::utils::conversion::fromBinMsg (
187
187
*msg, lanelet_map_ptr_, &traffic_rules_ptr_, &routing_graph_ptr_);
188
188
lanelet::ConstLanelets all_lanelets = lanelet::utils::query::laneletLayer (lanelet_map_ptr_);
189
- road_lanelets_ = lanelet::utils::query::roadLanelets (all_lanelets);
190
189
shoulder_lanelets_ = lanelet::utils::query::shoulderLanelets (all_lanelets);
191
190
is_graph_ready_ = true ;
192
191
}
@@ -331,8 +330,16 @@ bool DefaultPlanner::is_goal_valid(
331
330
}
332
331
}
333
332
334
- lanelet::Lanelet closest_lanelet;
335
- if (!lanelet::utils::query::getClosestLanelet (road_lanelets_, goal, &closest_lanelet)) {
333
+ constexpr auto max_queries = 50 ;
334
+ lanelet::ConstLanelets goal_candidate_lanelets;
335
+ lanelet::BasicPoint2d goal_point{goal.position .x , goal.position .y };
336
+ auto nb_queries = 0 ;
337
+ lanelet_map_ptr_->laneletLayer .nearestUntil (goal_point, [&](const auto &, const auto & ll) {
338
+ if (route_handler_.isRoadLanelet (ll)) goal_candidate_lanelets.push_back (ll);
339
+ return (++nb_queries >= max_queries);
340
+ });
341
+ lanelet::ConstLanelet closest_lanelet;
342
+ if (!lanelet::utils::query::getClosestLanelet (goal_candidate_lanelets, goal, &closest_lanelet)) {
336
343
return false ;
337
344
}
338
345
You can’t perform that action at this time.
0 commit comments