Interface VehicleController
- All Superinterfaces:
Lifecycle
,Scheduler.Client
@ScheduledApiChange(when="6.0", details="Will not extend Scheduler.Client any more; should be done by implementations.") public interface VehicleController extends Lifecycle, Scheduler.Client
-
Method Summary
Modifier and Type Method Description default void
abortDriveOrder()
Deprecated.UseabortTransportOrder(boolean)
instead.default void
abortTransportOrder(boolean immediate)
Notifies the controller that the current transport order is to be aborted.default ExplainedBoolean
canProcess(java.util.List<java.lang.String> operations)
Deprecated.UsecanProcess(org.opentcs.data.order.TransportOrder)
instead.default ExplainedBoolean
canProcess(TransportOrder order)
Checks if the vehicle would be able to process the given transport order, taking into account its current state.default void
clearCommandQueue()
Deprecated.UseabortTransportOrder(boolean)
instead.default void
clearDriveOrder()
Deprecated.UseabortTransportOrder(boolean)
instead.java.util.Queue<MovementCommand>
getCommandsSent()
Returns a list ofMovementCommand
s that have been sent to the communication adapter.default java.util.Optional<MovementCommand>
getInteractionsPendingCommand()
Returns the command for which the execution of peripheral operations must be completed before it can be sent to the communication adapter.default boolean
mayAllocateNow(java.util.Set<TCSResource<?>> resources)
Checks if the given set of resources are safe to be allocated immediately by this controller.default void
onVehiclePaused(boolean paused)
Notifies the implementation that the vehicle's paused state in the kernel has changed.void
sendCommAdapterCommand(AdapterCommand command)
Sends aAdapterCommand
to the communication adapter.void
sendCommAdapterMessage(java.lang.Object message)
Delivers a generic message to the communication adapter.default void
setDriveOrder(DriveOrder newOrder, java.util.Map<java.lang.String,java.lang.String> orderProperties)
Deprecated.default void
setTransportOrder(TransportOrder newOrder)
Sets/Updates the current transport order for the vehicle associated with this controller.default void
updateDriveOrder(DriveOrder newOrder, java.util.Map<java.lang.String,java.lang.String> orderProperties)
Deprecated.Methods inherited from interface org.opentcs.components.Lifecycle
initialize, isInitialized, terminate
Methods inherited from interface org.opentcs.components.kernel.Scheduler.Client
allocationFailed, allocationSuccessful, getId, getRelatedVehicle
-
Method Details
-
setTransportOrder
@ScheduledApiChange(when="6.0", details="Default implementation will be removed.") default void setTransportOrder(@Nonnull TransportOrder newOrder) throws java.lang.IllegalArgumentExceptionSets/Updates the current transport order for the vehicle associated with this controller.The controller is expected to process the transport order's current drive order. Once processing of this drive order is finished, it sets the vehicle's processing state to
Vehicle.ProcState.AWAITING_ORDER
to signal this. This method will then be called for either the next drive order in the same transport order or a new transport order.This method may also be called again for the same/current drive order in case any future part of the route to be taken for the transport order has changed. In case of such an update, the continuity of the transport order's route is guaranteed, which means that the previously given route and the one given in
newOrder
match up to the last point already sent to the vehicle associated with this controller. Beyond that point the routes may diverge.- Parameters:
newOrder
- The new or updated transport order.- Throws:
java.lang.IllegalArgumentException
- IfnewOrder
cannot be processed for some reason, e.g. because it has already been partly processed and the route's continuity is not given, the vehicle's current position is unknown or the resources for the vehicle's current position may not be allocated (in case of forced rerouting).
-
setDriveOrder
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") default void setDriveOrder(@Nonnull DriveOrder newOrder, @Nonnull java.util.Map<java.lang.String,java.lang.String> orderProperties) throws java.lang.IllegalStateExceptionDeprecated.Sets the current drive order for the vehicle associated with this controller.- Parameters:
newOrder
- The new drive order.orderProperties
- Properties of the transport order the new drive order is part of.- Throws:
java.lang.IllegalStateException
- If this controller already has a drive order.
-
updateDriveOrder
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") default void updateDriveOrder(@Nonnull DriveOrder newOrder, @Nonnull java.util.Map<java.lang.String,java.lang.String> orderProperties) throws java.lang.IllegalStateExceptionDeprecated.Updates the current drive order for the vehicle associated with this controller.An update is only allowed, if the continuity of the current drive order is guaranteed. The continuity of the current drive order is guaranteed, if the routes of both the current drive order and the
newOrder
match to the point where the vehicle associated with this controller is currently reported at. Beyond that point the routes may diverge.- Parameters:
newOrder
- The new drive order.orderProperties
- Properties of the transport order the new drive order is part of.- Throws:
java.lang.IllegalStateException
- If thenewOrder
would not guarantee the current drive order's continuity.
-
abortTransportOrder
@ScheduledApiChange(when="6.0", details="Default implementation will be removed.") default void abortTransportOrder(boolean immediate)Notifies the controller that the current transport order is to be aborted. After receiving this notification, the controller should not send any further movement commands to the vehicle.- Parameters:
immediate
- Iftrue
, immediately reset the current transport order for the vehicle associated with this controller, clears the vehicle's command queue implicitly and frees all resources reserved for the removed commands/movements. (Note that this is unsafe, as the vehicle might be moving and clearing the command queue might overlap with the vehicle's movement/progress.)
-
clearDriveOrder
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") default void clearDriveOrder()Deprecated.UseabortTransportOrder(boolean)
instead.Resets the current drive order for the vehicle associated with this controller. At the end of this method,clearCommandQueue()
is called implicitly. -
abortDriveOrder
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") default void abortDriveOrder()Deprecated.UseabortTransportOrder(boolean)
instead.Notifies the controller that the current drive order is to be aborted. After receiving this notification, the controller should not send any further movement commands to the vehicle. -
clearCommandQueue
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") default void clearCommandQueue()Deprecated.UseabortTransportOrder(boolean)
instead.Clears the associated vehicle's command queue and frees all resources reserved for the removed commands/movements. -
canProcess
@Nonnull @ScheduledApiChange(when="6.0", details="Default implementation will be removed.") default ExplainedBoolean canProcess(@Nonnull TransportOrder order)Checks if the vehicle would be able to process the given transport order, taking into account its current state.- Parameters:
order
- The transport order to be checked.- Returns:
- An
ExplainedBoolean
indicating whether the vehicle would be able to process given order.
-
canProcess
@Nonnull @Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") default ExplainedBoolean canProcess(@Nonnull java.util.List<java.lang.String> operations)Deprecated.UsecanProcess(org.opentcs.data.order.TransportOrder)
instead.Checks if the vehicle would be able to process the given sequence of operations, taking into account its current state.- Parameters:
operations
- A sequence of operations that might appear in future commands.- Returns:
- An
ExplainedBoolean
indicating whether the vehicle would be able to process every single operation in the list (in the given order).
-
onVehiclePaused
@ScheduledApiChange(when="6.0", details="Default implementation will be removed.") default void onVehiclePaused(boolean paused)Notifies the implementation that the vehicle's paused state in the kernel has changed. If pausing between points in the plant model is supported by the vehicle, the communication adapter may want to inform the vehicle about this change of state.- Parameters:
paused
- The vehicle's new paused state.
-
sendCommAdapterMessage
void sendCommAdapterMessage(@Nullable java.lang.Object message)Delivers a generic message to the communication adapter.- Parameters:
message
- The message to be delivered.
-
sendCommAdapterCommand
Sends aAdapterCommand
to the communication adapter.- Parameters:
command
- The adapter command to be sent.
-
getCommandsSent
Returns a list ofMovementCommand
s that have been sent to the communication adapter.- Returns:
- A list of
MovementCommand
s that have been sent to the communication adapter.
-
getInteractionsPendingCommand
@Nonnull @ScheduledApiChange(when="6.0", details="Default implementation will be removed.") default java.util.Optional<MovementCommand> getInteractionsPendingCommand()Returns the command for which the execution of peripheral operations must be completed before it can be sent to the communication adapter. For this command, allocated resources have already been accepted.- Returns:
- The command for which the execution of peripheral operations is pending or
Optional.empty()
if there's no such command.
-
mayAllocateNow
@ScheduledApiChange(when="6.0", details="Default implementation will be removed.") default boolean mayAllocateNow(@Nonnull java.util.Set<TCSResource<?>> resources)Checks if the given set of resources are safe to be allocated immediately by this controller.- Parameters:
resources
- The requested resources.- Returns:
true
if the given resources are safe to be allocated by this controller, otherwisefalse
.
-