dRonin
adbada4
dRonin firmware
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
UBX.h
Go to the documentation of this file.
1
15
/*
16
* This program is free software; you can redistribute it and/or modify
17
* it under the terms of the GNU General Public License as published by
18
* the Free Software Foundation; either version 3 of the License, or
19
* (at your option) any later version.
20
*
21
* This program is distributed in the hope that it will be useful, but
22
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24
* for more details.
25
*
26
* You should have received a copy of the GNU General Public License along
27
* with this program; if not, see <http://www.gnu.org/licenses/>
28
*/
29
30
#ifndef UBX_H
31
#define UBX_H
32
#include "
openpilot.h
"
33
#include "gpsposition.h"
34
#include "
GPS.h
"
35
36
37
#define UBX_SYNC1 0xb5 // UBX protocol synchronization characters
38
#define UBX_SYNC2 0x62
39
40
// From u-blox6 receiver protocol specification
41
42
// Messages classes
43
#define UBX_CLASS_NAV 0x01
44
45
// Message IDs (all in NAV class)
46
#define UBX_ID_POSLLH 0x02
47
#define UBX_ID_STATUS 0x03
48
#define UBX_ID_DOP 0x04
49
#define UBX_ID_SOL 0x06
50
#define UBX_ID_VELNED 0x12
51
#define UBX_ID_TIMEUTC 0x21
52
#define UBX_ID_SVINFO 0x30
53
54
#define UBX_CLASS_MON 0x0A
55
56
#define UBX_ID_MONVER 0x04
57
// private structures
58
59
// Geodetic Position Solution
60
struct
UBX_NAV_POSLLH
{
61
uint32_t
iTOW
;
// GPS Millisecond Time of Week (ms)
62
int32_t
lon
;
// Longitude (deg*1e-7)
63
int32_t
lat
;
// Latitude (deg*1e-7)
64
int32_t
height
;
// Height above Ellipsoid (mm)
65
int32_t
hMSL
;
// Height above mean sea level (mm)
66
uint32_t
hAcc
;
// Horizontal Accuracy Estimate (mm)
67
uint32_t
vAcc
;
// Vertical Accuracy Estimate (mm)
68
};
69
70
// Receiver Navigation Status
71
72
#define STATUS_GPSFIX_NOFIX 0x00
73
#define STATUS_GPSFIX_DRONLY 0x01
74
#define STATUS_GPSFIX_2DFIX 0x02
75
#define STATUS_GPSFIX_3DFIX 0x03
76
#define STATUS_GPSFIX_GPSDR 0x04
77
#define STATUS_GPSFIX_TIMEONLY 0x05
78
79
#define STATUS_FLAGS_GPSFIX_OK (1 << 0)
80
#define STATUS_FLAGS_DIFFSOLN (1 << 1)
81
#define STATUS_FLAGS_WKNSET (1 << 2)
82
#define STATUS_FLAGS_TOWSET (1 << 3)
83
84
struct
UBX_NAV_STATUS
{
85
uint32_t
iTOW
;
// GPS Millisecond Time of Week (ms)
86
uint8_t
gpsFix
;
// GPS fix type
87
uint8_t
flags
;
// Navigation Status Flags
88
uint8_t
fixStat
;
// Fix Status Information
89
uint8_t
flags2
;
// Additional navigation output information
90
uint32_t
ttff
;
// Time to first fix (ms)
91
uint32_t
msss
;
// Milliseconds since startup/reset (ms)
92
};
93
94
// Dilution of precision
95
struct
UBX_NAV_DOP
{
96
uint32_t
iTOW
;
// GPS Millisecond Time of Week (ms)
97
uint16_t
gDOP
;
// Geometric DOP
98
uint16_t
pDOP
;
// Position DOP
99
uint16_t
tDOP
;
// Time DOP
100
uint16_t
vDOP
;
// Vertical DOP
101
uint16_t
hDOP
;
// Horizontal DOP
102
uint16_t
nDOP
;
// Northing DOP
103
uint16_t
eDOP
;
// Easting DOP
104
};
105
106
// Navigation solution
107
108
struct
UBX_NAV_SOL
{
109
uint32_t
iTOW
;
// GPS Millisecond Time of Week (ms)
110
int32_t
fTOW
;
// fractional nanoseconds (ns)
111
int16_t
week
;
// GPS week
112
uint8_t
gpsFix
;
// GPS fix type
113
uint8_t
flags
;
// Fix status flags
114
int32_t
ecefX
;
// ECEF X coordinate (cm)
115
int32_t
ecefY
;
// ECEF Y coordinate (cm)
116
int32_t
ecefZ
;
// ECEF Z coordinate (cm)
117
uint32_t
pAcc
;
// 3D Position Accuracy Estimate (cm)
118
int32_t
ecefVX
;
// ECEF X coordinate (cm/s)
119
int32_t
ecefVY
;
// ECEF Y coordinate (cm/s)
120
int32_t
ecefVZ
;
// ECEF Z coordinate (cm/s)
121
uint32_t
sAcc
;
// Speed Accuracy Estimate
122
uint16_t
pDOP
;
// Position DOP
123
uint8_t
reserved1
;
// Reserved
124
uint8_t
numSV
;
// Number of SVs used in Nav Solution
125
uint32_t
reserved2
;
// Reserved
126
};
127
128
// North/East/Down velocity
129
130
struct
UBX_NAV_VELNED
{
131
uint32_t
iTOW
;
// ms GPS Millisecond Time of Week
132
int32_t
velN
;
// cm/s NED north velocity
133
int32_t
velE
;
// cm/s NED east velocity
134
int32_t
velD
;
// cm/s NED down velocity
135
uint32_t
speed
;
// cm/s Speed (3-D)
136
uint32_t
gSpeed
;
// cm/s Ground Speed (2-D)
137
int32_t
heading
;
// 1e-5 *deg Heading of motion 2-D
138
uint32_t
sAcc
;
// cm/s Speed Accuracy Estimate
139
uint32_t
cAcc
;
// 1e-5 *deg Course / Heading Accuracy Estimate
140
};
141
142
// UTC Time Solution
143
144
#define TIMEUTC_VALIDTOW (1 << 0)
145
#define TIMEUTC_VALIDWKN (1 << 1)
146
#define TIMEUTC_VALIDUTC (1 << 2)
147
148
struct
UBX_NAV_TIMEUTC
{
149
uint32_t
iTOW
;
// GPS Millisecond Time of Week (ms)
150
uint32_t
tAcc
;
// Time Accuracy Estimate (ns)
151
int32_t
nano
;
// Nanoseconds of second
152
uint16_t
year
;
153
uint8_t
month
;
154
uint8_t
day
;
155
uint8_t
hour
;
156
uint8_t
min
;
157
uint8_t
sec
;
158
uint8_t
valid
;
// Validity Flags
159
};
160
161
// Space Vehicle (SV) Information
162
163
// Single SV information block
164
165
#define SVUSED (1 << 0) // This SV is used for navigation
166
#define DIFFCORR (1 << 1) // Differential correction available
167
#define ORBITAVAIL (1 << 2) // Orbit information available
168
#define ORBITEPH (1 << 3) // Orbit information is Ephemeris
169
#define UNHEALTHY (1 << 4) // SV is unhealthy
170
#define ORBITALM (1 << 5) // Orbit information is Almanac Plus
171
#define ORBITAOP (1 << 6) // Orbit information is AssistNow Autonomous
172
#define SMOOTHED (1 << 7) // Carrier smoothed pseudoranges used
173
174
struct
UBX_NAV_SVINFO_SV
{
175
uint8_t
chn
;
// Channel number
176
uint8_t
svid
;
// Satellite ID
177
uint8_t
flags
;
// Misc SV information
178
uint8_t
quality
;
// Misc quality indicators
179
uint8_t
cno
;
// Carrier to Noise Ratio (dbHz)
180
int8_t
elev
;
// Elevation (integer degrees)
181
int16_t
azim
;
// Azimuth (integer degrees)
182
int32_t
prRes
;
// Pseudo range residual (cm)
183
};
184
185
// SV information message
186
#define MAX_SVS 32
187
188
struct
UBX_NAV_SVINFO
{
189
uint32_t
iTOW
;
// GPS Millisecond Time of Week (ms)
190
uint8_t
numCh
;
// Number of channels
191
uint8_t
globalFlags
;
//
192
uint16_t
reserved2
;
// Reserved
193
struct
UBX_NAV_SVINFO_SV
sv
[
MAX_SVS
];
// Repeated 'numCh' times
194
};
195
196
struct
UBX_MON_VER
{
197
uint8_t
swVersion
[30];
198
uint8_t
hwVersion
[10];
199
uint8_t
extra
[30];
200
};
201
202
typedef
union
{
203
uint8_t
payload
[0];
204
struct
UBX_NAV_POSLLH
nav_posllh;
205
struct
UBX_NAV_STATUS
nav_status;
206
struct
UBX_NAV_DOP
nav_dop;
207
struct
UBX_NAV_SOL
nav_sol;
208
struct
UBX_NAV_VELNED
nav_velned;
209
struct
UBX_NAV_TIMEUTC
nav_timeutc;
210
struct
UBX_NAV_SVINFO
nav_svinfo;
211
struct
UBX_MON_VER
mon_ver;
212
}
UBXPayload
;
213
214
struct
UBXHeader
{
215
uint8_t
class
;
216
uint8_t
id
;
217
uint16_t
len
;
218
uint8_t
ck_a
;
219
uint8_t
ck_b
;
220
};
221
222
struct
UBXPacket
{
223
struct
UBXHeader
header
;
224
UBXPayload
payload
;
225
};
226
227
int
parse_ubx_stream
(uint8_t,
char
*, GPSPositionData *,
struct
GPS_RX_STATS
*);
228
229
#endif
/* UBX_H */
230
UBX_NAV_DOP::hDOP
uint16_t hDOP
Definition:
UBX.h:101
UBX_NAV_DOP::vDOP
uint16_t vDOP
Definition:
UBX.h:100
UBXPacket::header
struct UBXHeader header
Definition:
UBX.h:223
UBX_NAV_VELNED::cAcc
uint32_t cAcc
Definition:
UBX.h:139
UBX_NAV_SVINFO::globalFlags
uint8_t globalFlags
Definition:
UBX.h:191
UBX_NAV_POSLLH::lon
int32_t lon
Definition:
UBX.h:62
UBX_NAV_SVINFO_SV::svid
uint8_t svid
Definition:
UBX.h:176
UBXHeader::ck_b
uint8_t ck_b
Definition:
UBX.h:219
UBX_NAV_SOL::ecefVY
int32_t ecefVY
Definition:
UBX.h:119
UBX_NAV_TIMEUTC
Definition:
UBX.h:148
UBX_NAV_DOP::pDOP
uint16_t pDOP
Definition:
UBX.h:98
UBX_MON_VER::extra
uint8_t extra[30]
Definition:
UBX.h:199
UBX_NAV_SVINFO::iTOW
uint32_t iTOW
Definition:
UBX.h:189
UBX_NAV_TIMEUTC::month
uint8_t month
Definition:
UBX.h:153
UBX_NAV_TIMEUTC::sec
uint8_t sec
Definition:
UBX.h:157
UBX_NAV_POSLLH
Definition:
UBX.h:60
UBX_MON_VER
Definition:
UBX.h:196
UBX_NAV_SVINFO::numCh
uint8_t numCh
Definition:
UBX.h:190
UBX_NAV_VELNED
Definition:
UBX.h:130
UBX_NAV_SOL::pDOP
uint16_t pDOP
Definition:
UBX.h:122
UBX_NAV_SOL::pAcc
uint32_t pAcc
Definition:
UBX.h:117
UBX_NAV_SVINFO_SV::cno
uint8_t cno
Definition:
UBX.h:179
UBXHeader
Definition:
UBX.h:214
UBX_MON_VER::hwVersion
uint8_t hwVersion[10]
Definition:
UBX.h:198
UBX_NAV_VELNED::heading
int32_t heading
Definition:
UBX.h:137
UBX_NAV_SOL::iTOW
uint32_t iTOW
Definition:
UBX.h:109
UBX_NAV_SOL::ecefX
int32_t ecefX
Definition:
UBX.h:114
UBX_NAV_POSLLH::hMSL
int32_t hMSL
Definition:
UBX.h:65
payload
uint8_t payload[CRSF_MAX_PAYLOAD+CRSF_CRC_LEN]
Definition:
pios_crossfire.h:53
UBX_NAV_SOL::week
int16_t week
Definition:
UBX.h:111
UBX_NAV_SVINFO_SV::chn
uint8_t chn
Definition:
UBX.h:175
UBXPayload
Definition:
UBX.h:202
UBX_NAV_DOP
Definition:
UBX.h:95
UBX_NAV_TIMEUTC::day
uint8_t day
Definition:
UBX.h:154
UBX_NAV_POSLLH::vAcc
uint32_t vAcc
Definition:
UBX.h:67
UBX_NAV_TIMEUTC::tAcc
uint32_t tAcc
Definition:
UBX.h:150
UBX_NAV_SOL::gpsFix
uint8_t gpsFix
Definition:
UBX.h:112
UBX_NAV_STATUS
Definition:
UBX.h:84
UBX_NAV_SVINFO_SV
Definition:
UBX.h:174
MAX_SVS
#define MAX_SVS
Definition:
UBX.h:186
UBX_NAV_DOP::iTOW
uint32_t iTOW
Definition:
UBX.h:96
UBX_NAV_SVINFO_SV::elev
int8_t elev
Definition:
UBX.h:180
UBX_NAV_SVINFO_SV::azim
int16_t azim
Definition:
UBX.h:181
UBX_NAV_SOL::reserved1
uint8_t reserved1
Definition:
UBX.h:123
UBX_NAV_SVINFO::reserved2
uint16_t reserved2
Definition:
UBX.h:192
UBX_NAV_VELNED::velE
int32_t velE
Definition:
UBX.h:133
UBX_NAV_SOL::flags
uint8_t flags
Definition:
UBX.h:113
UBX_NAV_TIMEUTC::year
uint16_t year
Definition:
UBX.h:152
UBX_NAV_VELNED::velD
int32_t velD
Definition:
UBX.h:134
UBX_NAV_STATUS::fixStat
uint8_t fixStat
Definition:
UBX.h:88
UBX_NAV_SOL::sAcc
uint32_t sAcc
Definition:
UBX.h:121
GPS.h
Include file of the GPS module.
UBXHeader::len
uint16_t len
Definition:
UBX.h:217
UBX_NAV_SOL
Definition:
UBX.h:108
UBX_NAV_VELNED::velN
int32_t velN
Definition:
UBX.h:132
parse_ubx_stream
int parse_ubx_stream(uint8_t, char *, GPSPositionData *, struct GPS_RX_STATS *)
UBXHeader::ck_a
uint8_t ck_a
Definition:
UBX.h:218
UBX_NAV_DOP::tDOP
uint16_t tDOP
Definition:
UBX.h:99
UBX_NAV_STATUS::msss
uint32_t msss
Definition:
UBX.h:91
UBX_NAV_TIMEUTC::iTOW
uint32_t iTOW
Definition:
UBX.h:149
UBX_NAV_SVINFO_SV::flags
uint8_t flags
Definition:
UBX.h:177
UBX_NAV_STATUS::flags2
uint8_t flags2
Definition:
UBX.h:89
UBX_NAV_STATUS::ttff
uint32_t ttff
Definition:
UBX.h:90
UBX_NAV_SOL::ecefZ
int32_t ecefZ
Definition:
UBX.h:116
UBX_NAV_POSLLH::hAcc
uint32_t hAcc
Definition:
UBX.h:66
UBX_NAV_TIMEUTC::min
uint8_t min
Definition:
UBX.h:156
UBX_NAV_SOL::ecefY
int32_t ecefY
Definition:
UBX.h:115
UBX_NAV_SOL::ecefVZ
int32_t ecefVZ
Definition:
UBX.h:120
UBX_NAV_VELNED::iTOW
uint32_t iTOW
Definition:
UBX.h:131
UBX_NAV_POSLLH::height
int32_t height
Definition:
UBX.h:64
UBX_NAV_SVINFO_SV::quality
uint8_t quality
Definition:
UBX.h:178
UBX_NAV_POSLLH::lat
int32_t lat
Definition:
UBX.h:63
openpilot.h
Includes PiOS and core architecture components.
UBXHeader::id
uint8_t id
Definition:
UBX.h:216
UBX_NAV_SOL::reserved2
uint32_t reserved2
Definition:
UBX.h:125
UBX_NAV_SOL::ecefVX
int32_t ecefVX
Definition:
UBX.h:118
UBX_NAV_SOL::numSV
uint8_t numSV
Definition:
UBX.h:124
UBX_NAV_DOP::eDOP
uint16_t eDOP
Definition:
UBX.h:103
UBX_NAV_DOP::gDOP
uint16_t gDOP
Definition:
UBX.h:97
UBX_NAV_STATUS::iTOW
uint32_t iTOW
Definition:
UBX.h:85
UBX_NAV_VELNED::sAcc
uint32_t sAcc
Definition:
UBX.h:138
UBX_NAV_STATUS::gpsFix
uint8_t gpsFix
Definition:
UBX.h:86
UBX_NAV_VELNED::gSpeed
uint32_t gSpeed
Definition:
UBX.h:136
UBX_NAV_SVINFO_SV::prRes
int32_t prRes
Definition:
UBX.h:182
UBX_MON_VER::swVersion
uint8_t swVersion[30]
Definition:
UBX.h:197
UBX_NAV_STATUS::flags
uint8_t flags
Definition:
UBX.h:87
UBX_NAV_TIMEUTC::nano
int32_t nano
Definition:
UBX.h:151
UBX_NAV_POSLLH::iTOW
uint32_t iTOW
Definition:
UBX.h:61
UBX_NAV_SVINFO::sv
struct UBX_NAV_SVINFO_SV sv[MAX_SVS]
Definition:
UBX.h:193
UBX_NAV_SOL::fTOW
int32_t fTOW
Definition:
UBX.h:110
UBX_NAV_TIMEUTC::hour
uint8_t hour
Definition:
UBX.h:155
GPS_RX_STATS
Definition:
GPS.h:44
UBX_NAV_DOP::nDOP
uint16_t nDOP
Definition:
UBX.h:102
UBXPacket
Definition:
UBX.h:222
UBX_NAV_SVINFO
Definition:
UBX.h:188
UBXPacket::payload
UBXPayload payload
Definition:
UBX.h:224
UBX_NAV_TIMEUTC::valid
uint8_t valid
Definition:
UBX.h:158
UBX_NAV_VELNED::speed
uint32_t speed
Definition:
UBX.h:135
flight
Modules
GPS
inc
UBX.h
Generated by
1.8.6