@@ -116,7 +116,7 @@ std::vector<PathWithLaneId> GeometricParallelParking::generatePullOverPaths(
116
116
: parameters_.backward_parking_path_interval ;
117
117
auto arc_paths = planOneTrial (
118
118
start_pose, goal_pose, R_E_far, road_lanes, shoulder_lanes, is_forward, left_side_parking,
119
- end_pose_offset, lane_departure_margin, arc_path_interval);
119
+ end_pose_offset, lane_departure_margin, arc_path_interval, {} );
120
120
if (arc_paths.empty ()) {
121
121
return std::vector<PathWithLaneId>{};
122
122
}
@@ -222,7 +222,8 @@ bool GeometricParallelParking::planPullOver(
222
222
223
223
bool GeometricParallelParking::planPullOut (
224
224
const Pose & start_pose, const Pose & goal_pose, const lanelet::ConstLanelets & road_lanes,
225
- const lanelet::ConstLanelets & shoulder_lanes, const bool left_side_start)
225
+ const lanelet::ConstLanelets & shoulder_lanes, const bool left_side_start,
226
+ const std::shared_ptr<lane_departure_checker::LaneDepartureChecker> lane_departure_checker)
226
227
{
227
228
constexpr bool is_forward = false ; // parking backward means pull_out forward
228
229
constexpr double start_pose_offset = 0.0 ; // start_pose is current_pose
@@ -242,7 +243,7 @@ bool GeometricParallelParking::planPullOut(
242
243
auto arc_paths = planOneTrial (
243
244
*end_pose, start_pose, R_E_min_, road_lanes, shoulder_lanes, is_forward, left_side_start,
244
245
start_pose_offset, parameters_.pull_out_lane_departure_margin ,
245
- parameters_.pull_out_path_interval );
246
+ parameters_.pull_out_path_interval , lane_departure_checker );
246
247
if (arc_paths.empty ()) {
247
248
// not found path
248
249
continue ;
@@ -362,7 +363,8 @@ std::vector<PathWithLaneId> GeometricParallelParking::planOneTrial(
362
363
const Pose & start_pose, const Pose & goal_pose, const double R_E_far,
363
364
const lanelet::ConstLanelets & road_lanes, const lanelet::ConstLanelets & shoulder_lanes,
364
365
const bool is_forward, const bool left_side_parking, const double end_pose_offset,
365
- const double lane_departure_margin, const double arc_path_interval)
366
+ const double lane_departure_margin, const double arc_path_interval,
367
+ const std::shared_ptr<lane_departure_checker::LaneDepartureChecker> lane_departure_checker)
366
368
{
367
369
clearPaths ();
368
370
@@ -496,6 +498,24 @@ std::vector<PathWithLaneId> GeometricParallelParking::planOneTrial(
496
498
setLaneIdsToPath (path_turn_first);
497
499
setLaneIdsToPath (path_turn_second);
498
500
501
+ if (lane_departure_checker) {
502
+ const auto lanelet_map_ptr = planner_data_->route_handler ->getLaneletMapPtr ();
503
+
504
+ const bool is_path_turn_first_outside_lanes =
505
+ lane_departure_checker->checkPathWillLeaveLane (lanelet_map_ptr, path_turn_first);
506
+
507
+ if (is_path_turn_first_outside_lanes) {
508
+ return std::vector<PathWithLaneId>{};
509
+ }
510
+
511
+ const bool is_path_turn_second_outside_lanes =
512
+ lane_departure_checker->checkPathWillLeaveLane (lanelet_map_ptr, path_turn_second);
513
+
514
+ if (is_path_turn_second_outside_lanes) {
515
+ return std::vector<PathWithLaneId>{};
516
+ }
517
+ }
518
+
499
519
// generate arc path vector
500
520
paths_.push_back (path_turn_first);
501
521
paths_.push_back (path_turn_second);
0 commit comments