Class DistractionField
java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.mental.DistractionField
- All Implemented Interfaces:
EventListener,EventListener
This class perceives all distractions. It stores information on lane, odometer and task demand per distraction. For
distraction objects that are behind, the information on odometer allows active distraction for some distance beyond the
distraction object. This class listens to lane changes to update the relevant lane information. An instance of this class
should be shared among different instances of tasks which each can request the total level of distraction given the filter
each supplies to the
getDistraction(BiFunction) method.
Copyright (c) 2026-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
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the level of distraction for the given direction.void
-
Constructor Details
-
DistractionField
Constructor.- Parameters:
gtu- GTU
-
-
Method Details
-
notify
- Specified by:
notifyin interfaceEventListener
-
getDistraction
public double getDistraction(BiFunction<RelativeLane, RoadSideDistraction, throws ParameterExceptionBoolean> filter) Returns the level of distraction for the given direction.- Parameters:
filter- filter to retain relevant distractions- Returns:
- level of distraction for the given direction
- Throws:
ParameterException- if parameter for lane structure is missing
-