@@ -88,6 +88,27 @@ std::optional<InterpolatedPathInfo> generateInterpolatedPathInfo(
88
88
return interpolated_path_info;
89
89
}
90
90
91
+ std::optional<size_t > getFirstPointIntersectsLineByFootprint (
92
+ const lanelet::ConstLineString2d & line, const InterpolatedPathInfo & interpolated_path_info,
93
+ const autoware::universe_utils::LinearRing2d & footprint, const double vehicle_length)
94
+ {
95
+ const auto & path_ip = interpolated_path_info.path ;
96
+ const auto [lane_start, lane_end] = interpolated_path_info.lane_id_interval .value ();
97
+ const size_t vehicle_length_idx = static_cast <size_t >(vehicle_length / interpolated_path_info.ds );
98
+ const size_t start =
99
+ static_cast <size_t >(std::max<int >(0 , static_cast <int >(lane_start) - vehicle_length_idx));
100
+ const auto line2d = line.basicLineString ();
101
+ for (auto i = start; i <= lane_end; ++i) {
102
+ const auto & base_pose = path_ip.points .at (i).point .pose ;
103
+ const auto path_footprint = autoware::universe_utils::transformVector (
104
+ footprint, autoware::universe_utils::pose2transform (base_pose));
105
+ if (boost::geometry::intersects (path_footprint, line2d)) {
106
+ return std::make_optional<size_t >(i);
107
+ }
108
+ }
109
+ return std::nullopt;
110
+ }
111
+
91
112
std::optional<lanelet::ConstLanelet> getSiblingStraightLanelet (
92
113
const lanelet::Lanelet assigned_lane,
93
114
const lanelet::routing::RoutingGraphConstPtr routing_graph_ptr)
@@ -200,35 +221,39 @@ static lanelet::LineString3d removeConst(lanelet::ConstLineString3d line)
200
221
return lanelet::LineString3d (lanelet::InvalId, pts);
201
222
}
202
223
203
- lanelet::ConstLanelets generateBlindSpotLanelets (
204
- const std::shared_ptr<autoware::route_handler::RouteHandler> route_handler,
205
- const TurnDirection turn_direction, const lanelet::Id lane_id,
206
- const tier4_planning_msgs::msg::PathWithLaneId & path, const double ignore_width_from_centerline,
207
- const double adjacent_extend_width, const double opposite_adjacent_extend_width)
224
+ std::vector<lanelet::Id> find_lane_ids_upto (
225
+ const tier4_planning_msgs::msg::PathWithLaneId & path, const lanelet::Id lane_id)
208
226
{
209
- const auto lanelet_map_ptr = route_handler->getLaneletMapPtr ();
210
- const auto routing_graph_ptr = route_handler->getRoutingGraphPtr ();
211
-
212
227
std::vector<int64_t > lane_ids;
213
228
/* get lane ids until intersection */
214
229
for (const auto & point : path.points ) {
215
230
bool found_intersection_lane = false ;
216
231
for (const auto id : point.lane_ids ) {
217
232
if (id == lane_id) {
218
233
found_intersection_lane = true ;
219
- lane_ids.push_back (lane_id);
220
234
break ;
221
235
}
222
236
// make lane_ids unique
223
- if (std::find (lane_ids.begin (), lane_ids.end (), lane_id ) == lane_ids.end ()) {
224
- lane_ids.push_back (lane_id );
237
+ if (std::find (lane_ids.begin (), lane_ids.end (), id ) == lane_ids.end ()) {
238
+ lane_ids.push_back (id );
225
239
}
226
240
}
227
241
if (found_intersection_lane) break ;
228
242
}
243
+ return lane_ids;
244
+ }
245
+
246
+ lanelet::ConstLanelets generateBlindSpotLanelets (
247
+ const std::shared_ptr<autoware::route_handler::RouteHandler> route_handler,
248
+ const TurnDirection turn_direction, const std::vector<lanelet::Id> lane_ids_upto_intersection,
249
+ const double ignore_width_from_centerline, const double adjacent_extend_width,
250
+ const double opposite_adjacent_extend_width)
251
+ {
252
+ const auto lanelet_map_ptr = route_handler->getLaneletMapPtr ();
253
+ const auto routing_graph_ptr = route_handler->getRoutingGraphPtr ();
229
254
230
255
lanelet::ConstLanelets blind_spot_lanelets;
231
- for (const auto i : lane_ids ) {
256
+ for (const auto i : lane_ids_upto_intersection ) {
232
257
const auto lane = lanelet_map_ptr->laneletLayer .get (i);
233
258
const auto ego_half_lanelet =
234
259
generateHalfLanelet (lane, turn_direction, ignore_width_from_centerline);
0 commit comments