Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 90688da

Browse files
kosuke55satoshi-ota
andauthoredMay 16, 2023
fix(avoidance): clear waiting approval only when all target module are unavoidable (autowarefoundation#3662) (autowarefoundation#482)
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> Co-authored-by: Satoshi OTA <44889564+satoshi-ota@users.noreply.github.com>
1 parent f8fa4fd commit 90688da

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed
 

‎planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -2877,24 +2877,35 @@ CandidateOutput AvoidanceModule::planCandidate() const
28772877

28782878
BehaviorModuleOutput AvoidanceModule::planWaitingApproval()
28792879
{
2880+
const auto & data = avoidance_data_;
2881+
28802882
// we can execute the plan() since it handles the approval appropriately.
28812883
BehaviorModuleOutput out = plan();
2884+
28822885
#ifndef USE_OLD_ARCHITECTURE
28832886
if (path_shifter_.getShiftLines().empty()) {
28842887
out.turn_signal_info = getPreviousModuleOutput().turn_signal_info;
28852888
}
28862889
#endif
2890+
2891+
const auto all_unavoidable = std::all_of(
2892+
data.target_objects.begin(), data.target_objects.end(),
2893+
[](const auto & o) { return !o.is_avoidable; });
2894+
28872895
const auto candidate = planCandidate();
2888-
constexpr double threshold_to_update_status = -1.0e-03;
2889-
if (candidate.start_distance_to_path_change > threshold_to_update_status) {
2896+
if (!avoidance_data_.safe_new_sl.empty()) {
28902897
updateCandidateRTCStatus(candidate);
28912898
waitApproval();
2899+
} else if (all_unavoidable) {
2900+
waitApproval();
28922901
} else {
28932902
clearWaitingApproval();
28942903
removeCandidateRTCStatus();
28952904
}
2905+
28962906
path_candidate_ = std::make_shared<PathWithLaneId>(candidate.path_candidate);
28972907
path_reference_ = getPreviousModuleOutput().reference_path;
2908+
28982909
return out;
28992910
}
29002911

@@ -3142,6 +3153,7 @@ void AvoidanceModule::updateData()
31423153
void AvoidanceModule::processOnEntry()
31433154
{
31443155
initVariables();
3156+
waitApproval();
31453157
}
31463158

31473159
void AvoidanceModule::processOnExit()

0 commit comments

Comments
 (0)