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(autoware_behavior_path_goal_planner_module): remove unused function plot_goal_candidates() #9752

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TIER IV, Inc.

Check notice on line 1 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/examples/plot_map_case1.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Overall Code Complexity

The mean cyclomatic complexity increases from 4.36 to 4.46, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
//
// 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 @@ -134,21 +134,7 @@
Args(xs, ys, yaw_cos, yaw_sin),
Kwargs("angles"_a = "xy", "scale_units"_a = "xy", "scale"_a = 2.0));
}

Check notice on line 137 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/examples/plot_map_case1.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Excess Number of Function Arguments

plot_goal_candidates is no longer above the threshold for number of arguments. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
void plot_goal_candidates(
matplotlibcpp17::axes::Axes & axes, const GoalCandidates & goals,
const std::map<size_t, size_t> & goal_id2prio,
const autoware::universe_utils::LinearRing2d & local_footprint,
const std::string & color = "green")
{
for (const auto & goal : goals) {
const auto it = goal_id2prio.find(goal.id);
if (it != goal_id2prio.end()) {
plot_goal_candidate(axes, goal, it->second, local_footprint, color);
}
}
}

void plot_path_with_lane_id(
matplotlibcpp17::axes::Axes & axes, const PathWithLaneId & path,
const std::string & color = "red", const std::string & label = "", const double linewidth = 1.0)
Expand Down Expand Up @@ -607,8 +593,6 @@
// plot_lanelet(ax3, lanelet);
}

// plot_goal_candidates(ax1, goal_candidates, footprint);

// plot_path_with_lane_id(ax2, reference_path.path, "green", "reference_path");

const auto start = std::chrono::steady_clock::now();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TIER IV, Inc.

Check notice on line 1 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/examples/plot_map_case2.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Overall Code Complexity

The mean cyclomatic complexity increases from 4.57 to 4.69, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
//
// 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 @@ -133,21 +133,7 @@
Args(xs, ys, yaw_cos, yaw_sin),
Kwargs("angles"_a = "xy", "scale_units"_a = "xy", "scale"_a = 2.0));
}

Check notice on line 136 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/examples/plot_map_case2.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Excess Number of Function Arguments

plot_goal_candidates is no longer above the threshold for number of arguments. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
void plot_goal_candidates(
matplotlibcpp17::axes::Axes & axes, const GoalCandidates & goals,
const std::map<size_t, size_t> & goal_id2prio,
const autoware::universe_utils::LinearRing2d & local_footprint,
const std::string & color = "green")
{
for (const auto & goal : goals) {
const auto it = goal_id2prio.find(goal.id);
if (it != goal_id2prio.end()) {
plot_goal_candidate(axes, goal, it->second, local_footprint, color);
}
}
}

void plot_path_with_lane_id(
matplotlibcpp17::axes::Axes & axes, const PathWithLaneId & path,
const std::string & color = "red", const std::string & label = "", const double linewidth = 1.0)
Expand Down Expand Up @@ -607,8 +593,6 @@
// plot_lanelet(ax3, lanelet);
}

// plot_goal_candidates(ax1, goal_candidates, footprint);

// plot_path_with_lane_id(ax2, reference_path.path, "green", "reference_path");

const auto start = std::chrono::steady_clock::now();
Expand Down
Loading