Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(avoidance): clear waiting approval only when all target module are unavoidable #3662

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2877,24 +2877,35 @@ CandidateOutput AvoidanceModule::planCandidate() const

BehaviorModuleOutput AvoidanceModule::planWaitingApproval()
{
const auto & data = avoidance_data_;

// we can execute the plan() since it handles the approval appropriately.
BehaviorModuleOutput out = plan();

#ifndef USE_OLD_ARCHITECTURE
if (path_shifter_.getShiftLines().empty()) {
out.turn_signal_info = getPreviousModuleOutput().turn_signal_info;
}
#endif

const auto all_unavoidable = std::all_of(
data.target_objects.begin(), data.target_objects.end(),
[](const auto & o) { return !o.is_avoidable; });

const auto candidate = planCandidate();
constexpr double threshold_to_update_status = -1.0e-03;
if (candidate.start_distance_to_path_change > threshold_to_update_status) {
if (!avoidance_data_.safe_new_sl.empty()) {
updateCandidateRTCStatus(candidate);
waitApproval();
} else if (all_unavoidable) {
waitApproval();
} else {
clearWaitingApproval();
removeCandidateRTCStatus();
}

path_candidate_ = std::make_shared<PathWithLaneId>(candidate.path_candidate);
path_reference_ = getPreviousModuleOutput().reference_path;

return out;
}

Expand Down Expand Up @@ -3142,6 +3153,7 @@ void AvoidanceModule::updateData()
void AvoidanceModule::processOnEntry()
{
initVariables();
waitApproval();
}

void AvoidanceModule::processOnExit()
Expand Down