Skip to content

Commit 30ecaad

Browse files
fix(autoware_behavior_velocity_no_drivable_lane_module): fix containerOutOfBounds wawrning (#7631)
* fix(autoware_behavior_velocity_no_drivable_lane_module): fix containerOutOfBounds wawrning Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> * style(pre-commit): autofix --------- Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent ca8cb30 commit 30ecaad

File tree

1 file changed

+29
-21
lines changed
  • planning/behavior_velocity_planner/autoware_behavior_velocity_no_drivable_lane_module/src

1 file changed

+29
-21
lines changed

planning/behavior_velocity_planner/autoware_behavior_velocity_no_drivable_lane_module/src/util.cpp

+29-21
Original file line numberDiff line numberDiff line change
@@ -85,29 +85,37 @@ PathWithNoDrivableLanePolygonIntersection getPathIntersectionWithNoDrivableLaneP
8585
bg::within(first_path_point, polygon);
8686
auto const & is_last_path_point_inside_polygon = bg::within(last_path_point, polygon);
8787

88-
if (
89-
intersects.empty() &&
90-
path_no_drivable_lane_polygon_intersection.is_first_path_point_inside_polygon &&
91-
is_last_path_point_inside_polygon) {
92-
path_no_drivable_lane_polygon_intersection.is_path_inside_of_polygon = true;
93-
} else {
94-
// classify first and second intersection points
95-
for (size_t i = 0; i < intersects.size(); ++i) {
96-
const auto & p = intersects.at(i);
97-
if (
98-
(intersects.size() == 2 && i == 0) ||
99-
(intersects.size() == 1 && is_last_path_point_inside_polygon)) {
100-
path_no_drivable_lane_polygon_intersection.first_intersection_point =
101-
createPoint(p.x(), p.y(), ego_pos.z);
102-
} else if (
103-
(intersects.size() == 2 && i == 1) ||
104-
(intersects.size() == 1 &&
105-
path_no_drivable_lane_polygon_intersection.is_first_path_point_inside_polygon)) {
106-
path_no_drivable_lane_polygon_intersection.second_intersection_point =
107-
createPoint(p.x(), p.y(), ego_pos.z);
108-
}
88+
if (intersects.empty()) {
89+
if (
90+
path_no_drivable_lane_polygon_intersection.is_first_path_point_inside_polygon &&
91+
is_last_path_point_inside_polygon) {
92+
path_no_drivable_lane_polygon_intersection.is_path_inside_of_polygon = true;
93+
} else {
94+
// do nothing
95+
}
96+
} else if (intersects.size() == 1) {
97+
const auto & p = intersects.at(0);
98+
if (is_last_path_point_inside_polygon) {
99+
path_no_drivable_lane_polygon_intersection.first_intersection_point =
100+
createPoint(p.x(), p.y(), ego_pos.z);
101+
} else if (path_no_drivable_lane_polygon_intersection.is_first_path_point_inside_polygon) {
102+
path_no_drivable_lane_polygon_intersection.second_intersection_point =
103+
createPoint(p.x(), p.y(), ego_pos.z);
104+
} else {
105+
// do nothing
109106
}
107+
} else if (intersects.size() == 2) {
108+
// classify first and second intersection points
109+
const auto & p0 = intersects.at(0);
110+
const auto & p1 = intersects.at(1);
111+
path_no_drivable_lane_polygon_intersection.first_intersection_point =
112+
createPoint(p0.x(), p0.y(), ego_pos.z);
113+
path_no_drivable_lane_polygon_intersection.second_intersection_point =
114+
createPoint(p1.x(), p1.y(), ego_pos.z);
115+
} else {
116+
// do nothing
110117
}
118+
111119
return path_no_drivable_lane_polygon_intersection;
112120
}
113121
} // namespace autoware::behavior_velocity_planner

0 commit comments

Comments
 (0)