Package org.opentrafficsim.core.gtu
Interface GTU
-
- All Superinterfaces:
Drawable
,EventProducerInterface
,Identifiable
,Locatable
,java.io.Serializable
- All Known Subinterfaces:
SpaceBasedGTU
- All Known Implementing Classes:
AbstractGTU
,AbstractLinkBasedGTU
public interface GTU extends Locatable, java.io.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 TimedEventType
DESTROY_EVENT
The event type for pub/sub indicating destruction of the GTU.static TimedEventType
INIT_EVENT
The event type for pub/sub indicating the initialization of a new GTU.static TimedEventType
MOVE_EVENT
The event type for pub/sub indicating a move.-
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
-
-
Method Summary
-
Methods inherited from interface org.djutils.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypesWithListeners, getSourceId, hasListeners, numberOfListeners, removeListener
-
Methods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable
getBounds, getLocation
-
-
-
-
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, DirectedPoint 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, DirectedPoint lastPosition, Length odometer]
-
-
Method Detail
-
getId
java.lang.String getId()
- Specified by:
getId
in 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()
- 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()
- Returns:
- the current speed of the GTU, along the direction of movement.
-
getSpeed
Speed getSpeed(Time time)
- Parameters:
time
- Time; time at which to obtain the speed- Returns:
- the current speed of the GTU, along the direction of movement.
-
getAcceleration
Acceleration getAcceleration()
- Returns:
- the current acceleration of the GTU, along the direction of movement.
-
getAcceleration
Acceleration getAcceleration(Time time)
- Parameters:
time
- Time; time at which to obtain the acceleration- Returns:
- the current acceleration of the GTU, along the direction of movement.
-
getOdometer
Length getOdometer()
- Returns:
- Length; the current odometer value.
-
getOdometer
Length getOdometer(Time time)
- Parameters:
time
- Time; time to obtain the odometer at- Returns:
- Length; the odometer value at given time.
-
getParameters
Parameters getParameters()
- Returns:
- Parameters.
-
setParameters
void setParameters(Parameters parameters)
- Parameters:
parameters
- Parameters; parameters
-
getStrategicalPlanner
StrategicalPlanner getStrategicalPlanner()
- Returns:
- StrategicalPlanner; the planner responsible for the overall 'mission' of the GTU, usually indicating where it needs to go. It operates by instantiating tactical planners to do the work.
-
getStrategicalPlanner
StrategicalPlanner getStrategicalPlanner(Time time)
- Parameters:
time
- Time; time to obtain the strategical planner at- Returns:
- StrategicalPlanner; the planner responsible for the overall 'mission' of the GTU, usually indicating where it needs to go. It operates by instantiating tactical planners to do the work.
-
getTacticalPlanner
default TacticalPlanner<?,?> getTacticalPlanner()
- Returns:
- TacticalPlanner; the current tactical planner that can generate an operational plan
-
getTacticalPlanner
default TacticalPlanner<?,?> getTacticalPlanner(Time time)
- Parameters:
time
- Time; time to obtain the tactical planner at- Returns:
- TacticalPlanner; the tactical planner that can generate an operational plan at the given time
-
getOperationalPlan
OperationalPlan getOperationalPlan()
- Returns:
- the current operational plan for the GTU
-
getOperationalPlan
OperationalPlan getOperationalPlan(Time time)
- Parameters:
time
- Time; time to obtain the operational plan at- Returns:
- the operational plan for the GTU at the given time.
-
destroy
void destroy()
Destroy the GTU from the simulation and animation.
-
isDestroyed
boolean isDestroyed()
Returns whether the GTU is destroyed.- Returns:
- whether the GTU is 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 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.- Parameters:
gtu
- GTU; gtu to exit this GTU
-
setParent
void setParent(GTU gtu) throws GTUException
Set the parent GTU.- Parameters:
gtu
- GTU; parent GTU, may benull
- Throws:
GTUException
- if the gtu already has a parent
-
getParent
GTU getParent()
Returns the parent GTU, ornull
if this GTU has no parent.- Returns:
- GTU; parent GTU, or
null
if this GTU has no parent
-
getChildren
java.util.Set<GTU> getChildren()
Returns the children GTU's.- Returns:
- Set<GTU>; children GTU's
-
setErrorHandler
void setErrorHandler(GTUErrorHandler errorHandler)
Sets the error handler.- Parameters:
errorHandler
- GTUErrorHandler; error handler
-
-