1 package org.opentrafficsim.road.gtu.lane.tactical.lmrs;
2
3 import org.opentrafficsim.base.parameters.ParameterException;
4 import org.opentrafficsim.base.parameters.ParameterSet;
5 import org.opentrafficsim.base.parameters.ParameterTypes;
6 import org.opentrafficsim.base.parameters.Parameters;
7 import org.opentrafficsim.core.gtu.perception.DirectEgoPerception;
8 import org.opentrafficsim.road.gtu.lane.LaneBasedGtu;
9 import org.opentrafficsim.road.gtu.lane.perception.CategoricalLanePerception;
10 import org.opentrafficsim.road.gtu.lane.perception.LanePerception;
11 import org.opentrafficsim.road.gtu.lane.perception.PerceptionFactory;
12 import org.opentrafficsim.road.gtu.lane.perception.categories.AnticipationTrafficPerception;
13 import org.opentrafficsim.road.gtu.lane.perception.categories.DirectInfrastructurePerception;
14 import org.opentrafficsim.road.gtu.lane.perception.categories.DirectIntersectionPerception;
15 import org.opentrafficsim.road.gtu.lane.perception.categories.neighbors.DirectNeighborsPerception;
16 import org.opentrafficsim.road.gtu.lane.perception.categories.neighbors.HeadwayGtuType;
17
18
19
20
21
22
23
24
25
26
27
28 public class DefaultLmrsPerceptionFactory implements PerceptionFactory
29 {
30
31
32 @Override
33 public LanePerception generatePerception(final LaneBasedGtu gtu)
34 {
35 LanePerception perception = new CategoricalLanePerception(gtu);
36 perception.addPerceptionCategory(new DirectEgoPerception<>(perception));
37 perception.addPerceptionCategory(new DirectInfrastructurePerception(perception));
38 perception.addPerceptionCategory(new DirectNeighborsPerception(perception, HeadwayGtuType.WRAP));
39 perception.addPerceptionCategory(new AnticipationTrafficPerception(perception));
40 perception.addPerceptionCategory(new DirectIntersectionPerception(perception, HeadwayGtuType.WRAP));
41 return perception;
42 }
43
44
45 @Override
46 public Parameters getParameters() throws ParameterException
47 {
48 return new ParameterSet().setDefaultParameter(ParameterTypes.LOOKAHEAD).setDefaultParameter(ParameterTypes.LOOKBACKOLD)
49 .setDefaultParameter(ParameterTypes.PERCEPTION).setDefaultParameter(ParameterTypes.LOOKBACK);
50 }
51
52 }