Package org.opentrafficsim.core.gtu
Interface Gtu
-
- All Superinterfaces:
Drawable,EventProducerInterface,Identifiable,Locatable,Serializable
- All Known Subinterfaces:
InternalGtu
- All Known Implementing Classes:
AbstractGtu
public interface Gtu extends Locatable, Serializable, EventProducerInterface, Identifiable, Drawable
Generalized Travel Unit.
A GTU is an object (person, car, ship) that can travel over the infrastructure. It has a (directed) location, dimensions, and some properties that all GTUs share. The GTU is not bound to any infrastructure and can travel freely in the world.
For its movement, a GTU uses an OperationalPlan, which indicates a shape in the world with a speed profile that the GTU will use to move. The OperationalPlan can be updated or replaced, for which a tactical planner is responsible. A tactical plan can for instance be for a car to change two lanes to the left during the next 200 m to be able to make a left turn in 200 m. The operational plans are then the implementation of segments of the movement (time, location, speed, acceleration) that the car will make to drive on the road and (safely) make the lane changes. On the highest level, a StrategicPlan puts boundary conditions on the tactical plans. The strategic plan contains for instance the destination we want to reach and possibly some constraints on solutions that the tactical plans have to comply with.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision: 6464 $, $LastChangedDate: 2020-05-08 11:08:12 +0200 (Fri, 08 May 2020) $, by $Author: pknoppers $,
initial version May 15, 2014
- Author:
- Alexander Verbraeck, Peter Knoppers
-
-
Field Summary
Fields Modifier and Type Field Description static TimedEventTypeDESTROY_EVENTThe event type for pub/sub indicating destruction of the GTU.static TimedEventTypeINIT_EVENTThe event type for pub/sub indicating the initialization of a new GTU.static TimedEventTypeMOVE_EVENTThe event type for pub/sub indicating a move.-
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddGtu(Gtu gtu)Adds the provided GTU to this GTU, meaning it moves with this GTU.voiddestroy()Destroy the GTU from the simulation and animation.AccelerationgetAcceleration()Retrieve the current acceleration of this GTU, along the direction of movement.Bounds3dgetBounds()RelativePositiongetCenter()Set<Gtu>getChildren()Retrieve the children GTUs of this GTU.ImmutableSet<RelativePosition>getContourPoints()RelativePositiongetFront()GtuTypegetGTUType()TODO: expand hierarchy to include length, width, maxSpeed, maxAcceleration, maxDeceleration, referencePoints?StringgetId()LengthgetLength()OrientedPoint3dgetLocation()AccelerationgetMaximumAcceleration()AccelerationgetMaximumDeceleration()SpeedgetMaximumSpeed()GtugetParent()Retrieve the parent GTU, ornullif this GTU has no parent.PerceivableContextgetPerceivableContext()RelativePositiongetRear()RelativePositiongetReference()ImmutableMap<RelativePosition.TYPE,RelativePosition>getRelativePositions()OTSSimulatorInterfacegetSimulator()SpeedgetSpeed()Retrieve the current speed of the GTU, along the direction of movement.LengthgetWidth()booleanisDestroyed()Returns whether the GTU is destroyed.voidremoveGtu(Gtu gtu)Removes the provided GTU from this GTU, meaning it no longer moves with this GTU.voidsetParent(Gtu gtu)Set the parent GTU.-
Methods inherited from interface org.djutils.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypesWithListeners, getSourceId, hasListeners, numberOfListeners, removeListener
-
-
-
-
Field Detail
-
INIT_EVENT
static final TimedEventType INIT_EVENT
The event type for pub/sub indicating the initialization of a new GTU.
Payload: [String id, PositionVector initialPosition, Direction initialDirection, Length length, Length width]
-
MOVE_EVENT
static final TimedEventType MOVE_EVENT
The event type for pub/sub indicating a move.
Payload: [String id, OrientedPoint3d position, Speed speed, Acceleration acceleration, Length odometer]
-
DESTROY_EVENT
static final TimedEventType DESTROY_EVENT
The event type for pub/sub indicating destruction of the GTU.
Payload: [String id, OrientedPoint3d lastPosition, Length odometer]
-
-
Method Detail
-
getId
String getId()
- Specified by:
getIdin interfaceIdentifiable- Returns:
- the id of the GTU
-
getPerceivableContext
PerceivableContext getPerceivableContext()
- Returns:
- the context to which the GTU belongs
-
getLength
Length getLength()
- Returns:
- the maximum length of the GTU (parallel with driving direction).
-
getWidth
Length getWidth()
- Returns:
- the maximum width of the GTU (perpendicular to driving direction).
-
getMaximumSpeed
Speed getMaximumSpeed()
- Returns:
- the maximum speed of the GTU, in the direction of movement.
-
getMaximumAcceleration
Acceleration getMaximumAcceleration()
- Returns:
- the maximum acceleration of the GTU, in the linear direction.
-
getMaximumDeceleration
Acceleration getMaximumDeceleration()
- Returns:
- the maximum deceleration of the GTU, in the linear direction, stored as a negative number.
-
getGTUType
GtuType getGTUType()
TODO: expand hierarchy to include length, width, maxSpeed, maxAcceleration, maxDeceleration, referencePoints?- Returns:
- the type of GTU, e.g. TruckType, CarType, BusType.
-
getSimulator
OTSSimulatorInterface getSimulator()
- Returns:
- the simulator of the GTU.
-
getReference
RelativePosition getReference()
- Returns:
- the reference position of the GTU, by definition (0, 0, 0).
-
getFront
RelativePosition getFront()
- Returns:
- the front position of the GTU, relative to its reference point.
-
getRear
RelativePosition getRear()
- Returns:
- the rear position of the GTU, relative to its reference point.
-
getCenter
RelativePosition getCenter()
- Returns:
- the center position of the GTU, relative to its reference point.
-
getContourPoints
ImmutableSet<RelativePosition> getContourPoints()
- Returns:
- the contour points of the GTU.
-
getRelativePositions
ImmutableMap<RelativePosition.TYPE,RelativePosition> getRelativePositions()
- Returns:
- the positions for this GTU, but not the contour points.
-
getSpeed
Speed getSpeed()
Retrieve the current speed of the GTU, along the direction of movement.- Returns:
- Speed; the current speed of the GTU, along the direction of movement
-
getAcceleration
Acceleration getAcceleration()
Retrieve the current acceleration of this GTU, along the direction of movement.- Returns:
- Acceleration; the current acceleration of the GTU, along the direction of movement
-
destroy
void destroy()
Destroy the GTU from the simulation and animation.
-
isDestroyed
boolean isDestroyed()
Returns whether the GTU is destroyed.- Returns:
- boolean; true if this GTU is destroyed; false if this GTU is not (yet) destroyed
-
addGtu
void addGtu(Gtu gtu) throws GtuException
Adds the provided GTU to this GTU, meaning it moves with this GTU.- Parameters:
gtu- GTU; gtu to enter/board this GTU- Throws:
GtuException- if the gtu already has a parent
-
removeGtu
void removeGtu(Gtu gtu)
Removes the provided GTU from this GTU, meaning it no longer moves with this GTU. TODO should throw some exception if the provided GTU is not aboard this GTU.- Parameters:
gtu- GTU; gtu to exit/alight from this GTU
-
setParent
void setParent(Gtu gtu) throws GtuException
Set the parent GTU.- Parameters:
gtu- GTU; parent GTU, may benull- Throws:
GtuException- if this GTU already has a parent
-
getParent
Gtu getParent()
Retrieve the parent GTU, ornullif this GTU has no parent.- Returns:
- GTU; the parent of this GTU, or
nullif this GTU has no parent
-
getChildren
Set<Gtu> getChildren()
Retrieve the children GTUs of this GTU.- Returns:
- Set<GTU>; children GTUs
-
getLocation
OrientedPoint3d getLocation()
- Specified by:
getLocationin interfaceLocatable
-
-