Package org.opentcs.drivers.vehicle
Class VehicleProcessModel
java.lang.Object
org.opentcs.drivers.vehicle.VehicleProcessModel
An observable model of a vehicle's and its comm adapter's attributes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumNotification arguments to indicate some change.static classA notification object sent to observers to indicate a change of a property.static classA notification object sent to observers to indicate a change of a transport order's property.static classA notification object sent to observers to indicate a change of a vehicle's property. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters 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.Returns the vehicle's current bounding box.intReturns the vehicle's current energy level.intDeprecated.Returns the vehicle's load handling devices.getName()Returns the vehicle's name.Returns user notifications published by the comm adapter.doubleDeprecated.UsegetPose()instead.getPose()Returns the vehicle's pose.Returns the vehicle's current position.Deprecated.UsegetPose()instead.protected PropertyChangeSupportReturns a reference to the vehicle.getState()Returns the vehicle's current state.voidNotifies observers that the vehicle would like to have its integration level changed.booleanIndicates whether the comm adapter is currently connected or not.booleanIndicates whether the comm adapter is currently enabled or not.voidPublishes an event via the kernel's event mechanism.voidpublishUserNotification(UserNotification notification) Publishes an user notification.voidUnregisters a property change listener from this model.voidsetBoundingBox(BoundingBox boundingBox) Sets the vehicle's current bounding box.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) Deprecated.UsesetBoundingBox(BoundingBox)instead.voidsetLoadHandlingDevices(List<LoadHandlingDevice> devices) Sets the vehicle's load handling devices.voidsetOrientationAngle(double angle) Deprecated.UsesetPose(Pose)instead.voidSets the vehicle's pose.voidsetPosition(String position) Updates the vehicle's current position.voidsetPrecisePosition(Triple position) Deprecated.UsesetPose(Pose)} instead.voidsetProperty(String key, String value) Sets a property of the vehicle.voidsetState(Vehicle.State newState) Sets the vehicle's current state.voidsetTransportOrderProperty(String key, String value) Sets a property of the transport order the vehicle is currently processing.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
Registers a new property change listener with this model.- Parameters:
listener- The listener to be registered.
-
removePropertyChangeListener
Unregisters a property change listener from this model.- Parameters:
listener- The listener to be unregistered.
-
getReference
Returns a reference to the vehicle.- Returns:
- A reference to the vehicle.
-
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.
-
getPosition
Returns the vehicle's current position.- Returns:
- The position.
-
setPosition
Updates the vehicle's current position.- Parameters:
position- The new position
-
getPrecisePosition
@Deprecated @ScheduledApiChange(when="7.0", details="Will be removed.") @Nullable public Triple getPrecisePosition()Deprecated.UsegetPose()instead.Returns the vehicle's precise position.- Returns:
- The vehicle's precise position.
-
setPrecisePosition
@Deprecated @ScheduledApiChange(when="7.0", details="Will be removed.") public void setPrecisePosition(@Nullable Triple position) Deprecated.UsesetPose(Pose)} instead.Sets the vehicle's precise position.- Parameters:
position- The new position.
-
getOrientationAngle
@Deprecated @ScheduledApiChange(when="7.0", details="Will be removed.") public double getOrientationAngle()Deprecated.UsegetPose()instead.Returns the vehicle's current orientation angle.- Returns:
- The vehicle's current orientation angle.
- See Also:
-
setOrientationAngle
@Deprecated @ScheduledApiChange(when="7.0", details="Will be removed.") public void setOrientationAngle(double angle) Deprecated.UsesetPose(Pose)instead.Sets the vehicle's current orientation angle.- Parameters:
angle- The new angle
-
getPose
Returns the vehicle's pose.- Returns:
- The vehicle's pose.
-
setPose
Sets the vehicle's pose.- Parameters:
pose- The new pose
-
getEnergyLevel
public int getEnergyLevel()Returns the vehicle's current energy level.- Returns:
- The vehicle's current energy level.
-
setEnergyLevel
public void setEnergyLevel(int newLevel) Sets the vehicle's current energy level.- Parameters:
newLevel- The new level.
-
getLoadHandlingDevices
Returns the vehicle's load handling devices.- Returns:
- The vehicle's load handling devices.
-
setLoadHandlingDevices
Sets the vehicle's load handling devices.- Parameters:
devices- The new devices
-
setProperty
Sets a property of the vehicle.- Parameters:
key- The property's key.value- The property's new value.
-
getState
Returns the vehicle's current state.- Returns:
- The state
-
setState
Sets the vehicle's current state.- Parameters:
newState- The new state
-
getLength
Deprecated.UsegetBoundingBox()instead.Returns the vehicle's current length.- Returns:
- The vehicle's current length.
-
setLength
@Deprecated @ScheduledApiChange(when="7.0", details="Will be removed.") public void setLength(int length) Deprecated.UsesetBoundingBox(BoundingBox)instead.Sets the vehicle's current length.- Parameters:
length- The new length.
-
getBoundingBox
Returns the vehicle's current bounding box.- Returns:
- The vehicle's current bounding box.
-
setBoundingBox
Sets the vehicle's current bounding box.- Parameters:
boundingBox- The new bounding box.
-
setTransportOrderProperty
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
-
getBoundingBox()instead.