Class NeighborsPerceptionChannel
java.lang.Object
org.opentrafficsim.core.gtu.perception.AbstractPerceptionCategory<LaneBasedGtu,LanePerception>
org.opentrafficsim.road.gtu.perception.mental.channel.NeighborsPerceptionChannel
- All Implemented Interfaces:
Type<AbstractPerceptionCategory<LaneBasedGtu,,LanePerception>> PerceptionCategory<LaneBasedGtu,,LanePerception> LaneBasedPerceptionCategory,NeighborsPerception
public class NeighborsPerceptionChannel
extends AbstractPerceptionCategory<LaneBasedGtu,LanePerception>
implements NeighborsPerception
This class is highly similar to
DirectNeighborsPerception, but creates and uses 4 different perceived GTU types for
the 4 standard channels. These headway GTU types dynamically obtain a perception delay from the mental module.
Copyright (c) 2024-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
-
Constructor Summary
ConstructorsConstructorDescriptionNeighborsPerceptionChannel(LanePerception perception, Estimation estimation, Anticipation anticipation) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanComputes whether there is a GTU alongside.Set of followers on a lane, which is usually 0 or 1, but possibly more in case of an upstream merge with no intermediate GTU.Set of leaders on a lane, which is usually 0 or 1, but possibly more in case of a downstream split with no intermediate GTU.getFollowers(RelativeLane lane) Set of followers on a lane, including adjacent GTU's who's FRONT is back of the own vehicle FRONT.getLeaders(RelativeLane lane) Set of leaders on a lane, including adjacent GTU's who's FRONT is ahead of the own vehicle FRONT.booleanWhether there is a GTU alongside, i.e. with overlap, in an adjacent lane.final StringtoString()Methods inherited from class org.opentrafficsim.core.gtu.perception.AbstractPerceptionCategory
cacheAsString, computeIfAbsent, computeIfAbsent, computeIfAbsent, getGtu, getPerception, getTimestamp
-
Constructor Details
-
NeighborsPerceptionChannel
public NeighborsPerceptionChannel(LanePerception perception, Estimation estimation, Anticipation anticipation) Constructor.- Parameters:
perception- perception.estimation- estimation.anticipation- anticipation.
-
-
Method Details
-
getFirstLeaders
public SortedSet<PerceivedGtu> getFirstLeaders(LateralDirectionality lat) throws ParameterException, NullPointerException, IllegalArgumentException Set of leaders on a lane, which is usually 0 or 1, but possibly more in case of a downstream split with no intermediate GTU. This is shown below. Suppose A needs to go straight. If A considers a lane change to the left, both GTUs B (who's tail ~ is still on the straight lane) and C need to be considered for whether it's safe to do so. In case of multiple splits close to one another, the returned set may contain even more than 2 leaders. Leaders are sorted by headway value.| | _________/B/_____ _ _?_ _ _~_ _C_ _ _ _A_ _ _ _ _ _ _ _________________Only vehicles who's rear is beyond the own front are considered, no alongside vehicles.
- Specified by:
getFirstLeadersin interfaceNeighborsPerception- Parameters:
lat- LEFT or RIGHT- Returns:
- list of followers on a lane
- Throws:
ParameterException- if parameter is not definedNullPointerException- iflatisnullIllegalArgumentException- iflatisNONE
-
getFirstFollowers
public SortedSet<PerceivedGtu> getFirstFollowers(LateralDirectionality lat) throws ParameterException, NullPointerException, IllegalArgumentException Set of followers on a lane, which is usually 0 or 1, but possibly more in case of an upstream merge with no intermediate GTU. This is shown below. If A considers a lane change to the left, both GTUs B and C need to be considered for whether it's safe to do so. In case of multiple merges close to one another, the returned set may contain even more than 2 followers. Followers are sorted by tailway value.| | |C| ________\ \______ _ _B_|_ _ _ _ _?_ _ _ _|_ _ _ _ _A_ _____|___________Only vehicles who's front is before the own rear are considered, no alongside vehicles.
- Specified by:
getFirstFollowersin interfaceNeighborsPerception- Parameters:
lat- LEFT or RIGHT- Returns:
- list of followers on a lane
- Throws:
ParameterException- if parameter is not definedNullPointerException- iflatisnullIllegalArgumentException- iflatisNONE
-
isGtuAlongside
public boolean isGtuAlongside(LateralDirectionality lat) throws ParameterException, NullPointerException, IllegalArgumentException Whether there is a GTU alongside, i.e. with overlap, in an adjacent lane.- Specified by:
isGtuAlongsidein interfaceNeighborsPerception- Parameters:
lat- LEFT or RIGHT- Returns:
- whether there is a GTU alongside, i.e. with overlap, in an adjacent lane
- Throws:
ParameterException- if parameter is not definedNullPointerException- iflatisnullIllegalArgumentException- iflatisNONE
-
computeGtuAlongside
Computes whether there is a GTU alongside.- Parameters:
lat- lateral directionality- Returns:
- whether there is a GTU alongside
-
getLeaders
Set of leaders on a lane, including adjacent GTU's who's FRONT is ahead of the own vehicle FRONT. Leaders are sorted by distance.- Specified by:
getLeadersin interfaceNeighborsPerception- Parameters:
lane- relative lateral lane- Returns:
- set of leaders on a lane, including adjacent GTU's who's FRONT is ahead of the own vehicle FRONT
-
getFollowers
Set of followers on a lane, including adjacent GTU's who's FRONT is back of the own vehicle FRONT. Followers are sorted by distance.- Specified by:
getFollowersin interfaceNeighborsPerception- Parameters:
lane- relative lateral lane- Returns:
- set of followers on a lane, including adjacent GTU's who's FRONT is back of the own vehicle FRONT
-
toString
-