Copernicus
1.0
An Arduino module for the Trimble Copernicus GPS receiver
Main Page
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Enumerations
Enumerator
Friends
Macros
Groups
copernicus
gpstype.h
Go to the documentation of this file.
1
/*
2
* File: gpstype.h
3
* Author: tbabb
4
*
5
* Created on October 7, 2013, 11:04 PM
6
*/
7
8
#ifndef GPSTYPE_H
9
#define GPSTYPE_H
10
11
#include <stdint.h>
12
#include <float.h>
13
14
class
CopernicusGPS
;
// fwd decl
15
26
/***************************
27
* enums *
28
***************************/
29
30
enum
CommandID
{
31
CMD_IO_OPTIONS
= 0x35
32
};
33
34
enum
ReportType
{
36
RPT_ERROR
= -1,
38
RPT_NONE
= 0x00,
39
40
// position/velocity fixes
41
43
RPT_FIX_POS_LLA_32
= 0x4A,
45
RPT_FIX_POS_LLA_64
= 0x84,
47
RPT_FIX_POS_XYZ_32
= 0x42,
49
RPT_FIX_POS_XYZ_64
= 0x83,
51
RPT_FIX_VEL_XYZ
= 0x43,
53
RPT_FIX_VEL_ENU
= 0x56,
54
55
// other auto-reports
56
58
RPT_GPSTIME
= 0x41,
60
RPT_HEALTH
= 0x46,
62
RPT_ADDL_STATUS
= 0x4B,
64
RPT_SATELLITES
= 0x6d,
66
RPT_SBAS_MODE
= 0x82,
67
68
// replies
69
71
RPT_IO_SETTINGS
= 0x55,
72
};
73
74
enum
GPSHealth
{
76
HLTH_UNKNOWN
= 0xFF,
78
HLTH_DOING_FIXES
= 0x00,
80
HLTH_NO_GPSTIME
= 0x01,
82
HLTH_PDOP_TOO_HIGH
= 0x03,
84
HLTH_SV_UNAVAILABLE
= 0x04,
86
HLTH_SATELLITES_NONE
= 0x08,
88
HLTH_SATELLITES_ONE
= 0x09,
90
HLTH_SATELLITES_TWO
= 0x0A,
92
HLTH_SATELLITES_THREE
= 0x0B,
94
HLTH_SATELLITES_OVERDETERMINED
= 0xBB,
95
};
96
97
enum
PacketStatus
{
99
PKT_IGNORE
,
101
PKT_CONSUMED
,
103
PKT_ERROR
,
105
PKT_PARTIAL
,
106
};
107
108
enum
AltMode
{
110
ALT_HAE
= 0x00,
112
ALT_MSL
= 0x01,
114
ALT_NOCHANGE
= 0xFF,
115
};
116
117
enum
PPSMode
{
119
PPS_ALWAYS
= 0x00,
121
PPS_FIX
= 0x20,
123
PPS_OFF
= 0x40,
125
PPS_NOCHANGE
= 0x60,
126
};
127
128
enum
GPSTimeMode
{
130
TME_GPSTIME
= 0x00,
132
TME_UTCTIME
= 0x01,
134
TME_NOCHANGE
= 0xFF
135
};
136
137
/***************************
138
* storage types *
139
***************************/
140
141
// many/most arduino chipsets do not support 64 bit floats,
142
// but we still need to be able to store the bits of a 64-bit float somehow.
143
144
union
Float32
{
146
uint32_t
bits
;
147
#if FLT_MANT_DIG == 24 || defined(PARSING_DOXYGEN)
148
153
float
f
;
154
#elif DBL_MANT_DIG == 24
155
double
f
;
156
#endif
157
};
158
159
union
Float64
{
161
uint64_t
bits
;
162
#if DBL_MANT_DIG == 53 || defined(PARSING_DOXYGEN)
163
169
double
d
;
170
#elif LDBL_MANT_DIG == 53
171
long
double
d
;
172
#endif
173
};
174
175
/***************************
176
* datapoints *
177
***************************/
178
179
// all angles are in radians.
180
// fix times are -1 if the fix is not valid.
181
182
template
<
typename
T>
183
struct
LLA_Fix
{
184
T
lat
;
185
T
lng
;
186
T
alt
;
187
T
bias
;
188
Float32
fixtime
;
189
};
190
191
template
<
typename
T>
192
struct
XYZ_Fix
{
193
T
x
;
194
T
y
;
195
T
z
;
196
T
bias
;
197
Float32
fixtime
;
198
};
199
200
struct
XYZ_VFix
{
201
Float32
x
;
202
Float32
y
;
203
Float32
z
;
204
Float32
bias
;
205
Float32
fixtime
;
206
};
207
208
struct
ENU_VFix
{
209
Float32
e
;
210
Float32
n
;
211
Float32
u
;
212
Float32
bias
;
213
Float32
fixtime
;
214
};
215
241
struct
PosFix
{
242
244
ReportType
type
;
245
246
PosFix
();
247
248
const
LLA_Fix<Float32>
*
getLLA_32
()
const
;
249
const
LLA_Fix<Float64>
*
getLLA_64
()
const
;
250
const
XYZ_Fix<Float32>
*
getXYZ_32
()
const
;
251
const
XYZ_Fix<Float64>
*
getXYZ_64
()
const
;
252
253
protected
:
254
255
union
{
256
XYZ_Fix<Float32>
xyz_32
;
257
XYZ_Fix<Float64>
xyz_64
;
258
LLA_Fix<Float32>
lla_32
;
259
LLA_Fix<Float64>
lla_64
;
260
};
261
262
friend
class
CopernicusGPS
;
263
};
264
289
struct
VelFix
{
291
ReportType
type
;
292
293
VelFix
();
294
295
const
XYZ_VFix
*
getXYZ
()
const
;
296
const
ENU_VFix
*
getENU
()
const
;
297
298
protected
:
299
300
union
{
301
XYZ_VFix
xyz
;
302
ENU_VFix
enu
;
303
};
304
305
friend
class
CopernicusGPS
;
306
};
307
308
struct
GPSTime
{
309
Float32
time_of_week
;
310
int16_t
week_no
;
311
Float32
utc_offs
;
312
};
313
314
struct
GPSStatus
{
315
GPSStatus
();
316
317
GPSHealth
health
;
// pkt 0x46
318
int
n_satellites
;
// pkt 0x6d
319
bool
almanac_incomplete
;
// pkt 0x4b
320
bool
rtclock_unavailable
;
// pkt 0x4b
321
bool
sbas_enabled
;
// pkt 0x82
322
bool
sbas_corrected
;
// pkt 0x82
323
};
324
326
327
#endif
/* GPSTYPE_H */
328
Generated on Mon Oct 14 2013 01:54:29 for Copernicus by
1.8.3.1