Skip to content

Commit

Permalink
fix(intersection): prevent unnecessary stop inside intersection witho…
Browse files Browse the repository at this point in the history
…ut traffic light when occlusion feature is off

Signed-off-by: Mamoru Sobue <[email protected]>
  • Loading branch information
soblin committed Oct 14, 2023
1 parent 4383d6b commit aec283e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ IntersectionModule::DecisionResult IntersectionModule::modifyPathVelocityDetail(
const auto intersection_stop_lines_opt = util::generateIntersectionStopLines(
first_conflicting_area, dummy_first_attention_area, planner_data_, interpolated_path_info,
planner_param_.stuck_vehicle.use_stuck_stopline, planner_param_.common.stop_line_margin,
peeking_offset, path);
peeking_offset, planner_param_.occlusion.enable, path);
if (!intersection_stop_lines_opt) {
return IntersectionModule::Indecisive{"failed to generate intersection_stop_lines"};
}
Expand Down
6 changes: 3 additions & 3 deletions planning/behavior_velocity_intersection_module/src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ std::optional<IntersectionStopLines> generateIntersectionStopLines(
const lanelet::CompoundPolygon3d & first_detection_area,
const std::shared_ptr<const PlannerData> & planner_data,
const InterpolatedPathInfo & interpolated_path_info, const bool use_stuck_stopline,
const double stop_line_margin, const double peeking_offset,
const double stop_line_margin, const double peeking_offset, const double enable_occlusion,
autoware_auto_planning_msgs::msg::PathWithLaneId * original_path)
{
const auto & path_ip = interpolated_path_info.path;
Expand Down Expand Up @@ -419,8 +419,8 @@ std::optional<IntersectionStopLines> generateIntersectionStopLines(
intersection_stop_lines_temp.default_stop_line;
}
if (
intersection_stop_lines_temp.occlusion_peeking_stop_line >
intersection_stop_lines_temp.pass_judge_line) {
enable_occlusion && intersection_stop_lines_temp.occlusion_peeking_stop_line >
intersection_stop_lines_temp.pass_judge_line) {

Check notice on line 423 in planning/behavior_velocity_intersection_module/src/util.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Excess Number of Function Arguments

generateIntersectionStopLines increases from 8 to 9 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check notice on line 423 in planning/behavior_velocity_intersection_module/src/util.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Complex Method

generateIntersectionStopLines increases in cyclomatic complexity from 20 to 21, 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.
intersection_stop_lines_temp.pass_judge_line =
intersection_stop_lines_temp.occlusion_peeking_stop_line;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ std::optional<IntersectionStopLines> generateIntersectionStopLines(
const lanelet::CompoundPolygon3d & first_detection_area,
const std::shared_ptr<const PlannerData> & planner_data,
const InterpolatedPathInfo & interpolated_path_info, const bool use_stuck_stopline,
const double stop_line_margin, const double peeking_offset,
const double stop_line_margin, const double peeking_offset, const double enable_occlusion,
autoware_auto_planning_msgs::msg::PathWithLaneId * original_path);

std::optional<size_t> getFirstPointInsidePolygon(
Expand Down

0 comments on commit aec283e

Please sign in to comment.