@@ -140,73 +140,56 @@ LaneChangePath NormalLaneChange::getLaneChangePath() const
140
140
141
141
BehaviorModuleOutput NormalLaneChange::getTerminalLaneChangePath () const
142
142
{
143
- BehaviorModuleOutput output;
143
+ auto output = prev_module_output_ ;
144
144
145
145
if (isAbortState () && abort_path_) {
146
146
output.path = abort_path_->path ;
147
- output.reference_path = prev_module_reference_path_;
148
- output.turn_signal_info = prev_turn_signal_info_;
149
147
extendOutputDrivableArea (output);
150
148
const auto current_seg_idx = planner_data_->findEgoSegmentIndex (output.path .points );
151
149
output.turn_signal_info = planner_data_->turn_signal_decider .use_prior_turn_signal (
152
- output.path , getEgoPose (), current_seg_idx, prev_turn_signal_info_, output .turn_signal_info ,
153
- planner_data_->parameters .ego_nearest_dist_threshold ,
150
+ output.path , getEgoPose (), current_seg_idx, prev_module_output_ .turn_signal_info ,
151
+ output. turn_signal_info , planner_data_->parameters .ego_nearest_dist_threshold ,
154
152
planner_data_->parameters .ego_nearest_yaw_threshold );
155
153
return output;
156
154
}
157
155
158
156
const auto current_lanes = getCurrentLanes ();
159
157
if (current_lanes.empty ()) {
160
- RCLCPP_WARN (logger_, " Current lanes not found!!! Something wrong." );
161
- output.path = prev_module_path_;
162
- output.reference_path = prev_module_reference_path_;
163
- output.drivable_area_info = prev_drivable_area_info_;
164
- output.turn_signal_info = prev_turn_signal_info_;
165
- return output;
158
+ RCLCPP_DEBUG (logger_, " Current lanes not found. Returning previous module's path as output." );
159
+ return prev_module_output_;
166
160
}
167
161
168
162
const auto terminal_path =
169
163
calcTerminalLaneChangePath (current_lanes, getLaneChangeLanes (current_lanes, direction_));
170
164
if (!terminal_path) {
171
- RCLCPP_DEBUG (logger_, " Terminal path not found!!!" );
172
- output.path = prev_module_path_;
173
- output.reference_path = prev_module_reference_path_;
174
- output.drivable_area_info = prev_drivable_area_info_;
175
- output.turn_signal_info = prev_turn_signal_info_;
176
- return output;
165
+ RCLCPP_DEBUG (logger_, " Terminal path not found. Returning previous module's path as output." );
166
+ return prev_module_output_;
177
167
}
178
168
179
169
output.path = terminal_path->path ;
180
- output.reference_path = prev_module_reference_path_;
181
170
output.turn_signal_info = updateOutputTurnSignal ();
182
171
183
172
extendOutputDrivableArea (output);
184
173
185
174
const auto current_seg_idx = planner_data_->findEgoSegmentIndex (output.path .points );
186
175
output.turn_signal_info = planner_data_->turn_signal_decider .use_prior_turn_signal (
187
- output.path , getEgoPose (), current_seg_idx, prev_turn_signal_info_, output .turn_signal_info ,
188
- planner_data_->parameters .ego_nearest_dist_threshold ,
176
+ output.path , getEgoPose (), current_seg_idx, prev_module_output_ .turn_signal_info ,
177
+ output. turn_signal_info , planner_data_->parameters .ego_nearest_dist_threshold ,
189
178
planner_data_->parameters .ego_nearest_yaw_threshold );
190
179
191
180
return output;
192
181
}
193
182
194
183
BehaviorModuleOutput NormalLaneChange::generateOutput ()
195
184
{
196
- BehaviorModuleOutput output;
197
-
198
185
if (!status_.is_valid_path ) {
199
- output.path = prev_module_path_;
200
- output.reference_path = prev_module_reference_path_;
201
- output.drivable_area_info = prev_drivable_area_info_;
202
- output.turn_signal_info = prev_turn_signal_info_;
203
- return output;
186
+ RCLCPP_DEBUG (logger_, " No valid path found. Returning previous module's path as output." );
187
+ return prev_module_output_;
204
188
}
205
189
190
+ auto output = prev_module_output_;
206
191
if (isAbortState () && abort_path_) {
207
192
output.path = abort_path_->path ;
208
- output.reference_path = prev_module_reference_path_;
209
- output.turn_signal_info = prev_turn_signal_info_;
210
193
insertStopPoint (status_.current_lanes , output.path );
211
194
} else {
212
195
output.path = getLaneChangePath ().path ;
@@ -235,8 +218,8 @@ BehaviorModuleOutput NormalLaneChange::generateOutput()
235
218
236
219
const auto current_seg_idx = planner_data_->findEgoSegmentIndex (output.path .points );
237
220
output.turn_signal_info = planner_data_->turn_signal_decider .use_prior_turn_signal (
238
- output.path , getEgoPose (), current_seg_idx, prev_turn_signal_info_, output .turn_signal_info ,
239
- planner_data_->parameters .ego_nearest_dist_threshold ,
221
+ output.path , getEgoPose (), current_seg_idx, prev_module_output_ .turn_signal_info ,
222
+ output. turn_signal_info , planner_data_->parameters .ego_nearest_dist_threshold ,
240
223
planner_data_->parameters .ego_nearest_yaw_threshold );
241
224
242
225
return output;
@@ -256,8 +239,8 @@ void NormalLaneChange::extendOutputDrivableArea(BehaviorModuleOutput & output) c
256
239
// for new architecture
257
240
DrivableAreaInfo current_drivable_area_info;
258
241
current_drivable_area_info.drivable_lanes = expanded_lanes;
259
- output.drivable_area_info =
260
- utils::combineDrivableAreaInfo ( current_drivable_area_info, prev_drivable_area_info_ );
242
+ output.drivable_area_info = utils::combineDrivableAreaInfo (
243
+ current_drivable_area_info, prev_module_output_. drivable_area_info );
261
244
}
262
245
263
246
void NormalLaneChange::insertStopPoint (
@@ -506,7 +489,7 @@ TurnSignalInfo NormalLaneChange::updateOutputTurnSignal() const
506
489
507
490
lanelet::ConstLanelets NormalLaneChange::getCurrentLanes () const
508
491
{
509
- return utils::getCurrentLanesFromPath (prev_module_path_ , planner_data_);
492
+ return utils::getCurrentLanesFromPath (prev_module_output_. path , planner_data_);
510
493
}
511
494
512
495
lanelet::ConstLanelets NormalLaneChange::getLaneChangeLanes (
@@ -738,10 +721,10 @@ std::pair<double, double> NormalLaneChange::calcCurrentMinMaxAcceleration() cons
738
721
const auto vehicle_max_acc = std::min (p.max_acc , lane_change_parameters_->max_longitudinal_acc );
739
722
740
723
const auto ego_seg_idx = motion_utils::findFirstNearestSegmentIndexWithSoftConstraints (
741
- prev_module_path_ .points , getEgoPose (), p.ego_nearest_dist_threshold ,
724
+ prev_module_output_. path .points , getEgoPose (), p.ego_nearest_dist_threshold ,
742
725
p.ego_nearest_yaw_threshold );
743
726
const auto max_path_velocity =
744
- prev_module_path_ .points .at (ego_seg_idx).point .longitudinal_velocity_mps ;
727
+ prev_module_output_. path .points .at (ego_seg_idx).point .longitudinal_velocity_mps ;
745
728
746
729
// calculate minimum and maximum acceleration
747
730
const auto min_acc = utils::lane_change::calcMinimumAcceleration (
@@ -765,7 +748,7 @@ double NormalLaneChange::calcMaximumLaneChangeLength(
765
748
std::vector<double > NormalLaneChange::sampleLongitudinalAccValues (
766
749
const lanelet::ConstLanelets & current_lanes, const lanelet::ConstLanelets & target_lanes) const
767
750
{
768
- if (prev_module_path_ .points .empty ()) {
751
+ if (prev_module_output_. path .points .empty ()) {
769
752
return {};
770
753
}
771
754
@@ -852,7 +835,7 @@ PathWithLaneId NormalLaneChange::getPrepareSegment(
852
835
return PathWithLaneId ();
853
836
}
854
837
855
- auto prepare_segment = prev_module_path_ ;
838
+ auto prepare_segment = prev_module_output_. path ;
856
839
const size_t current_seg_idx = motion_utils::findFirstNearestSegmentIndexWithSoftConstraints (
857
840
prepare_segment.points , getEgoPose (), 3.0 , 1.0 );
858
841
utils::clipPathLength (prepare_segment, current_seg_idx, prepare_length, backward_path_length);
@@ -1570,7 +1553,7 @@ std::optional<LaneChangePath> NormalLaneChange::calcTerminalLaneChangePath(
1570
1553
}
1571
1554
1572
1555
const auto lane_changing_start_pose = motion_utils::calcLongitudinalOffsetPose (
1573
- prev_module_path_ .points , current_lane_terminal_point,
1556
+ prev_module_output_. path .points , current_lane_terminal_point,
1574
1557
-(lane_change_buffer + next_lane_change_buffer + distance_to_terminal_from_goal));
1575
1558
1576
1559
if (!lane_changing_start_pose) {
@@ -1653,7 +1636,7 @@ std::optional<LaneChangePath> NormalLaneChange::calcTerminalLaneChangePath(
1653
1636
lane_changing_start_pose.value (), target_segment.points .front ().point .pose ,
1654
1637
target_lane_reference_path, shift_length);
1655
1638
1656
- auto reference_segment = prev_module_path_ ;
1639
+ auto reference_segment = prev_module_output_. path ;
1657
1640
const double length_to_lane_changing_start = motion_utils::calcSignedArcLength (
1658
1641
reference_segment.points , reference_segment.points .front ().point .pose .position ,
1659
1642
lane_changing_start_pose->position );
@@ -1877,7 +1860,7 @@ bool NormalLaneChange::calcAbortPath()
1877
1860
RCLCPP_ERROR (logger_, " failed to generate abort shifted path." );
1878
1861
}
1879
1862
1880
- PathWithLaneId reference_lane_segment = prev_module_path_ ;
1863
+ auto reference_lane_segment = prev_module_output_. path ;
1881
1864
{
1882
1865
const auto terminal_path =
1883
1866
calcTerminalLaneChangePath (reference_lanelets, selected_path.info .target_lanes );
@@ -2163,5 +2146,4 @@ bool NormalLaneChange::check_prepare_phase() const
2163
2146
2164
2147
return check_in_intersection || check_in_turns || check_in_general_lanes;
2165
2148
}
2166
-
2167
2149
} // namespace behavior_path_planner
0 commit comments