fzi-forschungszentrum-informatik/Lanelet2

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

Closed this issue · 6 comments

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 :)

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 :)

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:

  • Tag the lanelets you don't want to have as part of your route as not drivable lanelets (see also here). That's probably the most simple solution, but it requires you to change the map and doesn't allow dynamic changes.
  • Write your own RoutingCost object and use that over the default-provided ones when creating the routing graph. Here you have all the flexibility you might want to make certain lanelets more or less attractive. That probably also answers the second question
  • Write your own TrafficRules. This allows excluding certain lanelets completely from the routing graph. It doesn't change the cost calculation, of course.

Thanks for the amazing answers and support as usual 👍

  • 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. However, this tagging as standalone solution does not exclude it from the routing graph or does not help in providing other possible path (for the best of my understanding)

  • For the third point TrafficRules, I tried it after your answer and it is actually working very fine and doing the job. It provides other alternative route avoiding this particular lane.
    However, this is leading me to lose an edge in my feature when there is no other possible route to find than this one through the no_drivable_lane ➡️ to let the vehicle go to this no_drivable_lane and stop before entering it and notify the human driver to drive manually and then re-engage autonomous driving after passing it.
    That is because this TrafficRules has excluded this lanelet completely from the routing graph as you mentioned.

  • That is why I very interested in the second point RoutingCost and think it would be a better solution.
    However, I a bit struggling understanding its usage and how to plug it in code.

As it is mentioned in the documentation :

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

  • Does this mean RoutingCost is something that I can assign for a lanelet ? or is it a property for the whole graph ?
  • I can see from the methods in RoutingGraph.cpp for example :
    Optional<Route> RoutingGraph::getRoute(const ConstLanelet& from, const ConstLanelet& to, RoutingCostId routingCostId,
    is using routingCostId. How can I get this ID for the routingCost object that I will create.

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

Lots and lots of thanks

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:

static RoutingGraphUPtr build(const LaneletMap& laneletMap, const traffic_rules::TrafficRules& trafficRules,
const RoutingCostPtrs& routingCosts = defaultRoutingCosts(),
const Configuration& config = Configuration());

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.

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.

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