@@ -2877,24 +2877,35 @@ CandidateOutput AvoidanceModule::planCandidate() const
2877
2877
2878
2878
BehaviorModuleOutput AvoidanceModule::planWaitingApproval ()
2879
2879
{
2880
+ const auto & data = avoidance_data_;
2881
+
2880
2882
// we can execute the plan() since it handles the approval appropriately.
2881
2883
BehaviorModuleOutput out = plan ();
2884
+
2882
2885
#ifndef USE_OLD_ARCHITECTURE
2883
2886
if (path_shifter_.getShiftLines ().empty ()) {
2884
2887
out.turn_signal_info = getPreviousModuleOutput ().turn_signal_info ;
2885
2888
}
2886
2889
#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
+
2887
2895
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 ()) {
2890
2897
updateCandidateRTCStatus (candidate);
2891
2898
waitApproval ();
2899
+ } else if (all_unavoidable) {
2900
+ waitApproval ();
2892
2901
} else {
2893
2902
clearWaitingApproval ();
2894
2903
removeCandidateRTCStatus ();
2895
2904
}
2905
+
2896
2906
path_candidate_ = std::make_shared<PathWithLaneId>(candidate.path_candidate );
2897
2907
path_reference_ = getPreviousModuleOutput ().reference_path ;
2908
+
2898
2909
return out;
2899
2910
}
2900
2911
@@ -3142,6 +3153,7 @@ void AvoidanceModule::updateData()
3142
3153
void AvoidanceModule::processOnEntry ()
3143
3154
{
3144
3155
initVariables ();
3156
+ waitApproval ();
3145
3157
}
3146
3158
3147
3159
void AvoidanceModule::processOnExit ()
0 commit comments