Class CollisionDetector

java.lang.Object
org.opentrafficsim.road.gtu.lane.AbstractLaneBasedMoveChecker
org.opentrafficsim.road.gtu.lane.CollisionDetector
All Implemented Interfaces:
EventListener, EventListener, EventProducer

public class CollisionDetector extends AbstractLaneBasedMoveChecker implements EventProducer
Checks for collisions.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Field Details

    • COLLISION

      public static final EventType COLLISION
      Collision event.
  • Constructor Details

    • CollisionDetector

      public CollisionDetector(Network network)
      Constructor.
      Parameters:
      network - network
  • Method Details

    • checkMove

      public void checkMove(LaneBasedGtu gtu) throws Exception
      Description copied from class: AbstractLaneBasedMoveChecker
      Check the move of the given GTU.
      Specified by:
      checkMove in class AbstractLaneBasedMoveChecker
      Parameters:
      gtu - GTU.
      Throws:
      Exception - thrown when something is not all right
    • getEventListenerMap

      public EventListenerMap getEventListenerMap()
      Specified by:
      getEventListenerMap in interface EventProducer
    • logCollisions

      public CollisionDetector logCollisions()
      Logs collision with distance, speed difference and angle at info level.
      Returns:
      this collision detector for method chaining
    • stopCollided

      public CollisionDetector stopCollided()
      Stops the GTU and the object if it is a GTU.
      Returns:
      this collision detector for method chaining
    • throwException

      public CollisionDetector throwException()
      Throws an exception upon a collision.
      Returns:
      this collision detector for method chaining
    • destroyGtu

      public CollisionDetector destroyGtu()
      Destroys the GTU upon a collision.
      Returns:
      this collision detector for method chaining