esmini / esmini

a basic OpenSCENARIO player
Mozilla Public License 2.0
760 stars 217 forks source link

how to extract and discrete lane line from openDRIVE? #418

Open StephenHU-sh opened 1 year ago

StephenHU-sh commented 1 year ago

Hi,All

In a location where the number of lanes changes, the number of lanes changes from 4 to 5. According to the current EGO position, I want to extract all lane lines (discreted points) within a certain range ahead.

I used the MoveAlongS() function and found that one line was missing in the extracted lane lines (line 4 was lost). Actually, Line 3 splits into two lines at point A, one is the successor of line 3 and the other is line 4.

WXWorkCapture_16811911464190

I'm not sure if MoveAlongS() can handle such a case? Or is there any other function that can handle such cases?

eknabevcc commented 1 year ago

MoveAlongS() will move from current position along the current lane. It will seamlessly move into connected predecessors or successor roads. If reaching a junction it's a little bit more tricky: It will choose the connecting road going into a direction best matching the junctionSelectorAngle argument (0, 2pi). If set to -1 the choice will be random.

So, even though MoveAlongS(), while moving along, handles transition between road and lanes it will not spontaneously change lane. Hence it will not move into a new lane that might appear in a lane section being reached along the way.

My recommendation in your case is to explore OSI information. Hopefully it can provide what you need. As a start, see code example osi-groundtruth and testUDPDriver-print-osi-info.py involving some lane inspection.