All Implemented Interfaces:
Serializable, Comparable<Headway>, org.djutils.base.Identifiable, PerceivedObject, Headway

public class HeadwayObject extends AbstractHeadwayCopy
Container for a reference to information about a (lane based) object and a headway. The Headway can store information about objects ahead of the reference object, behind the reference object, or (partially) parallel to the reference object. 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 an 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 object (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 object 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
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.opentrafficsim.road.gtu.lane.perception.headway.Headway

    Headway.ObjectType
  • Constructor Summary

    Constructors
    Constructor
    Description
    HeadwayObject(String id, org.djunits.value.vdouble.scalar.Length distance)
    Construct a new Headway information object, for a non-moving object ahead of us or behind us.
    HeadwayObject(String id, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Length length)
    Construct a new Headway information object, for a non-moving object ahead of us or behind us.
    HeadwayObject(String id, org.djunits.value.vdouble.scalar.Length overlapFront, org.djunits.value.vdouble.scalar.Length overlap, org.djunits.value.vdouble.scalar.Length overlapRear)
    Construct a new Headway information object, for a non-moving object parallel with us.
    HeadwayObject(String id, 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)
    Construct a new Headway information object, for a non-moving object parallel with us.
    HeadwayObject(String id, 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.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration)
    Construct a new Headway information object, for a moving object parallel with us.
    HeadwayObject(String id, 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.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration)
    Construct a new Headway information object, for a moving object parallel with us.
    HeadwayObject(String id, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration)
    Construct a new Headway information object, for a moving object ahead of us or behind us.
    HeadwayObject(String id, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration)
    Construct a new Headway information object, for a moving object ahead of us or behind us.
  • Method Summary

    Modifier and Type
    Method
    Description
    final String

    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
  • Constructor Details

    • HeadwayObject

      public HeadwayObject(String id, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration) throws GtuException
      Construct a new Headway information object, for a moving object ahead of us or behind us.
      Parameters:
      id - String; the id of the object for comparison purposes, can not be null.
      distance - the distance to the other object; if this constructor is used, distance cannot 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.
      Throws:
      GtuException - when id is null, objectType is null, or parameters are inconsistent
    • HeadwayObject

      public HeadwayObject(String id, org.djunits.value.vdouble.scalar.Length distance) throws GtuException
      Construct a new Headway information object, for a non-moving object ahead of us or behind us.
      Parameters:
      id - String; the id of the object for comparison purposes, can not be null.
      distance - the distance to the other object; if this constructor is used, distance cannot be null.
      Throws:
      GtuException - when id is null, or parameters are inconsistent
    • HeadwayObject

      public HeadwayObject(String id, 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.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration) throws GtuException
      Construct a new Headway information object, for a moving object parallel with us.
      Parameters:
      id - String; the id of the object for comparison purposes, can not be null.
      overlapFront - the front-front distance to the other object; if this constructor is used, this value cannot be null.
      overlap - the 'center' overlap with the other object; if this constructor is used, this value cannot be null.
      overlapRear - the rear-rear distance to the other object; if this constructor is used, this value cannot 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.
      Throws:
      GtuException - when id is null, or parameters are inconsistent
    • HeadwayObject

      public HeadwayObject(String id, org.djunits.value.vdouble.scalar.Length overlapFront, org.djunits.value.vdouble.scalar.Length overlap, org.djunits.value.vdouble.scalar.Length overlapRear) throws GtuException
      Construct a new Headway information object, for a non-moving object parallel with us.
      Parameters:
      id - String; the id of the object for comparison purposes, can not be null.
      overlapFront - the front-front distance to the other object; if this constructor is used, this value cannot be null.
      overlap - the 'center' overlap with the other object; if this constructor is used, this value cannot be null.
      overlapRear - the rear-rear distance to the other object; if this constructor is used, this value cannot be null.
      Throws:
      GtuException - when id is null, or parameters are inconsistent
    • HeadwayObject

      public HeadwayObject(String id, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration) throws GtuException
      Construct a new Headway information object, for a moving object ahead of us or behind us.
      Parameters:
      id - String; the id of the object for comparison purposes, can not be null.
      distance - the distance to the other object; if this constructor is used, distance cannot be null.
      length - Length; the length of the other object, can be null of unknown.
      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.
      Throws:
      GtuException - when id is null, objectType is null, or parameters are inconsistent
    • HeadwayObject

      public HeadwayObject(String id, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Length length) throws GtuException
      Construct a new Headway information object, for a non-moving object ahead of us or behind us.
      Parameters:
      id - String; the id of the object for comparison purposes, can not be null.
      distance - the distance to the other object; if this constructor is used, distance cannot be null.
      length - Length; the length of the other object, can be null of unknown.
      Throws:
      GtuException - when id is null, or parameters are inconsistent
    • HeadwayObject

      public HeadwayObject(String id, 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.Speed speed, org.djunits.value.vdouble.scalar.Acceleration acceleration) throws GtuException
      Construct a new Headway information object, for a moving object parallel with us.
      Parameters:
      id - String; the id of the object for comparison purposes, can not be null.
      overlapFront - the front-front distance to the other object; if this constructor is used, this value cannot be null.
      overlap - the 'center' overlap with the other object; if this constructor is used, this value cannot be null.
      overlapRear - the rear-rear distance to the other object; if this constructor is used, this value cannot be null.
      length - Length; the length of the other object, can be null of unknown.
      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.
      Throws:
      GtuException - when id is null, or parameters are inconsistent
    • HeadwayObject

      public HeadwayObject(String id, 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) throws GtuException
      Construct a new Headway information object, for a non-moving object parallel with us.
      Parameters:
      id - String; the id of the object for comparison purposes, can not be null.
      overlapFront - the front-front distance to the other object; if this constructor is used, this value cannot be null.
      overlap - the 'center' overlap with the other object; if this constructor is used, this value cannot be null.
      overlapRear - the rear-rear distance to the other object; if this constructor is used, this value cannot be null.
      length - Length; the length of the other object, can be null of unknown.
      Throws:
      GtuException - when id is null, or parameters are inconsistent
  • Method Details