Skip to content

Commit a78482e

Browse files
authored
fix(lane_change): fix state transition in lane change module (#7436)
* fix(lane_change): fix state transition in lane change module Signed-off-by: Fumiya Watanabe <rej55.g@gmail.com> * fix(lane_change): remove overridden run() function Signed-off-by: Fumiya Watanabe <rej55.g@gmail.com> * fix(lane_change): fix RTC safety status Signed-off-by: Fumiya Watanabe <rej55.g@gmail.com> --------- Signed-off-by: Fumiya Watanabe <rej55.g@gmail.com>
1 parent 65665ce commit a78482e

File tree

2 files changed

+12
-35
lines changed

2 files changed

+12
-35
lines changed

planning/autoware_behavior_path_lane_change_module/include/autoware_behavior_path_lane_change_module/interface.hpp

-21
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ class LaneChangeInterface : public SceneModuleInterface
5959
LaneChangeInterface & operator=(LaneChangeInterface &&) = delete;
6060
~LaneChangeInterface() override = default;
6161

62-
void processOnEntry() override;
63-
6462
void processOnExit() override;
6563

6664
bool isExecutionRequested() const override;
@@ -93,25 +91,6 @@ class LaneChangeInterface : public SceneModuleInterface
9391

9492
MarkerArray getModuleVirtualWall() override;
9593

96-
// TODO(someone): remove this, and use base class function
97-
[[deprecated]] BehaviorModuleOutput run() override
98-
{
99-
updateData();
100-
101-
if (!isWaitingApproval()) {
102-
return plan();
103-
}
104-
105-
// module is waiting approval. Check it.
106-
if (isActivated()) {
107-
RCLCPP_DEBUG(getLogger(), "Was waiting approval, and now approved. Do plan().");
108-
return plan();
109-
} else {
110-
RCLCPP_DEBUG(getLogger(), "keep waiting approval... Do planCandidate().");
111-
return planWaitingApproval();
112-
}
113-
}
114-
11594
protected:
11695
std::shared_ptr<LaneChangeParameters> parameters_;
11796

planning/autoware_behavior_path_lane_change_module/src/interface.cpp

+12-14
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ LaneChangeInterface::LaneChangeInterface(
4747
logger_ = utils::lane_change::getLogger(module_type_->getModuleTypeStr());
4848
}
4949

50-
void LaneChangeInterface::processOnEntry()
51-
{
52-
waitApproval();
53-
}
54-
5550
void LaneChangeInterface::processOnExit()
5651
{
5752
module_type_->resetParameters();
@@ -79,7 +74,7 @@ void LaneChangeInterface::updateData()
7974
module_type_->setPreviousModuleOutput(getPreviousModuleOutput());
8075
module_type_->updateSpecialData();
8176

82-
if (isWaitingApproval()) {
77+
if (isWaitingApproval() || module_type_->isAbortState()) {
8378
module_type_->updateLaneChangeStatus();
8479
}
8580

@@ -116,14 +111,12 @@ BehaviorModuleOutput LaneChangeInterface::plan()
116111

117112
updateSteeringFactorPtr(output);
118113
if (module_type_->isAbortState()) {
119-
waitApproval();
120114
const auto candidate = planCandidate();
121115
path_candidate_ = std::make_shared<PathWithLaneId>(candidate.path_candidate);
122116
updateRTCStatus(
123117
std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(), true,
124118
State::ABORTING);
125119
} else {
126-
clearWaitingApproval();
127120
const auto path =
128121
assignToCandidate(module_type_->getLaneChangePath(), module_type_->getEgoPosition());
129122
updateRTCStatus(
@@ -153,7 +146,7 @@ BehaviorModuleOutput LaneChangeInterface::planWaitingApproval()
153146

154147
if (!module_type_->isValidPath()) {
155148
updateRTCStatus(
156-
std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(), true,
149+
std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(), false,
157150
State::FAILED);
158151
path_candidate_ = std::make_shared<PathWithLaneId>();
159152
return out;
@@ -209,11 +202,6 @@ bool LaneChangeInterface::canTransitSuccessState()
209202
}
210203
}
211204

212-
if (module_type_->isAbortState() && module_type_->hasFinishedAbort()) {
213-
log_debug_throttled("Abort process has completed.");
214-
return true;
215-
}
216-
217205
if (module_type_->hasFinishedLaneChange()) {
218206
module_type_->resetParameters();
219207
log_debug_throttled("Lane change process has completed.");
@@ -243,6 +231,16 @@ bool LaneChangeInterface::canTransitFailureState()
243231
return false;
244232
}
245233

234+
if (!module_type_->isValidPath()) {
235+
log_debug_throttled("Transit to failure state due not to find valid path");
236+
return true;
237+
}
238+
239+
if (module_type_->isAbortState() && module_type_->hasFinishedAbort()) {
240+
log_debug_throttled("Abort process has completed.");
241+
return true;
242+
}
243+
246244
if (module_type_->isCancelEnabled() && module_type_->isEgoOnPreparePhase()) {
247245
if (module_type_->isStoppedAtRedTrafficLight()) {
248246
log_debug_throttled("Stopping at traffic light while in prepare phase. Cancel lane change");

0 commit comments

Comments
 (0)