Skip to content

Commit

Permalink
perf(lanelet2_extension): improve performance of getClosestLanelet (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#161)

* perf(lanelet2_extension): improve performance of getClosestLanelet

Signed-off-by: Taiga Takano <[email protected]>

* style(pre-commit): autofix

Signed-off-by: Taiga Takano <[email protected]>

---------

Signed-off-by: Taiga Takano <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
TakanoTaiga and pre-commit-ci[bot] authored Apr 3, 2023
1 parent 401382d commit a70a157
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tmp/lanelet2_extension/lib/query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,11 @@ bool query::getClosestLanelet(
}
}

if (candidate_lanelets.size() == 1) {
*closest_lanelet_ptr = candidate_lanelets.at(0);
return found;
}

// find by angle
{
double min_angle = std::numeric_limits<double>::max();
Expand Down

0 comments on commit a70a157

Please sign in to comment.