Curves research for RNDF Maliput

Issue #170 closed
Agustin Alba Chicar created an issue

We need to further research on curves and how we can manage to construct the road geometry based on cubic interpolants. Options are:

  1. Ignition's Splines.
  2. Drake's Splines (which in fact represent the same curve as before).
  3. Drake's PChip.

Related issues: #134 and #149

Comments (8)

  1. Agustin Alba Chicar reporter

    So far we have done the following:

    • Create a RNDF file that shows a geoemtry that produces loops / cusps / colinear zig-zags.
    • Detected colinear zig-zags. This is implies the idea of monotonicity in the curve. This is provided by the PChip type but not by the Spline. We can avoid this case in ignition's spline by providing a high value of tension, and detect it in a not so good way but cost-less (from the programmer point of view).
    • The detection idea is based on that the projected distance should be always increasing its value as we increase the t parameter. The projection must be done over the vector that joins the beginning and the ending of the curve piece.
    • As PChip is a shape preserving curve, is C1 and provides monotonicity, we did a test by generating the curve with PChip and assigning the points and tangents to an ignition's Spline. This headed to results but we still need a curve to match the junctions between two lanes. Possible solution is Bezier here.

    Future work is related with Bezier interpolant to match the junctions.

  2. Agustin Alba Chicar reporter

    Here are some pictures of the RNDF file before adding the PChip code:

    I.png

    H.png

    G.png

    F.png

    And after applying the code of PChip:

    C.png

    D.png

    E.png

  3. Agustin Alba Chicar reporter

    After some iterations on the algorithms we could get the following:

    1. For lanes we generate with PChip the tangents to preserve shape (which implies convexity and monotonicity) in each piece (in between control points) and then create a Spline with those tangents and points. We need to mention that for the PChip knots, points coordinates were used and for breaks the distance between each knot plus the previous knot. These conditions avoids having null vector as tangent at the extents.
    2. There is a special condition for PChip when only two points are supplied, it will generate null tangents at the extents, so we avoid these step by creating a spline directly.
    3. For connections, as a high level we took the information from the connecting lanes and then we transform that information into a Bezier curve where we can easily tune the shape to match the desired path. Finally we convert it back to a spline. Detailed steps can be seen below:

      • First get point and tangent. Those make the Hermite Spline information. Then we convert them to Bezier points and run an algorithm to move control points so as to avoid having loops / cusps.
      • From those four Bezier points, we convert them back to Hermite Spline point and tangent pairs to create the final spline.
      • There are a couple of cases where no action is done when adjusting the control points in Bezier base. If the lines which can be constructed from point and tangent do not intersect or if the critical control point makes the curve to have a change in convexity we leave the points as they are as the adjustment will not make any effect.

    To dig a bit more on the specific cases where no action is take in Bezier base, we can add that if lines do not intersect, is because they are not coplanar or they are parallel. The other case may be a little more tricky to visualize, so here are a couple of pictures to show the effect of Bezier adjustment.

    BezierOk.png

    In the previous image blue dots are the extents of the curve, the arrows show the tangent direction and with lines we project those tangents until they intersect at the red dot. That is the critical control point which produces the curve shown. Now, if we have the following arrangement:

    BezierBad.png

    Following the previous approach, something similar to the black curve will be generated (if fact it will have a little loop at the upper blue dot to match the tangent heading). However we would like to have something similar to the red curve.

  4. Agustin Alba Chicar reporter

    From the previous description we manage to have the previous RNDF being generated like:

    A.png

    B.png

    C.png

  5. Agustin Alba Chicar reporter

    After some tests we found that we need to get rid of the avoided cases before. So, for parallel tangents, we found a way to create an S-connection and match both tangents and for the second case (depicted in this picture, this comment) we do something similar to what's done for the parallel tangents, we find the critical control point, and then adjust the intermediate control points so they creat the S shape. It must be said that to preserve the angle of the tangents, we set the control points over the the lines defined by the original control points, so the heading of the tangents are not affected, only modules are modified.

  6. Log in to comment