Class AbstractPerception<G extends Gtu>

    • Constructor Detail

      • AbstractPerception

        public AbstractPerception​(G egoGtu)
        Construct a new AbstractPerception.
        Parameters:
        egoGtu - G; the perceiving GTU
    • Method Detail

      • getEgoGtu

        public G getEgoGtu()
        Return the perceiving GTU.
        Specified by:
        getEgoGtu in interface Perception<G extends Gtu>
        Returns:
        G; the GTU of this perception
      • addPerceptionCategory

        public final <T extends PerceptionCategory<?,​?>> void addPerceptionCategory​(T perceptionCategory)
        Adds a perception category to the perception.
        Specified by:
        addPerceptionCategory in interface Perception<G extends Gtu>
        Type Parameters:
        T - perception category type
        Parameters:
        perceptionCategory - T; perception category to add
      • contains

        public final <T extends PerceptionCategory<?,​?>> boolean contains​(Class<T> category)
        Returns whether the given perception category is present in this Perception.
        Specified by:
        contains in interface Perception<G extends Gtu>
        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
      • getPerceptionCategoryOrNull

        public final <T extends PerceptionCategory<?,​?>> T getPerceptionCategoryOrNull​(Class<T> category)
        Returns the given perception category, or null if not present.
        Specified by:
        getPerceptionCategoryOrNull in interface Perception<G extends Gtu>
        Type Parameters:
        T - perception category
        Parameters:
        category - Class<T>; perception category class
        Returns:
        T; the given perception category
      • removePerceptionCategory

        public final void removePerceptionCategory​(PerceptionCategory<?,​?> perceptionCategory)
        Remove a perception category. TODO should this throw an exception if the perception category is not among the current set?
        Specified by:
        removePerceptionCategory in interface Perception<G extends Gtu>
        Parameters:
        perceptionCategory - PerceptionCategory<?,?>; perception category to remove
      • perceive

        public 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.
        Specified by:
        perceive in interface Perception<G extends Gtu>
        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.