Skip to content

Commit

Permalink
feat(goal_planner): use vehicle side edge to check isCrossingPossible…
Browse files Browse the repository at this point in the history
… for pull over execution

Signed-off-by: kosuke55 <kosuke.tnp@gmail.com>
  • Loading branch information
kosuke55 committed Oct 21, 2024
1 parent 6ff2121 commit 857afd6
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -710,11 +710,19 @@ bool GoalPlannerModule::isExecutionRequested() const
lanelet::ConstLanelet target_lane{};
lanelet::utils::query::getClosestLanelet(pull_over_lanes, goal_pose, &target_lane);

lanelet::ConstLanelet previous_module_terminal_lane{};
// Get the lanelet of the ego vehicle's side edge at the terminal pose of the previous module's
// path. Check if the lane is the target lane or the neighboring lane. NOTE: This is because in
// the case of avoidance, there is a possibility of base_link entering the neighboring lane, and
// we want to activate the pull over at this time as well.
const Pose previous_terminal_pose = getPreviousModuleOutput().path.points.back().point.pose;
const double vehicle_half_width = planner_data_->parameters.vehicle_width / 2.0;

Check warning on line 718 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.cpp#L718

Added line #L718 was not covered by tests
const Pose previous_terminal_vehicle_edge_pose = calcOffsetPose(
previous_terminal_pose, 0, left_side_parking_ ? vehicle_half_width : -vehicle_half_width, 0);
lanelet::ConstLanelet previous_module_terminal_vehicle_edge_lane{};
route_handler->getClosestLaneletWithinRoute(
getPreviousModuleOutput().path.points.back().point.pose, &previous_module_terminal_lane);
previous_terminal_vehicle_edge_pose, &previous_module_terminal_vehicle_edge_lane);

if (!isCrossingPossible(previous_module_terminal_lane, target_lane)) {
if (!isCrossingPossible(previous_module_terminal_vehicle_edge_lane, target_lane)) {

Check warning on line 725 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

GoalPlannerModule::isExecutionRequested increases in cyclomatic complexity from 16 to 17, 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.
return false;
}

Expand Down

0 comments on commit 857afd6

Please sign in to comment.