Rev 1565 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1559 | - | 1 | package dongfang.mkt.frames; |
2 | |||
1563 | - | 3 | import dongfang.mkt.datatype.GPSBearingAndRange; |
4 | import dongfang.mkt.datatype.GPSPosition; |
||
5 | |||
1559 | - | 6 | public class OSDDataResponseFrame extends ResponseFrame { |
7 | |||
8 | private int version; |
||
9 | private GPSPosition currentPosition; |
||
10 | private GPSPosition targetPosition; |
||
1563 | - | 11 | private GPSBearingAndRange currentToTarget; |
1559 | - | 12 | private GPSPosition homePosition; |
1563 | - | 13 | private GPSBearingAndRange currentToHome; |
1559 | - | 14 | |
15 | private int waypointIndex; |
||
16 | private int waypointCount; |
||
17 | |||
18 | private int numberOfSatellites; |
||
1565 | - | 19 | private double heightByPressure; // in m. |
1568 | - | 20 | private double verticalVelocityByPressure; // 16 bit signed. |
1559 | - | 21 | |
22 | private int flightTime; // in secs. 16 bit unsigned. |
||
23 | private int batteryVoltage; // in 0.1 volts. |
||
24 | |||
1568 | - | 25 | private double groundSpeed; // in m/s. 16 bit unsigned. |
1562 | - | 26 | private int directionOfFlight; // of movement. 16 bit signed. |
1559 | - | 27 | private int compassHeading;// 16 bit signed. |
28 | |||
29 | private int pitchAngle; |
||
30 | private int rollAngle; |
||
31 | |||
32 | private int rcQuality; |
||
33 | private int fcFlags; |
||
34 | private int ncFlags; |
||
35 | private int errorCode; |
||
36 | |||
37 | private int operatingRadius; |
||
1568 | - | 38 | private double verticalVelocityByGPS; // 16 bit signed. |
1559 | - | 39 | |
40 | private int targetLoiterTime; |
||
41 | private int fcFlags2; |
||
1565 | - | 42 | private double setpointForAltitude; // in m. |
1559 | - | 43 | |
44 | private int throttle; |
||
45 | private int current; // 16 bit unsigned. |
||
46 | private int capacityUsed; // 16 bit unsigned. |
||
47 | |||
48 | public OSDDataResponseFrame(int address) { |
||
49 | super(address); |
||
50 | } |
||
51 | |||
52 | public int getVersion() { |
||
53 | return version; |
||
54 | } |
||
55 | public GPSPosition getCurrentPosition() { |
||
56 | return currentPosition; |
||
57 | } |
||
58 | public GPSPosition getTargetPosition() { |
||
59 | return targetPosition; |
||
60 | } |
||
1563 | - | 61 | public GPSBearingAndRange getCurrentToTarget() { |
1559 | - | 62 | return currentToTarget; |
63 | } |
||
64 | public GPSPosition getHomePosition() { |
||
65 | return homePosition; |
||
66 | } |
||
1563 | - | 67 | public GPSBearingAndRange getCurrentToHome() { |
1559 | - | 68 | return currentToHome; |
69 | } |
||
70 | public int getWaypointIndex() { |
||
71 | return waypointIndex; |
||
72 | } |
||
73 | public int getWaypointCount() { |
||
74 | return waypointCount; |
||
75 | } |
||
76 | public int getNumberOfSatellites() { |
||
77 | return numberOfSatellites; |
||
78 | } |
||
1565 | - | 79 | public double getHeightByPressure() { |
1559 | - | 80 | return heightByPressure; |
81 | } |
||
1568 | - | 82 | public double getVerticalVelocityByPressure() { |
1559 | - | 83 | return verticalVelocityByPressure; |
84 | } |
||
85 | public int getFlightTime() { |
||
86 | return flightTime; |
||
87 | } |
||
88 | public int getBatteryVoltage() { |
||
89 | return batteryVoltage; |
||
90 | } |
||
1568 | - | 91 | public double getGroundSpeed() { |
1559 | - | 92 | return groundSpeed; |
93 | } |
||
1562 | - | 94 | public int getDirectionOfFlight() { |
95 | return directionOfFlight; |
||
1559 | - | 96 | } |
97 | public int getCompassHeading() { |
||
98 | return compassHeading; |
||
99 | } |
||
100 | public int getPitchAngle() { |
||
101 | return pitchAngle; |
||
102 | } |
||
103 | public int getRollAngle() { |
||
104 | return rollAngle; |
||
105 | } |
||
106 | public int getRcQuality() { |
||
107 | return rcQuality; |
||
108 | } |
||
109 | public int getFcFlags() { |
||
110 | return fcFlags; |
||
111 | } |
||
112 | public int getNcFlags() { |
||
113 | return ncFlags; |
||
114 | } |
||
115 | public int getErrorCode() { |
||
116 | return errorCode; |
||
117 | } |
||
118 | public int getOperatingRadius() { |
||
119 | return operatingRadius; |
||
120 | } |
||
1568 | - | 121 | public double getVerticalVelocityByGPS() { |
1559 | - | 122 | return verticalVelocityByGPS; |
123 | } |
||
124 | public int getTargetLoiterTime() { |
||
125 | return targetLoiterTime; |
||
126 | } |
||
127 | public int getFcFlags2() { |
||
128 | return fcFlags2; |
||
129 | } |
||
1565 | - | 130 | public double getSetpointForAltitude() { |
1559 | - | 131 | return setpointForAltitude; |
132 | } |
||
133 | public int getThrottle() { |
||
134 | return throttle; |
||
135 | } |
||
136 | public int getCurrent() { |
||
137 | return current; |
||
138 | } |
||
139 | public int getCapacityUsed() { |
||
140 | return capacityUsed; |
||
141 | } |
||
142 | public void setVersion(int version) { |
||
143 | this.version = version; |
||
144 | } |
||
145 | public void setCurrentPosition(GPSPosition currentPosition) { |
||
146 | this.currentPosition = currentPosition; |
||
147 | } |
||
148 | public void setTargetPosition(GPSPosition targetPosition) { |
||
149 | this.targetPosition = targetPosition; |
||
150 | } |
||
1563 | - | 151 | public void setCurrentToTarget(GPSBearingAndRange currentToTarget) { |
1559 | - | 152 | this.currentToTarget = currentToTarget; |
153 | } |
||
154 | public void setHomePosition(GPSPosition homePosition) { |
||
155 | this.homePosition = homePosition; |
||
156 | } |
||
1563 | - | 157 | public void setCurrentToHome(GPSBearingAndRange currentToHome) { |
1559 | - | 158 | this.currentToHome = currentToHome; |
159 | } |
||
160 | public void setWaypointIndex(int waypointIndex) { |
||
161 | this.waypointIndex = waypointIndex; |
||
162 | } |
||
163 | public void setWaypointCount(int waypointCount) { |
||
164 | this.waypointCount = waypointCount; |
||
165 | } |
||
166 | public void setNumberOfSatellites(int numberOfSatellites) { |
||
167 | this.numberOfSatellites = numberOfSatellites; |
||
168 | } |
||
1565 | - | 169 | public void _setHeightByPressure(double heightByPressure) { |
1559 | - | 170 | this.heightByPressure = heightByPressure; |
171 | } |
||
1568 | - | 172 | public void setVerticalVelocityByPressure(double verticalVelocityByPressure) { |
1559 | - | 173 | this.verticalVelocityByPressure = verticalVelocityByPressure; |
174 | } |
||
175 | public void setFlightTime(int flightTime) { |
||
176 | this.flightTime = flightTime; |
||
177 | } |
||
178 | public void setBatteryVoltage(int batteryVoltage) { |
||
179 | this.batteryVoltage = batteryVoltage; |
||
180 | } |
||
1568 | - | 181 | public void setGroundSpeed(double groundSpeed) { |
1559 | - | 182 | this.groundSpeed = groundSpeed; |
183 | } |
||
1562 | - | 184 | public void setDirectionOfFlight(int heading) { |
185 | this.directionOfFlight = heading; |
||
1559 | - | 186 | } |
187 | public void setCompassHeading(int compassHeading) { |
||
188 | this.compassHeading = compassHeading; |
||
189 | } |
||
190 | public void setPitchAngle(int pitchAngle) { |
||
191 | this.pitchAngle = pitchAngle; |
||
192 | } |
||
193 | public void setRollAngle(int rollAngle) { |
||
194 | this.rollAngle = rollAngle; |
||
195 | } |
||
196 | public void setRcQuality(int rcQuality) { |
||
197 | this.rcQuality = rcQuality; |
||
198 | } |
||
199 | public void setFcFlags(int fcFlags) { |
||
200 | this.fcFlags = fcFlags; |
||
201 | } |
||
202 | public void setNcFlags(int ncFlags) { |
||
203 | this.ncFlags = ncFlags; |
||
204 | } |
||
205 | public void setErrorCode(int errorCode) { |
||
206 | this.errorCode = errorCode; |
||
207 | } |
||
208 | public void setOperatingRadius(int operatingRadius) { |
||
209 | this.operatingRadius = operatingRadius; |
||
210 | } |
||
1568 | - | 211 | public void setVerticalVelocityByGPS(double verticalVelocityByGPS) { |
1559 | - | 212 | this.verticalVelocityByGPS = verticalVelocityByGPS; |
213 | } |
||
214 | public void setTargetLoiterTime(int targetLoiterTime) { |
||
215 | this.targetLoiterTime = targetLoiterTime; |
||
216 | } |
||
217 | public void setFcFlags2(int fcFlags2) { |
||
218 | this.fcFlags2 = fcFlags2; |
||
219 | } |
||
1565 | - | 220 | public void setSetpointForAltitude(double setpointForAltitude) { |
1559 | - | 221 | this.setpointForAltitude = setpointForAltitude; |
222 | } |
||
223 | public void setThrottle(int throttle) { |
||
224 | this.throttle = throttle; |
||
225 | } |
||
226 | public void setCurrent(int current) { |
||
227 | this.current = current; |
||
228 | } |
||
229 | public void setCapacityUsed(int capacityUsed) { |
||
230 | this.capacityUsed = capacityUsed; |
||
231 | } |
||
1562 | - | 232 | |
233 | @Override |
||
234 | public boolean isResponseTo(RequestFrame r) { |
||
235 | return r instanceof OSDDataRequestFrame; |
||
236 | } |
||
237 | |||
238 | public String toString() { |
||
239 | StringBuilder result = new StringBuilder(); |
||
240 | result.append("OSDData version=" + this.version + "\n"); |
||
241 | result.append("currentPosition: " + this.currentPosition + "\n"); |
||
242 | result.append("targetPosition: " + this.targetPosition + " (" + this.currentToTarget + ")" + "\n"); |
||
243 | result.append("homePosition: " + this.homePosition + " (" + this.currentToHome + ")" + "\n"); |
||
244 | result.append("heightByPressure: " + this.heightByPressure + "\n"); |
||
1564 | - | 245 | result.append("heightByPressureReal: " + this.heightByPressure / 1.26 + "\n"); |
1562 | - | 246 | result.append("verticalVelocityByPressure: " + this.verticalVelocityByPressure + "\n"); |
247 | result.append("verticalVelocityByGPS: " + this.verticalVelocityByGPS + "\n"); |
||
248 | result.append("direction of flight: " + this.directionOfFlight + "\n"); |
||
249 | result.append("compassHeading: " + this.compassHeading + "\n"); |
||
250 | result.append("pitchAngle: " + this.pitchAngle + "\n"); |
||
251 | result.append("rollAngle: " + this.rollAngle + "\n"); |
||
252 | result.append("battery voltage: " + ((double)this.batteryVoltage)/10 + "\n"); |
||
253 | result.append("throttle: " + this.throttle + "\n"); |
||
254 | return result.toString(); |
||
255 | } |
||
1559 | - | 256 | } |
257 |