Class AbstractLaneBasedTacticalPlanner

java.lang.Object
org.opentrafficsim.road.gtu.lane.tactical.AbstractLaneBasedTacticalPlanner
All Implemented Interfaces:
java.io.Serializable, TacticalPlanner<LaneBasedGTU,​LanePerception>, LaneBasedTacticalPlanner
Direct Known Subclasses:
AbstractIncentivesTacticalPlanner, LaneBasedCFLCTacticalPlanner, LaneBasedGTUFollowingDirectedChangeTacticalPlanner, LaneBasedGTUFollowingTacticalPlanner, SteeringLmrs, Toledo

public abstract class AbstractLaneBasedTacticalPlanner
extends java.lang.Object
implements LaneBasedTacticalPlanner, java.io.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.
BSD-style license. See OpenTrafficSim License.

$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Nov 25, 2015
Author:
Alexander Verbraeck, Peter Knoppers
See Also:
Serialized Form
  • Field Details

  • Constructor Details

  • Method Details

    • getGtu

      public final LaneBasedGTU getGtu()
      Specified by:
      getGtu in interface TacticalPlanner<LaneBasedGTU,​LanePerception>
    • buildLanePathInfo

      public static LanePathInfo buildLanePathInfo​(LaneBasedGTU gtu, Length maxHeadway) throws GTUException, NetworkException
      Build a list of lanes forward, with a maximum headway relative to the reference point of the GTU.
      Parameters:
      gtu - LaneBasedGTU; the GTU for which to calculate the lane list
      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 registered
      NetworkException - when the strategic planner is not able to return a next node in the route
    • buildLanePathInfo

      public static LanePathInfo buildLanePathInfo​(LaneBasedGTU gtu, 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.
      Parameters:
      gtu - LaneBasedGTU; the GTU for which to calculate the lane list
      maxHeadway - Length; the maximum length for which lanes should be returned
      startLane - Lane; the lane in which the path starts
      position - Length; the position on the start lane
      startDirectionality - 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 registered
      NetworkException - when the strategic planner is not able to return a next node in the route
      GTUException - when the vehicle is not on one of the lanes on which it is registered
      NetworkException - when the strategic planner is not able to return a next node in the route
    • concatenateNull

      public static OTSLine3D concatenateNull​(OTSLine3D path, OTSLine3D centerLine) throws OTSGeometryException
      Concatenate two paths, where the first may be null.
      Parameters:
      path - OTSLine3D; path, may be null
      centerLine - OTSLine3D; center line of lane to add
      Returns:
      concatenated line
      Throws:
      OTSGeometryException - when lines are degenerate or too distant
    • determineNextSplit

      public static NextSplitInfo determineNextSplit​(LaneBasedGTU gtu, 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 (!).
      Parameters:
      gtu - LaneBasedGTU; the GTU for which to calculate the lane list
      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 registered
      NetworkException - when the strategic planner is not able to return a next node in the route
    • connectsToPath

      protected static boolean connectsToPath​(LaneBasedGTU gtu, 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:
      gtu - LaneBasedGTU; the GTU for which we have to determine the lane suitability
      maxHeadway - Length; the maximum length for use in the calculation
      startLane - Lane; the first lane in the list
      startLanePosition - Length; the position on the start lane
      startDirectionality - GTUDirectionality; the driving direction on the start lane
      linkAfterSplit - 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 registered
      NetworkException - when the strategic planner is not able to return a next node in the route
    • noLaneDrop

      protected static boolean noLaneDrop​(LaneBasedGTU gtu, 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:
      gtu - LaneBasedGTU; the GTU for which we have to determine the lane suitability
      maxHeadway - Length; the maximum length for use in the calculation
      startLane - Lane; the first lane in the list
      startLanePosition - Length; the position on the start lane
      startDirectionality - 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 registered
      NetworkException - when the strategic planner is not able to return a next node in the route
    • buildLinkListForward

      protected static java.util.List<LinkDirection> buildLinkListForward​(LaneBasedGTU gtu, 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:
      gtu - LaneBasedGTU; the GTU for which to calculate the link list
      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 registered
      NetworkException - 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:
      getCarFollowingModel in interface LaneBasedTacticalPlanner
      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:
      getPerception in interface TacticalPlanner<LaneBasedGTU,​LanePerception>