Class HeadwayGtuSimple
java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadway
org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayCopy
org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayGtu
org.opentrafficsim.road.gtu.lane.perception.headway.HeadwayGtuSimple
- All Implemented Interfaces:
Serializable
,Comparable<Headway>
,org.djutils.base.Identifiable
,PerceivedObject
,Headway
,HeadwayGtu
Container 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.
This particular version has only limited behavioral information about the observed GTU.
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.
This particular version has only limited behavioral information about the observed GTU.
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, Wouter Schakel
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opentrafficsim.road.gtu.lane.perception.headway.Headway
Headway.ObjectType
-
Constructor Summary
ConstructorDescriptionHeadwayGtuSimple
(String id, GtuType gtuType, org.djunits.value.vdouble.scalar.Length overlapFront, org.djunits.value.vdouble.scalar.Length overlap, org.djunits.value.vdouble.scalar.Length overlapRear, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length width, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration, org.djunits.value.vdouble.scalar.Speed desiredSpeed, GtuStatus... gtuStatus) Construct a new Headway information object, for a moving GTU parallel with us.HeadwayGtuSimple
(String id, GtuType gtuType, org.djunits.value.vdouble.scalar.Length overlapFront, org.djunits.value.vdouble.scalar.Length overlap, org.djunits.value.vdouble.scalar.Length overlapRear, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length width, org.djunits.value.vdouble.scalar.Speed desiredSpeed, GtuStatus... gtuStatus) Construct a new Headway information object, for a non-moving GTU parallel with us.HeadwayGtuSimple
(String id, GtuType gtuType, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length width, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration, org.djunits.value.vdouble.scalar.Speed desiredSpeed, GtuStatus... gtuStatus) Construct a new Headway information object, for a moving GTU ahead of us or behind us.HeadwayGtuSimple
(String id, GtuType gtuType, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length width, org.djunits.value.vdouble.scalar.Speed desiredSpeed, GtuStatus... gtuStatus) Construct a new Headway information object, for a non-moving GTU ahead of us or behind us. -
Method Summary
Modifier and TypeMethodDescriptionfinal CarFollowingModel
Many models that observe a GTU need to predict the imminent behavior of that GTU.final org.opentrafficsim.base.parameters.Parameters
Many models that observe a GTU need to predict the imminent behavior of that GTU.final Route
getRoute()
Models responding to other GTU may assume a route of the vehicle, for instance at intersections.final SpeedLimitInfo
Many models that observe a GTU need to predict the imminent behavior of that GTU.final AbstractHeadwayGtu
moved
(org.djunits.value.vdouble.scalar.Length headway, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration) Creates a copy with different headway, speed and possibly acceleration.final String
toString()
Methods inherited from class org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayGtu
getDesiredSpeed, getGtuStatus, getGtuStatuses, getGtuType, getSpeedLimitInfo, getWidth, isBrakingLightsOn, isEmergencyLightsOn, isFacingSameDirection, isHonking, isLeftTurnIndicatorOn, isRightTurnIndicatorOn
Methods inherited from class org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayCopy
equals, getAcceleration, getId, getLength, getObjectType, getSpeed, hashCode
Methods inherited from class org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadway
getDistance, getOverlap, getOverlapFront, getOverlapRear, isAhead, isBehind, isParallel
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opentrafficsim.road.gtu.lane.perception.headway.Headway
compareTo, getAcceleration, getDistance, getId, getLength, getObjectType, getOverlap, getOverlapFront, getOverlapRear, getSpeed, isAhead, isBehind, isParallel
-
Constructor Details
-
HeadwayGtuSimple
public HeadwayGtuSimple(String id, GtuType gtuType, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length width, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration, org.djunits.value.vdouble.scalar.Speed desiredSpeed, GtuStatus... gtuStatus) throws GtuException Construct a new Headway information object, for a moving GTU ahead of us or behind us.- Parameters:
id
- String; the id of the GTU for comparison purposes, can not be null.gtuType
- GtuType; the perceived GTU Type, or null if unknown.distance
- the distance to the other object; if this constructor is used, distance cannot be null.length
- the length of the other object; if this constructor is used, length cannot be null.width
- the (perceived) width of the other object; can not be null.speed
- the (perceived) speed of the other object; can be null if unknown.acceleration
- the (perceived) acceleration of the other object; can be null if unknown.desiredSpeed
- Speed; desired speedgtuStatus
- GtuStatus...; the observable characteristics of the GTU.- Throws:
GtuException
- when id is null, objectType is null, or parameters are inconsistent
-
HeadwayGtuSimple
public HeadwayGtuSimple(String id, GtuType gtuType, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length width, org.djunits.value.vdouble.scalar.Speed desiredSpeed, GtuStatus... gtuStatus) throws GtuException Construct a new Headway information object, for a non-moving GTU ahead of us or behind us.- Parameters:
id
- String; the id of the GTU for comparison purposes, can not be null.gtuType
- GtuType; the perceived GTU Type, or null if unknown.distance
- Length; the distance to the other Gtu; if this constructor is used, distance cannot be null.length
- the length of the other object; if this constructor is used, length cannot be null.width
- the (perceived) width of the other object; can not be null.desiredSpeed
- Speed; desired speedgtuStatus
- GtuStatus...; the observable characteristics of the GTU.- Throws:
GtuException
- when id is null, or parameters are inconsistent
-
HeadwayGtuSimple
public HeadwayGtuSimple(String id, GtuType gtuType, org.djunits.value.vdouble.scalar.Length overlapFront, org.djunits.value.vdouble.scalar.Length overlap, org.djunits.value.vdouble.scalar.Length overlapRear, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length width, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration, org.djunits.value.vdouble.scalar.Speed desiredSpeed, GtuStatus... gtuStatus) throws GtuException Construct a new Headway information object, for a moving GTU parallel with us.- Parameters:
id
- String; the id of the GTU for comparison purposes, can not be null.gtuType
- GtuType; the perceived GTU Type, or null if unknown.overlapFront
- the front-front distance to the other Gtu; if this constructor is used, this value cannot be null.overlap
- the 'center' overlap with the other Gtu; if this constructor is used, this value cannot be null.overlapRear
- the rear-rear distance to the other Gtu; if this constructor is used, this value cannot be null.length
- the length of the other object; if this constructor is used, length cannot be null.width
- the (perceived) width of the other object; can not be null.speed
- the (perceived) speed of the other Gtu; can be null if unknown.acceleration
- the (perceived) acceleration of the other Gtu; can be null if unknown.desiredSpeed
- Speed; desired speedgtuStatus
- GtuStatus...; the observable characteristics of the GTU.- Throws:
GtuException
- when id is null, or parameters are inconsistent
-
HeadwayGtuSimple
public HeadwayGtuSimple(String id, GtuType gtuType, org.djunits.value.vdouble.scalar.Length overlapFront, org.djunits.value.vdouble.scalar.Length overlap, org.djunits.value.vdouble.scalar.Length overlapRear, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length width, org.djunits.value.vdouble.scalar.Speed desiredSpeed, GtuStatus... gtuStatus) throws GtuException Construct a new Headway information object, for a non-moving GTU parallel with us.- Parameters:
id
- String; the id of the GTU for comparison purposes, can not be null.gtuType
- GtuType; the perceived GTU Type, or null if unknown.overlapFront
- the front-front distance to the other Gtu; if this constructor is used, this value cannot be null.overlap
- the 'center' overlap with the other Gtu; if this constructor is used, this value cannot be null.overlapRear
- the rear-rear distance to the other Gtu; if this constructor is used, this value cannot be null.length
- the length of the other object; if this constructor is used, length cannot be null.width
- the (perceived) width of the other object; can not be null.desiredSpeed
- Speed; desired speedgtuStatus
- GtuStatus...; the observable characteristics of the GTU.- Throws:
GtuException
- when id is null, or parameters are inconsistent
-
-
Method Details
-
getCarFollowingModel
Many models that observe a GTU need to predict the imminent behavior of that GTU. Having a car following model of the observed GTU can help with that. The car following model that is returned can be on a continuum between the actual car following model of the observed GTU and the own car following model of the observing GTU, not making any assumptions about the observed GTU. When successive observations of the GTU take place, parameters about its behavior can be estimated more accurately. Another interesting easy-to-implement solution is to return a car following model per GTU type, where the following model of a truck can differ from that of a car.- Returns:
- a car following model that represents the expected behavior of the observed GTU
-
getParameters
public final org.opentrafficsim.base.parameters.Parameters getParameters()Many models that observe a GTU need to predict the imminent behavior of that GTU. Having an estimate of the behavioral characteristics of the observed GTU can help with that. The parameters that are returned can be on a continuum between the actual parameters of the observed GTU and the own parameters of the observing GTU, not making any assumptions about the observed GTU. When successive observations of the GTU take place, parameters about its behavior can be estimated more accurately. Another interesting easy-to-implement solution is to return a set of parameters per GTU type, where the parameters of a truck can differ from that of a car.- Returns:
- the parameters that represent the expected behavior of the observed GTU
-
getSpeedLimitInfo
Many models that observe a GTU need to predict the imminent behavior of that GTU. Having a model of the speed info profile for the observed GTU can help with predicting its future behavior. The speed limit info that is returned can be on a continuum between the actual speed limit model of the observed GTU and the own speed limit model of the observing GTU, not making any assumptions about the observed GTU. When successive observations of the GTU take place, parameters about its behavior, such as the maximum speed it accepts, can be estimated more accurately. Another interesting easy-to-implement solution is to return a speed limit info object per GTU type, where the returned information of a truck -- with a maximum allowed speed on 80 km/h -- can differ from that of a car -- which can have a maximum allowed speed of 100 km/h on the same road.- Returns:
- a speed limit model that helps in determining the expected behavior of the observed GTU
-
getRoute
Models responding to other GTU may assume a route of the vehicle, for instance at intersections. The route may be short, i.e. only over the next intersection. Implementations may return anything from the actual route, a route based on indicators and other assumptions, ornull
if simply not known/estimated.- Returns:
- route of gtu
-
moved
public final AbstractHeadwayGtu moved(org.djunits.value.vdouble.scalar.Length headway, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration) Creates a copy with different headway, speed and possibly acceleration. It may not be alongside. This method is used to anticipate movement of a neighboring GTU.- Parameters:
headway
- Length; headwayspeed
- Speed; speedacceleration
- Acceleration; acceleration- Returns:
- copy with different headway, speed and possibly acceleration
-
toString
- Overrides:
toString
in classAbstractHeadwayGtu
-