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

Relies on GetClosestPoint for the GetClosestPointUsing2dProjection method. #53

Merged

Conversation

francocipollone
Copy link
Contributor

🎉 New feature

Related to #50 #47

Goes on top of #52

Summary

  • Refactor GetClosestPointUsing2dProjection in order to make use of the kdtree3d we have.
    This reduce a lot the time it takes LaneGeoemetry::WInverse queries, and therefore ToLanePosition, ToRoadPosition and FindRoadPosition times are massively improved

Speed up

Benchmark name cpu time[us] speed up map
francocipollone/poc_line_string_kd_tree francocipollone/use_closest_point_for_2d_projection_case
MaliputSparseGeometryTime/InterpolatePointAtCenterline 0.132 0.124 1.06
MaliputSparseGeometryTime/ToArcCoordinates/WInverse 14717 3.07 4793.81
MaliputOsmQueryTime/GetLane/0 0.023 0.023 1.00 SingleLane.osm
MaliputOsmQueryTime/GetLane/1 0.022 0.022 1.00 ArcLane.osm
MaliputOsmQueryTime/GetLane/2 0.024 0.028 0.86 ArcLaneDense.osm
MaliputOsmQueryTime/GetLane/3 0.024 0.023 1.04 Circuit.osm
MaliputOsmQueryTime/Length/0 0.003 0.003 1.00 SingleLane.osm
MaliputOsmQueryTime/Length/1 0.003 0.004 0.75 ArcLane.osm
MaliputOsmQueryTime/Length/2 0.003 0.004 0.75 ArcLaneDense.osm
MaliputOsmQueryTime/Length/3 0.003 0.003 1.00 Circuit.osm
MaliputOsmQueryTime/ToLanePosition/0 3.26 4.51 0.72 SingleLane.osm
MaliputOsmQueryTime/ToLanePosition/1 11.5 6.24 1.84 ArcLane.osm
MaliputOsmQueryTime/ToLanePosition/2 350 17.1 20.47 ArcLaneDense.osm
MaliputOsmQueryTime/ToLanePosition/3 23.8 8.85 2.69 Circuit.osm
MaliputOsmQueryTime/ToInertialPosition/0 1.22 1.41 0.87 SingleLane.osm
MaliputOsmQueryTime/ToInertialPosition/1 4.16 1.65 2.52 ArcLane.osm
MaliputOsmQueryTime/ToInertialPosition/2 129 4.5 28.67 ArcLaneDense.osm
MaliputOsmQueryTime/ToInertialPosition/3 8.45 2.45 3.45 Circuit.osm
MaliputOsmQueryTime/GetOrientation/0 1.07 1.25 0.86 SingleLane.osm
MaliputOsmQueryTime/GetOrientation/1 3.92 1.48 2.65 ArcLane.osm
MaliputOsmQueryTime/GetOrientation/2 119 4.04 29.46 ArcLaneDense.osm
MaliputOsmQueryTime/GetOrientation/3 7.92 2.31 3.43 Circuit.osm
MaliputOsmQueryTime/ToRoadPosition/0 8.97 10.4 0.86 SingleLane.osm
MaliputOsmQueryTime/ToRoadPosition/1 37.1 13.7 2.71 ArcLane.osm
MaliputOsmQueryTime/ToRoadPosition/2 1155 36.8 31.39 ArcLaneDense.osm
MaliputOsmQueryTime/ToRoadPosition/3 476 168 2.83 Circuit.osm
MaliputOsmQueryTime/FindRoadPositions/0 7.24 8.3 0.87 SingleLane.osm
MaliputOsmQueryTime/FindRoadPositions/1 24.8 10.2 2.43 ArcLane.osm
MaliputOsmQueryTime/FindRoadPositions/2 761 28.5 26.70 ArcLaneDense.osm
MaliputOsmQueryTime/FindRoadPositions/3 429 153 2.80 Circuit.osm

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if it affects the public API)

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
…/poc_line_string_kd_tree

Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
agalbachicar
agalbachicar previously approved these changes Feb 7, 2023
Copy link
Contributor

@agalbachicar agalbachicar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Wow. Impressive!
It sounds like small amounts of points still prefer the previous approach, right?

@francocipollone
Copy link
Contributor Author

LGTM!

Wow. Impressive! It sounds like small amounts of points still prefer the previous approach, right?

Yes but only for SingleLane which each line string is only created with 2 points (start and end point).
That scalates quickly: For ArcLane (not dense one) there are about 10-20 points per linestring and the speed up is already remarkable

francocipollone and others added 5 commits February 9, 2023 10:31
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
…ollone/use_closest_point_for_2d_projection_case
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
…ollone/use_closest_point_for_2d_projection_case
Base automatically changed from francocipollone/poc_line_string_kd_tree to main February 14, 2023 16:17
…jection_case

Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
@francocipollone francocipollone merged commit 471c19d into main Feb 14, 2023
@francocipollone francocipollone deleted the francocipollone/use_closest_point_for_2d_projection_case branch February 14, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants