Class DirectDefaultSimplePerception

    • Field Detail

      • LOOKAHEAD

        protected static final org.opentrafficsim.base.parameters.ParameterTypeLength LOOKAHEAD
        Look ahead parameter type.
      • LOOKBACKOLD

        protected static final org.opentrafficsim.base.parameters.ParameterTypeLength LOOKBACKOLD
        Look back parameter type.
    • Constructor Detail

      • DirectDefaultSimplePerception

        public DirectDefaultSimplePerception​(LanePerception perception)
        Parameters:
        perception - LanePerception; perception
    • Method Detail

      • updateLanePathInfo

        public final void updateLanePathInfo()
                                      throws GTUException,
                                             NetworkException,
                                             org.opentrafficsim.base.parameters.ParameterException
        Specified by:
        updateLanePathInfo in interface DefaultSimplePerception
        Throws:
        GTUException - when the GTU was not initialized yet.
        NetworkException - when the speed limit for a GTU type cannot be retrieved from the network.
        org.opentrafficsim.base.parameters.ParameterException - in case of not being able to retrieve parameter ParameterTypes.LOOKAHEAD
      • updateForwardHeadwayGTU

        public final void updateForwardHeadwayGTU()
                                           throws GTUException,
                                                  NetworkException,
                                                  org.opentrafficsim.base.parameters.ParameterException
        Update the forward headway and first object (a GTU) in front.
        Specified by:
        updateForwardHeadwayGTU in interface DefaultSimplePerception
        Throws:
        GTUException - when the GTU was not yet initialized
        NetworkException - in case of network exception
        org.opentrafficsim.base.parameters.ParameterException - if parameter is not defined or out of bounds
      • updateForwardHeadwayObject

        public final void updateForwardHeadwayObject()
                                              throws GTUException,
                                                     NetworkException,
                                                     org.opentrafficsim.base.parameters.ParameterException
        Update the forward headway and first object (but not a GTU) in front.
        Specified by:
        updateForwardHeadwayObject in interface DefaultSimplePerception
        Throws:
        GTUException - when the GTU was not yet initialized
        NetworkException - in case of network exception
        org.opentrafficsim.base.parameters.ParameterException - if parameter is not defined or out of bounds
      • updateBackwardHeadway

        public final void updateBackwardHeadway()
                                         throws GTUException,
                                                org.opentrafficsim.base.parameters.ParameterException,
                                                NetworkException
        Update the backward headway and first object (e.g., a GTU) behind.
        Specified by:
        updateBackwardHeadway in interface DefaultSimplePerception
        Throws:
        GTUException - when the GTU was not yet initialized
        org.opentrafficsim.base.parameters.ParameterException - if parameter is not defined or out of bounds
        NetworkException - in case of network exception
      • updateNeighboringHeadwaysLeft

        public final void updateNeighboringHeadwaysLeft()
                                                 throws GTUException,
                                                        org.opentrafficsim.base.parameters.ParameterException,
                                                        NetworkException
        Update the objects (e.g., GTUs) in parallel, in front and behind on the left neighboring lane, with their headway relative to our GTU, and information about the status of the adjacent objects.
        Specified by:
        updateNeighboringHeadwaysLeft in interface DefaultSimplePerception
        Throws:
        GTUException - when the GTU was not yet initialized
        org.opentrafficsim.base.parameters.ParameterException - if parameter is not defined or out of bounds
        NetworkException - in case of network exception
      • updateNeighboringHeadwaysRight

        public final void updateNeighboringHeadwaysRight()
                                                  throws GTUException,
                                                         org.opentrafficsim.base.parameters.ParameterException,
                                                         NetworkException
        Update the objects (e.g., GTUs) in parallel, in front and behind on the right neighboring lane, with their headway relative to our GTU, and information about the status of the adjacent objects.
        Specified by:
        updateNeighboringHeadwaysRight in interface DefaultSimplePerception
        Throws:
        GTUException - when the GTU was not yet initialized
        org.opentrafficsim.base.parameters.ParameterException - if parameter is not defined or out of bounds
        NetworkException - in case of network exception
      • updateNeighboringHeadways

        public final void updateNeighboringHeadways​(LateralDirectionality lateralDirection)
                                             throws GTUException,
                                                    org.opentrafficsim.base.parameters.ParameterException,
                                                    NetworkException
        Update the objects (e.g., GTUs) in parallel, in front and behind for the lane in the given direction, with their headway relative to our GTU, and information about the status of the adjacent objects.
        Specified by:
        updateNeighboringHeadways in interface DefaultSimplePerception
        Parameters:
        lateralDirection - LateralDirectionality; the direction to update the parallel headway collection for
        Throws:
        GTUException - when the GTU was not yet initialized
        org.opentrafficsim.base.parameters.ParameterException - if parameter is not defined or out of bounds
        NetworkException - in case of network exception
      • updateParallelHeadways

        public final void updateParallelHeadways​(LateralDirectionality lateralDirection)
                                          throws GTUException
        Update the parallel objects (e.g., GTUs) for the given direction, with information about their status and parallel overlap with our GTU.
        Specified by:
        updateParallelHeadways in interface DefaultSimplePerception
        Parameters:
        lateralDirection - LateralDirectionality; the direction to return the neighboring headway collection for
        Throws:
        GTUException - when the GTU was not yet initialized
      • getNeighboringHeadwaysLeft

        public final Collection<Headway> getNeighboringHeadwaysLeft()
        Specified by:
        getNeighboringHeadwaysLeft in interface DefaultSimplePerception
        Returns:
        neighboringHeadwaysLeft, the objects (e.g., GTUs) in parallel, in front and behind on the left neighboring lane, with their headway relative to our GTU, and information about the status of the adjacent objects
      • getNeighboringHeadwaysRight

        public final Collection<Headway> getNeighboringHeadwaysRight()
        Specified by:
        getNeighboringHeadwaysRight in interface DefaultSimplePerception
        Returns:
        neighboringHeadwaysRight, the objects (e.g., GTUs) in parallel, in front and behind on the right neighboring lane, with their headway relative to our GTU, and information about the status of the adjacent objects
      • getNeighboringHeadways

        public final Collection<Headway> getNeighboringHeadways​(LateralDirectionality lateralDirection)
        Specified by:
        getNeighboringHeadways in interface DefaultSimplePerception
        Parameters:
        lateralDirection - LateralDirectionality; the direction to return the parallel headway collection for
        Returns:
        the the objects (e.g., GTUs) in parallel, in front and behind for the lane in the given direction, with their headway relative to our GTU, and information about the status of the adjacent objects
      • getParallelHeadways

        public final Collection<Headway> getParallelHeadways​(LateralDirectionality lateralDirection)
        Specified by:
        getParallelHeadways in interface DefaultSimplePerception
        Parameters:
        lateralDirection - LateralDirectionality; the direction to return the neighboring headway collection for
        Returns:
        the the parallel objects (e.g., GTUs) for the given direction, with information about their status and parallel overlap with our GTU.
      • getTimeStampedForwardHeadwayGTU

        public final org.opentrafficsim.base.TimeStampedObject<Headway> getTimeStampedForwardHeadwayGTU()
        Returns:
        TimeStamped forwardHeadway, the forward headway and first object (GTU) in front
      • getTimeStampedForwardHeadwayObject

        public final org.opentrafficsim.base.TimeStampedObject<Headway> getTimeStampedForwardHeadwayObject()
        Returns:
        TimeStamped forwardHeadway, the forward headway and first object (not a GTU) in front
      • getTimeStampedBackwardHeadway

        public final org.opentrafficsim.base.TimeStampedObject<Headway> getTimeStampedBackwardHeadway()
        Returns:
        TimeStamped backwardHeadwayGTU, the backward headway and first object (e.g., a GTU) behind
      • getTimeStampedAccessibleAdjacentLanesLeft

        public final org.opentrafficsim.base.TimeStampedObject<Map<Lane,​Set<Lane>>> getTimeStampedAccessibleAdjacentLanesLeft()
        Returns:
        TimeStamped accessibleAdjacentLanesLeft, the accessible adjacent lanes on the left
      • getTimeStampedAccessibleAdjacentLanesRight

        public final org.opentrafficsim.base.TimeStampedObject<Map<Lane,​Set<Lane>>> getTimeStampedAccessibleAdjacentLanesRight()
        Returns:
        TimeStamped accessibleAdjacentLanesRight, the accessible adjacent lanes on the right
      • getTimeStampedAccessibleAdjacentLanes

        public final org.opentrafficsim.base.TimeStampedObject<Map<Lane,​Set<Lane>>> getTimeStampedAccessibleAdjacentLanes​(LateralDirectionality lateralDirection)
        Parameters:
        lateralDirection - LateralDirectionality; the direction to return the accessible adjacent lanes for
        Returns:
        TimeStamped accessibleAdjacentLanesRight, the accessible adjacent lanes on the right
      • getTimeStampedNeighboringHeadwaysLeft

        public final org.opentrafficsim.base.TimeStampedObject<Collection<Headway>> getTimeStampedNeighboringHeadwaysLeft()
        Returns:
        TimeStamped neighboringHeadwaysLeft, the objects (e.g., GTUs) in parallel, in front and behind on the left neighboring lane, with their headway relative to our GTU, and information about the status of the adjacent objects
      • getTimeStampedNeighboringHeadwaysRight

        public final org.opentrafficsim.base.TimeStampedObject<Collection<Headway>> getTimeStampedNeighboringHeadwaysRight()
        Returns:
        TimeStamped neighboringHeadwaysRight, the objects (e.g., GTUs) in parallel, in front and behind on the right neighboring lane, with their headway relative to our GTU, and information about the status of the adjacent objects
      • getTimeStampedNeighboringHeadways

        public final org.opentrafficsim.base.TimeStampedObject<Collection<Headway>> getTimeStampedNeighboringHeadways​(LateralDirectionality lateralDirection)
        Parameters:
        lateralDirection - LateralDirectionality; the direction to return the neighboring headways for
        Returns:
        TimeStamped neighboringHeadwaysRight, the objects (e.g., GTUs) in parallel, in front and behind on the right neighboring lane, with their headway relative to our GTU, and information about the status of the adjacent objects
      • getTimeStampedParallelHeadwaysLeft

        public final org.opentrafficsim.base.TimeStampedObject<Collection<Headway>> getTimeStampedParallelHeadwaysLeft()
        Returns:
        TimeStamped parallelHeadwaysLeft, the parallel objects (e.g., GTUs) on the left, with information about their status and parallel overlap with our GTU.
      • getTimeStampedParallelHeadwaysRight

        public final org.opentrafficsim.base.TimeStampedObject<Collection<Headway>> getTimeStampedParallelHeadwaysRight()
        Returns:
        TimeStamped parallelHeadwaysRight, the parallel objects (e.g., GTUs) on the right, with information about their status and parallel overlap with our GTU.
      • getTimeStampedParallelHeadways

        public final org.opentrafficsim.base.TimeStampedObject<Collection<Headway>> getTimeStampedParallelHeadways​(LateralDirectionality lateralDirection)
        Parameters:
        lateralDirection - LateralDirectionality; the direction to return the parallel headways for
        Returns:
        TimeStamped parallelHeadwaysRight, the parallel objects (e.g., GTUs) on the right, with information about their status and parallel overlap with our GTU.
      • getTimeStampedSpeedLimit

        public final org.opentrafficsim.base.TimeStampedObject<Speed> getTimeStampedSpeedLimit()
        Returns:
        TimeStamped speedLimit
      • getTimeStampedLanePathInfo

        public final org.opentrafficsim.base.TimeStampedObject<LanePathInfo> getTimeStampedLanePathInfo()
        Retrieve the time stamped last perceived lane path info.
        Returns:
        LanePathInfo time stamped last perceived lane path info
      • bestAccessibleAdjacentLane

        public final Lane bestAccessibleAdjacentLane​(Lane currentLane,
                                                     LateralDirectionality lateralDirection,
                                                     Length longitudinalPosition)
        Determine whether there is a lane to the left or to the right of this lane, which is accessible from this lane, or null if no lane could be found. The method takes the LongitidinalDirectionality of the lane into account. In other words, if we drive FORWARD and look for a lane on the LEFT, and there is a lane but the Directionality of that lane is not FORWARD or BOTH, null will be returned.
        A lane is called adjacent to another lane if the lateral edges are not more than a delta distance apart. This means that a lane that overlaps with another lane is not returned as an adjacent lane.
        The algorithm also looks for RoadMarkerAcross elements between the lanes to determine the lateral permeability for a GTU. A RoadMarkerAcross is seen as being between two lanes if its center line is not more than delta distance from the relevant lateral edges of the two adjacent lanes.
        When there are multiple lanes that are adjacent, which could e.g. be the case if an overlapping tram lane and a car lane are adjacent to the current lane, the widest lane that best matches the GTU accessibility of the provided GTUType is returned.
        Note: LEFT is seen as a negative lateral direction, RIGHT as a positive lateral direction.
        FIXME In other places in OTS LEFT is positive (and RIGHT is negative). This should be made more consistent.
        Specified by:
        bestAccessibleAdjacentLane in interface DefaultSimplePerception
        Parameters:
        currentLane - Lane; the lane to look for the best accessible adjacent lane
        lateralDirection - LateralDirectionality; the direction (LEFT, RIGHT) to look at
        longitudinalPosition - Length; the position of the GTU along currentLane
        Returns:
        the lane if it is accessible, or null if there is no lane, it is not accessible, or the driving direction does not match.