Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(avoidance): don't ignore objects on straight lane in intersection #5939

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 17 additions & 19 deletions planning/behavior_path_avoidance_module/src/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 TIER IV, Inc.

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

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Lines of Code in a Single File

The lines of code decreases from 1557 to 1556, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -635,41 +635,39 @@
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;
return false;
}

// check vehicle shift ratio
lanelet::BasicPoint2d object_centroid(object.centroid.x(), object.centroid.y());
const auto on_ego_driving_lane =
within(object_centroid, object.overhang_lanelet.polygon2d().basicPolygon());
if (on_ego_driving_lane) {
if (isObjectOnRoadShoulder(object, planner_data->route_handler, parameters)) {
return true;
} else {
object.reason = AvoidanceDebugFactor::NOT_PARKING_OBJECT;
return false;
}
}

if (!object.is_within_intersection) {
return true;
// 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;
return false;

Check warning on line 654 in planning/behavior_path_avoidance_module/src/utils.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_avoidance_module/src/utils.cpp#L653-L654

Added lines #L653 - L654 were not covered by tests
}

std::string turn_direction = object.overhang_lanelet.attributeOr("turn_direction", "else");
if (turn_direction == "straight") {
return true;
if (object.is_within_intersection) {
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 670 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.

Check warning on line 670 in planning/behavior_path_avoidance_module/src/utils.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_avoidance_module/src/utils.cpp#L670

Added line #L670 was not covered by tests
return false;
}

Expand Down
Loading