View Javadoc
1   package org.opentrafficsim.road.gtu.lane.perception;
2   
3   import org.opentrafficsim.core.gtu.GTUException;
4   import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterException;
5   import org.opentrafficsim.core.gtu.perception.Perception;
6   import org.opentrafficsim.core.network.NetworkException;
7   
8   /**
9    * The perception module of a GTU based on lanes. It is responsible for perceiving (sensing) the environment of the GTU, which
10   * includes the locations of other GTUs. Perception is done at a certain time, and the perceived information might have a
11   * limited validity. In that sense, Perception is stateful. Information can be requested as often as needed, but will only be
12   * recalculated when asked explicitly. This "Full" version of LanePerception will perceive all information at once when
13   * perceive() is called. <br>
14   * Perception for lane-based GTUs involves information about GTUs in front of the owner GTU on the same lane (the 'leader' GTU),
15   * parallel vehicles (important if we want to change lanes), distance to other vehicles on parallel lanes, as well in front as
16   * to the back (important if we want to change lanes), and information about obstacles, traffic lights, speed signs, and ending
17   * lanes.
18   * <p>
19   * Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
20   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
21   * </p>
22   * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
23   * initial version Nov 15, 2015 <br>
24   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
25   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
26   */
27  public class LanePerceptionFull extends AbstractLanePerception implements Perception
28  {
29      /** */
30      private static final long serialVersionUID = 20151128L;
31  
32      /**
33       * Create a new LanePerceptionFull module. Because the constructor is often called inside the constructor of a GTU, this
34       * constructor does not ask for the pointer to the GTU, as it is often impossible to provide at the time of construction.
35       * Use the setter of the GTU instead.
36       */
37      public LanePerceptionFull()
38      {
39          super();
40      }
41  
42      /** {@inheritDoc} */
43      @Override
44      public final void perceive() throws GTUException, NetworkException, ParameterException
45      {
46          updateSpeedLimit();
47          updateForwardHeadway();
48          updateBackwardHeadway();
49          updateAccessibleAdjacentLanesLeft();
50          updateAccessibleAdjacentLanesRight();
51          updateParallelHeadwaysLeft();
52          updateParallelHeadwaysRight();
53          updateLaneTrafficLeft();
54          updateLaneTrafficRight();
55      }
56  
57      /** {@inheritDoc} */
58      @Override
59      public final String toString()
60      {
61          return "LanePerceptionFull []";
62      }
63  
64  }