@@ -49,11 +49,6 @@ std::optional<PullOutPath> ShiftPullOut::plan(const Pose & start_pose, const Pos
49
49
50
50
const double backward_path_length =
51
51
planner_data_->parameters .backward_path_length + parameters_.max_back_distance ;
52
- const auto pull_out_lanes = getPullOutLanes (planner_data_, backward_path_length);
53
- if (pull_out_lanes.empty ()) {
54
- return std::nullopt;
55
- }
56
-
57
52
const auto road_lanes = utils::getExtendedCurrentLanes (
58
53
planner_data_, backward_path_length, std::numeric_limits<double >::max (),
59
54
/* forward_only_in_route*/ true );
@@ -69,41 +64,17 @@ std::optional<PullOutPath> ShiftPullOut::plan(const Pose & start_pose, const Pos
69
64
pull_out_path.partial_paths .front (); // shift path is not separate but only one.
70
65
71
66
// check lane_departure with path between pull_out_start to pull_out_end
72
- PathWithLaneId path_start_to_end {};
67
+ PathWithLaneId path_shift_start_to_end {};
73
68
{
74
69
const size_t pull_out_start_idx = findNearestIndex (shift_path.points , start_pose.position );
70
+ const size_t pull_out_end_idx =
71
+ findNearestIndex (shift_path.points , pull_out_path.end_pose .position );
75
72
76
- // calculate collision check end idx
77
- const size_t collision_check_end_idx = std::invoke ([&]() {
78
- const auto collision_check_end_pose = motion_utils::calcLongitudinalOffsetPose (
79
- shift_path.points , pull_out_path.end_pose .position ,
80
- parameters_.collision_check_distance_from_end );
81
-
82
- if (collision_check_end_pose) {
83
- return findNearestIndex (shift_path.points , collision_check_end_pose->position );
84
- } else {
85
- return shift_path.points .size () - 1 ;
86
- }
87
- });
88
- path_start_to_end.points .insert (
89
- path_start_to_end.points .begin (), shift_path.points .begin () + pull_out_start_idx,
90
- shift_path.points .begin () + collision_check_end_idx + 1 );
73
+ path_shift_start_to_end.points .insert (
74
+ path_shift_start_to_end.points .begin (), shift_path.points .begin () + pull_out_start_idx,
75
+ shift_path.points .begin () + pull_out_end_idx + 1 );
91
76
}
92
77
93
- // extract shoulder lanes from pull out lanes
94
- lanelet::ConstLanelets shoulder_lanes;
95
- std::copy_if (
96
- pull_out_lanes.begin (), pull_out_lanes.end (), std::back_inserter (shoulder_lanes),
97
- [&route_handler](const auto & pull_out_lane) {
98
- return route_handler->isShoulderLanelet (pull_out_lane);
99
- });
100
- const auto drivable_lanes =
101
- utils::generateDrivableLanesWithShoulderLanes (road_lanes, shoulder_lanes);
102
- const auto & dp = planner_data_->drivable_area_expansion_parameters ;
103
- const auto expanded_lanes = utils::transformToLanelets (utils::expandLanelets (
104
- drivable_lanes, dp.drivable_area_left_bound_offset , dp.drivable_area_right_bound_offset ,
105
- dp.drivable_area_types_to_skip ));
106
-
107
78
// crop backward path
108
79
// removes points which are out of lanes up to the start pose.
109
80
// this ensures that the backward_path stays within the drivable area when starting from a
@@ -117,7 +88,7 @@ std::optional<PullOutPath> ShiftPullOut::plan(const Pose & start_pose, const Pos
117
88
const auto transformed_vehicle_footprint =
118
89
transformVector (vehicle_footprint_, tier4_autoware_utils::pose2transform (pose));
119
90
const bool is_out_of_lane =
120
- LaneDepartureChecker::isOutOfLane (expanded_lanes , transformed_vehicle_footprint);
91
+ LaneDepartureChecker::isOutOfLane (drivable_lanes_ , transformed_vehicle_footprint);
121
92
if (i <= start_segment_idx) {
122
93
if (!is_out_of_lane) {
123
94
cropped_path.points .push_back (shift_path.points .at (i));
@@ -131,7 +102,7 @@ std::optional<PullOutPath> ShiftPullOut::plan(const Pose & start_pose, const Pos
131
102
// check lane departure
132
103
if (
133
104
parameters_.check_shift_path_lane_departure &&
134
- lane_departure_checker_->checkPathWillLeaveLane (expanded_lanes, path_start_to_end )) {
105
+ lane_departure_checker_->checkPathWillLeaveLane (drivable_lanes_, path_shift_start_to_end )) {
135
106
continue ;
136
107
}
137
108
0 commit comments