From 1b25d14b4c70cd283cd2dfba1cef0f95171285d4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 13 May 2017 20:25:38 +0200 Subject: [PATCH] Work on initializations --- src/algorithms/libs/rtklib/rtklib.h | 13 ++++ src/algorithms/libs/rtklib/rtklib_rtcm.cc | 13 ++-- src/algorithms/libs/rtklib/rtklib_rtcm2.cc | 20 +++--- src/algorithms/libs/rtklib/rtklib_rtcm3.cc | 71 +++++++++++++--------- src/algorithms/libs/rtklib/rtklib_rtcm3.h | 20 ------ 5 files changed, 74 insertions(+), 63 deletions(-) diff --git a/src/algorithms/libs/rtklib/rtklib.h b/src/algorithms/libs/rtklib/rtklib.h index 1a8632220..1d0b6df1d 100644 --- a/src/algorithms/libs/rtklib/rtklib.h +++ b/src/algorithms/libs/rtklib/rtklib.h @@ -1223,6 +1223,19 @@ typedef struct { /* RTK server type */ lock_t lock; /* lock flag */ } rtksvr_t; +typedef struct { /* multi-signal-message header type */ + unsigned char iod; /* issue of data station */ + unsigned char time_s; /* cumulative session transmitting time */ + unsigned char clk_str; /* clock steering indicator */ + unsigned char clk_ext; /* external clock indicator */ + unsigned char smooth; /* divergence free smoothing indicator */ + unsigned char tint_s; /* soothing interval */ + unsigned char nsat,nsig; /* number of satellites/signals */ + unsigned char sats[64]; /* satellites */ + unsigned char sigs[32]; /* signals */ + unsigned char cellmask[64]; /* cell mask */ +} msm_h_t; + const double chisqr[100] = { /* chi-sqr(n) (alpha=0.001) */ 10.8, 13.8, 16.3, 18.5, 20.5, 22.5, 24.3, 26.1, 27.9, 29.6, diff --git a/src/algorithms/libs/rtklib/rtklib_rtcm.cc b/src/algorithms/libs/rtklib/rtklib_rtcm.cc index e49f98831..5221e5f6a 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtcm.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtcm.cc @@ -67,11 +67,14 @@ *-----------------------------------------------------------------------------*/ int init_rtcm(rtcm_t *rtcm) { - gtime_t time0 = {0}; - obsd_t data0 = {{0}}; - eph_t eph0 = {0, -1, -1}; - geph_t geph0 = {0, -1}; - ssr_t ssr0 = {{{0}}}; + gtime_t time0 = {0, 0.0}; + obsd_t data0 = {{0, 0.0}, 0, 0, {0}, {0}, {0}, {0.0}, {0.0}, {0.0}}; + eph_t eph0 = {0, -1, -1, 0, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0,0.0}, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {0.0}, 0.0, 0.0}; + geph_t geph0 = {0, -1, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0.0}, {0.0}, {0.0}, + 0.0, 0.0, 0.0}; + ssr_t ssr0 = { {{0, 0.0}}, {0.0}, {0}, 0, 0, 0, 0, {0.0}, {0.0}, {0.0}, 0.0, {0.0}, {0.0}, {0.0}, 0.0, 0.0, '0' }; int i, j; trace(3, "init_rtcm:\n"); diff --git a/src/algorithms/libs/rtklib/rtklib_rtcm2.cc b/src/algorithms/libs/rtklib/rtklib_rtcm2.cc index ea987e50d..0494b4471 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtcm2.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtcm2.cc @@ -206,7 +206,9 @@ int decode_type16(rtcm_t *rtcm) /* decode type 17: gps ephemerides -------------------------------------------*/ int decode_type17(rtcm_t *rtcm) { - eph_t eph = {0}; + eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0,0.0}, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {0.0}, 0.0, 0.0}; double toc, sqrtA; int i = 48, week, prn, sat; @@ -423,56 +425,56 @@ int decode_type22(rtcm_t *rtcm) /* decode type 23: antenna type definition record ----------------------------*/ -int decode_type23(rtcm_t *rtcm) +int decode_type23(rtcm_t *rtcm __attribute((unused))) { return 0; } /* decode type 24: antenna reference point (arp) -----------------------------*/ -int decode_type24(rtcm_t *rtcm) +int decode_type24(rtcm_t *rtcm __attribute((unused))) { return 0; } /* decode type 31: differential glonass correction ---------------------------*/ -int decode_type31(rtcm_t *rtcm) +int decode_type31(rtcm_t *rtcm __attribute((unused))) { return 0; } /* decode type 32: differential glonass reference station parameters ---------*/ -int decode_type32(rtcm_t *rtcm) +int decode_type32(rtcm_t *rtcm __attribute((unused))) { return 0; } /* decode type 34: glonass partial differential correction set ---------------*/ -int decode_type34(rtcm_t *rtcm) +int decode_type34(rtcm_t *rtcm __attribute((unused))) { return 0; } /* decode type 36: glonass special message -----------------------------------*/ -int decode_type36(rtcm_t *rtcm) +int decode_type36(rtcm_t *rtcm __attribute((unused))) { return 0; } /* decode type 37: gnss system time offset -----------------------------------*/ -int decode_type37(rtcm_t *rtcm) +int decode_type37(rtcm_t *rtcm __attribute((unused))) { return 0; } /* decode type 59: proprietary message ---------------------------------------*/ -int decode_type59(rtcm_t *rtcm) +int decode_type59(rtcm_t *rtcm __attribute((unused))) { return 0; } diff --git a/src/algorithms/libs/rtklib/rtklib_rtcm3.cc b/src/algorithms/libs/rtklib/rtklib_rtcm3.cc index e5b53a432..e03457833 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtcm3.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtcm3.cc @@ -727,7 +727,9 @@ int decode_type1013(rtcm_t *rtcm) /* decode type 1019: gps ephemerides -----------------------------------------*/ int decode_type1019(rtcm_t *rtcm) { - eph_t eph = {0}; + eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0,0.0}, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {0.0}, 0.0, 0.0}; double toc, sqrtA; char *msg; int i = 24+12, prn, sat, week, sys = SYS_GPS; @@ -806,7 +808,8 @@ int decode_type1019(rtcm_t *rtcm) /* decode type 1020: glonass ephemerides -------------------------------------*/ int decode_type1020(rtcm_t *rtcm) { - geph_t geph = {0}; + geph_t geph = {0, -1, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0.0}, {0.0}, {0.0}, + 0.0, 0.0, 0.0}; double tk_h, tk_m, tk_s, toe, tow, tod, tof; char *msg; int i = 24+12, prn, sat, week, tb, bn, sys = SYS_GLO; @@ -877,7 +880,7 @@ int decode_type1020(rtcm_t *rtcm) /* decode type 1021: helmert/abridged molodenski -----------------------------*/ -int decode_type1021(rtcm_t *rtcm) +int decode_type1021(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1021: not supported message\n"); return 0; @@ -885,7 +888,7 @@ int decode_type1021(rtcm_t *rtcm) /* decode type 1022: moledenski-badekas transfromation -----------------------*/ -int decode_type1022(rtcm_t *rtcm) +int decode_type1022(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1022: not supported message\n"); return 0; @@ -893,7 +896,7 @@ int decode_type1022(rtcm_t *rtcm) /* decode type 1023: residual, ellipoidal grid representation ----------------*/ -int decode_type1023(rtcm_t *rtcm) +int decode_type1023(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1023: not supported message\n"); return 0; @@ -901,7 +904,7 @@ int decode_type1023(rtcm_t *rtcm) /* decode type 1024: residual, plane grid representation ---------------------*/ -int decode_type1024(rtcm_t *rtcm) +int decode_type1024(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1024: not supported message\n"); return 0; @@ -909,7 +912,7 @@ int decode_type1024(rtcm_t *rtcm) /* decode type 1025: projection (types except LCC2SP, OM) ---------------------*/ -int decode_type1025(rtcm_t *rtcm) +int decode_type1025(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1025: not supported message\n"); return 0; @@ -917,7 +920,7 @@ int decode_type1025(rtcm_t *rtcm) /* decode type 1026: projection (LCC2SP - lambert conic conformal (2sp)) -----*/ -int decode_type1026(rtcm_t *rtcm) +int decode_type1026(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1026: not supported message\n"); return 0; @@ -925,7 +928,7 @@ int decode_type1026(rtcm_t *rtcm) /* decode type 1027: projection (type OM - oblique mercator) -----------------*/ -int decode_type1027(rtcm_t *rtcm) +int decode_type1027(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1027: not supported message\n"); return 0; @@ -972,7 +975,7 @@ int decode_type1029(rtcm_t *rtcm) /* decode type 1030: network rtk residual ------------------------------------*/ -int decode_type1030(rtcm_t *rtcm) +int decode_type1030(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1030: not supported message\n"); return 0; @@ -980,7 +983,7 @@ int decode_type1030(rtcm_t *rtcm) /* decode type 1031: glonass network rtk residual ----------------------------*/ -int decode_type1031(rtcm_t *rtcm) +int decode_type1031(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1031: not supported message\n"); return 0; @@ -988,7 +991,7 @@ int decode_type1031(rtcm_t *rtcm) /* decode type 1032: physical reference station position information ---------*/ -int decode_type1032(rtcm_t *rtcm) +int decode_type1032(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1032: not supported message\n"); return 0; @@ -1062,7 +1065,7 @@ int decode_type1033(rtcm_t *rtcm) /* decode type 1034: gps network fkp gradient --------------------------------*/ -int decode_type1034(rtcm_t *rtcm) +int decode_type1034(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1034: not supported message\n"); return 0; @@ -1070,7 +1073,7 @@ int decode_type1034(rtcm_t *rtcm) /* decode type 1035: glonass network fkp gradient ----------------------------*/ -int decode_type1035(rtcm_t *rtcm) +int decode_type1035(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1035: not supported message\n"); return 0; @@ -1078,7 +1081,7 @@ int decode_type1035(rtcm_t *rtcm) /* decode type 1037: glonass network rtk ionospheric correction difference ---*/ -int decode_type1037(rtcm_t *rtcm) +int decode_type1037(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1037: not supported message\n"); return 0; @@ -1086,7 +1089,7 @@ int decode_type1037(rtcm_t *rtcm) /* decode type 1038: glonass network rtk geometic correction difference ------*/ -int decode_type1038(rtcm_t *rtcm) +int decode_type1038(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1038: not supported message\n"); return 0; @@ -1094,7 +1097,7 @@ int decode_type1038(rtcm_t *rtcm) /* decode type 1039: glonass network rtk combined correction difference ------*/ -int decode_type1039(rtcm_t *rtcm) +int decode_type1039(rtcm_t *rtcm __attribute__((unused))) { trace(2, "rtcm3 1039: not supported message\n"); return 0; @@ -1104,7 +1107,9 @@ int decode_type1039(rtcm_t *rtcm) /* decode type 1044: qzss ephemerides (ref [15]) -----------------------------*/ int decode_type1044(rtcm_t *rtcm) { - eph_t eph = {0}; + eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0,0.0}, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {0.0}, 0.0, 0.0}; double toc, sqrtA; char *msg; int i = 24+12, prn, sat, week, sys = SYS_QZS; @@ -1179,7 +1184,9 @@ int decode_type1044(rtcm_t *rtcm) /* decode type 1045: galileo satellite ephemerides (ref [15]) ----------------*/ int decode_type1045(rtcm_t *rtcm) { - eph_t eph = {0}; + eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0,0.0}, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {0.0}, 0.0, 0.0}; double toc, sqrtA; char *msg; int i = 24+12, prn, sat, week, e5a_hs, e5a_dvs, rsv, sys = SYS_GAL; @@ -1254,7 +1261,9 @@ int decode_type1045(rtcm_t *rtcm) /* decode type 1046: galileo satellite ephemerides (extension for IGS MGEX) --*/ int decode_type1046(rtcm_t *rtcm) { - eph_t eph = {0}; + eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0,0.0}, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {0.0}, 0.0, 0.0}; double toc, sqrtA; char *msg; int i = 24+12, prn, sat, week, e5a_hs, e5a_dvs, rsv, sys = SYS_GAL; @@ -1329,7 +1338,9 @@ int decode_type1046(rtcm_t *rtcm) /* decode type 1047: beidou ephemerides (tentative mt and format) ------------*/ int decode_type1047(rtcm_t *rtcm) { - eph_t eph = {0}; + eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0,0.0}, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {0.0}, 0.0, 0.0};; double toc, sqrtA; char *msg; int i = 24+12, prn, sat, week, sys = SYS_BDS; @@ -1407,7 +1418,9 @@ int decode_type1047(rtcm_t *rtcm) /* decode type 63: beidou ephemerides (rtcm draft) ---------------------------*/ int decode_type63(rtcm_t *rtcm) { - eph_t eph = {0}; + eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0,0.0}, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {0.0}, 0.0, 0.0}; double toc, sqrtA; char *msg; int i = 24+12, prn, sat, week, sys = SYS_BDS; @@ -2180,7 +2193,7 @@ void save_msm_obs(rtcm_t *rtcm, int sys, msm_h_t *h, const double *r, int decode_msm_head(rtcm_t *rtcm, int sys, int *sync, int *iod, msm_h_t *h, int *hsize) { - msm_h_t h0 = {0}; + msm_h_t h0 = {0, 0, 0, 0, 0, 0, 0, 0, {0}, {0}, {0}}; double tow, tod; char *msg; int i = 24, j, dow, mask, staid, type, ncell = 0; @@ -2270,7 +2283,7 @@ int decode_msm_head(rtcm_t *rtcm, int sys, int *sync, int *iod, /* decode unsupported msm message --------------------------------------------*/ int decode_msm0(rtcm_t *rtcm, int sys) { - msm_h_t h = {0}; + msm_h_t h = {0, 0, 0, 0, 0, 0, 0, 0, {0}, {0}, {0}}; int i, sync, iod; if (decode_msm_head(rtcm, sys, &sync, &iod, &h, &i) < 0) return -1; rtcm->obsflag = !sync; @@ -2281,7 +2294,7 @@ int decode_msm0(rtcm_t *rtcm, int sys) /* decode msm 4: full pseudorange and phaserange plus cnr --------------------*/ int decode_msm4(rtcm_t *rtcm, int sys) { - msm_h_t h = {0}; + msm_h_t h = {0, 0, 0, 0, 0, 0, 0, 0, {0}, {0}, {0}}; double r[64], pr[64], cp[64], cnr[64]; int i, j, type, sync, iod, ncell, rng, rng_m, prv, cpv, lock[64], half[64]; @@ -2290,7 +2303,7 @@ int decode_msm4(rtcm_t *rtcm, int sys) /* decode msm header */ if ((ncell = decode_msm_head(rtcm, sys, &sync, &iod, &h, &i)) < 0) return -1; - if (i+h.nsat*18+ncell*48>rtcm->len*8) + if (i+h.nsat*18+ncell*48 > rtcm->len*8) { trace(2, "rtcm3 %d length error: nsat=%d ncell=%d len=%d\n", type, h.nsat, ncell, rtcm->len); @@ -2344,7 +2357,7 @@ int decode_msm4(rtcm_t *rtcm, int sys) /* decode msm 5: full pseudorange, phaserange, phaserangerate and cnr --------*/ int decode_msm5(rtcm_t *rtcm, int sys) { - msm_h_t h = {0}; + msm_h_t h = {0, 0, 0, 0, 0, 0, 0, 0, {0}, {0}, {0}}; double r[64], rr[64], pr[64], cp[64], rrf[64], cnr[64]; int i, j, type, sync, iod, ncell, rng, rng_m, rate, prv, cpv, rrv, lock[64]; int ex[64], half[64]; @@ -2425,7 +2438,7 @@ int decode_msm5(rtcm_t *rtcm, int sys) /* decode msm 6: full pseudorange and phaserange plus cnr (high-res) ---------*/ int decode_msm6(rtcm_t *rtcm, int sys) { - msm_h_t h = {0}; + msm_h_t h = {0, 0, 0, 0, 0, 0, 0, 0, {0}, {0}, {0}}; double r[64], pr[64], cp[64], cnr[64]; int i, j, type, sync, iod, ncell, rng, rng_m, prv, cpv, lock[64], half[64]; @@ -2488,7 +2501,7 @@ int decode_msm6(rtcm_t *rtcm, int sys) /* decode msm 7: full pseudorange, phaserange, phaserangerate and cnr (h-res) */ int decode_msm7(rtcm_t *rtcm, int sys) { - msm_h_t h = {0}; + msm_h_t h = {0, 0, 0, 0, 0, 0, 0, 0, {0}, {0}, {0}}; double r[64], rr[64], pr[64], cp[64], rrf[64], cnr[64]; int i, j, type, sync, iod, ncell, rng, rng_m, rate, prv, cpv, rrv, lock[64]; int ex[64], half[64]; diff --git a/src/algorithms/libs/rtklib/rtklib_rtcm3.h b/src/algorithms/libs/rtklib/rtklib_rtcm3.h index 58ae71fb0..8ddcc8f05 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtcm3.h +++ b/src/algorithms/libs/rtklib/rtklib_rtcm3.h @@ -62,26 +62,6 @@ const double PRUNIT_GPS = 299792.458; /* rtcm ver.3 unit of gps pseudorange (m) const double PRUNIT_GLO = 599584.916; /* rtcm ver.3 unit of glonass pseudorange (m) */ const double RANGE_MS = SPEED_OF_LIGHT * 0.001; /* range in 1 ms */ -//#define P2_10 0.0009765625 /* 2^-10 */ -//#define P2_34 5.820766091346740E-11 /* 2^-34 */ -//#define P2_46 1.421085471520200E-14 /* 2^-46 */ -//#define P2_59 1.734723475976810E-18 /* 2^-59 */ -//#define P2_66 1.355252715606880E-20 /* 2^-66 */ - -/* type definition -----------------------------------------------------------*/ - -typedef struct { /* multi-signal-message header type */ - unsigned char iod; /* issue of data station */ - unsigned char time_s; /* cumulative session transmitting time */ - unsigned char clk_str; /* clock steering indicator */ - unsigned char clk_ext; /* external clock indicator */ - unsigned char smooth; /* divergence free smoothing indicator */ - unsigned char tint_s; /* soothing interval */ - unsigned char nsat,nsig; /* number of satellites/signals */ - unsigned char sats[64]; /* satellites */ - unsigned char sigs[32]; /* signals */ - unsigned char cellmask[64]; /* cell mask */ -} msm_h_t; /* msm signal id table -------------------------------------------------------*/ const char *msm_sig_gps[32] = {