1 package org.opentrafficsim.core.gtu; 2 3 import java.io.Serializable; 4 import java.util.Map; 5 6 import javax.media.j3d.Bounds; 7 8 import nl.tudelft.simulation.dsol.animation.LocatableInterface; 9 import nl.tudelft.simulation.language.d3.DirectedPoint; 10 11 import org.djunits.value.vdouble.scalar.Acceleration; 12 import org.djunits.value.vdouble.scalar.Length; 13 import org.djunits.value.vdouble.scalar.Speed; 14 import org.djunits.value.vdouble.scalar.Time; 15 import org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface; 16 import org.opentrafficsim.core.gtu.perception.Perception; 17 import org.opentrafficsim.core.gtu.plan.operational.OperationalPlan; 18 import org.opentrafficsim.core.gtu.plan.strategical.StrategicalPlanner; 19 import org.opentrafficsim.core.gtu.plan.tactical.TacticalPlanner; 20 21 /** 22 * Generalized Travel Unit. <br> 23 * A GTU is an object (person, car, ship) that can travel over the infrastructure. It has a (directed) location, dimensions, and 24 * some properties that all GTUs share. The GTU is not bound to any infrastructure and can travel freely in the world. <br> 25 * For its movement, a GTU uses an OperationalPlan, which indicates a shape in the world with a speed profile that the GTU will 26 * use to move. The OperationalPlan can be updated or replaced, for which a tactical planner is responsible. A tactical plan can 27 * 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 28 * operational plans are then the implementation of segments of the movement (time, location, speed, acceleration) that the car 29 * will make to drive on the road and (safely) make the lane changes. On the highest level, a StrategicPlan puts boundary 30 * conditions on the tactical plans. The strategic plan contains for instance the destination we want to reach and possibly some 31 * constraints on solutions that the tactical plans have to comply with. 32 * <p> 33 * Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 34 * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>. 35 * <p> 36 * @version $Revision: 1889 $, $LastChangedDate: 2016-04-05 21:30:47 +0200 (Tue, 05 Apr 2016) $, by $Author: pknoppers $, 37 * initial version May 15, 2014 <br> 38 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a> 39 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a> 40 */ 41 public interface GTU extends LocatableInterface, Serializable 42 { 43 /** @return the id of the GTU */ 44 String getId(); 45 46 /** @return the maximum length of the GTU (parallel with driving direction). */ 47 Length.Rel getLength(); 48 49 /** @return the maximum width of the GTU (perpendicular to driving direction). */ 50 Length.Rel getWidth(); 51 52 /** @return the maximum velocity of the GTU, in the linear direction. */ 53 Speed getMaximumVelocity(); 54 55 /** @return the maximum acceleration of the GTU, in the linear direction. */ 56 Acceleration getMaximumAcceleration(); 57 58 /** @return the maximum deceleration of the GTU, in the linear direction, stored as a negative number. */ 59 Acceleration getMaximumDeceleration(); 60 61 /** @return the type of GTU, e.g. TruckType, CarType, BusType. */ 62 GTUType getGTUType(); 63 64 /** @return the simulator of the GTU. */ 65 OTSDEVSSimulatorInterface getSimulator(); 66 67 /** @return the reference position of the GTU, by definition (0, 0, 0). */ 68 RelativePosition getReference(); 69 70 /** @return the front position of the GTU, relative to its reference point. */ 71 RelativePosition getFront(); 72 73 /** @return the rear position of the GTU, relative to its reference point. */ 74 RelativePosition getRear(); 75 76 /** 77 * @param time the time for which the velocity needs to be calculated. 78 * @return the acceleration of the GTU at the given time, combining longitudinal, lateral and vertical acceleration 79 * components. 80 * @throws GTUException when the time is outside the current operational plan's interval 81 */ 82 Speed getVelocity(final Time.Abs time) throws GTUException; 83 84 /** 85 * @return the current velocity of the GTU, combining longitudinal, lateral and vertical speed components. 86 */ 87 Speed getVelocity(); 88 89 /** @return the positions for this GTU. */ 90 Map<RelativePosition.TYPE, RelativePosition> getRelativePositions(); 91 92 /** Destroy the GTU from the simulation and animation. */ 93 void destroy(); 94 95 /** 96 * @param time the time for which the acceleration needs to be calculated. 97 * @return the acceleration of the GTU at the given time, combining longitudinal, lateral and vertical acceleration 98 * components. 99 * @throws GTUException when the time is outside the current operational plan's interval 100 */ 101 Acceleration getAcceleration(final Time.Abs time) throws GTUException; 102 103 /** 104 * @return the current acceleration of the GTU, combining longitudinal, lateral and vertical acceleration components. 105 */ 106 Acceleration getAcceleration(); 107 108 /** @return Length.Rel; the current odometer value. */ 109 Length.Rel getOdometer(); 110 111 /** 112 * @return strategicalPlanner the planner responsible for the overall 'mission' of the GTU, usually indicating where it 113 * needs to go. It operates by instantiating tactical planners to do the work. 114 */ 115 StrategicalPlanner getStrategicalPlanner(); 116 117 /** @return tacticalPlanner the tactical planner that can generate an operational plan */ 118 TacticalPlanner getTacticalPlanner(); 119 120 /** @return the operational plan for the GTU. */ 121 OperationalPlan getOperationalPlan(); 122 123 /** @return the perception module of this GTU */ 124 Perception getPerception(); 125 126 /** @return the driving characteristics of this GTU (driver). */ 127 DrivingCharacteristics getBehavioralCharacteristics(); 128 129 /** @return the status of the turn indicator. */ 130 TurnIndicatorStatus getTurnIndicatorStatus(); 131 132 /** 133 * Set the status of the turn indicator. 134 * @param turnIndicatorStatus the new status of the turn indicator. 135 * @throws GTUException when GTUType does not have a turn indicator 136 */ 137 void setTurnIndicatorStatus(TurnIndicatorStatus turnIndicatorStatus) throws GTUException; 138 139 /** {@inheritDoc} */ 140 @Override 141 DirectedPoint getLocation(); 142 143 /** {@inheritDoc} */ 144 @Override 145 Bounds getBounds(); 146 147 }