tum-gis / rtron

r:trån is a road space model transformer library for OpenDRIVE, CityGML and beyond
https://rtron.io
Apache License 2.0
50 stars 12 forks source link

Possibly incorrect warning about not needed junctions #24

Closed MatteoRagni closed 1 year ago

MatteoRagni commented 1 year ago

RTron version: 1.3.0

When validating OpenDRIVE files with some specific junction topologies, a warning is raised stating that such junction is not needed, as that junction only has two incoming roads. Here is an example of such an error:

{
    "type": "",
    "info": "Junctions of type default should only be used when at least three roads are coming in (currently incoming road ids: [9, 12])",
    "location": "Junction: junctionId=0",
    "incidentSeverity": "WARNING",
    "wasFixed": false,
    "infoValues": {
    },
    "messageSeverity": "WARNING"
},

The junction in question is the following (road IDs are indicated in red):

rtron_sample_junction_error

The OpenDRIVE standard states that:

"Junctions should not be used when only two roads meet." ("Rules" section of OpenDRIVE 1.7, chapter 10.1)

From our understanding, this means that if a junction is only used to connect two roads, then the junction is not needed. In the case shown above, however, three roads are meeting at the junction: road 8, 9 and 12. The standard also states that:

"Junctions shall only be used when roads cannot be linked directly. They clarify ambiguities for the linking. Ambiguities are caused when a road has two or more possible predecessor or successor roads." ("Rules" section of OpenDRIVE 1.7, chapter 10.1)

In this case, the successor of road 8 is ambiguous, as both roads 10 and 11 are valid successors. As stated by the standard, to clarify this ambiguity a junction is needed.

The error indicated by rtron is therefore incorrect, but there are still situations in which a junction could be unnecessary. We tried to better understand how to identify not needed junctions, and the algorithm we came up with is:

for each connecting road of the junction, store the ID of the road before (predecessor) and after (successor) the connecting road. If any road was stored more than once, the junction is necessary (solves an ambiguity of that road). If no road was stored more than once, no ambiguity is present, and therefore the junction could be replaced with 1 to N roads (the connecting roads of the junction itself).

Here are some examples showing situations with ambiguities and without ambiguities. The algorithm described above would correctly identify these situations:

not_needed_junctions_examples

We believe that the algorithm described above covers all cases, but if a counter-example is found please feel free to reply describing that situation.

benediktschwab commented 1 year ago

Thanks for reporting this issue and especially for the detailed discussion with the proposed algorithm! I implemented it according to your idea in 63aa0bb.

Could you check if the develop branch solves your issue?

DavideFarina96 commented 1 year ago

Hi Benedikt, I am Matteo's colleague. I tested the develop branch on various OpenDRIVE files, and it looks like the problem has been solved! It is hard to say if it is solved in all cases, but I was not able to find an example in which the warning was raised incorrectly.

Thanks for the update! Should i find an example in which the same issue occours, I will make sure to let you know.

benediktschwab commented 1 year ago

Thanks for testing and giving feedback! I will close the issue then.