Class AbstractLaneBasedTacticalPlanner
- java.lang.Object
-
- org.opentrafficsim.road.gtu.lane.tactical.AbstractLaneBasedTacticalPlanner
-
- All Implemented Interfaces:
Serializable,TacticalPlanner<InternalLaneBasedGtu,LanePerception>,LaneBasedTacticalPlanner
- Direct Known Subclasses:
AbstractIncentivesTacticalPlanner,LaneBasedCFLCTacticalPlanner,LaneBasedGTUFollowingDirectedChangeTacticalPlanner,LaneBasedGTUFollowingTacticalPlanner,SteeringLmrs,Toledo
public abstract class AbstractLaneBasedTacticalPlanner extends Object implements LaneBasedTacticalPlanner, Serializable
A lane-based tactical planner generates an operational plan for the lane-based GTU. It can ask the strategic planner for assistance on the route to take when the network splits. This abstract class contains a number of helper methods that make it easy to implement a tactical planner.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Nov 25, 2015
BSD-style license. See OpenTrafficSim License.- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static ParameterTypeDurationDTTime step parameter type.protected static ParameterTypeLengthLOOKAHEADLook ahead parameter type.static ParameterTypeClass<LaneBasedTacticalPlanner>TACTICAL_PLANNERTactical planner parameter.
-
Constructor Summary
Constructors Constructor Description AbstractLaneBasedTacticalPlanner(CarFollowingModel carFollowingModel, InternalLaneBasedGtu gtu, LanePerception lanePerception)Instantiates a tactical planner.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LanePathInfobuildLanePathInfo(Length maxHeadway)Build a list of lanes forward, with a maximum headway relative to the reference point of the GTU.LanePathInfobuildLanePathInfo(Length maxHeadway, Lane startLane, Length position, GtuDirectionality startDirectionality)Build a list of lanes forward, with a maximum headway relative to the reference point of the GTU.protected List<LinkDirection>buildLinkListForward(Length maxHeadway)Make a list of links on which to drive next, with a maximum headway relative to the reference point of the GTU.static PolyLine3dconcatenateNull(PolyLine3d path, PolyLine3d centerLine)Concatenate two paths, where the first may benull.protected booleanconnectsToPath(Length maxHeadway, Lane startLane, Length startLanePosition, GtuDirectionality startDirectionality, Link linkAfterSplit)Determine whether the lane is directly connected to our route, in other words: if we would (continue to) drive on the given lane, can we take the right branch at the nextSplitNode without switching lanes?NextSplitInfodetermineNextSplit(Length maxHeadway)Calculate the next location where the network splits, with a maximum headway relative to the reference point of the GTU.CarFollowingModelgetCarFollowingModel()Returns the car-following model.InternalLaneBasedGtugetEgoGtu()LanePerceptiongetPerception()protected booleannoLaneDrop(Length maxHeadway, Lane startLane, Length startLanePosition, GtuDirectionality startDirectionality)Determine whether the lane does not drop, in other words: if we would (continue to) drive on the given lane, can we continue to drive at the nextSplitNode without switching lanes?voidsetCarFollowingModel(CarFollowingModel carFollowingModel)Sets the car-following model.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.LaneBasedTacticalPlanner
chooseLaneAtSplit, okDistance
-
Methods inherited from interface org.opentrafficsim.core.gtu.plan.tactical.TacticalPlanner
generateOperationalPlan
-
-
-
-
Field Detail
-
TACTICAL_PLANNER
public static final ParameterTypeClass<LaneBasedTacticalPlanner> TACTICAL_PLANNER
Tactical planner parameter.
-
LOOKAHEAD
protected static final ParameterTypeLength LOOKAHEAD
Look ahead parameter type.
-
DT
protected static final ParameterTypeDuration DT
Time step parameter type.
-
-
Constructor Detail
-
AbstractLaneBasedTacticalPlanner
public AbstractLaneBasedTacticalPlanner(CarFollowingModel carFollowingModel, InternalLaneBasedGtu gtu, LanePerception lanePerception)
Instantiates a tactical planner.- Parameters:
carFollowingModel- CarFollowingModel; car-following modelgtu- InternalLaneBasedGtu; GTUlanePerception- LanePerception; perception
-
-
Method Detail
-
getEgoGtu
public final InternalLaneBasedGtu getEgoGtu()
- Specified by:
getEgoGtuin interfaceTacticalPlanner<InternalLaneBasedGtu,LanePerception>
-
buildLanePathInfo
public LanePathInfo buildLanePathInfo(Length maxHeadway) throws GtuException, NetworkException
Build a list of lanes forward, with a maximum headway relative to the reference point of the GTU.- Specified by:
buildLanePathInfoin interfaceLaneBasedTacticalPlanner- Parameters:
maxHeadway- Length; the maximum length for which lanes should be returned- Returns:
- LanePathInfo; an instance that provides the following information for an operational plan: the lanes to follow, and the path to follow when staying on the same lane.
- Throws:
GtuException- when the vehicle is not on one of the lanes on which it is registeredNetworkException- when the strategic planner is not able to return a next node in the route
-
buildLanePathInfo
public LanePathInfo buildLanePathInfo(Length maxHeadway, Lane startLane, Length position, GtuDirectionality startDirectionality) throws GtuException, NetworkException
Build a list of lanes forward, with a maximum headway relative to the reference point of the GTU.- Specified by:
buildLanePathInfoin interfaceLaneBasedTacticalPlanner- Parameters:
maxHeadway- Length; the maximum length for which lanes should be returnedstartLane- Lane; the lane in which the path startsposition- Length; the position on the start lanestartDirectionality- GtuDirectionality; the driving direction on the start lane- Returns:
- LanePathInfo; an instance that provides the following information for an operational plan: the lanes to follow, and the path to follow when staying on the same lane.
- Throws:
GtuException- when the vehicle is not on one of the lanes on which it is registeredNetworkException- when the strategic planner is not able to return a next node in the route
-
concatenateNull
public static PolyLine3d concatenateNull(PolyLine3d path, PolyLine3d centerLine)
Concatenate two paths, where the first may benull.- Parameters:
path- PolyLine3d; path, may benullcenterLine- PolyLine3d; center line of lane to add- Returns:
- concatenated line
-
determineNextSplit
public NextSplitInfo determineNextSplit(Length maxHeadway) throws GtuException, NetworkException
Calculate the next location where the network splits, with a maximum headway relative to the reference point of the GTU. Note: a lane drop is also considered a split (!).- Specified by:
determineNextSplitin interfaceLaneBasedTacticalPlanner- Parameters:
maxHeadway- Length; the maximum length for which lanes should be returned- Returns:
- NextSplitInfo; an instance that provides the following information for an operational plan: whether the network splits, the node where it splits, and the current lanes that lead to the right node after the split node.
- Throws:
GtuException- when the vehicle is not on one of the lanes on which it is registeredNetworkException- when the strategic planner is not able to return a next node in the route
-
connectsToPath
protected boolean connectsToPath(Length maxHeadway, Lane startLane, Length startLanePosition, GtuDirectionality startDirectionality, Link linkAfterSplit) throws GtuException, NetworkException
Determine whether the lane is directly connected to our route, in other words: if we would (continue to) drive on the given lane, can we take the right branch at the nextSplitNode without switching lanes?- Parameters:
maxHeadway- Length; the maximum length for use in the calculationstartLane- Lane; the first lane in the liststartLanePosition- Length; the position on the start lanestartDirectionality- GtuDirectionality; the driving direction on the start lanelinkAfterSplit- Link; the link after the split to which we should connect- Returns:
- boolean; true if the lane (XXXXX which lane?) is connected to our path
- Throws:
GtuException- when the vehicle is not on one of the lanes on which it is registeredNetworkException- when the strategic planner is not able to return a next node in the route
-
noLaneDrop
protected boolean noLaneDrop(Length maxHeadway, Lane startLane, Length startLanePosition, GtuDirectionality startDirectionality) throws GtuException, NetworkException
Determine whether the lane does not drop, in other words: if we would (continue to) drive on the given lane, can we continue to drive at the nextSplitNode without switching lanes?- Parameters:
maxHeadway- Length; the maximum length for use in the calculationstartLane- Lane; the first lane in the liststartLanePosition- Length; the position on the start lanestartDirectionality- GtuDirectionality; the driving direction on the start lane- Returns:
- boolean; true if the lane (XXX which lane?) is connected to our path
- Throws:
GtuException- when the vehicle is not on one of the lanes on which it is registeredNetworkException- when the strategic planner is not able to return a next node in the route
-
buildLinkListForward
protected List<LinkDirection> buildLinkListForward(Length maxHeadway) throws GtuException, NetworkException
Make a list of links on which to drive next, with a maximum headway relative to the reference point of the GTU.- Parameters:
maxHeadway- Length; the maximum length for which links should be returned- Returns:
- List<LinkDirection>; a list of links on which to drive next
- Throws:
GtuException- when the vehicle is not on one of the lanes on which it is registeredNetworkException- when the strategic planner is not able to return a next node in the route
-
getCarFollowingModel
public final CarFollowingModel getCarFollowingModel()
Returns the car-following model.- Specified by:
getCarFollowingModelin interfaceLaneBasedTacticalPlanner- Returns:
- car following model
-
setCarFollowingModel
public final void setCarFollowingModel(CarFollowingModel carFollowingModel)
Sets the car-following model.- Parameters:
carFollowingModel- CarFollowingModel; Car-following model to set.
-
getPerception
public final LanePerception getPerception()
- Specified by:
getPerceptionin interfaceTacticalPlanner<InternalLaneBasedGtu,LanePerception>
-
-