altos: Require sequencing through 'main' state before landing
[fw/altos] / src / ao_telem.h
1 /*
2  * Copyright © 2011 Keith Packard <keithp@keithp.com>
3  *
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.
7  *
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.
12  *
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.
16  */
17
18 #ifndef _AO_TELEM_H_
19 #define _AO_TELEM_H_
20
21 #define AO_TELEMETRY_VERSION            4
22
23 /*
24  * Telemetry version 4 and higher format:
25  *
26  * General header fields
27  *
28  *      Name            Value
29  *
30  *      VERSION         Telemetry version number (4 or more). Must be first.
31  *      c               Callsign (string, no spaces allowed)
32  *      n               Flight unit serial number (integer)
33  *      f               Flight number (integer)
34  *      r               Packet RSSI value (integer)
35  *      s               Flight computer state (string, no spaces allowed)
36  *      t               Flight computer clock (integer in centiseconds)
37  */
38
39 #define AO_TELEM_VERSION        "VERSION"
40 #define AO_TELEM_CALL           "c"
41 #define AO_TELEM_SERIAL         "n"
42 #define AO_TELEM_FLIGHT         "f"
43 #define AO_TELEM_RSSI           "r"
44 #define AO_TELEM_STATE          "s"
45 #define AO_TELEM_TICK           "t"
46
47 /*
48  * Raw sensor values
49  *
50  *      Name            Value
51  *      r_a             Accelerometer reading (integer)
52  *      r_b             Barometer reading (integer)
53  *      r_t             Thermometer reading (integer)
54  *      r_v             Battery reading (integer)
55  *      r_d             Drogue continuity (integer)
56  *      r_m             Main continuity (integer)
57  */
58
59 #define AO_TELEM_RAW_ACCEL      "r_a"
60 #define AO_TELEM_RAW_BARO       "r_b"
61 #define AO_TELEM_RAW_THERMO     "r_t"
62 #define AO_TELEM_RAW_BATT       "r_v"
63 #define AO_TELEM_RAW_DROGUE     "r_d"
64 #define AO_TELEM_RAW_MAIN       "r_m"
65
66 /*
67  * Sensor calibration values
68  *
69  *      Name            Value
70  *      c_a             Ground accelerometer reading (integer)
71  *      c_b             Ground barometer reading (integer)
72  *      c_p             Accelerometer reading for +1g
73  *      c_m             Accelerometer reading for -1g
74  */
75
76 #define AO_TELEM_CAL_ACCEL_GROUND       "c_a"
77 #define AO_TELEM_CAL_BARO_GROUND        "c_b"
78 #define AO_TELEM_CAL_ACCEL_PLUS         "c_p"
79 #define AO_TELEM_CAL_ACCEL_MINUS        "c_m"
80
81 /*
82  * Kalman state values
83  *
84  *      Name            Value
85  *      k_h             Height above pad (integer, meters)
86  *      k_s             Vertical speeed (integer, m/s * 16)
87  *      k_a             Vertical acceleration (integer, m/s² * 16)
88  */
89
90 #define AO_TELEM_KALMAN_HEIGHT          "k_h"
91 #define AO_TELEM_KALMAN_SPEED           "k_s"
92 #define AO_TELEM_KALMAN_ACCEL           "k_a"
93
94 /*
95  * Ad-hoc flight values
96  *
97  *      Name            Value
98  *      a_a             Acceleration (integer, sensor units)
99  *      a_s             Speed (integer, integrated acceleration value)
100  *      a_b             Barometer reading (integer, sensor units)
101  */
102
103 #define AO_TELEM_ADHOC_ACCEL            "a_a"
104 #define AO_TELEM_ADHOC_SPEED            "a_s"
105 #define AO_TELEM_ADHOC_BARO             "a_b"
106
107 /*
108  * GPS values
109  *
110  *      Name            Value
111  *      g               GPS state (string):
112  *                              l       locked
113  *                              u       unlocked
114  *                              e       error (missing or broken)
115  *      g_n             Number of sats used in solution
116  *      g_ns            Latitude (degrees * 10e7)
117  *      g_ew            Longitude (degrees * 10e7)
118  *      g_a             Altitude (integer meters)
119  *      g_Y             GPS year (integer)
120  *      g_M             GPS month (integer - 1-12)
121  *      g_D             GPS day (integer - 1-31)
122  *      g_h             GPS hour (integer - 0-23)
123  *      g_m             GPS minute (integer - 0-59)
124  *      g_s             GPS second (integer - 0-59)
125  *      g_v             GPS vertical speed (integer, cm/sec)
126  *      g_g             GPS horizontal speed (integer, cm/sec)
127  *      g_c             GPS course (integer, 0-359)
128  *      g_hd            GPS hdop (integer * 10)
129  *      g_vd            GPS vdop (integer * 10)
130  *      g_he            GPS h error (integer)
131  *      g_ve            GPS v error (integer)
132  */
133
134 #define AO_TELEM_GPS_STATE              "g"
135 #define AO_TELEM_GPS_STATE_LOCKED       'l'
136 #define AO_TELEM_GPS_STATE_UNLOCKED     'u'
137 #define AO_TELEM_GPS_STATE_ERROR        'e'
138 #define AO_TELEM_GPS_NUM_SAT            "g_n"
139 #define AO_TELEM_GPS_LATITUDE           "g_ns"
140 #define AO_TELEM_GPS_LONGITUDE          "g_ew"
141 #define AO_TELEM_GPS_ALTITUDE           "g_a"
142 #define AO_TELEM_GPS_YEAR               "g_Y"
143 #define AO_TELEM_GPS_MONTH              "g_M"
144 #define AO_TELEM_GPS_DAY                "g_D"
145 #define AO_TELEM_GPS_HOUR               "g_h"
146 #define AO_TELEM_GPS_MINUTE             "g_m"
147 #define AO_TELEM_GPS_SECOND             "g_s"
148 #define AO_TELEM_GPS_VERTICAL_SPEED     "g_v"
149 #define AO_TELEM_GPS_HORIZONTAL_SPEED   "g_g"
150 #define AO_TELEM_GPS_COURSE             "g_c"
151 #define AO_TELEM_GPS_HDOP               "g_hd"
152 #define AO_TELEM_GPS_VDOP               "g_vd"
153 #define AO_TELEM_GPS_HERROR             "g_he"
154 #define AO_TELEM_GPS_VERROR             "g_ve"
155
156 /*
157  * GPS satellite values
158  *
159  *      Name            Value
160  *      s_n             Number of satellites reported (integer)
161  *      s_v0            Space vehicle ID (integer) for report 0
162  *      s_c0            C/N0 number (integer) for report 0
163  *      s_v1            Space vehicle ID (integer) for report 1
164  *      s_c1            C/N0 number (integer) for report 1
165  *      ...
166  */
167
168 #define AO_TELEM_SAT_NUM                "s_n"
169 #define AO_TELEM_SAT_SVID               "s_v"
170 #define AO_TELEM_SAT_C_N_0              "s_c"
171
172 #endif /* _AO_TELEM_H_ */