Skip to content

Commit a2b2fcb

Browse files
authored
fix(avoidance): fix bug in yield judge logic (#3322)
* fix(avoidance): fix bug in yield judge logic Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * fix(avoidance): don't generate raw shift line for objects behind unavoidable object Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * chore(avoidance): add comments Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> --------- Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent 1b1650d commit a2b2fcb

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

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

+24-5
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,12 @@ void AvoidanceModule::fillShiftLine(AvoidancePlanningData & data, DebugData & de
409409
* if the both of following two conditions are satisfied, the module surely avoid the object.
410410
* Condition1: there is risk to collide with object without avoidance.
411411
* 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.
412414
*/
413415
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) {
415418
data.avoid_required = true;
416419
data.stop_target_object = o;
417420
break;
@@ -732,7 +735,11 @@ AvoidLineArray AvoidanceModule::calcRawShiftLinesFromObjects(
732735
avoidance_debug_array_false_and_push_back(AvoidanceDebugFactor::INSUFFICIENT_LATERAL_MARGIN);
733736
o.reason = AvoidanceDebugFactor::INSUFFICIENT_LATERAL_MARGIN;
734737
debug.unavoidable_objects.push_back(o);
735-
continue;
738+
if (o.avoid_required) {
739+
break;
740+
} else {
741+
continue;
742+
}
736743
}
737744

738745
const auto is_object_on_right = isOnRight(o);
@@ -741,7 +748,11 @@ AvoidLineArray AvoidanceModule::calcRawShiftLinesFromObjects(
741748
avoidance_debug_array_false_and_push_back(AvoidanceDebugFactor::SAME_DIRECTION_SHIFT);
742749
o.reason = AvoidanceDebugFactor::SAME_DIRECTION_SHIFT;
743750
debug.unavoidable_objects.push_back(o);
744-
continue;
751+
if (o.avoid_required) {
752+
break;
753+
} else {
754+
continue;
755+
}
745756
}
746757

747758
const auto avoiding_shift = shift_length - current_ego_shift;
@@ -771,7 +782,11 @@ AvoidLineArray AvoidanceModule::calcRawShiftLinesFromObjects(
771782
if (!data.avoiding_now) {
772783
o.reason = AvoidanceDebugFactor::REMAINING_DISTANCE_LESS_THAN_ZERO;
773784
debug.unavoidable_objects.push_back(o);
774-
continue;
785+
if (o.avoid_required) {
786+
break;
787+
} else {
788+
continue;
789+
}
775790
}
776791
}
777792

@@ -785,7 +800,11 @@ AvoidLineArray AvoidanceModule::calcRawShiftLinesFromObjects(
785800
if (!data.avoiding_now) {
786801
o.reason = AvoidanceDebugFactor::TOO_LARGE_JERK;
787802
debug.unavoidable_objects.push_back(o);
788-
continue;
803+
if (o.avoid_required) {
804+
break;
805+
} else {
806+
continue;
807+
}
789808
}
790809
}
791810
}

0 commit comments

Comments
 (0)