Skip to content

Commit

Permalink
fix(behavior_path_planner_common): added a guard of obstacle polygon …
Browse files Browse the repository at this point in the history
…points (#5945)

* fix(behavior_path_planner_common): added a guard of obstacle polygon points

Signed-off-by: Takayuki Murooka <[email protected]>

* fix

Signed-off-by: Takayuki Murooka <[email protected]>

---------

Signed-off-by: Takayuki Murooka <[email protected]>
  • Loading branch information
takayuki5168 authored Dec 24, 2023
1 parent 2e2f184 commit 83d316c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1085,13 +1085,17 @@ void extractObstaclesFromDrivableArea(
std::vector<std::vector<PolygonPoint>> right_polygons;
std::vector<std::vector<PolygonPoint>> left_polygons;
for (const auto & obstacle : obstacles) {
if (obstacle.poly.outer().empty()) {
continue;
}

const auto & obj_pos = obstacle.pose.position;

// get edge points of the object
const size_t nearest_path_idx =
motion_utils::findNearestIndex(path.points, obj_pos); // to get z for object polygon
std::vector<Point> edge_points;
for (size_t i = 0; i < obstacle.poly.outer().size() - 1;
for (int i = 0; i < static_cast<int>(obstacle.poly.outer().size()) - 1;
++i) { // NOTE: There is a duplicated points
edge_points.push_back(tier4_autoware_utils::createPoint(
obstacle.poly.outer().at(i).x(), obstacle.poly.outer().at(i).y(),
Expand Down

0 comments on commit 83d316c

Please sign in to comment.