@@ -409,9 +409,12 @@ void AvoidanceModule::fillShiftLine(AvoidancePlanningData & data, DebugData & de
409
409
* if the both of following two conditions are satisfied, the module surely avoid the object.
410
410
* Condition1: there is risk to collide with object without avoidance.
411
411
* Condition2: there is enough space to avoid.
412
+ * In TOO_LARGE_JERK condition, it is possible to avoid object by deceleration even if the flag
413
+ * is_avoidable is FALSE. So, the module inserts stop point for such a object.
412
414
*/
413
415
for (const auto & o : data.target_objects ) {
414
- if (o.avoid_required && o.is_avoidable ) {
416
+ const auto enough_space = o.is_avoidable || o.reason == AvoidanceDebugFactor::TOO_LARGE_JERK;
417
+ if (o.avoid_required && enough_space) {
415
418
data.avoid_required = true ;
416
419
data.stop_target_object = o;
417
420
break ;
@@ -732,7 +735,11 @@ AvoidLineArray AvoidanceModule::calcRawShiftLinesFromObjects(
732
735
avoidance_debug_array_false_and_push_back (AvoidanceDebugFactor::INSUFFICIENT_LATERAL_MARGIN);
733
736
o.reason = AvoidanceDebugFactor::INSUFFICIENT_LATERAL_MARGIN;
734
737
debug.unavoidable_objects .push_back (o);
735
- continue ;
738
+ if (o.avoid_required ) {
739
+ break ;
740
+ } else {
741
+ continue ;
742
+ }
736
743
}
737
744
738
745
const auto is_object_on_right = isOnRight (o);
@@ -741,7 +748,11 @@ AvoidLineArray AvoidanceModule::calcRawShiftLinesFromObjects(
741
748
avoidance_debug_array_false_and_push_back (AvoidanceDebugFactor::SAME_DIRECTION_SHIFT);
742
749
o.reason = AvoidanceDebugFactor::SAME_DIRECTION_SHIFT;
743
750
debug.unavoidable_objects .push_back (o);
744
- continue ;
751
+ if (o.avoid_required ) {
752
+ break ;
753
+ } else {
754
+ continue ;
755
+ }
745
756
}
746
757
747
758
const auto avoiding_shift = shift_length - current_ego_shift;
@@ -771,7 +782,11 @@ AvoidLineArray AvoidanceModule::calcRawShiftLinesFromObjects(
771
782
if (!data.avoiding_now ) {
772
783
o.reason = AvoidanceDebugFactor::REMAINING_DISTANCE_LESS_THAN_ZERO;
773
784
debug.unavoidable_objects .push_back (o);
774
- continue ;
785
+ if (o.avoid_required ) {
786
+ break ;
787
+ } else {
788
+ continue ;
789
+ }
775
790
}
776
791
}
777
792
@@ -785,7 +800,11 @@ AvoidLineArray AvoidanceModule::calcRawShiftLinesFromObjects(
785
800
if (!data.avoiding_now ) {
786
801
o.reason = AvoidanceDebugFactor::TOO_LARGE_JERK;
787
802
debug.unavoidable_objects .push_back (o);
788
- continue ;
803
+ if (o.avoid_required ) {
804
+ break ;
805
+ } else {
806
+ continue ;
807
+ }
789
808
}
790
809
}
791
810
}
0 commit comments