woven-planet / l5kit

L5Kit - https://woven.toyota
https://woven-planet.github.io/l5kit
857 stars 278 forks source link

Is there any easy way to get the nearest lane given a position? #289

Closed dongb5 closed 3 years ago

dongb5 commented 3 years ago

Hi, I am just wondering is there any easy way to get the nearest lane given a position in l5kit? What I come up with is using MapAPI to get all lane [xyz_left, xyz_right], and using global coords of position to compute the verticle distance between them. Any help? Thanks

lucabergamini commented 3 years ago

Hey, We don't have any utility function for that out of the box. However, what you did should give you the correct result. The lanes are cached in the mapAPI so that part should be cheap enough. I guess that computing all distances is probably more expensive though.

something that can also hep is using the bounds_info of the mapAPI for a quick lookup (so you don't have to compute all distances every time)