Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
gps_ubx.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Antoine Drouin <poinix@gmail.com>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 
23 #include "modules/gps/gps_ubx.h"
24 #include "modules/core/abi.h"
25 #include "pprzlink/dl_protocol.h"
26 #include "led.h"
27 
28 #ifndef USE_GPS_UBX_RTCM
29 #define USE_GPS_UBX_RTCM 0
30 #endif
31 
32 
33 #if USE_GPS_UBX_RTCM
35 #define RTCM3_PREAMBLE 0xD3
36 #define RTCM3_MSG_1005 0x69
37 #define RTCM3_MSG_1077 0xB1
38 #define RTCM3_MSG_4072 0x72
39 #define RTCM3_MSG_1230 0xE6
40 #define RTCM3_MSG_1087 0xBB
41 #endif
42 
43 #if PRINT_DEBUG_GPS_UBX
44 #define DEBUG_PRINT(...) printf(__VA_ARGS__)
45 #else
46 #define DEBUG_PRINT(...) {}
47 #endif
48 
50 #include "ubx_protocol.h"
51 
52 /* parser status */
53 #define UNINIT 0
54 #define GOT_SYNC1 1
55 #define GOT_SYNC2 2
56 #define GOT_CLASS 3
57 #define GOT_ID 4
58 #define GOT_LEN1 5
59 #define GOT_LEN2 6
60 #define GOT_PAYLOAD 7
61 #define GOT_CHECKSUM1 8
62 
63 #define RXM_RTCM_VERSION 0x02
64 #define NAV_RELPOSNED_VERSION 0x01
65 /* last error type */
66 #define GPS_UBX_ERR_NONE 0
67 #define GPS_UBX_ERR_OVERRUN 1
68 #define GPS_UBX_ERR_MSG_TOO_LONG 2
69 #define GPS_UBX_ERR_CHECKSUM 3
70 #define GPS_UBX_ERR_UNEXPECTED 4
71 #define GPS_UBX_ERR_OUT_OF_SYNC 5
72 
73 #define UTM_HEM_NORTH 0
74 #define UTM_HEM_SOUTH 1
75 
76 struct GpsUbx gps_ubx;
77 
78 #if USE_GPS_UBX_RXM_RAW
79 struct GpsUbxRaw gps_ubx_raw;
80 #endif
81 
82 #if USE_GPS_UBX_RTCM
83 extern struct GpsRelposNED gps_relposned;
84 extern struct RtcmMan rtcm_man;
85 
86 #ifndef INJECT_BUFF_SIZE
87 #define INJECT_BUFF_SIZE 1024 + 6
88 #endif
89 /* RTCM control struct type */
90 struct rtcm_t {
91  uint32_t nbyte;
92  uint32_t len;
93  uint8_t buff[INJECT_BUFF_SIZE];
94 };
95 struct rtcm_t rtcm = { 0 };
96 
97 #endif
98 
99 void gps_ubx_init(void)
100 {
102  gps_ubx.msg_available = false;
103  gps_ubx.error_cnt = 0;
105 
107 }
108 
109 void gps_ubx_event(void)
110 {
111  struct link_device *dev = &((UBX_GPS_LINK).device);
112 
113  while (dev->char_available(dev->periph)) {
114  gps_ubx_parse(dev->get_byte(dev->periph));
115  if (gps_ubx.msg_available) {
116  gps_ubx_msg();
117  }
118  }
119 }
120 
122 {
124  if (gps_ubx.msg_available) {
125  gps_ubx.error_cnt++;
127  } else {
128  gps_ubx.msg_class = DL_HITL_UBX_class(buf);
129  gps_ubx.msg_id = DL_HITL_UBX_id(buf);
130  uint8_t l = DL_HITL_UBX_ubx_payload_length(buf);
131  uint8_t *ubx_payload = DL_HITL_UBX_ubx_payload(buf);
132  memcpy(gps_ubx.msg_buf, ubx_payload, l);
133  gps_ubx.msg_available = true;
134  }
135 }
136 
137 static void gps_ubx_parse_nav_pvt(void)
138 {
139  uint8_t flags = UBX_NAV_PVT_flags(gps_ubx.msg_buf);
140 
141  // Copy fix information
142  uint8_t gnssFixOK = bit_is_set(flags, 0);
143  uint8_t diffSoln = bit_is_set(flags, 1);
144  uint8_t carrSoln = (flags & 0xC0) >> 6;
145  if (diffSoln && carrSoln == 2) {
146  gps_ubx.state.fix = 5; // rtk
147  } else if(diffSoln && carrSoln == 1) {
148  gps_ubx.state.fix = 4; // dgnss
149  } else if(gnssFixOK) {
150  gps_ubx.state.fix = 3; // 3D
151  } else{
152  gps_ubx.state.fix = 0;
153  }
154 
155  // Copy time information
156  gps_ubx.state.tow = UBX_NAV_PVT_iTOW(gps_ubx.msg_buf);
157  uint16_t year = UBX_NAV_PVT_year(gps_ubx.msg_buf);
158  uint8_t month = UBX_NAV_PVT_month(gps_ubx.msg_buf);
159  uint8_t day = UBX_NAV_PVT_day(gps_ubx.msg_buf);
160  gps_ubx.state.week = gps_week_number(year, month, day);
161  gps_ubx.state.num_sv = UBX_NAV_PVT_numSV(gps_ubx.msg_buf);
162 
163  // Copy LLA position
164  gps_ubx.state.lla_pos.lat = UBX_NAV_PVT_lat(gps_ubx.msg_buf);
165  gps_ubx.state.lla_pos.lon = UBX_NAV_PVT_lon(gps_ubx.msg_buf);
166  gps_ubx.state.lla_pos.alt = UBX_NAV_PVT_height(gps_ubx.msg_buf);
168 
169  // Copy heading if valid
170  uint8_t headVehValid = bit_is_set(flags, 5);
171  if (headVehValid) {
172  // Ublox gives I4 heading in 1e-5 degrees, apparenty from 0 to 360 degrees (not -180 to 180)
173  // I4 max = 2^31 = 214 * 1e5 * 100 < 360 * 1e7: overflow on angles over 214 deg -> casted to -214 deg
174  // solution: First to radians, and then scale to 1e-7 radians
175  // First x 10 for loosing less resolution, then to radians, then multiply x 10 again
176  gps_ubx.state.course = (RadOfDeg(UBX_NAV_PVT_headMot(gps_ubx.msg_buf) * 10)) * 10;
178  gps_ubx.state.cacc = (RadOfDeg(UBX_NAV_PVT_headAcc(gps_ubx.msg_buf) * 10)) * 10;
179  }
180 
181  // Copy HMSL and ground speed
182  gps_ubx.state.hmsl = UBX_NAV_PVT_hMSL(gps_ubx.msg_buf);
184  gps_ubx.state.gspeed = UBX_NAV_PVT_gSpeed(gps_ubx.msg_buf) / 10;
185 
186  // Copy NED velocities
187  gps_ubx.state.ned_vel.x = UBX_NAV_PVT_velN(gps_ubx.msg_buf) / 10;
188  gps_ubx.state.ned_vel.y = UBX_NAV_PVT_velE(gps_ubx.msg_buf) / 10;
189  gps_ubx.state.ned_vel.z = UBX_NAV_PVT_velD(gps_ubx.msg_buf) / 10;
191 
192  // Copy accuracy information
193  gps_ubx.state.pdop = UBX_NAV_PVT_pDOP(gps_ubx.msg_buf);
194  gps_ubx.state.hacc = UBX_NAV_PVT_hAcc(gps_ubx.msg_buf) / 10;
195  gps_ubx.state.vacc = UBX_NAV_PVT_vAcc(gps_ubx.msg_buf) / 10;
196  gps_ubx.state.sacc = UBX_NAV_PVT_sAcc(gps_ubx.msg_buf) / 10;
197 }
198 
199 static void gps_ubx_parse_nav_sol(void)
200 {
201  // Copy time and fix information
202 #if !USE_GPS_UBX_RTCM
203  gps_ubx.state.fix = UBX_NAV_SOL_gpsFix(gps_ubx.msg_buf);
204 #endif
205  gps_ubx.state.tow = UBX_NAV_SOL_iTOW(gps_ubx.msg_buf);
206  gps_ubx.state.week = UBX_NAV_SOL_week(gps_ubx.msg_buf);
207  gps_ubx.state.num_sv = UBX_NAV_SOL_numSV(gps_ubx.msg_buf);
208 
209  // Copy ecef position
210  gps_ubx.state.ecef_pos.x = UBX_NAV_SOL_ecefX(gps_ubx.msg_buf);
211  gps_ubx.state.ecef_pos.y = UBX_NAV_SOL_ecefY(gps_ubx.msg_buf);
212  gps_ubx.state.ecef_pos.z = UBX_NAV_SOL_ecefZ(gps_ubx.msg_buf);
214 
215  // Copy ecef velocity
216  gps_ubx.state.ecef_vel.x = UBX_NAV_SOL_ecefVX(gps_ubx.msg_buf);
217  gps_ubx.state.ecef_vel.y = UBX_NAV_SOL_ecefVY(gps_ubx.msg_buf);
218  gps_ubx.state.ecef_vel.z = UBX_NAV_SOL_ecefVZ(gps_ubx.msg_buf);
220 
221  // Copy accuracy measurements
222  gps_ubx.state.pacc = UBX_NAV_SOL_pAcc(gps_ubx.msg_buf);
223  gps_ubx.state.sacc = UBX_NAV_SOL_sAcc(gps_ubx.msg_buf);
224  gps_ubx.state.pdop = UBX_NAV_SOL_pDOP(gps_ubx.msg_buf);
225 }
226 
227 static void gps_ubx_parse_nav_posecef(void)
228 {
229  gps_ubx.state.tow = UBX_NAV_POSECEF_iTOW(gps_ubx.msg_buf);
230 
231  // Copy ecef position
232  gps_ubx.state.ecef_pos.x = UBX_NAV_POSECEF_ecefX(gps_ubx.msg_buf);
233  gps_ubx.state.ecef_pos.y = UBX_NAV_POSECEF_ecefY(gps_ubx.msg_buf);
234  gps_ubx.state.ecef_pos.z = UBX_NAV_POSECEF_ecefZ(gps_ubx.msg_buf);
236 
237  // Copy accuracy information
238  gps_ubx.state.pacc = UBX_NAV_POSECEF_pAcc(gps_ubx.msg_buf);
239 }
240 
241 static void gps_ubx_parse_nav_posllh(void)
242 {
243  // Copy LLA position
244  gps_ubx.state.lla_pos.lat = UBX_NAV_POSLLH_lat(gps_ubx.msg_buf);
245  gps_ubx.state.lla_pos.lon = UBX_NAV_POSLLH_lon(gps_ubx.msg_buf);
246  gps_ubx.state.lla_pos.alt = UBX_NAV_POSLLH_height(gps_ubx.msg_buf);
248 
249  // Copy HMSL
250  gps_ubx.state.hmsl = UBX_NAV_POSLLH_hMSL(gps_ubx.msg_buf);
252 
253  // Copy accuracy information
254  gps_ubx.state.hacc = UBX_NAV_POSLLH_hAcc(gps_ubx.msg_buf) / 10;
255  gps_ubx.state.vacc = UBX_NAV_POSLLH_vAcc(gps_ubx.msg_buf) / 10;
256 }
257 
258 static void gps_ubx_parse_nav_posutm(void)
259 {
260  uint8_t hem = UBX_NAV_POSUTM_hem(gps_ubx.msg_buf);
261 
262  // Copy UTM state
263  gps_ubx.state.utm_pos.east = UBX_NAV_POSUTM_east(gps_ubx.msg_buf);
264  gps_ubx.state.utm_pos.north = UBX_NAV_POSUTM_north(gps_ubx.msg_buf);
265  if (hem == UTM_HEM_SOUTH) {
266  gps_ubx.state.utm_pos.north -= 1000000000; /* Subtract false northing: -10000km */
267  }
268  gps_ubx.state.utm_pos.alt = UBX_NAV_POSUTM_alt(gps_ubx.msg_buf) * 10;
269  gps_ubx.state.utm_pos.zone = UBX_NAV_POSUTM_zone(gps_ubx.msg_buf);
271 
272  // Copy HMSL
275 }
276 
277 static void gps_ubx_parse_velecef(void)
278 {
279  gps_ubx.state.tow = UBX_NAV_VELECEF_iTOW(gps_ubx.msg_buf);
280 
281  // Copy ecef velocity
282  gps_ubx.state.ecef_vel.x = UBX_NAV_VELECEF_ecefVX(gps_ubx.msg_buf);
283  gps_ubx.state.ecef_vel.y = UBX_NAV_VELECEF_ecefVY(gps_ubx.msg_buf);
284  gps_ubx.state.ecef_vel.z = UBX_NAV_VELECEF_ecefVZ(gps_ubx.msg_buf);
286 
287  // Copy accuracy measurements
288  gps_ubx.state.sacc = UBX_NAV_VELECEF_sAcc(gps_ubx.msg_buf);
289 }
290 
291 static void gps_ubx_parse_nav_velned(void)
292 {
293  // Copy groundspeed and total 3d speed
294  gps_ubx.state.speed_3d = UBX_NAV_VELNED_speed(gps_ubx.msg_buf);
295  gps_ubx.state.gspeed = UBX_NAV_VELNED_gSpeed(gps_ubx.msg_buf);
296 
297  // Copy NED velocities
298  gps_ubx.state.ned_vel.x = UBX_NAV_VELNED_velN(gps_ubx.msg_buf);
299  gps_ubx.state.ned_vel.y = UBX_NAV_VELNED_velE(gps_ubx.msg_buf);
300  gps_ubx.state.ned_vel.z = UBX_NAV_VELNED_velD(gps_ubx.msg_buf);
302 
303  // Copy course
304  gps_ubx.state.course = (RadOfDeg(UBX_NAV_VELNED_heading(gps_ubx.msg_buf) * 10)) * 10;
305  gps_ubx.state.cacc = (RadOfDeg(UBX_NAV_VELNED_cAcc(gps_ubx.msg_buf) * 10)) * 10;
307 
308  // Copy time of week
309  gps_ubx.state.tow = UBX_NAV_VELNED_iTOW(gps_ubx.msg_buf);
310 }
311 
312 static void gps_ubx_parse_nav_svinfo(void)
313 {
314  // Get the number of channels
315  gps_ubx.state.nb_channels = Min(UBX_NAV_SVINFO_numCh(gps_ubx.msg_buf), GPS_NB_CHANNELS);
316 
317  // Go through all the different channels
318  for (uint8_t i = 0; i < gps_ubx.state.nb_channels; i++) {
319  gps_ubx.state.svinfos[i].svid = UBX_NAV_SVINFO_svid(gps_ubx.msg_buf, i);
320  gps_ubx.state.svinfos[i].flags = UBX_NAV_SVINFO_flags(gps_ubx.msg_buf, i);
321  gps_ubx.state.svinfos[i].qi = UBX_NAV_SVINFO_quality(gps_ubx.msg_buf, i);
322  gps_ubx.state.svinfos[i].cno = UBX_NAV_SVINFO_cno(gps_ubx.msg_buf, i);
323  gps_ubx.state.svinfos[i].elev = UBX_NAV_SVINFO_elev(gps_ubx.msg_buf, i);
324  gps_ubx.state.svinfos[i].azim = UBX_NAV_SVINFO_azim(gps_ubx.msg_buf, i);
325  }
326 }
327 
328 static void gps_ubx_parse_nav_sat(void)
329 {
330  // Get the number of channels(sattelites) and time of week
331  gps_ubx.state.tow = UBX_NAV_SAT_iTOW(gps_ubx.msg_buf);
332  gps_ubx.state.nb_channels = Min(UBX_NAV_SAT_numSvs(gps_ubx.msg_buf), GPS_NB_CHANNELS);
333 
334  // Check the version
335  uint8_t version = UBX_NAV_SAT_version(gps_ubx.msg_buf);
336  if (version != 1) {
337  return;
338  }
339 
340  // Go through all the different channels
341  for (uint8_t i = 0; i < gps_ubx.state.nb_channels; i++) {
342  uint32_t flags = UBX_NAV_SVINFO_flags(gps_ubx.msg_buf, i);
343  gps_ubx.state.svinfos[i].svid = UBX_NAV_SAT_svId(gps_ubx.msg_buf, i);
344  gps_ubx.state.svinfos[i].cno = UBX_NAV_SAT_cno(gps_ubx.msg_buf, i);
345  gps_ubx.state.svinfos[i].elev = UBX_NAV_SAT_elev(gps_ubx.msg_buf, i);
346  gps_ubx.state.svinfos[i].azim = UBX_NAV_SAT_azim(gps_ubx.msg_buf, i);
347  gps_ubx.state.svinfos[i].qi = flags & 0x7;
348  gps_ubx.state.svinfos[i].flags = (flags >> 3) & 0x1;
349  }
350 }
351 
352 static void gps_ubx_parse_nav_status(void)
353 {
354 #if !USE_GPS_UBX_RTCM
355  gps_ubx.state.fix = UBX_NAV_STATUS_gpsFix(gps_ubx.msg_buf);
356 #endif
357  gps_ubx.state.tow = UBX_NAV_STATUS_iTOW(gps_ubx.msg_buf);
358  gps_ubx.status_flags = UBX_NAV_STATUS_flags(gps_ubx.msg_buf);
359 }
360 
362 {
363 #if USE_GPS_UBX_RTCM
364  uint8_t version = UBX_NAV_RELPOSNED_version(gps_ubx.msg_buf);
365  if (version <= NAV_RELPOSNED_VERSION) {
366  uint8_t flags = UBX_NAV_RELPOSNED_flags(gps_ubx.msg_buf);
367  uint8_t carrSoln = RTCMgetbitu(&flags, 3, 2);
368  uint8_t relPosValid = RTCMgetbitu(&flags, 5, 1);
369  uint8_t diffSoln = RTCMgetbitu(&flags, 6, 1);
370  uint8_t gnssFixOK = RTCMgetbitu(&flags, 7, 1);
371 
372  /* Only save the latest valid relative position */
373  if(relPosValid) {
374  if (diffSoln && carrSoln == 2) {
375  gps_ubx.state.fix = 5; // rtk
376  } else if(diffSoln && carrSoln == 1) {
377  gps_ubx.state.fix = 4; // dgnss
378  } else if(gnssFixOK) {
379  gps_ubx.state.fix = 3; // 3D
380  } else{
381  gps_ubx.state.fix = 0;
382  }
383 
384  gps_relposned.iTOW = UBX_NAV_RELPOSNED_iTOW(gps_ubx.msg_buf);
385  gps_relposned.refStationId = UBX_NAV_RELPOSNED_refStationId(gps_ubx.msg_buf);
386  gps_relposned.relPosN = UBX_NAV_RELPOSNED_relPosN(gps_ubx.msg_buf);
387  gps_relposned.relPosE = UBX_NAV_RELPOSNED_relPosE(gps_ubx.msg_buf);
388  gps_relposned.relPosD = UBX_NAV_RELPOSNED_relPosD(gps_ubx.msg_buf) ;
389  gps_relposned.relPosHPN = UBX_NAV_RELPOSNED_relPosHPN(gps_ubx.msg_buf);
390  gps_relposned.relPosHPE = UBX_NAV_RELPOSNED_relPosHPE(gps_ubx.msg_buf);
391  gps_relposned.relPosHPD = UBX_NAV_RELPOSNED_relPosHPD(gps_ubx.msg_buf);
392  gps_relposned.accN = UBX_NAV_RELPOSNED_accN(gps_ubx.msg_buf);
393  gps_relposned.accE = UBX_NAV_RELPOSNED_accE(gps_ubx.msg_buf);
394  gps_relposned.accD = UBX_NAV_RELPOSNED_accD(gps_ubx.msg_buf);
395  gps_relposned.carrSoln = carrSoln;
396  gps_relposned.relPosValid = relPosValid;
397  gps_relposned.diffSoln = diffSoln;
398  gps_relposned.gnssFixOK = gnssFixOK;
399  }
400  }
401 #endif
402 }
403 
404 static void gps_ubx_parse_rxm_raw(void)
405 {
406 #if USE_GPS_UBX_RXM_RAW
407  gps_ubx_raw.iTOW = UBX_RXM_RAW_iTOW(gps_ubx.msg_buf);
408  gps_ubx_raw.week = UBX_RXM_RAW_week(gps_ubx.msg_buf);
409  gps_ubx_raw.numSV = UBX_RXM_RAW_numSV(gps_ubx.msg_buf);
410  uint8_t i;
411  uint8_t max_SV = Min(gps_ubx_raw.numSV, GPS_UBX_NB_CHANNELS);
412  for (i = 0; i < max_SV; i++) {
413  gps_ubx_raw.measures[i].cpMes = UBX_RXM_RAW_cpMes(gps_ubx.msg_buf, i);
414  gps_ubx_raw.measures[i].prMes = UBX_RXM_RAW_prMes(gps_ubx.msg_buf, i);
415  gps_ubx_raw.measures[i].doMes = UBX_RXM_RAW_doMes(gps_ubx.msg_buf, i);
416  gps_ubx_raw.measures[i].sv = UBX_RXM_RAW_sv(gps_ubx.msg_buf, i);
417  gps_ubx_raw.measures[i].mesQI = UBX_RXM_RAW_mesQI(gps_ubx.msg_buf, i);
418  gps_ubx_raw.measures[i].cno = UBX_RXM_RAW_cno(gps_ubx.msg_buf, i);
419  gps_ubx_raw.measures[i].lli = UBX_RXM_RAW_lli(gps_ubx.msg_buf, i);
420  }
421 #endif // USE_GPS_UBX_RXM_RAW
422 }
423 
424 static void gps_ubx_parse_rxm_rtcm(void)
425 {
426 #if USE_GPS_UBX_RTCM
427  uint8_t version = UBX_RXM_RTCM_version(gps_ubx.msg_buf);
428  if (version == RXM_RTCM_VERSION) {
429  // uint8_t flags = UBX_RXM_RTCM_flags(gps_ubx.msg_buf);
430  // bool crcFailed = RTCMgetbitu(&flags, 7, 1);
431  // uint16_t refStation = UBX_RXM_RTCM_refStation(gps_ubx.msg_buf);
432  // uint16_t msgType = UBX_RXM_RTCM_msgType(gps_ubx.msg_buf);
433  // DEBUG_PRINT("Message %i from refStation %i processed (CRCfailed: %i)\n", msgType, refStation, crcFailed);
434 
435  rtcm_man.RefStation = UBX_RXM_RTCM_refStation(gps_ubx.msg_buf);
436  rtcm_man.MsgType = UBX_RXM_RTCM_msgType(gps_ubx.msg_buf);
437  uint8_t flags = UBX_RXM_RTCM_flags(gps_ubx.msg_buf);
438  bool crcFailed = RTCMgetbitu(&flags, 7, 1);
439  switch (rtcm_man.MsgType) {
440  case 1005:
441  rtcm_man.Cnt105 += 1;
442  rtcm_man.Crc105 += crcFailed;
443  break;
444  case 1077:
445  rtcm_man.Cnt177 += 1;
446  rtcm_man.Crc177 += crcFailed;;
447  break;
448  case 1087:
449  rtcm_man.Cnt187 += 1;
450  rtcm_man.Crc187 += crcFailed;;
451  break;
452  default:
453  break;
454  }
455  } else {
456  DEBUG_PRINT("Unknown RXM_RTCM version: %i\n", version);
457  }
458 #endif // USE_GPS_UBX_RTCM
459 }
460 
462 {
463 
464  if (gps_ubx.msg_class == UBX_NAV_ID) {
465  switch (gps_ubx.msg_id) {
466  case UBX_NAV_POSECEF_ID:
468  break;
469  case UBX_NAV_POSLLH_ID:
471  break;
472  case UBX_NAV_STATUS_ID:
474  break;
475  case UBX_NAV_SOL_ID:
477  break;
478  case UBX_NAV_PVT_ID:
480  break;
481  case UBX_NAV_POSUTM_ID:
483  break;
484  case UBX_NAV_VELECEF_ID:
486  break;
487  case UBX_NAV_VELNED_ID:
489  break;
490  case UBX_NAV_SVINFO_ID:
492  break;
493  case UBX_NAV_SAT_ID:
495  break;
496  case UBX_NAV_RELPOSNED_ID:
498  break;
499  default:
500  break;
501  }
502  }
503  else if (gps_ubx.msg_class == UBX_RXM_ID) {
504  switch (gps_ubx.msg_id) {
505  case UBX_RXM_RAW_ID:
507  break;
508  case UBX_RXM_RTCM_ID:
510  break;
511  default:
512  break;
513  }
514  }
515 
516 }
517 
518 #if LOG_RAW_GPS
520 #endif
521 
522 /* UBX parsing */
524 {
525 #if LOG_RAW_GPS
526  sdLogWriteByte(pprzLogFile, c);
527 #endif
528  if (gps_ubx.status < GOT_PAYLOAD) {
529  gps_ubx.ck_a += c;
531  }
532  switch (gps_ubx.status) {
533  case UNINIT:
534  if (c == UBX_SYNC1) {
535  gps_ubx.status++;
536  }
537  break;
538  case GOT_SYNC1:
539  if (c != UBX_SYNC2) {
541  goto error;
542  }
543  gps_ubx.ck_a = 0;
544  gps_ubx.ck_b = 0;
545  gps_ubx.status++;
546  break;
547  case GOT_SYNC2:
548  if (gps_ubx.msg_available) {
549  /* Previous message has not yet been parsed: discard this one */
551  goto error;
552  }
553  gps_ubx.msg_class = c;
554  gps_ubx.status++;
555  break;
556  case GOT_CLASS:
557  gps_ubx.msg_id = c;
558  gps_ubx.status++;
559  break;
560  case GOT_ID:
561  gps_ubx.len = c;
562  gps_ubx.status++;
563  break;
564  case GOT_LEN1:
565  gps_ubx.len |= (c << 8);
568  goto error;
569  }
570  gps_ubx.msg_idx = 0;
571  gps_ubx.status++;
572  break;
573  case GOT_LEN2:
575  gps_ubx.msg_idx++;
576  if (gps_ubx.msg_idx >= gps_ubx.len) {
577  gps_ubx.status++;
578  }
579  break;
580  case GOT_PAYLOAD:
581  if (c != gps_ubx.ck_a) {
583  goto error;
584  }
585  gps_ubx.status++;
586  break;
587  case GOT_CHECKSUM1:
588  if (c != gps_ubx.ck_b) {
590  goto error;
591  }
592  gps_ubx.msg_available = true;
593  goto restart;
594  break;
595  default:
597  goto error;
598  }
599  return;
600 error:
601  gps_ubx.error_cnt++;
602 restart:
604  return;
605 }
606 
607 static void ubx_send_1byte(struct link_device *dev, uint8_t byte)
608 {
609  dev->put_byte(dev->periph, 0, byte);
612 }
613 
614 void ubx_header(struct link_device *dev, uint8_t nav_id, uint8_t msg_id, uint16_t len)
615 {
616  dev->put_byte(dev->periph, 0, UBX_SYNC1);
617  dev->put_byte(dev->periph, 0, UBX_SYNC2);
618  gps_ubx.send_ck_a = 0;
619  gps_ubx.send_ck_b = 0;
620  ubx_send_1byte(dev, nav_id);
621  ubx_send_1byte(dev, msg_id);
622  ubx_send_1byte(dev, (uint8_t)(len & 0xFF));
623  ubx_send_1byte(dev, (uint8_t)(len >> 8));
624 }
625 
626 void ubx_trailer(struct link_device *dev)
627 {
628  dev->put_byte(dev->periph, 0, gps_ubx.send_ck_a);
629  dev->put_byte(dev->periph, 0, gps_ubx.send_ck_b);
630  dev->send_message(dev->periph, 0);
631 }
632 
633 void ubx_send_bytes(struct link_device *dev, uint8_t len, uint8_t *bytes)
634 {
635  int i;
636  for (i = 0; i < len; i++) {
637  ubx_send_1byte(dev, bytes[i]);
638  }
639 }
640 
641 void ubx_send_cfg_rst(struct link_device *dev, uint16_t bbr , uint8_t reset_mode)
642 {
643 #ifdef UBX_GPS_LINK
644  UbxSend_CFG_RST(dev, bbr, reset_mode, 0x00);
645 #endif /* else less harmful for HITL */
646 }
647 
648 #ifndef GPS_UBX_UCENTER
649 #define gps_ubx_ucenter_event() {}
650 #else
652 #endif
653 
654 void gps_ubx_msg(void)
655 {
656  // current timestamp
657  uint32_t now_ts = get_sys_time_usec();
658 
663  if (gps_ubx.msg_class == UBX_NAV_ID &&
664  (gps_ubx.msg_id == UBX_NAV_VELNED_ID ||
665  gps_ubx.msg_id == UBX_NAV_PVT_ID ||
666  (gps_ubx.msg_id == UBX_NAV_SOL_ID &&
668  if (gps_ubx.state.fix >= GPS_FIX_3D) {
671 #ifdef GPS_LED
672  LED_ON(GPS_LED);
673  } else {
674  LED_TOGGLE(GPS_LED);
675  }
676 #else
677  }
678 #endif
679  AbiSendMsgGPS(GPS_UBX_ID, now_ts, &gps_ubx.state);
680  }
681  gps_ubx.msg_available = false;
682 }
683 
684 /*
685  * Write bytes to the ublox UART connection
686  * This is a wrapper functions used in the librtcm library
687  */
688 void gps_ublox_write(struct link_device *dev, uint8_t *buff, uint32_t n);
689 void gps_ublox_write(struct link_device *dev, uint8_t *buff, uint32_t n)
690 {
691  uint32_t i = 0;
692  for (i = 0; i < n; i++) {
693  dev->put_byte(dev->periph, 0, buff[i]);
694  }
695  dev->send_message(dev->periph, 0);
696  return;
697 }
698 
702 #if USE_GPS_UBX_RTCM
703 void gps_inject_data(uint8_t packet_id, uint8_t length, uint8_t *data)
704 {
705  uint8_t i;
706 
707  // nothing to do
708  if (length == 0) {
709  return;
710  }
711 
712 #ifdef GPS_UBX_UCENTER
713  // not ready
714  if (gps_ubx_ucenter_get_status() != 0) {
715  return;
716  }
717 #endif
718 
719  // go through buffer
720  for (i = 0; i < length; i++) {
721  if (rtcm.nbyte == 0) {
722  // wait for frame start byte
723  if (data[i] == RTCM3_PREAMBLE) {
724  rtcm.buff[rtcm.nbyte++] = data[i];
725  }
726  } else {
727  // fill buffer
728  if (rtcm.nbyte < INJECT_BUFF_SIZE) {
729  rtcm.buff[rtcm.nbyte++] = data[i];
730  if (rtcm.nbyte == 3) {
731  // extract length
732  rtcm.len = RTCMgetbitu(rtcm.buff, 14, 10) + 3;
733  } else {
734  // wait complete frame
735  if (rtcm.nbyte == rtcm.len + 3) {
736  // check CRC
737  unsigned int crc1 = crc24q(rtcm.buff, rtcm.len);
738  unsigned int crc2 = RTCMgetbitu(rtcm.buff, rtcm.len * 8, 24);
739 
740  if (crc1 == crc2) {
741  // write to GPS
742  gps_ublox_write(&(UBX_GPS_LINK).device, rtcm.buff, rtcm.len + 3);
743  switch (packet_id) {
744  case RTCM3_MSG_1005 : break;
745  case RTCM3_MSG_1077 : break;
746  case RTCM3_MSG_1087 : break;
747  case RTCM3_MSG_4072 : break;
748  case RTCM3_MSG_1230 : break;
749  default: DEBUG_PRINT("Unknown type: %i", packet_id); break;
750  }
751  } else {
752  DEBUG_PRINT("Skipping message %i (CRC failed) - %d", packet_id, rtcm.buff[0]);
753  unsigned int j;
754  for (j = 1; j < rtcm.len; j++) {
755  DEBUG_PRINT(",%d", rtcm.buff[j]);
756  }
757  DEBUG_PRINT("\n");
758  }
759 
760  // reset index
761  rtcm.nbyte = 0;
762  }
763  }
764  } else {
765  // reset index
766  rtcm.nbyte = 0;
767  }
768  }
769  }
770 }
771 
772 #endif
GpsRelposNED::relPosHPE
int8_t relPosHPE
Definition: gps.h:136
LlaCoor_i::lon
int32_t lon
in degrees*1e7
Definition: pprz_geodetic_int.h:61
GpsState::valid_fields
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
Definition: gps.h:88
uint32_t
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
pprzLogFile
FileDes pprzLogFile
Definition: sdlog_chibios.c:86
LlaCoor_i::alt
int32_t alt
in millimeters above WGS84 reference ellipsoid
Definition: pprz_geodetic_int.h:62
GPS_VALID_COURSE_BIT
#define GPS_VALID_COURSE_BIT
Definition: gps.h:54
gps_ubx_parse_nav_velned
static void gps_ubx_parse_nav_velned(void)
Definition: gps_ubx.c:291
GpsUbx::error_last
uint8_t error_last
Definition: gps_ubx.h:67
GPS_UBX_ERR_MSG_TOO_LONG
#define GPS_UBX_ERR_MSG_TOO_LONG
Definition: gps_ubx.c:68
RTCM3_MSG_1230
#define RTCM3_MSG_1230
Definition: rtcm3.h:24
GpsUbx::len
uint16_t len
Definition: gps_ubx.h:62
SVinfo::azim
int16_t azim
azimuth in deg
Definition: gps.h:83
GpsRelposNED::gnssFixOK
uint8_t gnssFixOK
Definition: gps.h:144
UtmCoor_i::north
int32_t north
in centimeters
Definition: pprz_geodetic_int.h:87
GpsUbx::msg_buf
uint8_t msg_buf[GPS_UBX_MAX_PAYLOAD]
Definition: gps_ubx.h:57
SVinfo::flags
uint8_t flags
bitfield with GPS receiver specific flags
Definition: gps.h:79
abi.h
NedCoor_i::y
int32_t y
East.
Definition: pprz_geodetic_int.h:70
GpsUbx::msg_idx
uint16_t msg_idx
Definition: gps_ubx.h:63
GpsRelposNED::accE
uint32_t accE
Definition: gps.h:139
GpsState::tow
uint32_t tow
GPS time of week in ms.
Definition: gps.h:109
crc24q
unsigned int crc24q(const unsigned char *buff, int len)
Definition: CRC24Q.h:44
GpsUbx::msg_class
uint8_t msg_class
Definition: gps_ubx.h:59
RtcmMan::Cnt105
uint32_t Cnt105
Definition: gps.h:150
GpsRelposNED::relPosD
int32_t relPosD
Definition: gps.h:134
SVinfo::qi
uint8_t qi
quality bitfield (GPS receiver specific)
Definition: gps.h:80
RtcmMan::Cnt177
uint32_t Cnt177
Definition: gps.h:151
GpsState::nb_channels
uint8_t nb_channels
Number of scanned satellites.
Definition: gps.h:111
gps_ubx_parse_nav_sol
static void gps_ubx_parse_nav_sol(void)
Definition: gps_ubx.c:199
CRC24Q.h
GOT_PAYLOAD
#define GOT_PAYLOAD
Definition: gps_ubx.c:60
EcefCoor_i::x
int32_t x
in centimeters
Definition: pprz_geodetic_int.h:51
gps_ubx_parse_nav_posllh
static void gps_ubx_parse_nav_posllh(void)
Definition: gps_ubx.c:241
GpsState::pacc
uint32_t pacc
position accuracy in cm
Definition: gps.h:100
RtcmMan::MsgType
uint16_t MsgType
Definition: gps.h:149
GpsRelposNED::diffSoln
uint8_t diffSoln
Definition: gps.h:143
GpsState::sacc
uint32_t sacc
speed accuracy in cm/s
Definition: gps.h:103
gps_ubx_read_message
void gps_ubx_read_message(void)
Definition: gps_ubx.c:461
GOT_LEN2
#define GOT_LEN2
Definition: gps_ubx.c:59
GpsRelposNED::iTOW
uint32_t iTOW
Definition: gps.h:130
GpsState::vacc
uint32_t vacc
vertical accuracy in cm
Definition: gps.h:102
gps_ubx_ucenter_event
#define gps_ubx_ucenter_event()
Definition: gps_ubx.c:649
LED_ON
#define LED_ON(i)
Definition: led_hw.h:51
GOT_LEN1
#define GOT_LEN1
Definition: gps_ubx.c:58
GOT_CHECKSUM1
#define GOT_CHECKSUM1
Definition: gps_ubx.c:61
gps_ubx.h
UBX protocol specific code.
gps_ubx_parse_nav_posecef
static void gps_ubx_parse_nav_posecef(void)
Definition: gps_ubx.c:227
LED_TOGGLE
#define LED_TOGGLE(i)
Definition: led_hw.h:53
GpsRelposNED::relPosHPD
int8_t relPosHPD
Definition: gps.h:137
GpsUbx::ck_a
uint8_t ck_a
Definition: gps_ubx.h:64
buff
uint8_t buff[25]
Buffer used for general comunication over SPI (in buffer)
Definition: high_speed_logger_direct_memory.c:130
gps_ubx_parse_rxm_rtcm
static void gps_ubx_parse_rxm_rtcm(void)
Definition: gps_ubx.c:424
GpsState::ned_vel
struct NedCoor_i ned_vel
speed NED in cm/s
Definition: gps.h:96
gps_ublox_write
void gps_ublox_write(struct link_device *dev, uint8_t *buff, uint32_t n)
Definition: gps_ubx.c:689
GpsRelposNED::relPosE
int32_t relPosE
Definition: gps.h:133
EcefCoor_i::y
int32_t y
in centimeters
Definition: pprz_geodetic_int.h:52
GPS_VALID_POS_LLA_BIT
#define GPS_VALID_POS_LLA_BIT
Definition: gps.h:49
NedCoor_i::z
int32_t z
Down.
Definition: pprz_geodetic_int.h:71
RtcmMan::Cnt187
uint32_t Cnt187
Definition: gps.h:152
sdlog_chibios.h
gps_ubx_init
void gps_ubx_init(void)
Definition: gps_ubx.c:99
get_sys_time_usec
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Definition: sys_time_arch.c:75
ubx_send_cfg_rst
void ubx_send_cfg_rst(struct link_device *dev, uint16_t bbr, uint8_t reset_mode)
Definition: gps_ubx.c:641
LlaCoor_i::lat
int32_t lat
in degrees*1e7
Definition: pprz_geodetic_int.h:60
gps_ubx_parse_HITL_UBX
void gps_ubx_parse_HITL_UBX(uint8_t *buf)
Definition: gps_ubx.c:121
GPS_UBX_ERR_CHECKSUM
#define GPS_UBX_ERR_CHECKSUM
Definition: gps_ubx.c:69
GpsState::last_msg_ticks
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
Definition: gps.h:116
gps_ubx
struct GpsUbx gps_ubx
Definition: gps_ubx.c:76
UtmCoor_i::east
int32_t east
in centimeters
Definition: pprz_geodetic_int.h:88
gps_ubx_parse
void gps_ubx_parse(uint8_t c)
Definition: gps_ubx.c:523
RTCM3_PREAMBLE
#define RTCM3_PREAMBLE
Definition: rtcm3.h:19
GPS_UBX_ERR_NONE
#define GPS_UBX_ERR_NONE
Definition: gps_ubx.c:66
GpsRelposNED::relPosN
int32_t relPosN
Definition: gps.h:132
SVinfo::cno
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
Definition: gps.h:81
RTCM3_MSG_1087
#define RTCM3_MSG_1087
Definition: rtcm3.h:23
GpsState::hacc
uint32_t hacc
horizontal accuracy in cm
Definition: gps.h:101
EcefCoor_i::z
int32_t z
in centimeters
Definition: pprz_geodetic_int.h:53
gps_week_number
uint16_t gps_week_number(uint16_t year, uint8_t month, uint8_t day)
Number of weeks since navigation epoch (6 January 1980)
Definition: gps.c:483
GpsState::fix
uint8_t fix
status of fix
Definition: gps.h:107
gps_ubx_parse_nav_pvt
static void gps_ubx_parse_nav_pvt(void)
Definition: gps_ubx.c:137
GpsUbx::status
uint8_t status
Definition: gps_ubx.h:61
gps_ubx_parse_nav_relposned
static void gps_ubx_parse_nav_relposned(void)
Definition: gps_ubx.c:361
GpsState::speed_3d
uint16_t speed_3d
norm of 3d speed in cm/s
Definition: gps.h:98
UTM_HEM_SOUTH
#define UTM_HEM_SOUTH
Definition: gps_ubx.c:74
GpsUbx::msg_available
bool msg_available
Definition: gps_ubx.h:56
GpsState::week
uint16_t week
GPS week.
Definition: gps.h:108
RTCM3_MSG_1077
#define RTCM3_MSG_1077
Definition: rtcm3.h:22
dev
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
GpsUbx::msg_id
uint8_t msg_id
Definition: gps_ubx.h:58
GPS_VALID_POS_UTM_BIT
#define GPS_VALID_POS_UTM_BIT
Definition: gps.h:50
GpsUbx::error_cnt
uint8_t error_cnt
Definition: gps_ubx.h:66
SVinfo::svid
uint8_t svid
Satellite ID.
Definition: gps.h:78
UtmCoor_i::alt
int32_t alt
in millimeters (above WGS84 reference ellipsoid or above MSL)
Definition: pprz_geodetic_int.h:89
NAV_RELPOSNED_VERSION
#define NAV_RELPOSNED_VERSION
Definition: gps_ubx.c:64
GPS_UBX_ERR_OUT_OF_SYNC
#define GPS_UBX_ERR_OUT_OF_SYNC
Definition: gps_ubx.c:71
GpsState::gspeed
uint16_t gspeed
norm of 2d ground speed in cm/s
Definition: gps.h:97
GOT_CLASS
#define GOT_CLASS
Definition: gps_ubx.c:56
GpsRelposNED
data structures for GPS with RTK capabilities
Definition: gps.h:129
gps_ubx_ucenter.h
Configure Ublox GPS.
GpsRelposNED::refStationId
uint16_t refStationId
Definition: gps.h:131
byte
#define byte
Definition: nps_fdm_crrcsim.c:74
GPS_NB_CHANNELS
#define GPS_NB_CHANNELS
Definition: gps.h:57
RtcmMan::Crc177
uint32_t Crc177
Definition: gps.h:154
GpsState::last_3dfix_time
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
Definition: gps.h:115
GOT_ID
#define GOT_ID
Definition: gps_ubx.c:57
GPS_UBX_MAX_PAYLOAD
#define GPS_UBX_MAX_PAYLOAD
Definition: gps_ubx.h:54
ubx_send_bytes
void ubx_send_bytes(struct link_device *dev, uint8_t len, uint8_t *bytes)
Definition: gps_ubx.c:633
RtcmMan::Crc105
uint32_t Crc105
Definition: gps.h:153
GpsState::last_3dfix_ticks
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
Definition: gps.h:114
GpsState::utm_pos
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over MSL)
Definition: gps.h:93
GpsState::comp_id
uint8_t comp_id
id of current gps
Definition: gps.h:89
led.h
arch independent LED (Light Emitting Diodes) API
gps_ubx_ucenter_get_status
int gps_ubx_ucenter_get_status(void)
Definition: gps_ubx_ucenter.c:619
gps_ubx_parse_rxm_raw
static void gps_ubx_parse_rxm_raw(void)
Definition: gps_ubx.c:404
GpsRelposNED::accD
uint32_t accD
Definition: gps.h:140
GPS_UBX_ERR_UNEXPECTED
#define GPS_UBX_ERR_UNEXPECTED
Definition: gps_ubx.c:70
GpsUbx::ck_b
uint8_t ck_b
Definition: gps_ubx.h:64
GpsState::course
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
Definition: gps.h:99
UNINIT
#define UNINIT
Includes macros generated from ubx.xml.
Definition: gps_ubx.c:53
ubx_trailer
void ubx_trailer(struct link_device *dev)
Definition: gps_ubx.c:626
GpsState::last_msg_time
uint32_t last_msg_time
cpu time in sec at last received GPS message
Definition: gps.h:117
GpsState::ecef_pos
struct EcefCoor_i ecef_pos
position in ECEF in cm
Definition: gps.h:91
gps_ubx_parse_nav_status
static void gps_ubx_parse_nav_status(void)
Definition: gps_ubx.c:352
ubx_header
void ubx_header(struct link_device *dev, uint8_t nav_id, uint8_t msg_id, uint16_t len)
Definition: gps_ubx.c:614
gps_ubx_msg
void gps_ubx_msg(void)
Definition: gps_ubx.c:654
DEBUG_PRINT
#define DEBUG_PRINT(...)
Definition: gps_ubx.c:46
GPS_VALID_VEL_NED_BIT
#define GPS_VALID_VEL_NED_BIT
Definition: gps.h:52
gps_relposned
struct GpsRelposNED gps_relposned
Definition: gps.c:71
GPS_UBX_NB_CHANNELS
#define GPS_UBX_NB_CHANNELS
Definition: gps_ubx.h:52
GpsState::lla_pos
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
Definition: gps.h:92
GPS_UBX_ID
#define GPS_UBX_ID
Definition: abi_sender_ids.h:228
gps_inject_data
void WEAK gps_inject_data(uint8_t packet_id, uint8_t length, uint8_t *data)
Default parser for GPS injected data.
Definition: gps.c:380
GPS_VALID_VEL_ECEF_BIT
#define GPS_VALID_VEL_ECEF_BIT
Definition: gps.h:51
sys_time
Definition: sys_time.h:71
RTCMgetbitu
unsigned int RTCMgetbitu(unsigned char *buff, int pos, int lenb)
Definition: CRC24Q.h:54
RTCM3_MSG_4072
#define RTCM3_MSG_4072
Definition: rtcm3.h:21
GpsState::num_sv
uint8_t num_sv
number of sat in fix
Definition: gps.h:106
GOT_SYNC1
#define GOT_SYNC1
Definition: gps_ubx.c:54
sys_time::nb_sec_rem
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
Definition: sys_time.h:73
GpsRelposNED::accN
uint32_t accN
Definition: gps.h:138
gps_ubx_parse_nav_posutm
static void gps_ubx_parse_nav_posutm(void)
Definition: gps_ubx.c:258
GpsState::hmsl
int32_t hmsl
height above mean sea level (MSL) in mm
Definition: gps.h:94
RtcmMan::RefStation
uint16_t RefStation
Definition: gps.h:148
NedCoor_i::x
int32_t x
North.
Definition: pprz_geodetic_int.h:69
SVinfo::elev
int8_t elev
elevation in deg
Definition: gps.h:82
GpsState::pdop
uint16_t pdop
position dilution of precision scaled by 100
Definition: gps.h:105
GpsUbx::status_flags
uint8_t status_flags
Definition: gps_ubx.h:69
GpsUbx::send_ck_b
uint8_t send_ck_b
Definition: gps_ubx.h:65
gps_ubx_parse_velecef
static void gps_ubx_parse_velecef(void)
Definition: gps_ubx.c:277
ubx_send_1byte
static void ubx_send_1byte(struct link_device *dev, uint8_t byte)
Definition: gps_ubx.c:607
GpsRelposNED::carrSoln
uint8_t carrSoln
Definition: gps.h:141
GpsRelposNED::relPosValid
uint8_t relPosValid
Definition: gps.h:142
GPS_VALID_POS_ECEF_BIT
#define GPS_VALID_POS_ECEF_BIT
Definition: gps.h:48
GpsState::cacc
uint32_t cacc
course accuracy in rad*1e7
Definition: gps.h:104
RTCM3_MSG_1005
#define RTCM3_MSG_1005
Definition: rtcm3.h:20
GpsUbx
Definition: gps_ubx.h:55
GPS_UBX_ERR_OVERRUN
#define GPS_UBX_ERR_OVERRUN
Definition: gps_ubx.c:67
sys_time::nb_sec
volatile uint32_t nb_sec
full seconds since startup
Definition: sys_time.h:72
GpsState::ecef_vel
struct EcefCoor_i ecef_vel
speed ECEF in cm/s
Definition: gps.h:95
RXM_RTCM_VERSION
#define RXM_RTCM_VERSION
Definition: gps_ubx.c:63
rtcm_man
struct RtcmMan rtcm_man
Definition: gps.c:72
GOT_SYNC2
#define GOT_SYNC2
Definition: gps_ubx.c:55
GpsRelposNED::relPosHPN
int8_t relPosHPN
Definition: gps.h:135
uint16_t
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
gps_ubx_event
void gps_ubx_event(void)
Definition: gps_ubx.c:109
GpsState::svinfos
struct SVinfo svinfos[GPS_NB_CHANNELS]
holds information from the Space Vehicles (Satellites)
Definition: gps.h:112
gps_ubx_parse_nav_sat
static void gps_ubx_parse_nav_sat(void)
Definition: gps_ubx.c:328
GPS_FIX_3D
#define GPS_FIX_3D
3D GPS fix
Definition: gps.h:39
gps_ubx_parse_nav_svinfo
static void gps_ubx_parse_nav_svinfo(void)
Definition: gps_ubx.c:312
GpsUbx::state
struct GpsState state
Definition: gps_ubx.h:72
RtcmMan::Crc187
uint32_t Crc187
Definition: gps.h:155
RtcmMan
Definition: gps.h:147
GPS_VALID_HMSL_BIT
#define GPS_VALID_HMSL_BIT
Definition: gps.h:53
UtmCoor_i::zone
uint8_t zone
UTM zone number.
Definition: pprz_geodetic_int.h:90
Min
#define Min(x, y)
Definition: esc_dshot.c:85
GpsUbx::send_ck_a
uint8_t send_ck_a
Definition: gps_ubx.h:65