Class VehicleProcessModel

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

public class VehicleProcessModel
extends java.lang.Object
An observable model of a vehicle's and its comm adapter's attributes.
  • Constructor Details

    • VehicleProcessModel

      public VehicleProcessModel​(@Nonnull Vehicle attachedVehicle)
      Creates a new instance.
      Parameters:
      attachedVehicle - The vehicle attached to the new instance.
  • Method Details

    • addPropertyChangeListener

      public void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)
      Registers a new property change listener with this model.
      Parameters:
      listener - The listener to be registered.
    • removePropertyChangeListener

      public void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
      Unregisters a property change listener from this model.
      Parameters:
      listener - The listener to be unregistered.
    • getVehicleReference

      @Nonnull public TCSObjectReference<Vehicle> getVehicleReference()
      Returns a reference to the vehicle.
      Returns:
      A reference to the vehicle.
    • getName

      @Nonnull public java.lang.String getName()
      Returns the vehicle's name.
      Returns:
      The vehicle's name.
    • getNotifications

      @Nonnull public java.util.Queue<UserNotification> getNotifications()
      Returns user notifications published by the comm adapter.
      Returns:
      The notifications.
    • publishUserNotification

      public void publishUserNotification​(@Nonnull UserNotification notification)
      Publishes an user notification.
      Parameters:
      notification - The notification to be published.
    • publishEvent

      public void publishEvent​(@Nonnull VehicleCommAdapterEvent event)
      Publishes an event via the kernel's event mechanism.
      Parameters:
      event - The event to be published.
    • isCommAdapterEnabled

      public boolean isCommAdapterEnabled()
      Indicates whether the comm adapter is currently enabled or not.
      Returns:
      true if, and only if, the comm adapter is currently enabled.
    • setCommAdapterEnabled

      public void setCommAdapterEnabled​(boolean commAdapterEnabled)
      Sets the comm adapter's enabled flag.
      Parameters:
      commAdapterEnabled - The new value.
    • isCommAdapterConnected

      public boolean isCommAdapterConnected()
      Indicates whether the comm adapter is currently connected or not.
      Returns:
      true if, and only if, the comm adapter is currently connected.
    • setCommAdapterConnected

      public void setCommAdapterConnected​(boolean commAdapterConnected)
      Sets the comm adapter's connected flag.
      Parameters:
      commAdapterConnected - The new value.
    • getVehiclePosition

      @Nullable public java.lang.String getVehiclePosition()
      Returns the vehicle's current position.
      Returns:
      The position.
    • setVehiclePosition

      public void setVehiclePosition​(@Nullable java.lang.String position)
      Updates the vehicle's current position.
      Parameters:
      position - The new position
    • getVehiclePrecisePosition

      @Nullable public Triple getVehiclePrecisePosition()
      Returns the vehicle's precise position.
      Returns:
      The vehicle's precise position.
    • setVehiclePrecisePosition

      public void setVehiclePrecisePosition​(@Nullable Triple position)
      Sets the vehicle's precise position.
      Parameters:
      position - The new position.
    • getVehicleOrientationAngle

      public double getVehicleOrientationAngle()
      Returns the vehicle's current orientation angle.
      Returns:
      The vehicle's current orientation angle.
      See Also:
      Vehicle.getOrientationAngle()
    • setVehicleOrientationAngle

      public void setVehicleOrientationAngle​(double angle)
      Sets the vehicle's current orientation angle.
      Parameters:
      angle - The new angle
    • getVehicleEnergyLevel

      public int getVehicleEnergyLevel()
      Returns the vehicle's current energy level.
      Returns:
      The vehicle's current energy level.
    • setVehicleEnergyLevel

      public void setVehicleEnergyLevel​(int newLevel)
      Sets the vehicle's current energy level.
      Parameters:
      newLevel - The new level.
    • getVehicleLoadHandlingDevices

      @Nonnull public java.util.List<LoadHandlingDevice> getVehicleLoadHandlingDevices()
      Returns the vehicle's load handling devices.
      Returns:
      The vehicle's load handling devices.
    • setVehicleLoadHandlingDevices

      public void setVehicleLoadHandlingDevices​(@Nonnull java.util.List<LoadHandlingDevice> devices)
      Sets the vehicle's load handling devices.
      Parameters:
      devices - The new devices
    • setVehicleProperty

      public void setVehicleProperty​(@Nonnull java.lang.String key, @Nullable java.lang.String value)
      Sets a property of the vehicle.
      Parameters:
      key - The property's key.
      value - The property's new value.
    • getVehicleState

      @Nonnull public Vehicle.State getVehicleState()
      Returns the vehicle's current state.
      Returns:
      The state
    • setVehicleState

      public void setVehicleState​(@Nonnull Vehicle.State newState)
      Sets the vehicle's current state.
      Parameters:
      newState - The new state
    • setTransportOrderProperty

      public void setTransportOrderProperty​(@Nonnull java.lang.String key, @Nullable java.lang.String value)
      Sets a property of the transport order the vehicle is currently processing.
      Parameters:
      key - The property's key.
      value - The property's new value.
    • commandEnqueued

      public void commandEnqueued​(@Nonnull MovementCommand enqueuedCommand)
      Notifies observers that the given command has been added to the comm adapter's command queue.
      Parameters:
      enqueuedCommand - The command that has been added to the queue.
    • commandSent

      public void commandSent​(@Nonnull MovementCommand sentCommand)
      Notifies observers that the given command has been sent to the associated vehicle.
      Parameters:
      sentCommand - The command that has been sent to the vehicle.
    • commandExecuted

      public void commandExecuted​(@Nonnull MovementCommand executedCommand)
      Notifies observers that the given command has been executed by the comm adapter/vehicle.
      Parameters:
      executedCommand - The command that has been executed.
    • commandFailed

      public void commandFailed​(@Nonnull MovementCommand failedCommand)
      Notifies observers that the given command could not be executed by the comm adapter/vehicle.
      Parameters:
      failedCommand - The command that could not be executed.
    • getPropertyChangeSupport

      protected java.beans.PropertyChangeSupport getPropertyChangeSupport()