Class MovementCommand

java.lang.Object
org.opentcs.drivers.vehicle.MovementCommand

public class MovementCommand extends Object
A command for moving a step.
  • Field Details

    • NO_OPERATION

      public static final String NO_OPERATION
      A constant indicating there is no operation to be executed after moving.
      See Also:
    • MOVE_OPERATION

      public static final String MOVE_OPERATION
      A constant indicating the vehicle should basically just move to a point without a location associated to it.
      See Also:
    • PARK_OPERATION

      public static final String PARK_OPERATION
      A constant for parking the vehicle. (Again, basically doing nothing at the destination.)
      See Also:
  • Constructor Details

    • MovementCommand

      public MovementCommand(@Nonnull TransportOrder transportOrder, @Nonnull DriveOrder driveOrder, @Nonnull Route.Step step, @Nonnull String operation, @Nullable Location opLocation, boolean finalMovement, @Nullable Location finalDestinationLocation, @Nonnull Point finalDestination, @Nonnull String finalOperation, @Nonnull Map<String,String> properties)
      Creates a new instance.
      Parameters:
      transportOrder - The transport order this movement belongs to.
      driveOrder - The drive order this movement belongs to.
      step - The step describing the movement.
      operation - The operation to be executed after moving.
      opLocation - The location at which the operation is to be executed. May be null if the movement command's operation is considred an empty operation (i.e. is NO_OPERATION, MOVE_OPERATION or PARK_OPERATION).
      finalMovement - Indicates whether this movement is the final one in the drive order it belongs to.
      finalDestinationLocation - The destination location of the whole drive order.
      finalDestination - The destination position of the whole drive order.
      finalOperation - The operation to be executed at the destination position.
      properties - Properties of the order this command is part of.
  • Method Details

    • getTransportOrder

      @Nonnull public TransportOrder getTransportOrder()
      Returns the transport order this movement belongs to.
      Returns:
      The transport order this movement belongs to.
    • withTransportOrder

      public MovementCommand withTransportOrder(@Nonnull TransportOrder transportOrder)
      Creates a copy of this object, with the given transport order.
      Parameters:
      transportOrder - The value to be set in the copy.
      Returns:
      A copy of this object, differing in the given value.
    • getDriveOrder

      @Nonnull public DriveOrder getDriveOrder()
      Returns the drive order this movement belongs to.
      Returns:
      The drive order this movement belongs to.
    • withDriveOrder

      public MovementCommand withDriveOrder(@Nonnull DriveOrder driveOrder)
      Creates a copy of this object, with the given drive order.
      Parameters:
      driveOrder - The value to be set in the copy.
      Returns:
      A copy of this object, differing in the given value.
    • getStep

      @Nonnull public Route.Step getStep()
      Returns the step describing the movement.
      Returns:
      The step describing the movement.
    • withStep

      public MovementCommand withStep(@Nonnull Route.Step step)
      Creates a copy of this object, with the given step.
      Parameters:
      step - The value to be set in the copy.
      Returns:
      A copy of this object, differing in the given value.
    • getOperation

      @Nonnull public String getOperation()
      Returns the operation to be executed after moving.
      Returns:
      The operation to be executed after moving.
    • withOperation

      public MovementCommand withOperation(@Nonnull String operation)
      Creates a copy of this object, with the given operation.
      Parameters:
      operation - The value to be set in the copy.
      Returns:
      A copy of this object, differing in the given value.
    • hasEmptyOperation

      public boolean hasEmptyOperation()
      Indicates whether an operation is to be executed in addition to moving or not.
      Returns:
      true if, and only if, no operation is to be executed.
    • getOpLocation

      @Nullable public Location getOpLocation()
      Returns the location at which the operation is to be executed.

      May be null if the movement command's operation is considred an empty operation (i.e. is NO_OPERATION, MOVE_OPERATION or PARK_OPERATION).

      Returns:
      The location at which the operation is to be executed.
    • withOpLocation

      public MovementCommand withOpLocation(@Nullable Location opLocation)
      Creates a copy of this object, with the given location at which the operation is to be executed.

      May be null if the movement command's operation is considred an empty operation (i.e. is NO_OPERATION, MOVE_OPERATION or PARK_OPERATION).

      Parameters:
      opLocation - The value to be set in the copy.
      Returns:
      A copy of this object, differing in the given value.
    • isFinalMovement

      public boolean isFinalMovement()
      Indicates whether this movement is the final one in the driver order it belongs to.
      Returns:
      true if, and only if, this movement is the final one.
    • withFinalMovement

      public MovementCommand withFinalMovement(boolean finalMovement)
      Creates a copy of this object, with the given final movement flag.
      Parameters:
      finalMovement - The value to be set in the copy.
      Returns:
      A copy of this object, differing in the given value.
    • getFinalDestination

      @Nonnull public Point getFinalDestination()
      Returns the final destination of the drive order this MovementCommand was created for.
      Returns:
      The final destination of the drive order this MovementCommand was created for.
    • withFinalDestination

      public MovementCommand withFinalDestination(@Nonnull Point finalDestination)
      Creates a copy of this object, with the given final destination.
      Parameters:
      finalDestination - The value to be set in the copy.
      Returns:
      A copy of this object, differing in the given value.
    • getFinalDestinationLocation

      @Nullable public Location getFinalDestinationLocation()
      Returns the destination location of the whole drive order.
      Returns:
      The destination location of the whole drive order.
    • withFinalDestinationLocation

      public MovementCommand withFinalDestinationLocation(@Nullable Location finalDestinationLocation)
      Creates a copy of this object, with the given final destination location.
      Parameters:
      finalDestinationLocation - The value to be set in the copy.
      Returns:
      A copy of this object, differing in the given value.
    • getFinalOperation

      @Nonnull public String getFinalOperation()
      Returns the operation to be executed at the final destination position.
      Returns:
      The operation to be executed at the final destination position.
    • withFinalOperation

      public MovementCommand withFinalOperation(@Nonnull String finalOperation)
      Creates a copy of this object, with the given final operation.
      Parameters:
      finalOperation - The value to be set in the copy.
      Returns:
      A copy of this object, differing in the given value.
    • getProperties

      @Nonnull public Map<String,String> getProperties()
      Returns the properties of the order this command is part of.
      Returns:
      The properties of the order this command is part of.
    • withProperties

      public MovementCommand withProperties(@Nonnull Map<String,String> properties)
      Creates a copy of this object, with the given properties.
      Parameters:
      properties - The value to be set in the copy.
      Returns:
      A copy of this object, differing in the given value.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • equalsInMovement

      public boolean equalsInMovement(MovementCommand command)
      Compares the given movement command to this movement command, ignoring rerouting-related properties.
      Parameters:
      command - The movement command to compare to.
      Returns:
      true, if the given movement command is equal to this movement command (ignoring rerouting-related properties), otherwise false.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object