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