fzi-forschungszentrum-informatik / Lanelet2

Map handling framework for automated driving
BSD 3-Clause "New" or "Revised" License
800 stars 327 forks source link

centerline wierd output #271

Closed Recepalp10 closed 1 year ago

Recepalp10 commented 1 year ago

Hey,

I'm trying to calculate the centerline for lanes after uploading an osm file using lanelet2.io.load. When I run centerline its output is like [id: 0 point ids: 0, 0, 0, 0].

I wanted to know what could be the problem here and how to fix it as I need centerlines for my purpose. Are the centerline coordinates actually calculated but not stored? If so, how can these coordinates be displayed?

Thanks!

map = lanelet2.io.load(example_file, lanelet2.io.Origin(0, 0))
traffic_rules = lanelet2.traffic_rules.create(lanelet2.traffic_rules.Locations.Germany, lanelet2.traffic_rules.Participants.Vehicle)
graph = lanelet2.routing.RoutingGraph(map, traffic_rules)
lanelet = map.laneletLayer[92]

print(lanelet.centerline)

for point in lanelet.centerline:
    print("{}, {}\n".format(point.x, point.y))
poggenhans commented 1 year ago

The output is perfectly fine. Centerlines are calculated on the fly and are no persistent objects. Hence they don't get a persistent ID, but 0. They still have valid coordinates (as your print output should show).