Skip to content

Commit

Permalink
feat(goal_planner): resample path interval for lane departure check a…
Browse files Browse the repository at this point in the history
…ccuracy

Signed-off-by: kosuke55 <[email protected]>
  • Loading branch information
kosuke55 committed Jan 31, 2025
1 parent 2c53d5f commit 3a2dd14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "autoware/behavior_path_goal_planner_module/util.hpp"
#include "autoware/behavior_path_planner_common/utils/drivable_area_expansion/static_drivable_area.hpp"
#include "autoware/behavior_path_planner_common/utils/path_utils.hpp"

#include <autoware_lanelet2_extension/utility/query.hpp>
#include <autoware_lanelet2_extension/utility/utilities.hpp>
Expand Down Expand Up @@ -77,6 +78,10 @@ std::optional<PullOverPath> GeometricPullOver::plan(
const auto arc_path = planner_.getArcPath();

// check lane departure with road and shoulder lanes
// To improve the accuracy of lane departure detection, make the sampling interval finer
// todo: Implement lane departure detection that does not depend on the footprint
const auto resampled_arc_path =
utils::resamplePathWithSpline(arc_path, parameters_.center_line_path_interval / 2);
if (lane_departure_checker_.checkPathWillLeaveLane({departure_check_lane}, arc_path)) return {};

auto pull_over_path_opt = PullOverPath::create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,12 @@ std::optional<PullOverPath> ShiftPullOver::generatePullOverPath(

const auto departure_check_lane = goal_planner_utils::createDepartureCheckLanelet(
pull_over_lanes, *planner_data->route_handler, left_side_parking_);
const bool is_in_lanes = !lane_departure_checker_.checkPathWillLeaveLane(
{departure_check_lane}, pull_over_path.parking_path());
// To improve the accuracy of lane departure detection, make the sampling interval finer
// todo: Implement lane departure detection that does not depend on the footprint
const auto resampled_parking_path = utils::resamplePathWithSpline(
pull_over_path.parking_path(), parameters_.center_line_path_interval / 2);
const bool is_in_lanes =
!lane_departure_checker_.checkPathWillLeaveLane({departure_check_lane}, resampled_parking_path);

Check warning on line 307 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/pull_over_planner/shift_pull_over.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

ShiftPullOver::generatePullOverPath already has high cyclomatic complexity, and now it increases in Lines of Code from 137 to 139. 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.

if (!is_in_parking_lots && !is_in_lanes) {
return {};
Expand Down

0 comments on commit 3a2dd14

Please sign in to comment.