pyoscx / scenariogeneration

Python library to generate linked OpenDRIVE and OpenSCENARIO files
Mozilla Public License 2.0
255 stars 81 forks source link

OpenDRIVE lane linking issue #169

Closed johschmitz closed 10 months ago

johschmitz commented 1 year ago

I reported a problem here https://github.com/esmini/esmini/issues/447 and @eknabe correctly told me that some links where missing. I then further investigated the problem and found that

xodr.create_lane_links_from_ids(road, road_suc, lane_ids_road, lanes_ids_road_suc)

is failing for this edge case where the road is connected to a junction and another road.

image

Deeper debugging showed that there seems to be a bug in

 _get_related_lanesection(road1, road2)

https://github.com/pyoscx/scenariogeneration/blob/484656b8f8a2387f3ce3072a0fa303a424c9a749/scenariogeneration/xodr/links.py#L864

It first correctly identifies the linktype as successor but then overwrites it since it also finds the junction connected to the other end.

johschmitz commented 1 year ago

I created a pull request to fix this problem. Please check if this makes sense.

mander76 commented 1 year ago

This fails a bunch of tests, so not a viable solution sadly enough.

mander76 commented 1 year ago

I created a simple example to replicate the issue circular_road_with_junction.zip And found out the real problem, and pushed a fix to this branch: https://github.com/pyoscx/scenariogeneration/tree/circular_road_with_junction_fix Could you try it out and see if it solves it for you aswell?

johschmitz commented 12 months ago

@mander76 I can confirm that this works. Can be merged and released.