Skip to content

Commit

Permalink
fix(behavior_path_planner): do not return FAILURE in lane change modu…
Browse files Browse the repository at this point in the history
…le if it uses new architecture (autowarefoundation#3820) (autowarefoundation#545)

Signed-off-by: Fumiya Watanabe <rej55.g@gmail.com>
Signed-off-by: tomoya.kimura <tomoya.kimura@tier4.jp>
Co-authored-by: Fumiya Watanabe <rej55.g@gmail.com>
  • Loading branch information
tkimura4 and rej55 authored May 30, 2023
1 parent 9bad135 commit 04c7bca
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class LaneChangeInterface : public SceneModuleInterface

void resetPathIfAbort();

void resetLaneChangeModule();

void setObjectDebugVisualization() const;

void updateSteeringFactorPtr(const BehaviorModuleOutput & output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,22 @@ bool LaneChangeInterface::isExecutionReady() const
ModuleStatus LaneChangeInterface::updateState()
{
if (!module_type_->isValidPath()) {
#ifdef USE_OLD_ARCHITECTURE
return ModuleStatus::FAILURE;
#else
return ModuleStatus::RUNNING;
#endif
}

if (module_type_->isAbortState()) {
current_state_ =
module_type_->hasFinishedAbort() ? ModuleStatus::FAILURE : ModuleStatus::RUNNING;
return current_state_;
#ifdef USE_OLD_ARCHITECTURE
return module_type_->hasFinishedAbort() ? ModuleStatus::FAILURE : ModuleStatus::RUNNING;
#else
if (module_type_->hasFinishedAbort()) {
resetLaneChangeModule();
}
return ModuleStatus::RUNNING;
#endif
}

if (module_type_->hasFinishedLaneChange()) {
Expand Down Expand Up @@ -152,8 +161,14 @@ ModuleStatus LaneChangeInterface::updateState()
RCLCPP_WARN_STREAM_THROTTLE(
getLogger(), *clock_, 5000, "Lane change path is unsafe. Cancel lane change.");
module_type_->toCancelState();
current_state_ = isWaitingApproval() ? ModuleStatus::RUNNING : ModuleStatus::FAILURE;
return current_state_;
#ifdef USE_OLD_ARCHITECTURE
return isWaitingApproval() ? ModuleStatus::RUNNING : ModuleStatus::FAILURE;
#else
if (!isWaitingApproval()) {
resetLaneChangeModule();
}
return ModuleStatus::RUNNING;
#endif
}

if (!module_type_->isAbortEnabled()) {
Expand Down Expand Up @@ -190,6 +205,13 @@ ModuleStatus LaneChangeInterface::updateState()
return current_state_;
}

void LaneChangeInterface::resetLaneChangeModule()
{
processOnExit();
removeRTCStatus();
processOnEntry();
}

void LaneChangeInterface::updateData()
{
module_type_->setPreviousModulePaths(
Expand Down

0 comments on commit 04c7bca

Please sign in to comment.