Skip to content

Commit

Permalink
fix(avoidance): don't ignore objects on straight lane in intersection
Browse files Browse the repository at this point in the history
Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed Dec 23, 2023
1 parent 2e2f184 commit b44bb1c
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions planning/behavior_path_avoidance_module/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,6 @@ bool isSatisfiedWithVehicleCondition(
return true;
}

// always ignore all merging objects.
if (object.behavior == ObjectData::Behavior::MERGING) {
object.reason = "MergingToEgoLane";
return false;
}

// Object is on center line -> ignore.
if (std::abs(object.to_centerline) < parameters->threshold_distance_object_is_on_center) {
object.reason = AvoidanceDebugFactor::TOO_NEAR_TO_CENTERLINE;
Expand All @@ -659,17 +653,20 @@ bool isSatisfiedWithVehicleCondition(
}
}

if (!object.is_within_intersection) {
return true;
}
if (object.is_within_intersection) {
std::string turn_direction = object.overhang_lanelet.attributeOr("turn_direction", "else");
if (turn_direction == "straight") {
return true;
}

std::string turn_direction = object.overhang_lanelet.attributeOr("turn_direction", "else");
if (turn_direction == "straight") {
return true;
if (object.behavior == ObjectData::Behavior::NONE) {
object.reason = "ParallelToEgoLane";
return false;
}
}

if (object.behavior == ObjectData::Behavior::NONE) {
object.reason = "ParallelToEgoLane";
if (object.behavior == ObjectData::Behavior::MERGING) {
object.reason = "MergingToEgoLane";

Check notice on line 669 in planning/behavior_path_avoidance_module/src/utils.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ New issue: Bumpy Road Ahead

isSatisfiedWithVehicleCondition has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.
return false;
}

Expand Down

0 comments on commit b44bb1c

Please sign in to comment.