maliput / maliput_malidrive

Open-source ready OpenDrive backend for Maliput
BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

Builder handling jumps in LaneWidth descriptions #133

Open francocipollone opened 3 years ago

francocipollone commented 3 years ago

See Slack thread related

Context

image

It was found that sometimes the XODR sintethizer tool (e.g. RoadRunner) creates laneWidth descriptions with jumps in the image of the piecewise-defined description:

<width sOffset="0.0000000000000000e+0" a="3.5000000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
<width sOffset="2.0499999999999972e+0" a="4.0000000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>

When the builder finds this it will throw given that maliput_malidrive tries to guarantee C1 continuity in the functions that describes the lane width, lane offset, and elevation or superelevation of the road.

Discussion

Should the builder try to smooth this jump in the description when doing a best effort to load the map?

Creating a function that fits in between and matches in value and derivative with both functions shouldn't be a problem, however:

We could enable an experimental functionality in which the builder tries to smooth the descriptions and of course this would be enabled only on demand.

Related to https://github.com/ToyotaResearchInstitute/maliput_malidrive/issues/148

@liangfok @agalbachicar

liangfok commented 3 years ago

I would like to understand how an .xodr can handle lane width changes while still adhering to the linear tolerance without the builder having any smoothing logic. In this case, the lane width changes by 0.5m. If we want a linear tolerance of 5cm, does this mean we need to have 0.5 / 0.05 - 1 = 9 entries in the .xodr the gradually ramp the lane width from 3.5 to 4.0 where each delta is 0.05m?

Something like this:

<width sOffset="0.0000000000000000e+0" a="3.5000000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
<width sOffset="0.2000000000000000e+0" a="3.5500000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
<width sOffset="0.4000000000000000e+0" a="3.6000000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
<width sOffset="0.6000000000000000e+0" a="3.6500000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
<width sOffset="0.8000000000000000e+0" a="3.7000000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
<width sOffset="1.0000000000000000e+0" a="3.7500000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
<width sOffset="1.2000000000000000e+0" a="3.8000000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
<width sOffset="1.4000000000000000e+0" a="3.8500000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
<width sOffset="1.6000000000000000e+0" a="3.9000000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
<width sOffset="1.8000000000000000e+0" a="3.9500000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
<width sOffset="2.0499999999999972e+0" a="4.0000000000000000e+0" b="0.0000000000000000e+0" c="0.0000000000000000e+0" d="0.0000000000000000e+0"/>
francocipollone commented 3 years ago

I would like to understand how an .xodr can handle lane width changes while still adhering to the linear tolerance without the builder having any smoothing logic. In this case, the lane width changes by 0.5m. If we want a linear tolerance of 5cm, does this mean we need to have 0.5 / 0.05 - 1 = 9 entries in the .xodr gradually ramp the lane width from 3.5 to 4.0 where each delta is 0.05m?

Even though this will ok for the builder because the jumps are "below" linear tolerance won't be optimal.

We should create a polynomial(f_m(p)) in between the others (let's call them f_start(p) with p E [p_s_0, p_s_1] and f_end(p) with p E [p_e_0, p_e_1]).

f_m(p) = a + b * p + c * p^2 + d * p^3  ;  p E [p_m_0, p_m_1]

Where:

f_start(p_s_1) = f(p_m_0)
f_start ' (p_s_1) = f'(p_m_0)
f_end(p_e_1) = f(p_m_1)
f_end ' (p_e_1) = f'(p_m_1)

With those conditions, we should be able to get the corresponding coefficients.

The only thing to have in mind is that probably we will need to crop the length of the first function.

liangfok commented 3 years ago

I see, so it's possible that RoadRunner is unable to (or did not) produce the polynomial description and is instead simply providing a very sparse description of the change in lane width.