Interface Headway
- All Superinterfaces:
Comparable<Headway>
,org.djutils.base.Identifiable
,PerceivedObject
,Serializable
- All Known Subinterfaces:
HeadwayGtu
,HeadwayLaneBasedObject
- All Known Implementing Classes:
AbstractHeadway
,AbstractHeadwayCopy
,AbstractHeadwayGtu
,AbstractHeadwayLaneBasedObject
,CarFollowingUtil.CarFollowingHeadway
,HeadwayBusStop
,HeadwayConflict
,HeadwayDistance
,HeadwayGtuPerceived
,HeadwayGtuReal
,HeadwayGtuRealCopy
,HeadwayGtuSimple
,HeadwayGtuType
,HeadwayObject
,HeadwayStopLine
,HeadwayTrafficLight
Interface for a reference to information about a (lane based) GTU and a headway. The Headway can store information about GTUs
or objects ahead of the reference GTU, behind the reference GTU, or (partially) parallel to the reference GTU. In addition to
the (perceived) headway, several other pieces of information can be stored, such as (perceived) speed, (perceived)
acceleration, (perceived) turn indicators, and (perceived) braking lights.
Special care must be taken in curves when perceiving headway of a GTU or object on an adjacent lane.The question is whether we perceive the parallel or ahead/behind based on a line perpendicular to the front/back of the GTU (rectangular), or perpendicular to the center line of the lane (wedge-shaped in case of a curve). The difficulty of a wedge-shaped situation is that reciprocity might be violated: in case of a clothoid, for instance, it is not sure that the point on the center line when projected from lane 1 to lane 2 is the same as the projection from lane 2 to lane 1. The same holds for shapes with sharp bends. Therefore, algorithms implementing headway should only project the reference point of the reference GTU on the center line of the adjacent lane, and then calculate the forward position and backward position on the adjacent lane based on the reference point. Still, our human perception of what is parallel and what not, is not reflected by fractional positions.
Special care must be taken in curves when perceiving headway of a GTU or object on an adjacent lane.The question is whether we perceive the parallel or ahead/behind based on a line perpendicular to the front/back of the GTU (rectangular), or perpendicular to the center line of the lane (wedge-shaped in case of a curve). The difficulty of a wedge-shaped situation is that reciprocity might be violated: in case of a clothoid, for instance, it is not sure that the point on the center line when projected from lane 1 to lane 2 is the same as the projection from lane 2 to lane 1. The same holds for shapes with sharp bends. Therefore, algorithms implementing headway should only project the reference point of the reference GTU on the center line of the adjacent lane, and then calculate the forward position and backward position on the adjacent lane based on the reference point. Still, our human perception of what is parallel and what not, is not reflected by fractional positions.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
the object types that can be distinguished for headway. -
Method Summary
Modifier and TypeMethodDescriptiondefault int
org.djunits.value.vdouble.scalar.Acceleration
org.djunits.value.vdouble.scalar.Length
Retrieve the strongly typed distance to the other object.getId()
org.djunits.value.vdouble.scalar.Length
org.djunits.value.vdouble.scalar.Length
Return the (perceived) overlap with the other object.org.djunits.value.vdouble.scalar.Length
Return the (perceived) front overlap to the other object.org.djunits.value.vdouble.scalar.Length
Return the (perceived) rear overlap to the other object.org.djunits.value.vdouble.scalar.Speed
getSpeed()
boolean
isAhead()
boolean
isBehind()
boolean
-
Method Details
-
getId
String getId()- Specified by:
getId
in interfaceorg.djutils.base.Identifiable
- Returns:
- String; the id of the other object for comparison purposes, cannot be null.
-
getLength
org.djunits.value.vdouble.scalar.Length getLength()- Returns:
- Length; the length of the other object; can be null if unknown.
-
getSpeed
org.djunits.value.vdouble.scalar.Speed getSpeed()- Returns:
- Speed; the (perceived) speed of the other object; can be null if unknown.
-
getDistance
org.djunits.value.vdouble.scalar.Length getDistance()Retrieve the strongly typed distance to the other object.- Returns:
- Length; the distance to the object, return value null indicates that the other object is parallel to the reference object
-
getObjectType
Headway.ObjectType getObjectType()- Returns:
- Length; the (perceived) object Type, can be null if no object type unknown.
-
getAcceleration
org.djunits.value.vdouble.scalar.Acceleration getAcceleration()- Returns:
- Acceleration; acceleration the (perceived) acceleration of the other object; can be null if unknown.
-
getOverlapFront
org.djunits.value.vdouble.scalar.Length getOverlapFront()Return the (perceived) front overlap to the other object. This value should be null if there is no overlap. In the figure for two GTUs below, it is distance c, positive for GTU1, negative for GTU2.---------- | GTU 1 | -----> ---------- --------------- | GTU 2 | -----> --------------- | a | b | c |
- Returns:
- Length; the (perceived) front overlap to the other object or null if there is no overlap.
-
getOverlapRear
org.djunits.value.vdouble.scalar.Length getOverlapRear()Return the (perceived) rear overlap to the other object. This value should be null if there is no overlap.In the figure below for two GTUs, it is distance a, positive for GTU1, negative for GTU2.---------- | GTU 1 | -----> ---------- --------------- | GTU 2 | -----> --------------- | a | b | c |
- Returns:
- Length; the (perceived) rear overlap to the other object or null if there is no overlap.
-
getOverlap
org.djunits.value.vdouble.scalar.Length getOverlap()Return the (perceived) overlap with the other object. This value should be null if there is no overlap. In the figure below for two GTUs, it is distance b, positive for GTU1 and GTU2.---------- | GTU 1 | -----> ---------- --------------- | GTU 2 | -----> --------------- | a | b | c |
- Returns:
- Length, the (perceived) overlap with the other object or null if there is no overlap.
-
isAhead
boolean isAhead()- Returns:
- whether the other object is in front of the reference object.
-
isBehind
boolean isBehind()- Returns:
- whether the other object is behind the reference object.
-
isParallel
boolean isParallel()- Returns:
- whether the other object is parallel the reference object.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Headway>
-