EgoPerception.java

  1. package org.opentrafficsim.core.gtu.perception;

  2. import org.djunits.value.vdouble.scalar.Acceleration;
  3. import org.djunits.value.vdouble.scalar.Length;
  4. import org.djunits.value.vdouble.scalar.Speed;
  5. import org.opentrafficsim.base.parameters.ParameterException;
  6. import org.opentrafficsim.core.gtu.GTU;
  7. import org.opentrafficsim.core.gtu.GTUException;
  8. import org.opentrafficsim.core.network.NetworkException;

  9. /**
  10.  * Ego perception interface.
  11.  * <p>
  12.  * Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  13.  * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
  14.  * <p>
  15.  * @version $Revision$, $LastChangedDate$, by $Author$, initial version 13 feb. 2017 <br>
  16.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  17.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  18.  * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
  19.  * @param <G> GTU type
  20.  * @param <P> perception type
  21.  */
  22. public interface EgoPerception<G extends GTU, P extends Perception<G>> extends PerceptionCategory<G, P>
  23. {

  24.     /**
  25.      * Update speed.
  26.      * @throws GTUException if the GTU has not been initialized
  27.      */
  28.     void updateSpeed() throws GTUException;

  29.     /**
  30.      * Update acceleration.
  31.      * @throws GTUException if the GTU has not been initialized
  32.      */
  33.     void updateAcceleration() throws GTUException;

  34.     /**
  35.      * Update length.
  36.      * @throws GTUException if the GTU has not been initialized
  37.      */
  38.     void updateLength() throws GTUException;

  39.     /**
  40.      * Update width.
  41.      * @throws GTUException if the GTU has not been initialized
  42.      */
  43.     void updateWidth() throws GTUException;

  44.     /**
  45.      * Returns the acceleration.
  46.      * @return acceleration
  47.      */
  48.     Acceleration getAcceleration();

  49.     /**
  50.      * Returns the speed.
  51.      * @return speed
  52.      */
  53.     Speed getSpeed();

  54.     /**
  55.      * Returns the length.
  56.      * @return length
  57.      */
  58.     Length getLength();

  59.     /**
  60.      * Returns the width.
  61.      * @return width
  62.      */
  63.     Length getWidth();

  64.     /** {@inheritDoc} */
  65.     @Override
  66.     default void updateAll() throws GTUException, NetworkException, ParameterException
  67.     {
  68.         updateSpeed();
  69.         updateAcceleration();
  70.         updateLength();
  71.         updateWidth();
  72.     }

  73. }