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.DirectNeighborsPerception;
16 import org.opentrafficsim.road.gtu.lane.perception.categories.HeadwayGtuType;
17
18
19
20
21
22
23
24
25
26
27
28
29 public class DefaultLMRSPerceptionFactory implements PerceptionFactory
30 {
31
32
33 @Override
34 public LanePerception generatePerception(final LaneBasedGTU gtu)
35 {
36 LanePerception perception = new CategoricalLanePerception(gtu);
37 perception.addPerceptionCategory(new DirectEgoPerception(perception));
38 perception.addPerceptionCategory(new DirectInfrastructurePerception(perception));
39 perception.addPerceptionCategory(new DirectNeighborsPerception(perception, HeadwayGtuType.WRAP));
40 perception.addPerceptionCategory(new AnticipationTrafficPerception(perception));
41 perception.addPerceptionCategory(new DirectIntersectionPerception(perception, HeadwayGtuType.WRAP));
42 return perception;
43 }
44
45
46 @Override
47 public Parameters getParameters() throws ParameterException
48 {
49 return new ParameterSet().setDefaultParameter(ParameterTypes.LOOKAHEAD).setDefaultParameter(ParameterTypes.LOOKBACKOLD)
50 .setDefaultParameter(ParameterTypes.PERCEPTION).setDefaultParameter(ParameterTypes.LOOKBACK);
51 }
52
53 }