Package org.opentcs.drivers.vehicle
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.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVehicleProcessModel.AttributeNotification arguments to indicate some change.static classVehicleProcessModel.PropertyUpdateA notification object sent to observers to indicate a change of a property.static classVehicleProcessModel.TransportOrderPropertyUpdateA notification object sent to observers to indicate a change of a transport order's property.static classVehicleProcessModel.VehiclePropertyUpdateA notification object sent to observers to indicate a change of a vehicle's property. -
Constructor Summary
Constructors Constructor Description VehicleProcessModel(Vehicle attachedVehicle)Creates a new instance. -
Method Summary
Modifier and Type Method Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Registers a new property change listener with this model.voidcommandEnqueued(MovementCommand enqueuedCommand)Notifies observers that the given command has been added to the comm adapter's command queue.voidcommandExecuted(MovementCommand executedCommand)Notifies observers that the given command has been executed by the comm adapter/vehicle.voidcommandFailed(MovementCommand failedCommand)Notifies observers that the given command could not be executed by the comm adapter/vehicle.voidcommandSent(MovementCommand sentCommand)Notifies observers that the given command has been sent to the associated vehicle.intgetEnergyLevel()Returns the vehicle's current energy level.intgetLength()Returns the vehicle's current length.java.util.List<LoadHandlingDevice>getLoadHandlingDevices()Returns the vehicle's load handling devices.java.lang.StringgetName()Returns the vehicle's name.java.util.Queue<UserNotification>getNotifications()Returns user notifications published by the comm adapter.doublegetOrientationAngle()Returns the vehicle's current orientation angle.java.lang.StringgetPosition()Returns the vehicle's current position.TriplegetPrecisePosition()Returns the vehicle's precise position.protected java.beans.PropertyChangeSupportgetPropertyChangeSupport()TCSObjectReference<Vehicle>getReference()Returns a reference to the vehicle.Vehicle.StategetState()Returns the vehicle's current state.intgetVehicleEnergyLevel()Deprecated.UsegetEnergyLevel()instead.intgetVehicleLength()Deprecated.UsegetLength()instead.java.util.List<LoadHandlingDevice>getVehicleLoadHandlingDevices()Deprecated.UsegetLoadHandlingDevices()instead.doublegetVehicleOrientationAngle()Deprecated.UsegetOrientationAngle()instead.java.lang.StringgetVehiclePosition()Deprecated.UsegetPosition()instead.TriplegetVehiclePrecisePosition()Deprecated.UsegetPrecisePosition()instead.TCSObjectReference<Vehicle>getVehicleReference()Deprecated.UsegetReference()instead.Vehicle.StategetVehicleState()Deprecated.UsegetState()instead.voidintegrationLevelChangeRequested(Vehicle.IntegrationLevel level)Notifies observers that the vehicle would like to have its integration level changed.booleanisCommAdapterConnected()Indicates whether the comm adapter is currently connected or not.booleanisCommAdapterEnabled()Indicates whether the comm adapter is currently enabled or not.voidpublishEvent(VehicleCommAdapterEvent event)Publishes an event via the kernel's event mechanism.voidpublishUserNotification(UserNotification notification)Publishes an user notification.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Unregisters a property change listener from this model.voidsetCommAdapterConnected(boolean commAdapterConnected)Sets the comm adapter's connected flag.voidsetCommAdapterEnabled(boolean commAdapterEnabled)Sets the comm adapter's enabled flag.voidsetEnergyLevel(int newLevel)Sets the vehicle's current energy level.voidsetLength(int length)Sets the vehicle's current length.voidsetLoadHandlingDevices(java.util.List<LoadHandlingDevice> devices)Sets the vehicle's load handling devices.voidsetOrientationAngle(double angle)Sets the vehicle's current orientation angle.voidsetPosition(java.lang.String position)Updates the vehicle's current position.voidsetPrecisePosition(Triple position)Sets the vehicle's precise position.voidsetProperty(java.lang.String key, java.lang.String value)Sets a property of the vehicle.voidsetState(Vehicle.State newState)Sets the vehicle's current state.voidsetTransportOrderProperty(java.lang.String key, java.lang.String value)Sets a property of the transport order the vehicle is currently processing.voidsetVehicleEnergyLevel(int newLevel)Deprecated.UsesetEnergyLevel(int)instead.voidsetVehicleLength(int length)Deprecated.UsesetLength(int)instead.voidsetVehicleLoadHandlingDevices(java.util.List<LoadHandlingDevice> devices)Deprecated.UsesetLoadHandlingDevices(java.util.List)instead.voidsetVehicleOrientationAngle(double angle)Deprecated.UsesetOrientationAngle(double)instead.voidsetVehiclePosition(java.lang.String position)Deprecated.UsesetPosition(java.lang.String)instead.voidsetVehiclePrecisePosition(Triple position)Deprecated.UsesetPrecisePosition(org.opentcs.data.model.Triple)instead.voidsetVehicleProperty(java.lang.String key, java.lang.String value)Deprecated.UsesetProperty(java.lang.String, java.lang.String)instead.voidsetVehicleState(Vehicle.State newState)Deprecated.UsesetState(org.opentcs.data.model.Vehicle.State)instead.voidtransportOrderWithdrawalRequested(boolean forced)Notifies observers that the vehicle would like to have its current transport order withdrawn.
-
Constructor Details
-
VehicleProcessModel
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
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") @Nonnull public TCSObjectReference<Vehicle> getVehicleReference()Deprecated.UsegetReference()instead.Returns a reference to the vehicle.- Returns:
- A reference to the vehicle.
-
getReference
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
Returns user notifications published by the comm adapter.- Returns:
- The notifications.
-
publishUserNotification
Publishes an user notification.- Parameters:
notification- The notification to be published.
-
publishEvent
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:
trueif, 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:
trueif, 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
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") @Nullable public java.lang.String getVehiclePosition()Deprecated.UsegetPosition()instead.Returns the vehicle's current position.- Returns:
- The position.
-
getPosition
@Nullable public java.lang.String getPosition()Returns the vehicle's current position.- Returns:
- The position.
-
setVehiclePosition
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") public void setVehiclePosition(@Nullable java.lang.String position)Deprecated.UsesetPosition(java.lang.String)instead.Updates the vehicle's current position.- Parameters:
position- The new position
-
setPosition
public void setPosition(@Nullable java.lang.String position)Updates the vehicle's current position.- Parameters:
position- The new position
-
getVehiclePrecisePosition
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") @Nullable public Triple getVehiclePrecisePosition()Deprecated.UsegetPrecisePosition()instead.Returns the vehicle's precise position.- Returns:
- The vehicle's precise position.
-
getPrecisePosition
Returns the vehicle's precise position.- Returns:
- The vehicle's precise position.
-
setVehiclePrecisePosition
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") public void setVehiclePrecisePosition(@Nullable Triple position)Deprecated.UsesetPrecisePosition(org.opentcs.data.model.Triple)instead.Sets the vehicle's precise position.- Parameters:
position- The new position.
-
setPrecisePosition
Sets the vehicle's precise position.- Parameters:
position- The new position.
-
getVehicleOrientationAngle
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") public double getVehicleOrientationAngle()Deprecated.UsegetOrientationAngle()instead.Returns the vehicle's current orientation angle.- Returns:
- The vehicle's current orientation angle.
- See Also:
Vehicle.getOrientationAngle()
-
getOrientationAngle
public double getOrientationAngle()Returns the vehicle's current orientation angle.- Returns:
- The vehicle's current orientation angle.
- See Also:
Vehicle.getOrientationAngle()
-
setVehicleOrientationAngle
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") public void setVehicleOrientationAngle(double angle)Deprecated.UsesetOrientationAngle(double)instead.Sets the vehicle's current orientation angle.- Parameters:
angle- The new angle
-
setOrientationAngle
public void setOrientationAngle(double angle)Sets the vehicle's current orientation angle.- Parameters:
angle- The new angle
-
getVehicleEnergyLevel
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") public int getVehicleEnergyLevel()Deprecated.UsegetEnergyLevel()instead.Returns the vehicle's current energy level.- Returns:
- The vehicle's current energy level.
-
getEnergyLevel
public int getEnergyLevel()Returns the vehicle's current energy level.- Returns:
- The vehicle's current energy level.
-
setVehicleEnergyLevel
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") public void setVehicleEnergyLevel(int newLevel)Deprecated.UsesetEnergyLevel(int)instead.Sets the vehicle's current energy level.- Parameters:
newLevel- The new level.
-
setEnergyLevel
public void setEnergyLevel(int newLevel)Sets the vehicle's current energy level.- Parameters:
newLevel- The new level.
-
getVehicleLoadHandlingDevices
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") @Nonnull public java.util.List<LoadHandlingDevice> getVehicleLoadHandlingDevices()Deprecated.UsegetLoadHandlingDevices()instead.Returns the vehicle's load handling devices.- Returns:
- The vehicle's load handling devices.
-
getLoadHandlingDevices
Returns the vehicle's load handling devices.- Returns:
- The vehicle's load handling devices.
-
setVehicleLoadHandlingDevices
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") public void setVehicleLoadHandlingDevices(@Nonnull java.util.List<LoadHandlingDevice> devices)Deprecated.UsesetLoadHandlingDevices(java.util.List)instead.Sets the vehicle's load handling devices.- Parameters:
devices- The new devices
-
setLoadHandlingDevices
Sets the vehicle's load handling devices.- Parameters:
devices- The new devices
-
setVehicleProperty
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") public void setVehicleProperty(@Nonnull java.lang.String key, @Nullable java.lang.String value)Deprecated.UsesetProperty(java.lang.String, java.lang.String)instead.Sets a property of the vehicle.- Parameters:
key- The property's key.value- The property's new value.
-
setProperty
public void setProperty(@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
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") @Nonnull public Vehicle.State getVehicleState()Deprecated.UsegetState()instead.Returns the vehicle's current state.- Returns:
- The state
-
getState
Returns the vehicle's current state.- Returns:
- The state
-
setVehicleState
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") public void setVehicleState(@Nonnull Vehicle.State newState)Deprecated.UsesetState(org.opentcs.data.model.Vehicle.State)instead.Sets the vehicle's current state.- Parameters:
newState- The new state
-
setState
Sets the vehicle's current state.- Parameters:
newState- The new state
-
getVehicleLength
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") public int getVehicleLength()Deprecated.UsegetLength()instead.Returns the vehicle's current length.- Returns:
- The vehicle's current length.
-
getLength
public int getLength()Returns the vehicle's current length.- Returns:
- The vehicle's current length.
-
setVehicleLength
@Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") public void setVehicleLength(int length)Deprecated.UsesetLength(int)instead.Sets the vehicle's current length.- Parameters:
length- The new length.
-
setLength
public void setLength(int length)Sets the vehicle's current length.- Parameters:
length- The new length.
-
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
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
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
Notifies observers that the given command has been executed by the comm adapter/vehicle.- Parameters:
executedCommand- The command that has been executed.
-
commandFailed
Notifies observers that the given command could not be executed by the comm adapter/vehicle.- Parameters:
failedCommand- The command that could not be executed.
-
integrationLevelChangeRequested
Notifies observers that the vehicle would like to have its integration level changed.- Parameters:
level- The integration level to change to.
-
transportOrderWithdrawalRequested
public void transportOrderWithdrawalRequested(boolean forced)Notifies observers that the vehicle would like to have its current transport order withdrawn.- Parameters:
forced- Whether a forced withdrawal is requested.
-
getPropertyChangeSupport
protected java.beans.PropertyChangeSupport getPropertyChangeSupport()
-