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(start_planner): expand lane departure check for shift path #6055

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
24 changes: 7 additions & 17 deletions planning/behavior_path_start_planner_module/src/shift_pull_out.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,15 @@
pull_out_path.partial_paths.front(); // shift path is not separate but only one.

// check lane_departure with path between pull_out_start to pull_out_end
PathWithLaneId path_start_to_end{};
PathWithLaneId path_shift_start_to_end{};
{
const size_t pull_out_start_idx = findNearestIndex(shift_path.points, start_pose.position);
const size_t pull_out_end_idx =
findNearestIndex(shift_path.points, pull_out_path.end_pose.position);

Check warning on line 76 in planning/behavior_path_start_planner_module/src/shift_pull_out.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_start_planner_module/src/shift_pull_out.cpp#L76

Added line #L76 was not covered by tests

// calculate collision check end idx
const size_t collision_check_end_idx = std::invoke([&]() {
const auto collision_check_end_pose = motion_utils::calcLongitudinalOffsetPose(
shift_path.points, pull_out_path.end_pose.position,
parameters_.collision_check_distance_from_end);

if (collision_check_end_pose) {
return findNearestIndex(shift_path.points, collision_check_end_pose->position);
} else {
return shift_path.points.size() - 1;
}
});
path_start_to_end.points.insert(
path_start_to_end.points.begin(), shift_path.points.begin() + pull_out_start_idx,
shift_path.points.begin() + collision_check_end_idx + 1);
path_shift_start_to_end.points.insert(

Check warning on line 78 in planning/behavior_path_start_planner_module/src/shift_pull_out.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_start_planner_module/src/shift_pull_out.cpp#L78

Added line #L78 was not covered by tests
path_shift_start_to_end.points.begin(), shift_path.points.begin() + pull_out_start_idx,
shift_path.points.begin() + pull_out_end_idx + 1);
}

// extract shoulder lanes from pull out lanes
Expand Down Expand Up @@ -131,7 +121,7 @@
// check lane departure
if (
parameters_.check_shift_path_lane_departure &&
lane_departure_checker_->checkPathWillLeaveLane(expanded_lanes, path_start_to_end)) {
lane_departure_checker_->checkPathWillLeaveLane(expanded_lanes, path_shift_start_to_end)) {

Check notice on line 124 in planning/behavior_path_start_planner_module/src/shift_pull_out.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Complex Method

ShiftPullOut::plan decreases in cyclomatic complexity from 11 to 10, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check notice on line 124 in planning/behavior_path_start_planner_module/src/shift_pull_out.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Bumpy Road Ahead

ShiftPullOut::plan is no longer above the threshold for logical blocks with deeply nested code. 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 124 in planning/behavior_path_start_planner_module/src/shift_pull_out.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_start_planner_module/src/shift_pull_out.cpp#L124

Added line #L124 was not covered by tests
continue;
}

Expand Down
Loading