Package org.opentcs.drivers.vehicle

# 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 Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `default void` | `abortDriveOrder()` | Deprecated. Use `abortTransportOrder(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. Use `canProcess(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. Use `abortTransportOrder(boolean)` instead.
  `default void` | `clearDriveOrder()` | Deprecated. Use `abortTransportOrder(boolean)` instead.
  `java.util.Queue<MovementCommand>` | `getCommandsSent()` | Returns a list of `MovementCommand`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.
  `void` | `sendCommAdapterCommand​(AdapterCommand command)` | Sends a `AdapterCommand` 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. Use `setTransportOrder(org.opentcs.data.order.TransportOrder)` instead.
  `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. Use `setTransportOrder(org.opentcs.data.order.TransportOrder)` instead.

  ### Methods inherited from interface org.opentcs.components.Lifecycle

  `initialize, isInitialized, terminate`

  ### Methods inherited from interface org.opentcs.components.kernel.Scheduler.Client

  `allocationFailed, allocationSuccessful, getId`

- ## 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
    Deprecated.
    Use `setTransportOrder(org.opentcs.data.order.TransportOrder)` instead.
    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
    Deprecated.
    Use `setTransportOrder(org.opentcs.data.order.TransportOrder)` instead.
    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.
    Use `abortTransportOrder(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.
    Use `abortTransportOrder(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.
    Use `abortTransportOrder(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.
    Use `canProcess(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).

  - ### 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 `MovementCommand`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.