Interface Router
- All Superinterfaces:
Lifecycle
public interface Router extends Lifecycle
A router finds routes from a start point to an end point, rating them according to implementation specific criteria/costs parameters.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROPKEY_ROUTING_COST_FORWARD
The key (prefix) of a path property defining the routing cost when its travelled in forward direction.static java.lang.String
PROPKEY_ROUTING_COST_REVERSE
The key (prefix) of a path property defining the routing cost when its travelled in reverse direction.static java.lang.String
PROPKEY_ROUTING_GROUP
The key of a vehicle property defining the group of vehicles that may share the same routing. -
Method Summary
Modifier and Type Method Description java.util.Set<Vehicle>
checkRoutability(TransportOrder order)
Checks the general routability of a given transport order.long
getCosts(Vehicle vehicle, Point sourcePoint, Point destinationPoint)
long
getCosts(Vehicle vehicle, Point sourcePoint, Point destinationPoint, java.util.Set<TCSResourceReference<?>> resourcesToAvoid)
Returns the costs for travelling a route from one point to another with a given vehicle.long
getCostsByPointRef(Vehicle vehicle, TCSObjectReference<Point> srcPointRef, TCSObjectReference<Point> dstPointRef)
java.util.Optional<Route>
getRoute(Vehicle vehicle, Point sourcePoint, Point destinationPoint)
java.util.Optional<Route>
getRoute(Vehicle vehicle, Point sourcePoint, Point destinationPoint, java.util.Set<TCSResourceReference<?>> resourcesToAvoid)
Returns a route from one point to another, passable for a given vehicle.java.util.Optional<java.util.List<DriveOrder>>
getRoute(Vehicle vehicle, Point sourcePoint, TransportOrder transportOrder)
Returns a complete route for a given vehicle that starts on a specified point and allows the vehicle to process a given transport order.java.util.Map<Vehicle,java.util.List<DriveOrder>>
getSelectedRoutes()
Returns an unmodifiable view on the selected routes the router knows about.java.util.Set<Point>
getTargetedPoints()
Returns all points which are currently targeted by any vehicle.void
selectRoute(Vehicle vehicle, java.util.List<DriveOrder> driveOrders)
Notifies the router of a route being selected for a vehicle.void
topologyChanged()
Deprecated.UseupdateRoutingTopology()
instead.default void
updateRoutingTopology()
Deprecated.UseupdateRoutingTopology(java.util.Set)
instead.default void
updateRoutingTopology(java.util.Set<Path> paths)
Notifies the router to update its routing topology with respect to the given paths.Methods inherited from interface org.opentcs.components.Lifecycle
initialize, isInitialized, terminate
-
Field Details
-
PROPKEY_ROUTING_GROUP
static final java.lang.String PROPKEY_ROUTING_GROUPThe key of a vehicle property defining the group of vehicles that may share the same routing.The value is expected to be an integer.
- See Also:
- Constant Field Values
-
PROPKEY_ROUTING_COST_FORWARD
static final java.lang.String PROPKEY_ROUTING_COST_FORWARDThe key (prefix) of a path property defining the routing cost when its travelled in forward direction.The value is expected to be a (long) integer.
- See Also:
- Constant Field Values
-
PROPKEY_ROUTING_COST_REVERSE
static final java.lang.String PROPKEY_ROUTING_COST_REVERSEThe key (prefix) of a path property defining the routing cost when its travelled in reverse direction.The value is expected to be a (long) integer.
- See Also:
- Constant Field Values
-
-
Method Details
-
topologyChanged
Deprecated.UseupdateRoutingTopology()
instead.Notifies the router of changes in the topology.This method is supposed to be called only from the kernel executor thread.
-
updateRoutingTopology
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") default void updateRoutingTopology()Deprecated.UseupdateRoutingTopology(java.util.Set)
instead.Notifies the router to update its routing topology.This method is supposed to be called only from the kernel executor thread.
-
updateRoutingTopology
@ScheduledApiChange(when="6.0", details="Default implementation will be removed.") default void updateRoutingTopology(@Nonnull java.util.Set<Path> paths)Notifies the router to update its routing topology with respect to the given paths.This method is supposed to be called only from the kernel executor thread.
- Parameters:
paths
- The paths to update in the routing topology. An empty set of paths results in the router updating the entire routing topology.
-
checkRoutability
Checks the general routability of a given transport order.This method is supposed to be called only from the kernel executor thread.
- Parameters:
order
- The transport order to check for routability.- Returns:
- A set of vehicles for which a route for the given transport order would be computable.
-
getRoute
@Nonnull java.util.Optional<java.util.List<DriveOrder>> getRoute(@Nonnull Vehicle vehicle, @Nonnull Point sourcePoint, @Nonnull TransportOrder transportOrder)Returns a complete route for a given vehicle that starts on a specified point and allows the vehicle to process a given transport order. The route is encapsulated into drive orders which correspond to those drive orders that the transport order is composed of. The transport order itself is not modified.This method is supposed to be called only from the kernel executor thread.
- Parameters:
vehicle
- The vehicle for which the calculated route must be passable.sourcePoint
- The position at which the vehicle would start processing the transport order (i.e. the vehicle's current position).transportOrder
- The transport order to be processed by the vehicle.- Returns:
- A list of drive orders containing the complete calculated route for the given transport order, passable the given vehicle and starting on the given point, or the empty optional, if no such route exists.
-
getRoute
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") @Nonnull java.util.Optional<Route> getRoute(@Nonnull Vehicle vehicle, @Nonnull Point sourcePoint, @Nonnull Point destinationPoint)Deprecated.Returns a route from one point to another, passable for a given vehicle.This method is supposed to be called only from the kernel executor thread.
- Parameters:
vehicle
- The vehicle for which the route must be passable.sourcePoint
- The starting point of the route to calculate.destinationPoint
- The end point of the route to calculate.- Returns:
- The calculated route, or the empty optional, if a route between the given points does not exist.
-
getRoute
@Nonnull java.util.Optional<Route> getRoute(@Nonnull Vehicle vehicle, @Nonnull Point sourcePoint, @Nonnull Point destinationPoint, @Nonnull java.util.Set<TCSResourceReference<?>> resourcesToAvoid)Returns a route from one point to another, passable for a given vehicle.This method is supposed to be called only from the kernel executor thread.
- Parameters:
vehicle
- The vehicle for which the route must be passable.sourcePoint
- The starting point of the route to calculate.destinationPoint
- The end point of the route to calculate.resourcesToAvoid
- Resources to avoid when calculating the route.- Returns:
- The calculated route, or the empty optional, if a route between the given points does not exist.
-
getCosts
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") long getCosts(@Nonnull Vehicle vehicle, @Nonnull Point sourcePoint, @Nonnull Point destinationPoint)Deprecated.Returns the costs for travelling a route from one point to another with a given vehicle.This method is supposed to be called only from the kernel executor thread.
- Parameters:
vehicle
- The vehicle for which the route must be passable.sourcePoint
- The starting point of the route.destinationPoint
- The end point of the route.- Returns:
- The costs of the route, or
Long.MAX_VALUE
, if no such route exists.
-
getCostsByPointRef
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") long getCostsByPointRef(@Nonnull Vehicle vehicle, @Nonnull TCSObjectReference<Point> srcPointRef, @Nonnull TCSObjectReference<Point> dstPointRef)Deprecated.Returns the costs for travelling a route from one point to another with a given vehicle.This method is supposed to be called only from the kernel executor thread.
- Parameters:
vehicle
- The vehicle for which the route must be passable.srcPointRef
- The starting point reference of the route.dstPointRef
- The end point reference of the route.- Returns:
- The costs of the route, or
Long.MAX_VALUE
, if no such route exists.
-
getCosts
long getCosts(@Nonnull Vehicle vehicle, @Nonnull Point sourcePoint, @Nonnull Point destinationPoint, @Nonnull java.util.Set<TCSResourceReference<?>> resourcesToAvoid)Returns the costs for travelling a route from one point to another with a given vehicle.This method is supposed to be called only from the kernel executor thread.
- Parameters:
vehicle
- The vehicle for which the route must be passable.sourcePoint
- The starting point of the route.destinationPoint
- The end point of the route.resourcesToAvoid
- Resources to avoid when calculating the route.- Returns:
- The costs of the route, or
Long.MAX_VALUE
, if no such route exists.
-
selectRoute
Notifies the router of a route being selected for a vehicle.This method is supposed to be called only from the kernel executor thread.
- Parameters:
vehicle
- The vehicle for which a route is being selected.driveOrders
- The drive orders encapsulating the route being selected, ornull
, if no route is being selected for the vehicle (i.e. an existing entry for the given vehicle would be removed).
-
getSelectedRoutes
Returns an unmodifiable view on the selected routes the router knows about. The returned map contains an entry for each vehicle for which a selected route is known.This method is supposed to be called only from the kernel executor thread.
- Returns:
- An unmodifiable view on the selected routes the router knows about.
-
getTargetedPoints
Returns all points which are currently targeted by any vehicle.This method is supposed to be called only from the kernel executor thread.
- Returns:
- A set of all points currently targeted by any vehicle.
-