Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Roads linked by DirectJunctionCreator lack successor/predecessor. #228

Open
throusea opened this issue Apr 25, 2024 · 0 comments
Open

Comments

@throusea
Copy link

I tried code example in user documentation and run locally with version 0.14.3.

from scenariogeneration import xodr
junction_id = 100
direct_junction = xodr.DirectJunctionCreator(junction_id,'my_direct_junction')

first_road = xodr.create_road([xodr.Line(300)],
            id= 1,
            left_lanes=3,
            right_lanes=4)

continuation_road = xodr.create_road([xodr.Line(300)],
            id= 2,
            left_lanes=3,
            right_lanes=3)

off_ramp = xodr.create_road([xodr.Spiral(-0.00001,-0.02,length=150)],
            id= 3,
            left_lanes=0,
            right_lanes=1)

first_road.add_successor(xodr.ElementType.junction, junction_id)
continuation_road.add_predecessor(xodr.ElementType.junction, junction_id)
off_ramp.add_predecessor(xodr.ElementType.junction, junction_id)

direct_junction.add_connection(
            incoming_road = first_road,
            linked_road = continuation_road)
direct_junction.add_connection(
            incoming_road = first_road,
            linked_road = off_ramp,
            incoming_lane_ids=-4,
            linked_lane_ids = -1)
odr = xodr.OpenDrive('myroad')

odr.add_road(first_road)
odr.add_road(continuation_road)
odr.add_road(off_ramp)

odr.add_junction_creator(direct_junction)
odr.adjust_roads_and_lanes()
xodr.printToFile(odr, "demo7.xodr")

It generated a file named demo7.xodr and I tried to import it into carla. It shows error like "next_lane != nullptr". Then I preview it by online OpenDrive Viewer https://odrviewer.io/ and compared with its example road network. I found that the road lacks sucessor/predecessor with linked road. Or the connections between two roads by DirectJunctionCreator failed.

image

Maybe I ignore the step and have another code to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant