Skip to content

Commit

Permalink
perf(query): add faster getLinkedParkingLot function
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime CLEMENT <[email protected]>
  • Loading branch information
maxime-clem committed Jul 10, 2024
1 parent 98b1edb commit aa3ce3c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ bool getLinkedParkingLot(
bool getLinkedParkingLot(
const lanelet::BasicPoint2d & current_position, const lanelet::ConstPolygons3d & all_parking_lots,
lanelet::ConstPolygon3d * linked_parking_lot);
bool getLinkedParkingLot(
const lanelet::BasicPoint2d & current_position,
const lanelet::LaneletMapConstPtr & lanelet_map_ptr,
lanelet::ConstPolygon3d * linked_parking_lot);
// get linked parking lot from parking space
bool getLinkedParkingLot(
const lanelet::ConstLineString3d & parking_space,
Expand Down
16 changes: 16 additions & 0 deletions autoware_lanelet2_extension/lib/query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,22 @@ bool getLinkedParkingLot(
}
return false;
}
bool getLinkedParkingLot(

Check warning on line 552 in autoware_lanelet2_extension/lib/query.cpp

View check run for this annotation

Codecov / codecov/patch

autoware_lanelet2_extension/lib/query.cpp#L552

Added line #L552 was not covered by tests
const lanelet::BasicPoint2d & current_position,
const lanelet::LaneletMapConstPtr & lanelet_map_ptr, lanelet::ConstPolygon3d * linked_parking_lot)
{
auto candidates =
lanelet_map_ptr->polygonLayer.search(lanelet::geometry::boundingBox2d(current_position));
candidates.erase(
std::remove_if(

Check warning on line 559 in autoware_lanelet2_extension/lib/query.cpp

View check run for this annotation

Codecov / codecov/patch

autoware_lanelet2_extension/lib/query.cpp#L559

Added line #L559 was not covered by tests
candidates.begin(), candidates.end(),
[](const auto & c) {
const std::string type = c.attributeOr(lanelet::AttributeName::Type, "none");
return type != "parking_lot";

Check warning on line 563 in autoware_lanelet2_extension/lib/query.cpp

View check run for this annotation

Codecov / codecov/patch

autoware_lanelet2_extension/lib/query.cpp#L561-L563

Added lines #L561 - L563 were not covered by tests
}),
candidates.end());
return getLinkedParkingLot(current_position, candidates, linked_parking_lot);
}

// get overlapping parking lot
bool getLinkedParkingLot(
Expand Down

0 comments on commit aa3ce3c

Please sign in to comment.