Closed johannes-fischer closed 3 months ago
Lanelets have an orientation. If you want to search for a route in the opposite direction, you have to search with the inverted lanelet.
In your example assert(graph.following(lanelet_on_road_before.invert()) == [lanelet_before_roundabout.invert()])
Oh great thanks, that works! I assumed the id is enough to identify a lanelet uniquely and since the id remains the same after lanelet.invert(), I thought the inverted lanelet is still considered the same lanelet. Now I understand that only the tuple (lanelet.id, lanelet.inverted()) uniquely defines a lanelet.
I checked out the exported routing graph files and saw that they contain the two-way lanelet ids twice as different graph nodes, once for each direction.
The example map contains a section of two-way lanelets with a corresponding attribute. The routing graph seems to be set up incorrectly for these.
Code example:
Here
lanelet_before_roundabout
andlanelet_on_road_before
are two-way lanelets (see image below) but the routing graph can only find routing fromlanelet_before_roundabout
tolanelet_on_road_before
not the other direction. Also, it cannot find routing fromlanelet_before_roundabout
onto the roundabout. Hence, it seems there is a bug in the routing graph builder with two-way lanelets.Furthermore, assuming the routing between
lanelet_before_roundabout
andlanelet_on_road_before
is fixed, there might be additional issues with driving onto the fromlanelet_before_roundabout
tolanelet_in_roundabout
, since this code compares whether the end of previous lanelet left bound and beginning of next lanelet left bound match:However, in this case of two-way lanelets, the right bound of
lanelet_in_roundabout
attaches to the left bound oflanelet_before_roundabout
. Possibly, this can be solved by considering two-way lanelets in both directions for routing purposes.