maliput / maliput_sparse

A maliput backed capable of modeling RoadNetworks from waypoints.
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Uses the closest point to calculate the equivalent p in a boundary. #46

Closed francocipollone closed 1 year ago

francocipollone commented 1 year ago

🦟 Bug fix

Related to #39

Summary

39 Describes an issue that is evidenced when calculating the RBounds.

Intrinsically, this issue comes from the calculation of the equivalent p: this is the p in the left or right linestring that matches with the p in the centerline.

At the moment the equivalent p has been calculated by scaling the centerline p by the ratio of centerline length and boundary length. (Causing the issue in #39)

In this PR a new approach is given: For a given point in the centerline, the equivalent p in the boundaries will be given by the closest point(boundary to centerline)

Using this approach the issue of the RBounds calculation is solved, being consistent no matter the shape of the lane:

image (Compare it with the case in #39 )

Pros:

Cons:

Checklist

francocipollone commented 1 year ago

This is a draft and the tests will be updated once this approach has been debated.

agalbachicar commented 1 year ago

I think it is worth the pros against the cons because:

  • The time for creating the meshes for the s_shape_road was doubled. From 36sec to 70sec(we should improve overall performance tho)

This is a one time thing, and the problem should be reduced if we expose or use when computing meshes some kind of API that allows to pass in hints of where the previous value was computed, then the search is done in much smaller space. Also, sampling distance should reduce the computational cost here.

when equivalent p is wanted to be calculated on a change of direction: this is minimized by sampling the road correctly and avoiding big discrete jumps in direction.

There is no formal solution to this problem, I think. It is heuristic based and we should define one way to do it. This one seems reasonable based on the results you showed.

francocipollone commented 1 year ago

While the issue is solved for the SShapeRoad (which is flat), an anomaly can be seen when there is a variable superelevation, like in the SShapeSuperelevatedRoad. It is not as smooth as maliput_malidrive.

image

While in the part of the road where no superelevation is present.

image

agalbachicar commented 1 year ago

It is OK to not be smooth by definition. I think it is the combined effect between the curvature and the superelevation what makes that effect rather than superelevation alone.