@@ -50,9 +50,6 @@ LaneChangeInterface::LaneChangeInterface(
50
50
void LaneChangeInterface::processOnEntry ()
51
51
{
52
52
waitApproval ();
53
- module_type_->setPreviousModulePaths (
54
- getPreviousModuleOutput ().reference_path , getPreviousModuleOutput ().path );
55
- module_type_->updateLaneChangeStatus ();
56
53
}
57
54
58
55
void LaneChangeInterface::processOnExit ()
@@ -73,13 +70,21 @@ bool LaneChangeInterface::isExecutionRequested() const
73
70
74
71
bool LaneChangeInterface::isExecutionReady () const
75
72
{
76
- return module_type_->isSafe ();
73
+ return module_type_->isSafe () && !module_type_-> isAbortState () ;
77
74
}
78
75
79
76
void LaneChangeInterface::updateData ()
80
77
{
81
78
module_type_->setPreviousModulePaths (
82
79
getPreviousModuleOutput ().reference_path , getPreviousModuleOutput ().path );
80
+ module_type_->setPreviousDrivableAreaInfo (getPreviousModuleOutput ().drivable_area_info );
81
+ module_type_->setPreviousTurnSignalInfo (getPreviousModuleOutput ().turn_signal_info );
82
+
83
+ if (isWaitingApproval ()) {
84
+ module_type_->updateLaneChangeStatus ();
85
+ }
86
+ setObjectDebugVisualization ();
87
+
83
88
module_type_->updateSpecialData ();
84
89
module_type_->resetStopPose ();
85
90
}
@@ -98,8 +103,6 @@ BehaviorModuleOutput LaneChangeInterface::plan()
98
103
return {};
99
104
}
100
105
101
- module_type_->setPreviousDrivableAreaInfo (getPreviousModuleOutput ().drivable_area_info );
102
- module_type_->setPreviousTurnSignalInfo (getPreviousModuleOutput ().turn_signal_info );
103
106
auto output = module_type_->generateOutput ();
104
107
path_reference_ = std::make_shared<PathWithLaneId>(output.reference_path );
105
108
*prev_approved_path_ = getPreviousModuleOutput ().path ;
@@ -112,38 +115,36 @@ BehaviorModuleOutput LaneChangeInterface::plan()
112
115
}
113
116
114
117
updateSteeringFactorPtr (output);
115
- clearWaitingApproval ();
118
+ if (module_type_->isAbortState ()) {
119
+ waitApproval ();
120
+ removeRTCStatus ();
121
+ const auto candidate = planCandidate ();
122
+ path_candidate_ = std::make_shared<PathWithLaneId>(candidate.path_candidate );
123
+ updateRTCStatus (
124
+ candidate.start_distance_to_path_change , candidate.finish_distance_to_path_change );
125
+ } else {
126
+ clearWaitingApproval ();
127
+ }
116
128
117
129
return output;
118
130
}
119
131
120
132
BehaviorModuleOutput LaneChangeInterface::planWaitingApproval ()
121
133
{
122
134
*prev_approved_path_ = getPreviousModuleOutput ().path ;
123
- module_type_->insertStopPoint (
124
- module_type_->getLaneChangeStatus ().current_lanes , *prev_approved_path_);
125
135
126
136
BehaviorModuleOutput out;
127
- out.path = *prev_approved_path_;
128
- out.reference_path = getPreviousModuleOutput ().reference_path ;
129
- out.turn_signal_info = getPreviousModuleOutput ().turn_signal_info ;
130
- out.drivable_area_info = getPreviousModuleOutput ().drivable_area_info ;
131
-
132
- module_type_->setPreviousModulePaths (
133
- getPreviousModuleOutput ().reference_path , getPreviousModuleOutput ().path );
134
- module_type_->updateLaneChangeStatus ();
135
- setObjectDebugVisualization ();
137
+ out = module_type_->getTerminalLaneChangePath ();
138
+ module_type_->insertStopPoint (module_type_->getLaneChangeStatus ().current_lanes , out.path );
139
+ out.turn_signal_info =
140
+ getCurrentTurnSignalInfo (out.path , getPreviousModuleOutput ().turn_signal_info );
136
141
137
142
for (const auto & [uuid, data] : module_type_->getDebugData ()) {
138
143
const auto color = data.is_safe ? ColorName::GREEN : ColorName::RED;
139
144
setObjectsOfInterestData (data.current_obj_pose , data.obj_shape , color);
140
145
}
141
146
142
- // change turn signal when the vehicle reaches at the end of the path for waiting lane change
143
- out.turn_signal_info = getCurrentTurnSignalInfo (out.path , out.turn_signal_info );
144
-
145
147
path_reference_ = std::make_shared<PathWithLaneId>(getPreviousModuleOutput ().reference_path );
146
-
147
148
stop_pose_ = module_type_->getStopPose ();
148
149
149
150
if (!module_type_->isValidPath ()) {
@@ -211,6 +212,7 @@ bool LaneChangeInterface::canTransitSuccessState()
211
212
}
212
213
213
214
if (module_type_->hasFinishedLaneChange ()) {
215
+ module_type_->resetParameters ();
214
216
log_debug_throttled (" Lane change process has completed." );
215
217
return true ;
216
218
}
@@ -468,16 +470,13 @@ TurnSignalInfo LaneChangeInterface::getCurrentTurnSignalInfo(
468
470
const double buffer =
469
471
next_lane_change_buffer + min_length_for_turn_signal_activation + base_to_front;
470
472
const double path_length = motion_utils::calcArcLength (path.points );
471
- const auto & front_point = path.points .front ().point .pose .position ;
472
473
const size_t & current_nearest_seg_idx =
473
474
motion_utils::findFirstNearestSegmentIndexWithSoftConstraints (
474
475
path.points , current_pose, nearest_dist_threshold, nearest_yaw_threshold);
475
- const double length_front_to_ego = motion_utils::calcSignedArcLength (
476
- path.points , front_point, static_cast <size_t >(0 ), current_pose.position ,
477
- current_nearest_seg_idx);
476
+ const double dist_to_terminal = utils::getDistanceToEndOfLane (current_pose, current_lanes);
478
477
const auto start_pose =
479
478
motion_utils::calcLongitudinalOffsetPose (path.points , 0 , std::max (path_length - buffer, 0.0 ));
480
- if (path_length - length_front_to_ego < buffer && start_pose) {
479
+ if (dist_to_terminal - base_to_front < buffer && start_pose) {
481
480
// modify turn signal
482
481
current_turn_signal_info.desired_start_point = *start_pose;
483
482
current_turn_signal_info.desired_end_point = lane_change_path.info .lane_changing_end ;
0 commit comments