Skip to content

Commit

Permalink
fix(bpp): transition from IDLE to WAITING APPROVAL
Browse files Browse the repository at this point in the history
Signed-off-by: Muhammad Zulfaqar Azmi <[email protected]>
  • Loading branch information
zulfaqar-azmi-t4 committed Jan 11, 2024
1 parent 9b736d5 commit 0c92e1c
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class AvoidanceModule : public SceneModuleInterface

bool canTransitFailureState() override { return false; }

bool canTransitIdleToRunningState() override { return true; }
bool canTransitIdleToWaitingApprovalState() override { return true; }

/**
* @brief update RTC status for candidate shift line.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class DynamicAvoidanceModule : public SceneModuleInterface

bool canTransitFailureState() override { return false; }

bool canTransitIdleToRunningState() override { return false; }
bool canTransitIdleToWaitingApprovalState() override { return false; }

bool isLabelTargetObstacle(const uint8_t label) const;
void updateTargetObjects();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class GoalPlannerModule : public SceneModuleInterface
// If terminating it, it may switch to lane following and could generate an inappropriate path.
bool canTransitSuccessState() override { return false; }
bool canTransitFailureState() override { return false; }
bool canTransitIdleToRunningState() override { return true; }
bool canTransitIdleToWaitingApprovalState() override { return true; }

mutable StartGoalPlannerData goal_planner_data_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1766,6 +1766,9 @@ void GoalPlannerModule::updateSafetyCheckTargetObjectsData(

std::pair<bool, bool> GoalPlannerModule::isSafePath() const
{
if (!thread_safe_data_.get_pull_over_path()) {
return {false, false};
}
const auto pull_over_path = thread_safe_data_.get_pull_over_path()->getCurrentPath();
const auto & current_pose = planner_data_->self_odometry->pose.pose;
const double current_velocity = std::hypot(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class LaneChangeInterface : public SceneModuleInterface

bool canTransitFailureState() override;

bool canTransitIdleToRunningState() override;
bool canTransitIdleToWaitingApprovalState() override;

void setObjectDebugVisualization() const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ bool LaneChangeInterface::canTransitFailureState()
return false;
}

bool LaneChangeInterface::canTransitIdleToRunningState()
bool LaneChangeInterface::canTransitIdleToWaitingApprovalState()
{
setObjectDebugVisualization();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ class SceneModuleInterface
RCLCPP_DEBUG(getLogger(), "%s", message.data());
};
if (current_state_ == ModuleStatus::IDLE) {
if (canTransitIdleToRunningState()) {
if (canTransitIdleToWaitingApprovalState()) {
log_debug_throttled("transiting from IDLE to RUNNING");
return ModuleStatus::RUNNING;
return ModuleStatus::WAITING_APPROVAL;
}

log_debug_throttled("transiting from IDLE to IDLE");
Expand Down Expand Up @@ -462,7 +462,7 @@ class SceneModuleInterface
/**
* @brief State transition condition IDLE -> RUNNING
*/
virtual bool canTransitIdleToRunningState() = 0;
virtual bool canTransitIdleToWaitingApprovalState() = 0;

/**
* @brief Get candidate path. This information is used for external judgement.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class SideShiftModule : public SceneModuleInterface

bool canTransitFailureState() override { return false; }

bool canTransitIdleToRunningState() override { return true; }
bool canTransitIdleToWaitingApprovalState() override { return true; }

void initVariables();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class StartPlannerModule : public SceneModuleInterface

bool canTransitFailureState() override { return false; }

bool canTransitIdleToRunningState() override;
bool canTransitIdleToWaitingApprovalState() override;

/**
* @brief init member variables.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ bool StartPlannerModule::canTransitSuccessState()
return hasFinishedPullOut();
}

bool StartPlannerModule::canTransitIdleToRunningState()
bool StartPlannerModule::canTransitIdleToWaitingApprovalState()
{
return isActivated() && !isWaitingApproval();
}
Expand Down

0 comments on commit 0c92e1c

Please sign in to comment.