Interface DefaultSimplePerception
-
- All Superinterfaces:
LaneBasedPerceptionCategory,PerceptionCategory<LaneBasedGTU,LanePerception>
- All Known Implementing Classes:
DirectDefaultSimplePerception
public interface DefaultSimplePerception extends LaneBasedPerceptionCategory
Default perception category.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$, $LastChangedDate$, by $Author$, initial version 14 feb. 2017
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description LanebestAccessibleAdjacentLane(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.Map<Lane,Set<Lane>>getAccessibleAdjacentLanes(LateralDirectionality lateralDirection)Map<Lane,Set<Lane>>getAccessibleAdjacentLanesLeft()Map<Lane,Set<Lane>>getAccessibleAdjacentLanesRight()HeadwaygetBackwardHeadway()HeadwaygetForwardHeadwayGTU()HeadwaygetForwardHeadwayObject()LanePathInfogetLanePathInfo()Retrieve the last perceived lane path info.Collection<Headway>getNeighboringHeadways(LateralDirectionality lateralDirection)Collection<Headway>getNeighboringHeadwaysLeft()Collection<Headway>getNeighboringHeadwaysRight()Collection<Headway>getParallelHeadways(LateralDirectionality lateralDirection)Collection<Headway>getParallelHeadwaysLeft()Collection<Headway>getParallelHeadwaysRight()SpeedgetSpeedLimit()default voidupdateAccessibleAdjacentLanes()Update the accessible adjacent lanes.voidupdateAccessibleAdjacentLanesLeft()Update the accessible adjacent lanes on the left.voidupdateAccessibleAdjacentLanesRight()Update the accessible adjacent lanes on the right.default voidupdateAll()voidupdateBackwardHeadway()Update the backward headway and first object (e.g., a GTU) behind.voidupdateForwardHeadwayGTU()Update the forward headway and first object (a GTU) in front.voidupdateForwardHeadwayObject()Update the forward headway and first object (but not a GTU) in front.voidupdateLanePathInfo()voidupdateNeighboringHeadways(LateralDirectionality lateralDirection)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.voidupdateNeighboringHeadwaysLeft()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.voidupdateNeighboringHeadwaysRight()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.voidupdateParallelHeadways(LateralDirectionality lateralDirection)Update the parallel objects (e.g., GTUs) for the given direction, with information about their status and parallel overlap with our GTU.voidupdateParallelHeadwaysLeft()Update the parallel objects (e.g., GTUs) on the left, with information about their status and parallel overlap with our GTU.voidupdateParallelHeadwaysRight()Update the parallel objects (e.g., GTUs) on the right, with information about their status and parallel overlap with our GTU.voidupdateSpeedLimit()Update speedLimit.
-
-
-
Method Detail
-
updateLanePathInfo
void updateLanePathInfo() throws GTUException, NetworkException, ParameterException- Throws:
GTUException- when the GTU was not initialized yet.NetworkException- when the speed limit for a GTU type cannot be retrieved from the network.ParameterException- in case of not being able to retrieve parameter ParameterTypes.LOOKAHEAD
-
updateForwardHeadwayGTU
void updateForwardHeadwayGTU() throws GTUException, NetworkException, ParameterExceptionUpdate the forward headway and first object (a GTU) in front.- Throws:
GTUException- when the GTU was not yet initializedParameterException- if parameter is not defined or out of boundsNetworkException- in case of network exception
-
updateForwardHeadwayObject
void updateForwardHeadwayObject() throws GTUException, NetworkException, ParameterExceptionUpdate the forward headway and first object (but not a GTU) in front.- Throws:
GTUException- when the GTU was not yet initializedParameterException- if parameter is not defined or out of boundsNetworkException- in case of network exception
-
updateBackwardHeadway
void updateBackwardHeadway() throws GTUException, ParameterException, NetworkExceptionUpdate the backward headway and first object (e.g., a GTU) behind.- Throws:
GTUException- when the GTU was not yet initializedParameterException- if parameter is not defined or out of boundsNetworkException- in case of network exception
-
updateAccessibleAdjacentLanes
default void updateAccessibleAdjacentLanes() throws GTUExceptionUpdate the accessible adjacent lanes.- Throws:
GTUException- when the GTU was not yet initialized
-
updateAccessibleAdjacentLanesLeft
void updateAccessibleAdjacentLanesLeft() throws GTUExceptionUpdate the accessible adjacent lanes on the left.- Throws:
GTUException- when the GTU was not yet initialized
-
updateAccessibleAdjacentLanesRight
void updateAccessibleAdjacentLanesRight() throws GTUExceptionUpdate the accessible adjacent lanes on the right.- Throws:
GTUException- when the GTU was not yet initialized
-
updateNeighboringHeadwaysLeft
void updateNeighboringHeadwaysLeft() throws GTUException, ParameterException, NetworkExceptionUpdate 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.- Throws:
GTUException- when the GTU was not yet initializedParameterException- if parameter is not defined or out of boundsNetworkException- in case of network exception
-
updateNeighboringHeadwaysRight
void updateNeighboringHeadwaysRight() throws GTUException, ParameterException, NetworkExceptionUpdate 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.- Throws:
GTUException- when the GTU was not yet initializedParameterException- if parameter is not defined or out of boundsNetworkException- in case of network exception
-
updateNeighboringHeadways
void updateNeighboringHeadways(LateralDirectionality lateralDirection) throws GTUException, 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.- Parameters:
lateralDirection- LateralDirectionality; the direction to update the parallel headway collection for- Throws:
GTUException- when the GTU was not yet initializedParameterException- if parameter is not defined or out of boundsNetworkException- in case of network exception
-
updateParallelHeadwaysLeft
void updateParallelHeadwaysLeft() throws GTUExceptionUpdate the parallel objects (e.g., GTUs) on the left, with information about their status and parallel overlap with our GTU.- Throws:
GTUException- when the GTU was not yet initialized
-
updateParallelHeadwaysRight
void updateParallelHeadwaysRight() throws GTUExceptionUpdate the parallel objects (e.g., GTUs) on the right, with information about their status and parallel overlap with our GTU.- Throws:
GTUException- when the GTU was not yet initialized
-
updateParallelHeadways
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.- Parameters:
lateralDirection- LateralDirectionality; the direction to return the neighboring headway collection for- Throws:
GTUException- when the GTU was not yet initialized
-
updateSpeedLimit
void updateSpeedLimit() throws GTUException, NetworkExceptionUpdate speedLimit.- Throws:
GTUException- when the GTU was not yet initializedNetworkException- in case of network exception
-
getLanePathInfo
LanePathInfo getLanePathInfo()
Retrieve the last perceived lane path info.- Returns:
- LanePathInfo
-
getForwardHeadwayGTU
Headway getForwardHeadwayGTU()
- Returns:
- forwardHeadway, the forward headway and first object (GTU) in front
-
getForwardHeadwayObject
Headway getForwardHeadwayObject()
- Returns:
- forwardHeadway, the forward headway and first object (not a GTU) in front
-
getBackwardHeadway
Headway getBackwardHeadway()
- Returns:
- backwardHeadwayGTU, the backward headway and first object (e.g., a GTU) behind
-
getAccessibleAdjacentLanesLeft
Map<Lane,Set<Lane>> getAccessibleAdjacentLanesLeft()
- Returns:
- accessibleAdjacentLanesLeft, the accessible adjacent lanes on the left
-
getAccessibleAdjacentLanesRight
Map<Lane,Set<Lane>> getAccessibleAdjacentLanesRight()
- Returns:
- accessibleAdjacentLanesRight, the accessible adjacent lanes on the right
-
getAccessibleAdjacentLanes
Map<Lane,Set<Lane>> getAccessibleAdjacentLanes(LateralDirectionality lateralDirection)
- Parameters:
lateralDirection- LateralDirectionality; the direction to return the accessible adjacent lane map for- Returns:
- the accessible adjacent lane map for the given direction
-
getNeighboringHeadwaysLeft
Collection<Headway> getNeighboringHeadwaysLeft()
- 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
Collection<Headway> getNeighboringHeadwaysRight()
- 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
Collection<Headway> getNeighboringHeadways(LateralDirectionality lateralDirection)
- 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
-
getParallelHeadwaysLeft
Collection<Headway> getParallelHeadwaysLeft()
- Returns:
- parallelHeadwaysLeft, the parallel objects (e.g., GTUs) on the left, with information about their status and parallel overlap with our GTU.
-
getParallelHeadwaysRight
Collection<Headway> getParallelHeadwaysRight()
- Returns:
- parallelHeadwaysRight, the parallel objects (e.g., GTUs) on the right, with information about their status and parallel overlap with our GTU.
-
getParallelHeadways
Collection<Headway> getParallelHeadways(LateralDirectionality lateralDirection)
- 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.
-
getSpeedLimit
Speed getSpeedLimit()
- Returns:
- speedLimit
-
updateAll
default void updateAll() throws GTUException, ParameterException, NetworkException- Specified by:
updateAllin interfacePerceptionCategory<LaneBasedGTU,LanePerception>- Throws:
GTUExceptionParameterExceptionNetworkException
-
bestAccessibleAdjacentLane
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.- Parameters:
currentLane- Lane; the lane to look for the best accessible adjacent lanelateralDirection- LateralDirectionality; the direction (LEFT, RIGHT) to look atlongitudinalPosition- 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.
-
-