Interface VehicleController

All Superinterfaces:
Lifecycle, Scheduler.Client

public interface VehicleController
extends Lifecycle, Scheduler.Client
Provides high-level methods for the kernel to control a vehicle.
  • Method Details

    • setTransportOrder

      @ScheduledApiChange(when="6.0", details="Default implementation will be removed.") default void setTransportOrder​(@Nonnull TransportOrder newOrder) throws java.lang.IllegalArgumentException
      Sets/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 - If newOrder cannot be processed for some reason, e.g. because it has already been partly processed and the route's continuity is not given.
    • 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.IllegalStateException
      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.IllegalStateException
      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 the newOrder 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 - If true, 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.
      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.
      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.
      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)
      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).
    • sendCommAdapterMessage

      void sendCommAdapterMessage​(@Nullable java.lang.Object message)
      Delivers a generic message to the communication adapter.
      Parameters:
      message - The message to be delivered.
    • sendCommAdapterCommand

      void sendCommAdapterCommand​(@Nonnull AdapterCommand command)
      Sends a AdapterCommand to the communication adapter.
      Parameters:
      command - The adapter command to be sent.
    • getCommandsSent

      @Nonnull java.util.Queue<MovementCommand> getCommandsSent()
      Returns a list of MovementCommands that have been sent to the communication adapter.
      Returns:
      A list of MovementCommands 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.