@@ -135,8 +135,7 @@ BehaviorModuleOutput LaneChangeInterface::planWaitingApproval()
135
135
136
136
BehaviorModuleOutput out = getPreviousModuleOutput ();
137
137
module_type_->insertStopPoint (module_type_->getLaneChangeStatus ().current_lanes , out.path );
138
- out.turn_signal_info =
139
- getCurrentTurnSignalInfo (out.path , getPreviousModuleOutput ().turn_signal_info );
138
+ out.turn_signal_info = module_type_->get_current_turn_signal_info ();
140
139
141
140
const auto & lane_change_debug = module_type_->getDebugData ();
142
141
for (const auto & [uuid, data] : lane_change_debug.collision_check_objects ) {
@@ -367,81 +366,4 @@ void LaneChangeInterface::updateSteeringFactorPtr(
367
366
{output.start_distance_to_path_change , output.finish_distance_to_path_change },
368
367
PlanningBehavior::LANE_CHANGE, steering_factor_direction, SteeringFactor::APPROACHING, " " );
369
368
}
370
-
371
- TurnSignalInfo LaneChangeInterface::getCurrentTurnSignalInfo (
372
- const PathWithLaneId & path, const TurnSignalInfo & original_turn_signal_info)
373
- {
374
- const auto & current_lanes = module_type_->getLaneChangeStatus ().current_lanes ;
375
- const auto & is_valid = module_type_->getLaneChangeStatus ().is_valid_path ;
376
- const auto & lane_change_path = module_type_->getLaneChangeStatus ().lane_change_path ;
377
- const auto & lane_change_param = module_type_->getLaneChangeParam ();
378
-
379
- if (
380
- module_type_->getModuleType () != LaneChangeModuleType::NORMAL || current_lanes.empty () ||
381
- !is_valid) {
382
- return original_turn_signal_info;
383
- }
384
-
385
- // check direction
386
- TurnSignalInfo current_turn_signal_info;
387
- const auto & current_pose = module_type_->getEgoPose ();
388
- const auto direction = module_type_->getDirection ();
389
- if (direction == Direction::LEFT) {
390
- current_turn_signal_info.turn_signal .command = TurnIndicatorsCommand::ENABLE_LEFT;
391
- } else if (direction == Direction::RIGHT) {
392
- current_turn_signal_info.turn_signal .command = TurnIndicatorsCommand::ENABLE_RIGHT;
393
- }
394
-
395
- if (path.points .empty ()) {
396
- current_turn_signal_info.desired_start_point = current_pose;
397
- current_turn_signal_info.required_start_point = current_pose;
398
- current_turn_signal_info.desired_end_point = lane_change_path.info .lane_changing_end ;
399
- current_turn_signal_info.required_end_point = lane_change_path.info .lane_changing_end ;
400
- return current_turn_signal_info;
401
- }
402
-
403
- const auto & min_length_for_turn_signal_activation =
404
- lane_change_param.min_length_for_turn_signal_activation ;
405
- const auto & route_handler = module_type_->getRouteHandler ();
406
- const auto & common_parameter = module_type_->getCommonParam ();
407
- const auto shift_intervals =
408
- route_handler->getLateralIntervalsToPreferredLane (current_lanes.back ());
409
- const double next_lane_change_buffer =
410
- utils::lane_change::calcMinimumLaneChangeLength (lane_change_param, shift_intervals);
411
- const double & nearest_dist_threshold = common_parameter.ego_nearest_dist_threshold ;
412
- const double & nearest_yaw_threshold = common_parameter.ego_nearest_yaw_threshold ;
413
- const double & base_to_front = common_parameter.base_link2front ;
414
-
415
- const double buffer =
416
- next_lane_change_buffer + min_length_for_turn_signal_activation + base_to_front;
417
- const double path_length = motion_utils::calcArcLength (path.points );
418
- const size_t & current_nearest_seg_idx =
419
- motion_utils::findFirstNearestSegmentIndexWithSoftConstraints (
420
- path.points , current_pose, nearest_dist_threshold, nearest_yaw_threshold);
421
- const double dist_to_terminal = utils::getDistanceToEndOfLane (current_pose, current_lanes);
422
- const auto start_pose =
423
- motion_utils::calcLongitudinalOffsetPose (path.points , 0 , std::max (path_length - buffer, 0.0 ));
424
- if (dist_to_terminal - base_to_front < buffer && start_pose) {
425
- // modify turn signal
426
- current_turn_signal_info.desired_start_point = *start_pose;
427
- current_turn_signal_info.desired_end_point = lane_change_path.info .lane_changing_end ;
428
- current_turn_signal_info.required_start_point = current_turn_signal_info.desired_start_point ;
429
- current_turn_signal_info.required_end_point = current_turn_signal_info.desired_end_point ;
430
-
431
- const auto & original_command = original_turn_signal_info.turn_signal .command ;
432
- if (
433
- original_command == TurnIndicatorsCommand::DISABLE ||
434
- original_command == TurnIndicatorsCommand::NO_COMMAND) {
435
- return current_turn_signal_info;
436
- }
437
-
438
- // check the priority of turn signals
439
- return module_type_->getTurnSignalDecider ().use_prior_turn_signal (
440
- path, current_pose, current_nearest_seg_idx, original_turn_signal_info,
441
- current_turn_signal_info, nearest_dist_threshold, nearest_yaw_threshold);
442
- }
443
-
444
- // not in the vicinity of the end of the path. return original
445
- return original_turn_signal_info;
446
- }
447
369
} // namespace behavior_path_planner
0 commit comments