33 #ifndef GNSS_SDR_RTKLIB_H 34 #define GNSS_SDR_RTKLIB_H 44 #include <netinet/in.h> 53 #define closesocket close 54 #define lock_t pthread_mutex_t 55 #define initlock(f) pthread_mutex_init(f, NULL) 56 #define rtk_lock(f) pthread_mutex_lock(f) 57 #define rtk_unlock(f) pthread_mutex_unlock(f) 59 #define VER_RTKLIB "2.4.2" 60 #define NTRIP_AGENT "RTKLIB/" VER_RTKLIB 61 #define NTRIP_CLI_PORT 2101 62 #define NTRIP_SVR_PORT 80 63 #define NTRIP_MAXRSP 32768 64 #define NTRIP_MAXSTR 256 65 #define NTRIP_RSP_OK_CLI "ICY 200 OK\r\n" 66 #define NTRIP_RSP_OK_SVR "OK\r\n" 67 #define NTRIP_RSP_SRCTBL "SOURCETABLE 200 OK\r\n" 68 #define NTRIP_RSP_TBLEND "ENDSOURCETABLE" 69 #define NTRIP_RSP_HTTP "HTTP/" 70 #define NTRIP_RSP_ERROR "ERROR" 72 #define FTP_CMD "wget" 86 const int FILEPATHSEP =
'/';
90 const double HION = 350000.0;
150 const int NSYSGPS = 1;
169 const int NSYSGLO = 1;
174 const int NSYSGLO = 0;
181 const int NSYSGAL = 1;
184 const int MINPRNQZS = 193;
185 const int MAXPRNQZS = 199;
186 const int MINPRNQZS_S = 183;
187 const int MAXPRNQZS_S = 189;
188 const int NSATQZS = (MAXPRNQZS - MINPRNQZS + 1);
189 const int NSYSQZS = 1;
191 const int MINPRNQZS = 0;
192 const int MAXPRNQZS = 0;
193 const int MINPRNQZS_S = 0;
194 const int MAXPRNQZS_S = 0;
195 const int NSATQZS = 0;
196 const int NSYSQZS = 0;
204 const int NSYSBDS = 1;
209 const int NSYSBDS = 0;
213 const int MINPRNIRN = 1;
214 const int MAXPRNIRN = 7;
215 const int NSATIRN = (MAXPRNIRN - MINPRNIRN + 1);
216 const int NSYSIRN = 1;
218 const int MINPRNIRN = 0;
219 const int MAXPRNIRN = 0;
220 const int NSATIRN = 0;
221 const int NSYSIRN = 0;
225 const int MINPRNLEO = 1;
226 const int NSATLEO = 10;
227 const int NSATLEO = (MAXPRNLEO - MINPRNLEO + 1);
228 const int NSYSLEO = 1;
230 const int MINPRNLEO = 0;
231 const int MAXPRNLEO = 0;
232 const int NSATLEO = 0;
233 const int NSYSLEO = 0;
236 const int NSYS = (NSYSGPS + NSYSGLO + NSYSGAL + NSYSQZS + NSYSBDS + NSYSIRN + NSYSLEO);
244 const int MAXSTA = 255;
313 const int ARMODE_WLNL = 6;
314 const int ARMODE_TCAR = 7;
323 #define STR_MODE_R 0x1 324 #define STR_MODE_W 0x2 325 #define STR_MODE_RW 0x3 333 #define STR_NTRIPSVR 6 334 #define STR_NTRIPCLI 7 338 #define NP_PPP(opt) ((opt)->dynamics ? 9 : 3) 339 #define IC_PPP(s, opt) (NP_PPP(opt) + (s)) 340 #define IT_PPP(opt) (IC_PPP(0, opt) + NSYS) 341 #define NR_PPP(opt) (IT_PPP(opt) + ((opt)->tropopt < TROPOPT_EST ? 0 : ((opt)->tropopt == TROPOPT_EST ? 1 : 3))) 342 #define IB_PPP(s, opt) (NR_PPP(opt) + (s)-1) 343 #define NX_PPP(opt) (IB_PPP(MAXSAT, opt) + 1) 345 #define NF_RTK(opt) ((opt)->ionoopt == IONOOPT_IFLC ? 1 : (opt)->nf) 346 #define NP_RTK(opt) ((opt)->dynamics == 0 ? 3 : 9) 347 #define NI_RTK(opt) ((opt)->ionoopt != IONOOPT_EST ? 0 : MAXSAT) 348 #define NT_RTK(opt) ((opt)->tropopt < TROPOPT_EST ? 0 : ((opt)->tropopt < TROPOPT_ESTG ? 2 : 6)) 349 #define NL_RTK(opt) ((opt)->glomodear != 2 ? 0 : NFREQGLO) 350 #define NB_RTK(opt) ((opt)->mode <= PMODE_DGPS ? 0 : MAXSAT * NF_RTK(opt)) 351 #define NR_RTK(opt) (NP_RTK(opt) + NI_RTK(opt) + NT_RTK(opt) + NL_RTK(opt)) 352 #define NX_RTK(opt) (NR_RTK(opt) + NB_RTK(opt)) 364 unsigned char sat, rcv;
404 double off[
NFREQ][3];
405 double var[
NFREQ][19];
425 double A, e, i0, OMG0, omg, M0, OMGd;
442 double A, e, i0, OMG0, omg, M0, deln, OMGd, idot;
443 double crc, crs, cuc, cus, cic, cis;
476 double pos[MAXSAT][4];
477 float std[MAXSAT][4];
478 double vel[MAXSAT][4];
479 float vst[MAXSAT][4];
480 float cov[MAXSAT][3];
481 float vco[MAXSAT][3];
489 double clk[MAXSAT][1];
490 float std[MAXSAT][1];
554 double bias[MAXSAT][3];
555 double std[MAXSAT][3];
563 unsigned char msg[29];
665 double yaw_ang, yaw_rate;
666 unsigned char update;
678 unsigned char msg[212];
694 unsigned char health;
737 char stas[MAXSTA][8];
738 double rr[MAXSTA][3];
739 int ns[MAXSTA], nsmax[MAXSTA];
740 int nt[MAXSTA], ntmax[MAXSTA];
778 double lam[MAXSAT][
NFREQ];
779 double cbias[MAXSAT][3];
780 double rbias[
MAXRCV][2][3];
781 double wlbias[MAXSAT];
782 double glo_cpbias[4];
856 unsigned short slipc;
883 char msmtype[6][128];
893 unsigned char buff[1200];
895 unsigned int nmsg2[100];
896 unsigned int nmsg3[400];
922 double cerr[4][
NFREQ * 2];
923 double perr[4][
NFREQ * 2];
924 double gpsglob[
NFREQ];
925 double gloicb[
NFREQ];
932 double mask[
NFREQ][9];
965 double eratio[
NFREQ];
986 unsigned char exsats[MAXSAT];
993 double odisp[2][6 * 11];
1030 unsigned char vsat[
NFREQ];
1031 unsigned char snr[
NFREQ];
1032 unsigned char fix[
NFREQ];
1033 unsigned char slip[
NFREQ];
1034 unsigned char half[
NFREQ];
1036 unsigned int outc[
NFREQ];
1037 unsigned int slipc[
NFREQ];
1038 unsigned int rejc[
NFREQ];
1044 double ph[2][
NFREQ];
1080 unsigned char valid;
1092 unsigned int inb, inr;
1093 unsigned int outb, outr;
1094 unsigned int tick, tact;
1095 unsigned int inbt, outbt;
1125 unsigned int tick_f;
1139 struct sockaddr_in addr;
1171 char str[NTRIP_MAXSTR];
1172 unsigned char buff[NTRIP_MAXRSP];
1205 unsigned char subfrm[MAXSAT][380];
1208 double icpp[MAXSAT], off[MAXSAT], icpc;
1209 double prCA[MAXSAT], dpCA[MAXSAT];
1221 double receive_time;
1227 unsigned char pbuff[255 + 4 + 2];
1248 unsigned char *buff[3];
1249 unsigned char *sbuf[2];
1250 unsigned char *pbuf[3];
1252 unsigned int nmsg[3][10];
1272 unsigned char time_s;
1273 unsigned char clk_str;
1274 unsigned char clk_ext;
1275 unsigned char smooth;
1276 unsigned char tint_s;
1277 unsigned char nsat, nsig;
1278 unsigned char sats[64];
1279 unsigned char sigs[32];
1280 unsigned char cellmask[64];
1284 const double CHISQR[100] = {
1285 10.8, 13.8, 16.3, 18.5, 20.5, 22.5, 24.3, 26.1, 27.9, 29.6,
1286 31.3, 32.9, 34.5, 36.1, 37.7, 39.3, 40.8, 42.3, 43.8, 45.3,
1287 46.8, 48.3, 49.7, 51.2, 52.6, 54.1, 55.5, 56.9, 58.3, 59.7,
1288 61.1, 62.5, 63.9, 65.2, 66.6, 68.0, 69.3, 70.7, 72.1, 73.4,
1289 74.7, 76.0, 77.3, 78.6, 80.0, 81.3, 82.6, 84.0, 85.4, 86.7,
1290 88.0, 89.3, 90.6, 91.9, 93.3, 94.7, 96.0, 97.4, 98.7, 100,
1291 101, 102, 103, 104, 105, 107, 108, 109, 110, 112,
1292 113, 114, 115, 116, 118, 119, 120, 122, 123, 125,
1293 126, 127, 128, 129, 131, 132, 133, 134, 135, 137,
1294 138, 139, 140, 142, 143, 144, 145, 147, 148, 149};
1297 const double LAM_CARR[
MAXFREQ] = {
1301 const int STRFMT_RTCM2 = 0;
1302 const int STRFMT_RTCM3 = 1;
1303 const int STRFMT_SP3 = 16;
1304 const int STRFMT_RNXCLK = 17;
1305 const int STRFMT_SBAS = 18;
1306 const int STRFMT_NMEA = 19;
1309 const int MAXSTRRTK = 8;
1312 #endif // GNSS_SDR_RTKLIB_H const int ARMODE_PPPAR
AR mode: PPP-AR.
const double EFACT_SBS
error factor: SBAS
const double FE_WGS84
earth flattening (WGS84)
const int MAXOBSBUF
max number of observation data buffer
const int PMODE_PPP_STATIC
positioning mode: PPP-static
const double EFACT_BDS
error factor: BeiDou
const int EPHOPT_LEX
ephemeris option: QZSS LEX ephemeris
const int MAXRCV
max receiver number (1 to MAXRCV)
const int SERIBUFFSIZE
serial buffer size (bytes)
const double PRN_HWBIAS
process noise of h/w bias (m/MHz/sqrt(s))
const int ARMODE_INST
AR mode: instantaneous.
const int SOLF_NMEA
solution format: NMEA-183
const int PMODE_PPP_FIXED
positioning mode: PPP-fixed
const int MAXOBS
max number of obs in an epoch
const double HION
ionosphere height (m)
const int FTP_TIMEOUT
ftp/http timeout (s)
const int MAXPRNGAL
max satellite PRN number of Galileo
const int SOLQ_DGPS
solution status: DGPS/DGNSS
const int ARMODE_PPPAR_ILS
AR mode: AR mode: PPP-AR ILS.
const double EFACT_GAL
error factor: Galileo
const int SYS_ALL
navigation system: all
const int SYS_QZS
navigation system: QZSS
const int PMODE_FIXED
positioning mode: fixed
const int MAXPRNGPS
max satellite PRN number of GPS
const int SYS_SBS
navigation system: SBAS
const double INT_SWAP_STAT
swap interval of solution status file (s)
const int MAXCLI
max client connection for tcp svr
const int MINPRNBDS
min satellite sat number of BeiDou
constexpr double SPEED_OF_LIGHT_M_S
Speed of light in vacuum [m/s].
const int MINPRNGLO
min satellite slot number of GLONASS
const int SOLF_LLH
solution format: lat/lon/height
const int MAXLEAPS
max number of leap seconds table
constexpr double FREQ8
E5a+b frequency (Hz)
const double ERR_CBIAS
code bias error std (m)
const double ERR_BRDCI
broadcast iono model error factor
const int MAXSBSMSG
max number of SBAS msg in RTK server
const int IONOOPT_LEX
ionosphere option: QZSS LEX ionospehre
const int MAXNIGP
max number of IGP in SBAS band
const int SOLF_STAT
solution format: solution status
const int MAXEXFILE
max number of expanded files
const int IONOOPT_OFF
ionosphere option: correction off
const int ARMODE_OFF
AR mode: off.
const int PMODE_KINEMA
positioning mode: kinematic
const int MINPRNSBS
min satellite PRN number of SBAS
const int MAXPRNGLO
max satellite slot number of GLONASS
const int NSATGLO
number of GLONASS satellites
const int TIMES_GPST
time system: gps time
const int MAXPRNBDS
max satellite sat number of BeiDou
const int SYS_GAL
navigation system: Galileo
const int MAXPRNSBS
max satellite PRN number of SBAS
const int SYS_GPS
navigation system: GPS
const int NSYS
number of systems
const int SOLQ_SINGLE
solution status: single
const double EFACT_GLO
error factor: GLONASS
const int MAXNGEO
max number of GEO satellites
constexpr int32_t MAXCODE
max number of obs code
const int EPHOPT_SSRAPC
ephemeris option: broadcast + SSR_APC
const double MAXDTOE_QZS
max time difference to QZSS Toe (s)
const int MAXSOLBUF
max number of solution buffer
const int IONOOPT_SBAS
ionosphere option: SBAS model
const int SYS_NONE
navigation system: none
const int TROPOPT_COR
troposphere option: ZTD correction
const int MAXSBSURA
max URA of SBAS satellite
const int SOLQ_FLOAT
solution status: float
const int IONOOPT_TEC
ionosphere option: IONEX TEC model
const int EPHOPT_SBAS
ephemeris option: broadcast + SBAS
const int ARMODE_CONT
AR mode: continuous.
Defines useful mathematical constants and their scaled versions.
const int MAXANT
max length of station name/antenna type
const unsigned int POLYCRC32
CRC32 polynomial.
const int SYS_IRN
navigation system: IRNS
const int MAXSTRMSG
max length of stream message
const int PMODE_DGPS
positioning mode: DGPS/DGNSS
const double MAXDTOE_SBS
max time difference to SBAS Toe (s)
const int MAXFREQ
max NFREQ
const int TROPOPT_ESTG
troposphere option: ZTD+grad estimation
const int SYS_GLO
navigation system: GLONASS
const int PMODE_PPP_KINEMA
positioning mode: PPP-kinemaric
const double EFACT_IRN
error factor: IRNSS
const int MAXRAWLEN
max length of receiver raw message
const int MAXSOLMSG
max length of solution message
void(const char *) fatalfunc_t
fatal callback function type
const int TIMES_JST
time system: jst
constexpr double FREQ1
L1/E1 frequency (Hz)
const int MINPRNGAL
min satellite PRN number of Galileo
const double EFACT_GPS
error factor: GPS
const int PMODE_MOVEB
positioning mode: moving-base
const double DTTOL
tolerance of time difference (s)
const int TINTACT
period for stream active (ms)
const int TROPOPT_SBAS
troposphere option: SBAS model
const double MAXGDOP
max GDOP
const int NSATGAL
number of Galileo satellites
constexpr double FREQ5
L5/E5a frequency (Hz)
const double INT_SWAP_TRAC
swap interval of trace file (s)
const int NFREQ
number of carrier frequencies
const int SOLQ_NONE
solution status: no solution
const double MAXDTOE_BDS
max time difference to BeiDou Toe (s)
const int EPHOPT_BRDC
ephemeris option: broadcast ephemeris
const double REL_HUMI
relative humidity for saastamoinen model
const int MAXSOLQ
max number of solution status
const double EFACT_QZS
error factor: QZSS
const int IONOOPT_BRDC
ionosphere option: broadcast model
const int TROPOPT_SAAS
troposphere option: Saastamoinen model
const int TIMES_UTC
time system: utc
constexpr double FREQ6
E6/LEX frequency (Hz)
const int MAXERRMSG
max length of error/warning message
const int NSATSBS
number of SBAS satellites
const double MAXDTOE_S
max time difference to ephem toe (s) for other
const int TROPOPT_OFF
troposphere option: correction off
const int POSOPT_RINEX
pos option: rinex header pos
const int IONOOPT_IFLC
ionosphere option: L1/L2 or L1/L5 iono-free LC
const int MAXOBSTYPE
max number of obs type in RINEX
const int IONOOPT_STEC
ionosphere option: SLANT TEC model
const double ERR_SAAS
saastamoinen model error std (m)
const int EPHOPT_SSRCOM
ephemeris option: broadcast + SSR_COM
const int NSATGPS
number of GPS satellites
const int SOLF_XYZ
solution format: x/y/z-ecef
const int NSATBDS
number of BeiDou satellites
constexpr double FREQ2
L2 frequency (Hz)
constexpr double FREQ7
E5b frequency (Hz)
constexpr double FREQ9
S frequency (Hz)
const double MAXDTOE
max time difference to GPS Toe (s)
const double MAXDTOE_GLO
max time difference to GLONASS Toe (s)
const unsigned int POLYCRC24Q
CRC24Q polynomial.
const int IONOOPT_QZS
ionosphere option: QZSS broadcast model
const int TIMETAGH_LEN
time tag file header length
const double GAP_RESION
default gap to reset ionos parameters (ep)
const int MAXSTATMSG
max length of status message
const int SOLQ_DR
solution status: dead reckoning
const int ARMODE_FIXHOLD
AR mode: fix and hold.
const int NEXOBS
number of extended obs codes
const int SOLF_GSIF
solution format: GSI F1/F2
const int SOLF_ENU
solution format: e/n/u-baseline
const int EPHOPT_PREC
ephemeris option: precise ephemeris
const int TROPOPT_CORG
troposphere option: ZTD+grad correction
const int SYS_BDS
navigation system: BeiDou
const int PMODE_SINGLE
positioning mode: single
const int SOLQ_PPP
solution status: PPP
const double RE_WGS84
earth semimajor axis (WGS84) (m)
const int SOLQ_FIX
solution status: fix
const int TROPOPT_EST
troposphere option: ZTD estimation
const int MAXBAND
max SBAS band of IGP
const int IONOOPT_EST
ionosphere option: estimation
const int MINPRNGPS
min satellite PRN number of GPS
const double MAXSBSAGEL
max age of SBAS long term corr (s)
const int SYS_LEO
navigation system: LEO
const double MAXSBSAGEF
max age of SBAS fast correction (s)
const int PMODE_STATIC
positioning mode: static
const int SOLQ_SBAS
solution status: SBAS
const double MAXDTOE_GAL
max time difference to Galileo Toe (s)
const int NFREQGLO
number of carrier frequencies of GLONASS
const int MAXSTRPATH
max length of stream path