1 package simworldobjects;
2
3 import interfaces.*;
4
5
16 public abstract class SimSensor implements SimObject
17 {
18 private SimObject object;
20
21 private double xOffset, zOffset;
22 private double height, width, length;
23 private String type;
24
25
28 public void initSimSensor(SimObject object, double xOffset, double zOffset, double height, double width, double length, String type)
29 {
30 this.object=object;
31 this.xOffset=xOffset;
32 this.zOffset=zOffset;
33 this.height=height;
34 this.width=width;
35 this.length=length;
36 this.type=type;
37 }
38
39
44 public abstract int getValue();
45
46 public void setDesiredVelocity(double v){}
47 public void setActualVelocity(double v){}
48 public void setXCoord(double x){}
49 public void setYCoord(double y){}
50 public void setZCoord(double z){}
51
52 public double getDesiredVelocity()
53 {
54 return 0.0;
55 }
56
57 public double getActualVelocity()
58 {
59 return 0.0;
60 }
61
62
65 public double getXCoord()
66 {
67 return object.getXCoord()+
68 (xOffset*Math.cos(Math.toRadians(object.getActualBearingXZ())))+
69 (zOffset*-Math.sin(Math.toRadians(object.getActualBearingXZ())));
70 }
71
72
75 public double getYCoord()
76 {
77 return 0.0;
78 }
79
80
83 public double getZCoord()
84 {
85 return object.getZCoord()+
86 (zOffset*Math.cos(Math.toRadians(object.getActualBearingXZ())))+
87 (xOffset*Math.sin(Math.toRadians(object.getActualBearingXZ())));
88 }
89
90 public void setDesiredBearingVelocityXZ(double v){}
91 public void setDesiredBearingVelocityXY(double v){}
92 public void setActualBearingVelocityXZ(double b){}
93 public void setActualBearingVelocityXY(double b){}
94 public void setActualBearingXZ(double b){}
95 public void setActualBearingXY(double b){}
96
97 public double getDesiredBearingVelocityXZ()
98 {
99 return 0.0;
100 }
101
102 public double getDesiredBearingVelocityXY()
103 {
104 return 0.0;
105 }
106
107 public double getActualBearingVelocityXZ()
108 {
109 return 0.0;
110 }
111
112 public double getActualBearingVelocityXY()
113 {
114 return 0.0;
115 }
116
117
120 public double getActualBearingXZ()
121 {
122 return object.getActualBearingXZ();
123 }
124
125 public double getActualBearingXY()
126 {
127 return 0.0;
128 }
129
130 public double getHeight()
131 {
132 return this.height;
133 }
134
135 public double getWidth()
136 {
137 return this.width;
138 }
139
140 public double getLength()
141 {
142 return this.length;
143 }
144
145 public String getType()
146 {
147 return this.type;
148 }
149 }
150