Loading
Draft: Adaptations to center line generation for logical lanes
Added features:
- ComputeCenterline continues to receive 2 boundaries.
- Boundaries provided are now clipped between start_s and end_s. Points outside the range are dropped and points are interpolated at start_s / end_s where a boundary crosses them.
- A union is now created between the unique S values among the points of both boundaries
- For each unique S value in the union, we seek a boundary point for each boundary and use these two points to calculate the centerline point (their midpoint)
- In case there is no point available for a certain S in a certain boundary, a new point is interpolated based on the first points before and after that S value. S values outside the boundary hold its first or last point instead of extrapolating
- Only the first point of an S is used (the next point of a boundary needs a larger S). This also drops the joint point shared by consecutive boundaries; points with a different T at the same S (lateral steps) are ignored for now
- S values closer than 1e-6 m are treated as the same S
- A warning is logged when no centerline can be computed (a side has no boundary points in the lane range)
- The centerline in driving direction is the road-direction centerline, reversed for kDecreasingS
Added test coverage:
- Basic centerline: midpoint of left and right boundary, both in road and in driving direction
- Empty cases: no boundaries, only left, only right, boundary entirely before / after the lane range Union of S values: different number of points, more than three points, interleaved S values, boundaries split at different positions, single point boundaries
- Interpolation: all coordinates (x, y, z) interpolated at start_s / end_s from a single boundary segment spanning the lane, centerline height is the midpoint of boundaries at different heights
- Clipping to [start_s, end_s]: boundaries extending beyond the lane, points outside the range are not used, points exactly at the lane limits are not duplicated, boundaries starting inside the lane get no extra point
- Consecutive boundaries: shared joint point is not duplicated; joint point and vertices with a tiny S difference (1e-9) are treated as one point
- Lateral step (same S, different T): only the first point of the step is used
- U-turn lane: curved lane whose boundaries have different vertices (3 and 4 segments); the centerline keeps the vertices of both boundaries and every point is compared with an independently computed expected point
Edited by Joaquim Quadrado