Interface LaneBasedGtu

    • Field Detail

      • LANEBASED_INIT_EVENT

        static final TimedEventType LANEBASED_INIT_EVENT
        The lane-based event type for pub/sub indicating the initialization of a new GTU.
        Payload: [String gtuId, PositionVector initialPosition, Direction initialDirection, Length length, Length width, String linkId, String laneId, Length positionOnReferenceLane, GTUDirectionality direction, GTUType gtuType]
      • LANEBASED_MOVE_EVENT

        static final TimedEventType LANEBASED_MOVE_EVENT
        The lane-based event type for pub/sub indicating a move.
        Payload: [String gtuId, PositionVector currentPosition, Direction currentDirection, Speed speed, Acceleration acceleration, TurnIndicatorStatus turnIndicatorStatus, Length odometer, Link id of referenceLane, Lane id of referenceLane, Length positionOnReferenceLane, GTUDirectionality direction]
      • LANEBASED_DESTROY_EVENT

        static final TimedEventType LANEBASED_DESTROY_EVENT
        The lane-based event type for pub/sub indicating destruction of the GTU.
        Payload: [String gtuId, PositionVector finalPosition, Direction finalDirection, Length finalOdometer, Link referenceLink, Lane referenceLane, Length positionOnReferenceLane, GTUDirectionality direction]
      • LANE_ENTER_EVENT

        @Deprecated
        static final EventType LANE_ENTER_EVENT
        Deprecated.
        The event type for pub/sub indicating that the GTU entered a new lane (with the FRONT position if driving forward; REAR if driving backward).
        Payload: [String gtuId, String link id, String lane id]
      • LANE_EXIT_EVENT

        @Deprecated
        static final EventType LANE_EXIT_EVENT
        Deprecated.
        The event type for pub/sub indicating that the GTU exited a lane (with the REAR position if driving forward; FRONT if driving backward).
        Payload: [String gtuId, String link id, String lane id]
      • LANE_CHANGE_EVENT

        static final TimedEventType LANE_CHANGE_EVENT
        The event type for pub/sub indicating that the GTU change lane.
        Payload: [String gtuId, LateralDirectionality direction, DirectedLanePosition from]
    • Method Detail

      • getNetwork

        RoadNetwork getNetwork()
        Returns:
        the road network to which the LaneBasedGTU belongs
      • getProjectedLength

        default Length getProjectedLength​(Lane lane)
                                   throws GtuException
        Get projected length on the lane.
        Parameters:
        lane - Lane; lane to project the vehicle on
        Returns:
        Length; the length on the lane, which is different from the actual length during deviative tactical plans
        Throws:
        GtuException - when the vehicle is not on the given lane
      • positions

        Map<Lane,​Length> positions​(RelativePosition relativePosition)
                                  throws GtuException
        Return the longitudinal positions of a point relative to this GTU, relative to the center line of the Lanes in which the vehicle is registered.
        Note: If a GTU is registered in multiple parallel lanes, the lateralLaneChangeModel is used to determine the center line of the vehicle at this point in time. Otherwise, the average of the center positions of the lines will be taken.
        Parameters:
        relativePosition - RelativePosition; the position on the vehicle relative to the reference point.
        Returns:
        the lanes and the position on the lanes where the GTU is currently registered, for the given position of the GTU.
        Throws:
        GtuException - when the vehicle is not on one of the lanes on which it is registered.
      • position

        Length position​(Lane lane,
                        RelativePosition relativePosition)
                 throws GtuException
        Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane at the current simulation time.
        Parameters:
        lane - Lane; the position on this lane will be returned.
        relativePosition - RelativePosition; the position on the vehicle relative to the reference point.
        Returns:
        DoubleScalarAbs<LengthUnit>; the position, relative to the center line of the Lane.
        Throws:
        GtuException - when the vehicle is not on the given lane.
      • fractionalPositions

        Map<Lane,​Double> fractionalPositions​(RelativePosition relativePosition)
                                            throws GtuException
        Return the longitudinal positions of a point relative to this GTU, relative to the center line of the Lanes in which the vehicle is registered, as fractions of the length of the lane. This is important when we want to see if two vehicles are next to each other and we compare an 'inner' and 'outer' curve.
        Parameters:
        relativePosition - RelativePosition; the position on the vehicle relative to the reference point.
        Returns:
        the lanes and the position on the lanes where the GTU is currently registered, for the given position of the GTU.
        Throws:
        GtuException - when the vehicle is not on one of the lanes on which it is registered.
      • fractionalPosition

        double fractionalPosition​(Lane lane,
                                  RelativePosition relativePosition)
                           throws GtuException
        Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane, as a fraction of the length of the lane. This is important when we want to see if two vehicles are next to each other and we compare an 'inner' and 'outer' curve.
        Parameters:
        lane - Lane; the position on this lane will be returned.
        relativePosition - RelativePosition; the position on the vehicle relative to the reference point.
        Returns:
        the fractional relative position on the lane at the given time.
        Throws:
        GtuException - when the vehicle is not on the given lane.
      • getReferencePosition

        DirectedLanePosition getReferencePosition()
                                           throws GtuException
        Return the current Lane, position and directionality of the GTU.
        Returns:
        DirectedLanePosition; the current Lane, position and directionality of the GTU
        Throws:
        GtuException - in case the reference position of the GTU cannot be found on the lanes in its current path
      • getDirection

        GtuDirectionality getDirection​(Lane lane)
                                throws GtuException
        Return the directionality of a lane on which the GTU is registered for its current operational plan.
        Parameters:
        lane - Lane; the lane for which we want to know the direction
        Returns:
        GTUDirectionality; the direction on the given lane
        Throws:
        GtuException - in case the GTU is not registered on the Lane
      • isBrakingLightsOn

        default boolean isBrakingLightsOn()
        The default implementation returns true if the deceleration is larger than a speed-dependent threshold given by:

        c0 * g(v) + c1 + c3*v^2

        where c0 = 0.2, c1 = 0.15 and c3 = 0.00025 (with c2 = 0 implicit) are empirically derived averages, and g(v) is 0 below 25 km/h or 1 otherwise, representing that the engine is disengaged at low speeds.
        Returns:
        boolean; whether the braking lights are on
      • getLateralPosition

        Length getLateralPosition​(Lane lane)
                           throws GtuException
        Returns the lateral position of the GTU relative to the lane center line. Negative values are towards the right.
        Parameters:
        lane - Lane; lane to consider (most important regarding left/right, not upstream downstream)
        Returns:
        Length; lateral position of the GTU relative to the lane center line
        Throws:
        GtuException - when the vehicle is not on the given lane.
      • getTurnIndicatorStatus

        TurnIndicatorStatus getTurnIndicatorStatus()
        Returns:
        the status of the turn indicator