Class DirectInfrastructurePerception

java.lang.Object
org.opentrafficsim.core.gtu.perception.AbstractPerceptionCategory<LaneBasedGtu,LanePerception>
org.opentrafficsim.road.gtu.perception.categories.DirectInfrastructurePerception
All Implemented Interfaces:
Type<AbstractPerceptionCategory<LaneBasedGtu,LanePerception>>, PerceptionCategory<LaneBasedGtu,LanePerception>, InfrastructurePerception, LaneBasedPerceptionCategory

public class DirectInfrastructurePerception extends AbstractPerceptionCategory<LaneBasedGtu,LanePerception> implements InfrastructurePerception
Perceives information concerning the infrastructure, including splits, lanes, speed limits and road markings. This category is optimized by cooperating closely with the LaneStructure and only updating internal information when the GTU is on a new Lane. On the Lane information is defined relative to the start, and thus easily calculated at each time.

Copyright (c) 2013-2026 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
  • Field Details

    • LANE_STRUCTURE

      public static final ParameterTypeLength LANE_STRUCTURE
      Range of lane change info perception.
    • LOOKAHEAD

      public static final ParameterTypeLength LOOKAHEAD
      Range of lane change possibility perception.
  • Constructor Details

    • DirectInfrastructurePerception

      public DirectInfrastructurePerception(LanePerception perception)
      Constructor.
      Parameters:
      perception - perception
  • Method Details

    • getLegalLaneChangeInfo

      public SortedSet<LaneChangeInfo> getLegalLaneChangeInfo(RelativeLane lane)
      Description copied from interface: InfrastructurePerception
      Returns infrastructure lane change info of a lane. A set is returned as multiple points may force lane changes. Which point is considered most critical is a matter of driver interpretation and may change over time. This is shown below. Suppose vehicle A needs to take the off-ramp, and that behavior is that the minimum distance per required lane change determines how critical it is. First, 400m before the lane-drop, the off-ramp is critical. 300m downstream, the lane-drop is critical. Info is sorted by distance, closest first.
       _______
       _ _A_ _\_________
       _ _ _ _ _ _ _ _ _
       _________ _ _ ___
                \_______
           (-)        Lane-drop: 1 lane change  in 400m (400m per lane change)
           (--------) Off-ramp:  3 lane changes in 900m (300m per lane change, critical)
      
           (-)        Lane-drop: 1 lane change  in 100m (100m per lane change, critical)
           (--------) Off-ramp:  3 lane changes in 600m (200m per lane change)
       
      Specified by:
      getLegalLaneChangeInfo in interface InfrastructurePerception
      Parameters:
      lane - relative lateral lane
      Returns:
      infrastructure lane change info of a lane
    • getPhysicalLaneChangeInfo

      public SortedSet<LaneChangeInfo> getPhysicalLaneChangeInfo(RelativeLane lane)
      Description copied from interface: InfrastructurePerception
      Returns infrastructure lane change info of a lane. A set is returned as multiple points may force lane changes. Which point is considered most critical is a matter of driver interpretation and may change over time. This is shown below. Suppose vehicle A needs to take the off-ramp, and that behavior is that the minimum distance per required lane change determines how critical it is. First, 400m before the lane-drop, the off-ramp is critical. 300m downstream, the lane-drop is critical. Info is sorted by distance, closest first.
       _______
       _ _A_ _\_________
       _ _ _ _ _ _ _ _ _
       _________ _ _ ___
                \_______
           (-)        Lane-drop: 1 lane change  in 400m (400m per lane change)
           (--------) Off-ramp:  3 lane changes in 900m (300m per lane change, critical)
      
           (-)        Lane-drop: 1 lane change  in 100m (100m per lane change, critical)
           (--------) Off-ramp:  3 lane changes in 600m (200m per lane change)
       
      Specified by:
      getPhysicalLaneChangeInfo in interface InfrastructurePerception
      Parameters:
      lane - relative lateral lane
      Returns:
      infrastructure lane change info of a lane
    • getSpeedLimits

      public SpeedLimits getSpeedLimits(RelativeLane lane)
      Description copied from interface: InfrastructurePerception
      Returns the current speed limits.
      Specified by:
      getSpeedLimits in interface InfrastructurePerception
      Parameters:
      lane - lane for the speed limits
      Returns:
      current speed limits.
    • getLegalLaneChangePossibility

      public org.djunits.value.vdouble.scalar.Length getLegalLaneChangePossibility(RelativeLane fromLane, LateralDirectionality lat)
      Description copied from interface: InfrastructurePerception
      Returns the distance over which a lane change remains legally possible. Negative values indicate the distance over which a lane change is legally not possible.
      Specified by:
      getLegalLaneChangePossibility in interface InfrastructurePerception
      Parameters:
      fromLane - lane from which the lane change possibility is requested
      lat - LEFT or RIGHT, null not allowed
      Returns:
      distance over which a lane change remains possible
    • getPhysicalLaneChangePossibility

      public org.djunits.value.vdouble.scalar.Length getPhysicalLaneChangePossibility(RelativeLane fromLane, LateralDirectionality lat)
      Description copied from interface: InfrastructurePerception
      Returns the distance over which a lane change remains physically possible. Negative values indicate the distance over which a lane change is physically not possible.
      Specified by:
      getPhysicalLaneChangePossibility in interface InfrastructurePerception
      Parameters:
      fromLane - lane from which the lane change possibility is requested
      lat - LEFT or RIGHT, null not allowed
      Returns:
      distance over which a lane change remains possible
    • getCrossSection

      public SortedSet<RelativeLane> getCrossSection()
      Description copied from interface: InfrastructurePerception
      Returns a set of relative lanes representing the cross section. Lanes are sorted left to right.
      Specified by:
      getCrossSection in interface InfrastructurePerception
      Returns:
      set of relative lanes representing the cross section
    • getPathScan

      public SortedMap<org.djunits.value.vdouble.scalar.Length,DirectedPoint2d> getPathScan()
      Description copied from interface: InfrastructurePerception
      Relevant points in path from scanning.
      Specified by:
      getPathScan in interface InfrastructurePerception
      Returns:
      relevant points in path from scanning
    • getSpeedBump

      public Optional<DistancedObject<org.djunits.value.vdouble.scalar.Speed>> getSpeedBump()
      Description copied from interface: InfrastructurePerception
      Returns speed bump information.
      Specified by:
      getSpeedBump in interface InfrastructurePerception
      Returns:
      distance and speed of first downstream speed bump.
    • toString

      public final String toString()
      Overrides:
      toString in class Object