2 * Copyright © 2010 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 import java.util.HashMap;
23 import altosui.AltosConvert;
24 import altosui.AltosRecord;
25 import altosui.AltosGPS;
28 * Telemetry data contents
33 * The telemetry data stream is a bit of a mess at present, with no consistent
34 * formatting. In particular, the GPS data is formatted for viewing instead of parsing.
35 * However, the key feature is that every telemetry line contains all of the information
36 * necessary to describe the current rocket state, including the calibration values
37 * for accelerometer and barometer.
41 * VERSION 2 CALL KB0G SERIAL 51 FLIGHT 2 RSSI -68 STATUS ff STATE pad 1001 \
42 * a: 16032 p: 21232 t: 20284 v: 25160 d: 204 m: 204 fa: 16038 ga: 16032 fv: 0 \
43 * fp: 21232 gp: 21230 a+: 16049 a-: 16304 GPS 0 sat unlocked SAT 1 15 30
47 * VERSION 2 CALL KB0G SERIAL 51 FLIGHT 2 RSSI -71 STATUS ff STATE pad 2504 \
48 * a: 16028 p: 21220 t: 20360 v: 25004 d: 208 m: 200 fa: 16031 ga: 16032 fv: 330 \
49 * fp: 21231 gp: 21230 a+: 16049 a-: 16304 \
50 * GPS 9 sat 2010-02-13 17:16:51 35°20.0803'N 106°45.2235'W 1790m \
51 * 0.00m/s(H) 0° 0.00m/s(V) 1.0(hdop) 0(herr) 0(verr) \
52 * SAT 10 29 30 24 28 5 25 21 20 15 33 1 23 30 24 18 26 10 29 2 26
55 public class AltosTelemetry extends AltosRecord {
56 public AltosTelemetry(String line) throws ParseException {
57 String[] words = line.split("\\s+");
60 AltosParse.word (words[i++], "VERSION");
61 version = AltosParse.parse_int(words[i++]);
63 AltosParse.word (words[i++], "CALL");
64 callsign = words[i++];
66 AltosParse.word (words[i++], "SERIAL");
67 serial = AltosParse.parse_int(words[i++]);
69 AltosParse.word (words[i++], "FLIGHT");
70 flight = AltosParse.parse_int(words[i++]);
72 AltosParse.word(words[i++], "RSSI");
73 rssi = AltosParse.parse_int(words[i++]);
75 AltosParse.word(words[i++], "STATUS");
76 status = AltosParse.parse_hex(words[i++]);
78 AltosParse.word(words[i++], "STATE");
79 state = Altos.state(words[i++]);
81 tick = AltosParse.parse_int(words[i++]);
83 AltosParse.word(words[i++], "a:");
84 accel = AltosParse.parse_int(words[i++]);
86 AltosParse.word(words[i++], "p:");
87 pres = AltosParse.parse_int(words[i++]);
89 AltosParse.word(words[i++], "t:");
90 temp = AltosParse.parse_int(words[i++]);
92 AltosParse.word(words[i++], "v:");
93 batt = AltosParse.parse_int(words[i++]);
95 AltosParse.word(words[i++], "d:");
96 drogue = AltosParse.parse_int(words[i++]);
98 AltosParse.word(words[i++], "m:");
99 main = AltosParse.parse_int(words[i++]);
101 AltosParse.word(words[i++], "fa:");
102 flight_accel = AltosParse.parse_int(words[i++]);
104 AltosParse.word(words[i++], "ga:");
105 ground_accel = AltosParse.parse_int(words[i++]);
107 AltosParse.word(words[i++], "fv:");
108 flight_vel = AltosParse.parse_int(words[i++]);
110 AltosParse.word(words[i++], "fp:");
111 flight_pres = AltosParse.parse_int(words[i++]);
113 AltosParse.word(words[i++], "gp:");
114 ground_pres = AltosParse.parse_int(words[i++]);
116 AltosParse.word(words[i++], "a+:");
117 accel_plus_g = AltosParse.parse_int(words[i++]);
119 AltosParse.word(words[i++], "a-:");
120 accel_minus_g = AltosParse.parse_int(words[i++]);
122 gps = new AltosGPS(words, i);