fzi-forschungszentrum-informatik / Lanelet2

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

[Question] Possible Paths other than shortest path from start to end lanelets #308

Closed ahmeddesokyebrahim closed 1 year ago

ahmeddesokyebrahim commented 1 year ago

Hi ,

I am asking if there is a way in routing graph to get alternative paths other than the shortest path from start to end lanelets.

The motivation behind the question, the shortest path outcome is for sure working pretty fine in general. However, for some particular cases I need to handle, the vehicle should not go through specific lanelets (for technical or business reasons) and these lanelets are part of the shortest path.

That is why I am asking if there is a way to get other possible paths from start to end (or at least one other possible path).

Thanks :)

ahmeddesokyebrahim commented 1 year ago

I would like to add another piece to my question.

As long as the shortestPath() is using Dijkestra (not A*) algorithm, there is no way to pre-define higher costs for specific lanelets than others so that influences the shortest path (using heurisitc / h-cost). Is my understanding correct ?

I would be grateful for your amazing support :)

poggenhans commented 1 year ago

The shortest path returned by lanelet2 is always with respect to the routing cost calculation and the traffic rules you selected. Depending on you concrete use case, there are several options (see also here:

ahmeddesokyebrahim commented 1 year ago

Thanks for the amazing answers and support as usual :+1:

As it is mentioned in the documentation :

They generically determine the routing cost for traveling along a lanelet/area

I would appreciate your support and efforts answering these questions and simplifying this point.

Lots and lots of thanks

poggenhans commented 1 year ago

For the first point Tagging Lanelets, actually I am using this tagging already to let the vehicle stop by this no_drivable_lane and prevent autonomous driving in it

I rather meant that you use the official tags, as in this example. Lanelets that are not drivable for a given participant will not be considered as part of the routing graph.

Does this mean RoutingCost is something that I can assign for a lanelet ? or is it a property for the whole graph ?

When you create a routing graph, you pass a vector of RoutingCost objects: https://github.com/fzi-forschungszentrum-informatik/Lanelet2/blob/a184258a3ef020648a375c5c6bac083673ecdb74/lanelet2_routing/include/lanelet2_routing/RoutingGraph.h#L81-L83

If you don't pass anything, distance and travel time are used. The index in the vector when you initialize the graph will be the routingCostId for all subsequent queries on the resulting graph. This means you can easily define your own routing cost objects by inheriting from the abstract RoutingCost base class and implement whatever you like. And then for your queries toggle between the different cost calculations using the routingCostId.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 90 days with no activity. Is this issue still work in progress? If yes, mark it as "WIP" or comment, otherwise it will be closed in 30 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 30 days with no activity.