Interface Perception<G extends Gtu>

  • Type Parameters:
    G - GTU type
    All Superinterfaces:
    Serializable
    All Known Implementing Classes:
    AbstractPerception

    public interface Perception<G extends Gtu>
    extends Serializable
    The perception module of a GTU. It is responsible for perceiving (sensing) the environment of the GTU, which includes the locations of other GTUs. Perception is done at a certain time, and the perceived information might have a limited validity.

    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 15, 2015
    Author:
    Alexander Verbraeck, Peter Knoppers
    • Method Detail

      • perceive

        void perceive()
               throws GtuException,
                      NetworkException,
                      ParameterException
        Invoked by the GTU prior while determining an operational plan. If the implementation works in-sync with the tactical planner, this method is used to update perceived information. It is however possible for the implementation to ignore this and have fully autonomous perception.
        Throws:
        GtuException - when GTU has not been properly initialized.
        NetworkException - in case of inconsistencies in the network during perception calculations.
        ParameterException - in case of a parameter error.
      • getEgoGtu

        G getEgoGtu()
             throws GtuException
        Return the perceiving GTU.
        Returns:
        G; the GTU of this perception
        Throws:
        GtuException - if the GTU has not been initialized
      • addPerceptionCategory

        <T extends PerceptionCategory<?,​?>> void addPerceptionCategory​(T perceptionCategory)
        Adds a perception category to the perception.
        Type Parameters:
        T - perception category type
        Parameters:
        perceptionCategory - T; perception category to add
      • contains

        <T extends PerceptionCategory<?,​?>> boolean contains​(Class<T> category)
        Returns whether the given perception category is present in this Perception.
        Type Parameters:
        T - perception category
        Parameters:
        category - Class<T>; perception category class
        Returns:
        boolean; true if the given perception category is present; false if the given perception category is not present
      • getPerceptionCategory

        <T extends PerceptionCategory<?,​?>> T getPerceptionCategory​(Class<T> category)
                                                                   throws OperationalPlanException
        Returns the given perception category.
        Type Parameters:
        T - perception category
        Parameters:
        category - Class<T>; perception category class
        Returns:
        T; the given perception category
        Throws:
        OperationalPlanException - if the perception category is not present
      • getPerceptionCategoryOrNull

        <T extends PerceptionCategory<?,​?>> T getPerceptionCategoryOrNull​(Class<T> category)
        Returns the given perception category, or null if not present.
        Type Parameters:
        T - perception category
        Parameters:
        category - Class<T>; perception category class
        Returns:
        T; the given perception category
      • removePerceptionCategory

        void removePerceptionCategory​(PerceptionCategory<?,​?> perceptionCategory)
        Remove a perception category. TODO should this throw an exception if the perception category is not among the current set?
        Parameters:
        perceptionCategory - PerceptionCategory<?,?>; perception category to remove