Class AbstractHeadwayCopy

  • All Implemented Interfaces:
    Serializable, Comparable<Headway>, org.opentrafficsim.base.Identifiable, PerceivedObject, Headway
    Direct Known Subclasses:
    AbstractHeadwayGTU, AbstractHeadwayLaneBasedObject, HeadwayObject

    public abstract class AbstractHeadwayCopy
    extends AbstractHeadway
    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.
    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. See examples in http://simulation.tudelft.nl:8085/browse/OTS-113.

    Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    Version:
    $Revision: 1368 $, $LastChangedDate: 2015-09-02 00:20:20 +0200 (Wed, 02 Sep 2015) $, by $Author: averbraeck $, initial version 11 feb. 2015
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    See Also:
    Serialized Form
    • Constructor Detail

      • AbstractHeadwayCopy

        public AbstractHeadwayCopy​(Headway.ObjectType objectType,
                                   String id,
                                   Length distance,
                                   Speed speed,
                                   Acceleration acceleration)
                            throws GTUException
        Construct a new Headway information object, for a moving object ahead of us or behind us.
        Parameters:
        objectType - ObjectType; the perceived object type, can be null if object type unknown.
        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, or parameters are inconsistent
      • AbstractHeadwayCopy

        public AbstractHeadwayCopy​(Headway.ObjectType objectType,
                                   String id,
                                   Length distance)
                            throws GTUException
        Construct a new Headway information object, for a non-moving object ahead of us or behind us.
        Parameters:
        objectType - ObjectType; the perceived object type, can be null if object type unknown.
        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
      • AbstractHeadwayCopy

        public AbstractHeadwayCopy​(Headway.ObjectType objectType,
                                   String id,
                                   Length overlapFront,
                                   Length overlap,
                                   Length overlapRear,
                                   Speed speed,
                                   Acceleration acceleration)
                            throws GTUException
        Construct a new Headway information object, for a moving object parallel with us.
        Parameters:
        objectType - ObjectType; the perceived object type, can be null if object type unknown.
        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
      • AbstractHeadwayCopy

        public AbstractHeadwayCopy​(Headway.ObjectType objectType,
                                   String id,
                                   Length overlapFront,
                                   Length overlap,
                                   Length overlapRear)
                            throws GTUException
        Construct a new Headway information object, for a non-moving object parallel with us.
        Parameters:
        objectType - ObjectType; the perceived object type, can be null if object type unknown.
        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
      • AbstractHeadwayCopy

        public AbstractHeadwayCopy​(Headway.ObjectType objectType,
                                   String id,
                                   Length distance,
                                   Length length,
                                   Speed speed,
                                   Acceleration acceleration)
                            throws GTUException
        Construct a new Headway information object, for a moving object ahead of us or behind us.
        Parameters:
        objectType - ObjectType; the perceived object type, can be null if object type unknown.
        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 - the length of the other object; if this constructor is used, length 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
      • AbstractHeadwayCopy

        public AbstractHeadwayCopy​(Headway.ObjectType objectType,
                                   String id,
                                   Length distance,
                                   Length length)
                            throws GTUException
        Construct a new Headway information object, for a non-moving object ahead of us or behind us.
        Parameters:
        objectType - ObjectType; the perceived object type, can be null if object type unknown.
        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 - the length of the other object; if this constructor is used, length cannot be null.
        Throws:
        GTUException - when id is null, or parameters are inconsistent
      • AbstractHeadwayCopy

        public AbstractHeadwayCopy​(Headway.ObjectType objectType,
                                   String id,
                                   Length overlapFront,
                                   Length overlap,
                                   Length overlapRear,
                                   Length length,
                                   Speed speed,
                                   Acceleration acceleration)
                            throws GTUException
        Construct a new Headway information object, for a moving object parallel with us.
        Parameters:
        objectType - ObjectType; the perceived object type, can be null if object type unknown.
        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 - the length of the other object; if this constructor is used, length 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
      • AbstractHeadwayCopy

        public AbstractHeadwayCopy​(Headway.ObjectType objectType,
                                   String id,
                                   Length overlapFront,
                                   Length overlap,
                                   Length overlapRear,
                                   Length length)
                            throws GTUException
        Construct a new Headway information object, for a non-moving object parallel with us.
        Parameters:
        objectType - ObjectType; the perceived object type, can be null if object type unknown.
        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 - the length of the other object; if this constructor is used, length cannot be null.
        Throws:
        GTUException - when id is null, or parameters are inconsistent
    • Method Detail

      • getId

        public final String getId()
        Returns:
        String; the id of the other object for comparison purposes, cannot be null.
      • getLength

        public final Length getLength()
        Returns:
        Length; the length of the other object; can be null if unknown.
      • getSpeed

        public final Speed getSpeed()
        Returns:
        Speed; the (perceived) speed of the other object; can be null if unknown.
      • getObjectType

        public final Headway.ObjectType getObjectType()
        Returns:
        Length; the (perceived) object Type, can be null if no object type unknown.
      • getAcceleration

        public final Acceleration getAcceleration()
        Returns:
        Acceleration; acceleration the (perceived) acceleration of the other object; can be null if unknown.