mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
Add RTCM decoding functions
This commit is contained in:
parent
b2531cb926
commit
f0c8fc7089
413
src/algorithms/libs/rtklib/rtklib_rtcm.cc
Normal file
413
src/algorithms/libs/rtklib/rtklib_rtcm.cc
Normal file
@ -0,0 +1,413 @@
|
|||||||
|
/*!
|
||||||
|
* \file rtklib_rtcm.cc
|
||||||
|
* \brief RTCM functions
|
||||||
|
* \authors <ul>
|
||||||
|
* <li> 2007-2013, T. Takasu
|
||||||
|
* <li> 2017, Javier Arribas
|
||||||
|
* <li> 2017, Carles Fernandez
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* This is a derived work from RTKLIB http://www.rtklib.com/
|
||||||
|
* The original source code at https://github.com/tomojitakasu/RTKLIB is
|
||||||
|
* released under the BSD 2-clause license with an additional exclusive clause
|
||||||
|
* that does not apply here. This additional clause is reproduced below:
|
||||||
|
*
|
||||||
|
* " The software package includes some companion executive binaries or shared
|
||||||
|
* libraries necessary to execute APs on Windows. These licenses succeed to the
|
||||||
|
* original ones of these software. "
|
||||||
|
*
|
||||||
|
* Neither the executive binaries nor the shared libraries are required by, used
|
||||||
|
* or included in GNSS-SDR.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* Copyright (C) 2007-2013, T. Takasu
|
||||||
|
* Copyright (C) 2017, Javier Arribas
|
||||||
|
* Copyright (C) 2017, Carles Fernandez
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "rtklib_rtcm.h"
|
||||||
|
#include "rtklib_rtcm2.h"
|
||||||
|
#include "rtklib_rtcm3.h"
|
||||||
|
#include "rtklib_rtkcmn.h"
|
||||||
|
|
||||||
|
//extern int encode_rtcm3(rtcm_t *rtcm, int type, int sync);
|
||||||
|
|
||||||
|
|
||||||
|
/* initialize rtcm control -----------------------------------------------------
|
||||||
|
* initialize rtcm control struct and reallocate memory for observation and
|
||||||
|
* ephemeris buffer in rtcm control struct
|
||||||
|
* args : rtcm_t *raw IO rtcm control struct
|
||||||
|
* return : status (1:ok,0:memory allocation error)
|
||||||
|
*-----------------------------------------------------------------------------*/
|
||||||
|
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}}};
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
trace(3, "init_rtcm:\n");
|
||||||
|
|
||||||
|
rtcm->staid = rtcm->stah = rtcm->seqno = rtcm->outtype = 0;
|
||||||
|
rtcm->time = rtcm->time_s = time0;
|
||||||
|
rtcm->sta.name[0] = rtcm->sta.marker[0] = '\0';
|
||||||
|
rtcm->sta.antdes[0] = rtcm->sta.antsno[0] = '\0';
|
||||||
|
rtcm->sta.rectype[0] = rtcm->sta.recver[0] = rtcm->sta.recsno[0] = '\0';
|
||||||
|
rtcm->sta.antsetup = rtcm->sta.itrf = rtcm->sta.deltype = 0;
|
||||||
|
for (i = 0;i < 3;i++)
|
||||||
|
{
|
||||||
|
rtcm->sta.pos[i] = rtcm->sta.del[i] = 0.0;
|
||||||
|
}
|
||||||
|
rtcm->sta.hgt = 0.0;
|
||||||
|
rtcm->dgps = NULL;
|
||||||
|
for (i = 0;i < MAXSAT;i++)
|
||||||
|
{
|
||||||
|
rtcm->ssr[i] = ssr0;
|
||||||
|
}
|
||||||
|
rtcm->msg[0] = rtcm->msgtype[0] = rtcm->opt[0] = '\0';
|
||||||
|
for (i = 0;i < 6;i++) rtcm->msmtype[i][0] = '\0';
|
||||||
|
rtcm->obsflag = rtcm->ephsat = 0;
|
||||||
|
for (i = 0;i < MAXSAT;i++) for (j = 0;j < NFREQ+NEXOBS;j++)
|
||||||
|
{
|
||||||
|
rtcm->cp[i][j] = 0.0;
|
||||||
|
rtcm->lock[i][j] = rtcm->loss[i][j] = 0;
|
||||||
|
rtcm->lltime[i][j] = time0;
|
||||||
|
}
|
||||||
|
rtcm->nbyte = rtcm->nbit = rtcm->len = 0;
|
||||||
|
rtcm->word = 0;
|
||||||
|
for (i = 0;i < 100;i++) rtcm->nmsg2[i] = 0;
|
||||||
|
for (i = 0;i < 300;i++) rtcm->nmsg3[i] = 0;
|
||||||
|
|
||||||
|
rtcm->obs.data = NULL;
|
||||||
|
rtcm->nav.eph = NULL;
|
||||||
|
rtcm->nav.geph = NULL;
|
||||||
|
|
||||||
|
/* reallocate memory for observation and ephemris buffer */
|
||||||
|
if (!(rtcm->obs.data = (obsd_t *)malloc(sizeof(obsd_t)*MAXOBS)) ||
|
||||||
|
!(rtcm->nav.eph = (eph_t *)malloc(sizeof(eph_t )*MAXSAT)) ||
|
||||||
|
!(rtcm->nav.geph = (geph_t *)malloc(sizeof(geph_t)*MAXPRNGLO)))
|
||||||
|
{
|
||||||
|
free_rtcm(rtcm);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
rtcm->obs.n = 0;
|
||||||
|
rtcm->nav.n = MAXSAT;
|
||||||
|
rtcm->nav.ng = MAXPRNGLO;
|
||||||
|
for (i = 0;i < MAXOBS ;i++) rtcm->obs.data[i] = data0;
|
||||||
|
for (i = 0;i < MAXSAT ;i++) rtcm->nav.eph [i] = eph0;
|
||||||
|
for (i = 0;i < MAXPRNGLO;i++) rtcm->nav.geph[i] = geph0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* free rtcm control ----------------------------------------------------------
|
||||||
|
* free observation and ephemris buffer in rtcm control struct
|
||||||
|
* args : rtcm_t *raw IO rtcm control struct
|
||||||
|
* return : none
|
||||||
|
*-----------------------------------------------------------------------------*/
|
||||||
|
void free_rtcm(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
trace(3, "free_rtcm:\n");
|
||||||
|
|
||||||
|
/* free memory for observation and ephemeris buffer */
|
||||||
|
free(rtcm->obs.data); rtcm->obs.data = NULL; rtcm->obs.n = 0;
|
||||||
|
free(rtcm->nav.eph ); rtcm->nav.eph = NULL; rtcm->nav.n = 0;
|
||||||
|
free(rtcm->nav.geph); rtcm->nav.geph = NULL; rtcm->nav.ng = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* input rtcm 2 message from stream --------------------------------------------
|
||||||
|
* fetch next rtcm 2 message and input a message from byte stream
|
||||||
|
* args : rtcm_t *rtcm IO rtcm control struct
|
||||||
|
* unsigned char data I stream data (1 byte)
|
||||||
|
* return : status (-1: error message, 0: no message, 1: input observation data,
|
||||||
|
* 2: input ephemeris, 5: input station pos/ant parameters,
|
||||||
|
* 6: input time parameter, 7: input dgps corrections,
|
||||||
|
* 9: input special message)
|
||||||
|
* notes : before firstly calling the function, time in rtcm control struct has
|
||||||
|
* to be set to the approximate time within 1/2 hour in order to resolve
|
||||||
|
* ambiguity of time in rtcm messages.
|
||||||
|
* supported msgs RTCM ver.2: 1,3,9,14,16,17,18,19,22
|
||||||
|
* refer [1] for RTCM ver.2
|
||||||
|
*-----------------------------------------------------------------------------*/
|
||||||
|
int input_rtcm2(rtcm_t *rtcm, unsigned char data)
|
||||||
|
{
|
||||||
|
unsigned char preamb;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
trace(5, "input_rtcm2: data=%02x\n", data);
|
||||||
|
|
||||||
|
if ((data & 0xC0) != 0x40) return 0; /* ignore if upper 2bit != 01 */
|
||||||
|
|
||||||
|
for (i = 0; i < 6; i++, data >>= 1)
|
||||||
|
{ /* decode 6-of-8 form */
|
||||||
|
rtcm->word = (rtcm->word << 1) + (data & 1);
|
||||||
|
|
||||||
|
/* synchronize frame */
|
||||||
|
if (rtcm->nbyte == 0)
|
||||||
|
{
|
||||||
|
preamb = (unsigned char)(rtcm->word>>22);
|
||||||
|
if (rtcm->word & 0x40000000) preamb ^= 0xFF; /* decode preamble */
|
||||||
|
if (preamb != RTCM2PREAMB) continue;
|
||||||
|
|
||||||
|
/* check parity */
|
||||||
|
if (!decode_word(rtcm->word, rtcm->buff)) continue;
|
||||||
|
rtcm->nbyte = 3; rtcm->nbit = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (++rtcm->nbit < 30) continue; else rtcm->nbit = 0;
|
||||||
|
|
||||||
|
/* check parity */
|
||||||
|
if (!decode_word(rtcm->word, rtcm->buff+rtcm->nbyte))
|
||||||
|
{
|
||||||
|
trace(2, "rtcm2 partity error: i=%d word=%08x\n", i, rtcm->word);
|
||||||
|
rtcm->nbyte = 0; rtcm->word &= 0x3;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rtcm->nbyte += 3;
|
||||||
|
if (rtcm->nbyte == 6) rtcm->len = (rtcm->buff[5]>>3)*3+6;
|
||||||
|
if (rtcm->nbyte < rtcm->len) continue;
|
||||||
|
rtcm->nbyte = 0; rtcm->word &= 0x3;
|
||||||
|
|
||||||
|
/* decode rtcm2 message */
|
||||||
|
return decode_rtcm2(rtcm);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* input rtcm 3 message from stream --------------------------------------------
|
||||||
|
* fetch next rtcm 3 message and input a message from byte stream
|
||||||
|
* args : rtcm_t *rtcm IO rtcm control struct
|
||||||
|
* unsigned char data I stream data (1 byte)
|
||||||
|
* return : status (-1: error message, 0: no message, 1: input observation data,
|
||||||
|
* 2: input ephemeris, 5: input station pos/ant parameters,
|
||||||
|
* 10: input ssr messages)
|
||||||
|
* notes : before firstly calling the function, time in rtcm control struct has
|
||||||
|
* to be set to the approximate time within 1/2 week in order to resolve
|
||||||
|
* ambiguity of time in rtcm messages.
|
||||||
|
*
|
||||||
|
* to specify input options, set rtcm->opt to the following option
|
||||||
|
* strings separated by spaces.
|
||||||
|
*
|
||||||
|
* -EPHALL : input all ephemerides
|
||||||
|
* -STA=nnn : input only message with STAID=nnn
|
||||||
|
* -GLss : select signal ss for GPS MSM (ss=1C,1P,...)
|
||||||
|
* -RLss : select signal ss for GLO MSM (ss=1C,1P,...)
|
||||||
|
* -ELss : select signal ss for GAL MSM (ss=1C,1B,...)
|
||||||
|
* -JLss : select signal ss for QZS MSM (ss=1C,2C,...)
|
||||||
|
* -CLss : select signal ss for BDS MSM (ss=2I,7I,...)
|
||||||
|
*
|
||||||
|
* supported RTCM 3 messages
|
||||||
|
* (ref [2][3][4][5][6][7][8][9][10][11][12][13][14][15])
|
||||||
|
*
|
||||||
|
* TYPE GPS GLOASS GALILEO QZSS BEIDOU SBAS
|
||||||
|
* ----------------------------------------------------------------------
|
||||||
|
* OBS C-L1 : 1001~ 1009~ - - - -
|
||||||
|
* F-L1 : 1002 1010 - - - -
|
||||||
|
* C-L12 : 1003~ 1011~ - - - -
|
||||||
|
* F-L12 : 1004 1012 - - - -
|
||||||
|
*
|
||||||
|
* NAV : 1019 1020 1045* 1044* 1047* -
|
||||||
|
* - - 1046* - - -
|
||||||
|
*
|
||||||
|
* MSM 1 : 1071~ 1081~ 1091~ 1111*~ 1121*~ 1101*~
|
||||||
|
* 2 : 1072~ 1082~ 1092~ 1112*~ 1122*~ 1102*~
|
||||||
|
* 3 : 1073~ 1083~ 1093~ 1113*~ 1123*~ 1103*~
|
||||||
|
* 4 : 1074 1084 1094 1114* 1124* 1104*
|
||||||
|
* 5 : 1075 1085 1095 1115* 1125* 1105*
|
||||||
|
* 6 : 1076 1086 1096 1116* 1126* 1106*
|
||||||
|
* 7 : 1077 1087 1097 1117* 1127* 1107*
|
||||||
|
*
|
||||||
|
* SSR OBT : 1057 1063 1240* 1246* 1258* -
|
||||||
|
* CLK : 1058 1064 1241* 1247* 1259* -
|
||||||
|
* BIAS : 1059 1065 1242* 1248* 1260* -
|
||||||
|
* OBTCLK: 1060 1066 1243* 1249* 1261* -
|
||||||
|
* URA : 1061 1067 1244* 1250* 1262* -
|
||||||
|
* HRCLK : 1062 1068 1245* 1251* 1263* -
|
||||||
|
*
|
||||||
|
* ANT INFO : 1005 1006 1007 1008 1033
|
||||||
|
* ----------------------------------------------------------------------
|
||||||
|
* (* draft, ~ only encode)
|
||||||
|
*
|
||||||
|
* for MSM observation data with multiple signals for a frequency,
|
||||||
|
* a signal is selected according to internal priority. to select
|
||||||
|
* a specified signal, use the input options.
|
||||||
|
*
|
||||||
|
* rtcm3 message format:
|
||||||
|
* +----------+--------+-----------+--------------------+----------+
|
||||||
|
* | preamble | 000000 | length | data message | parity |
|
||||||
|
* +----------+--------+-----------+--------------------+----------+
|
||||||
|
* |<-- 8 --->|<- 6 -->|<-- 10 --->|<--- length x 8 --->|<-- 24 -->|
|
||||||
|
*
|
||||||
|
*-----------------------------------------------------------------------------*/
|
||||||
|
int input_rtcm3(rtcm_t *rtcm, unsigned char data)
|
||||||
|
{
|
||||||
|
trace(5, "input_rtcm3: data=%02x\n", data);
|
||||||
|
|
||||||
|
/* synchronize frame */
|
||||||
|
if (rtcm->nbyte == 0)
|
||||||
|
{
|
||||||
|
if (data != RTCM3PREAMB) return 0;
|
||||||
|
rtcm->buff[rtcm->nbyte++] = data;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
rtcm->buff[rtcm->nbyte++] = data;
|
||||||
|
|
||||||
|
if (rtcm->nbyte == 3)
|
||||||
|
{
|
||||||
|
rtcm->len = getbitu(rtcm->buff, 14, 10)+3; /* length without parity */
|
||||||
|
}
|
||||||
|
if (rtcm->nbyte < 3 || rtcm->nbyte < rtcm->len+3) return 0;
|
||||||
|
rtcm->nbyte = 0;
|
||||||
|
|
||||||
|
/* check parity */
|
||||||
|
if (rtk_crc24q(rtcm->buff, rtcm->len) != getbitu(rtcm->buff, rtcm->len*8, 24))
|
||||||
|
{
|
||||||
|
trace(2, "rtcm3 parity error: len=%d\n", rtcm->len);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* decode rtcm3 message */
|
||||||
|
return decode_rtcm3(rtcm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* input rtcm 2 message from file ----------------------------------------------
|
||||||
|
* fetch next rtcm 2 message and input a messsage from file
|
||||||
|
* args : rtcm_t *rtcm IO rtcm control struct
|
||||||
|
* FILE *fp I file pointer
|
||||||
|
* return : status (-2: end of file, -1...10: same as above)
|
||||||
|
* notes : same as above
|
||||||
|
*-----------------------------------------------------------------------------*/
|
||||||
|
int input_rtcm2f(rtcm_t *rtcm, FILE *fp)
|
||||||
|
{
|
||||||
|
int i, data = 0, ret;
|
||||||
|
|
||||||
|
trace(4, "input_rtcm2f: data=%02x\n", data);
|
||||||
|
|
||||||
|
for (i = 0;i < 4096;i++)
|
||||||
|
{
|
||||||
|
if ((data = fgetc(fp)) == EOF) return -2;
|
||||||
|
if ((ret = input_rtcm2(rtcm, (unsigned char)data))) return ret;
|
||||||
|
}
|
||||||
|
return 0; /* return at every 4k bytes */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* input rtcm 3 message from file ----------------------------------------------
|
||||||
|
* fetch next rtcm 3 message and input a messsage from file
|
||||||
|
* args : rtcm_t *rtcm IO rtcm control struct
|
||||||
|
* FILE *fp I file pointer
|
||||||
|
* return : status (-2: end of file, -1...10: same as above)
|
||||||
|
* notes : same as above
|
||||||
|
*-----------------------------------------------------------------------------*/
|
||||||
|
int input_rtcm3f(rtcm_t *rtcm, FILE *fp)
|
||||||
|
{
|
||||||
|
int i, data = 0, ret;
|
||||||
|
|
||||||
|
trace(4, "input_rtcm3f: data=%02x\n", data);
|
||||||
|
|
||||||
|
for (i = 0;i < 4096;i++)
|
||||||
|
{
|
||||||
|
if ((data = fgetc(fp)) == EOF) return -2;
|
||||||
|
if ((ret = input_rtcm3(rtcm, (unsigned char)data))) return ret;
|
||||||
|
}
|
||||||
|
return 0; /* return at every 4k bytes */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* generate rtcm 2 message -----------------------------------------------------
|
||||||
|
* generate rtcm 2 message
|
||||||
|
* args : rtcm_t *rtcm IO rtcm control struct
|
||||||
|
* int type I message type
|
||||||
|
* int sync I sync flag (1:another message follows)
|
||||||
|
* return : status (1:ok,0:error)
|
||||||
|
*-----------------------------------------------------------------------------*/
|
||||||
|
int gen_rtcm2(rtcm_t *rtcm, int type, int sync)
|
||||||
|
{
|
||||||
|
trace(4, "gen_rtcm2: type=%d sync=%d\n", type, sync);
|
||||||
|
|
||||||
|
rtcm->nbit = rtcm->len = rtcm->nbyte = 0;
|
||||||
|
|
||||||
|
/* not yet implemented */
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///* generate rtcm 3 message -----------------------------------------------------
|
||||||
|
// * generate rtcm 3 message
|
||||||
|
// * args : rtcm_t *rtcm IO rtcm control struct
|
||||||
|
// * int type I message type
|
||||||
|
// * int sync I sync flag (1:another message follows)
|
||||||
|
// * return : status (1:ok,0:error)
|
||||||
|
// *-----------------------------------------------------------------------------*/
|
||||||
|
//int gen_rtcm3(rtcm_t *rtcm, int type, int sync)
|
||||||
|
//{
|
||||||
|
// unsigned int crc;
|
||||||
|
// int i = 0;
|
||||||
|
//
|
||||||
|
// trace(4, "gen_rtcm3: type=%d sync=%d\n", type, sync);
|
||||||
|
//
|
||||||
|
// rtcm->nbit = rtcm->len = rtcm->nbyte = 0;
|
||||||
|
//
|
||||||
|
// /* set preamble and reserved */
|
||||||
|
// setbitu(rtcm->buff, i, 8, RTCM3PREAMB); i += 8;
|
||||||
|
// setbitu(rtcm->buff, i, 6, 0 ); i += 6;
|
||||||
|
// setbitu(rtcm->buff, i, 10, 0 ); i += 10;
|
||||||
|
//
|
||||||
|
// /* encode rtcm 3 message body */
|
||||||
|
// if (!encode_rtcm3(rtcm, type, sync)) return 0;
|
||||||
|
//
|
||||||
|
// /* padding to align 8 bit boundary */
|
||||||
|
// for (i = rtcm->nbit;i%8;i++)
|
||||||
|
// {
|
||||||
|
// setbitu(rtcm->buff, i, 1, 0);
|
||||||
|
// }
|
||||||
|
// /* message length (header+data) (bytes) */
|
||||||
|
// if ((rtcm->len = i/8) >= 3+1024)
|
||||||
|
// {
|
||||||
|
// trace(2, "generate rtcm 3 message length error len=%d\n", rtcm->len-3);
|
||||||
|
// rtcm->nbit = rtcm->len = 0;
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
// /* message length without header and parity */
|
||||||
|
// setbitu(rtcm->buff, 14, 10, rtcm->len-3);
|
||||||
|
//
|
||||||
|
// /* crc-24q */
|
||||||
|
// crc = rtk_crc24q(rtcm->buff, rtcm->len);
|
||||||
|
// setbitu(rtcm->buff, i, 24, crc);
|
||||||
|
//
|
||||||
|
// /* length total (bytes) */
|
||||||
|
// rtcm->nbyte = rtcm->len+3;
|
||||||
|
//
|
||||||
|
// return 1;
|
||||||
|
//}
|
74
src/algorithms/libs/rtklib/rtklib_rtcm.h
Normal file
74
src/algorithms/libs/rtklib/rtklib_rtcm.h
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/*!
|
||||||
|
* \file rtklib_rtcm.h
|
||||||
|
* \brief RTCM functions headers
|
||||||
|
* \authors <ul>
|
||||||
|
* <li> 2007-2013, T. Takasu
|
||||||
|
* <li> 2017, Javier Arribas
|
||||||
|
* <li> 2017, Carles Fernandez
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* This is a derived work from RTKLIB http://www.rtklib.com/
|
||||||
|
* The original source code at https://github.com/tomojitakasu/RTKLIB is
|
||||||
|
* released under the BSD 2-clause license with an additional exclusive clause
|
||||||
|
* that does not apply here. This additional clause is reproduced below:
|
||||||
|
*
|
||||||
|
* " The software package includes some companion executive binaries or shared
|
||||||
|
* libraries necessary to execute APs on Windows. These licenses succeed to the
|
||||||
|
* original ones of these software. "
|
||||||
|
*
|
||||||
|
* Neither the executive binaries nor the shared libraries are required by, used
|
||||||
|
* or included in GNSS-SDR.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* Copyright (C) 2007-2013, T. Takasu
|
||||||
|
* Copyright (C) 2017, Javier Arribas
|
||||||
|
* Copyright (C) 2017, Carles Fernandez
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "rtklib.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_RTKLIB_RTCM_H_
|
||||||
|
#define GNSS_SDR_RTKLIB_RTCM_H_
|
||||||
|
|
||||||
|
#define RTCM2PREAMB 0x66 /* rtcm ver.2 frame preamble */
|
||||||
|
#define RTCM3PREAMB 0xD3 /* rtcm ver.3 frame preamble */
|
||||||
|
|
||||||
|
|
||||||
|
int init_rtcm(rtcm_t *rtcm);
|
||||||
|
void free_rtcm(rtcm_t *rtcm);
|
||||||
|
int input_rtcm2(rtcm_t *rtcm, unsigned char data);
|
||||||
|
int input_rtcm3(rtcm_t *rtcm, unsigned char data);
|
||||||
|
int input_rtcm2f(rtcm_t *rtcm, FILE *fp);
|
||||||
|
int input_rtcm3f(rtcm_t *rtcm, FILE *fp);
|
||||||
|
int gen_rtcm2(rtcm_t *rtcm, int type, int sync);
|
||||||
|
//int gen_rtcm3(rtcm_t *rtcm, int type, int sync);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
548
src/algorithms/libs/rtklib/rtklib_rtcm2.cc
Normal file
548
src/algorithms/libs/rtklib/rtklib_rtcm2.cc
Normal file
@ -0,0 +1,548 @@
|
|||||||
|
/*!
|
||||||
|
* \file rtklib_rtcm2.cc
|
||||||
|
* \brief RTCM functions for v2
|
||||||
|
* \authors <ul>
|
||||||
|
* <li> 2007-2013, T. Takasu
|
||||||
|
* <li> 2017, Javier Arribas
|
||||||
|
* <li> 2017, Carles Fernandez
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* This is a derived work from RTKLIB http://www.rtklib.com/
|
||||||
|
* The original source code at https://github.com/tomojitakasu/RTKLIB is
|
||||||
|
* released under the BSD 2-clause license with an additional exclusive clause
|
||||||
|
* that does not apply here. This additional clause is reproduced below:
|
||||||
|
*
|
||||||
|
* " The software package includes some companion executive binaries or shared
|
||||||
|
* libraries necessary to execute APs on Windows. These licenses succeed to the
|
||||||
|
* original ones of these software. "
|
||||||
|
*
|
||||||
|
* Neither the executive binaries nor the shared libraries are required by, used
|
||||||
|
* or included in GNSS-SDR.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* Copyright (C) 2007-2013, T. Takasu
|
||||||
|
* Copyright (C) 2017, Javier Arribas
|
||||||
|
* Copyright (C) 2017, Carles Fernandez
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "rtklib_rtcm2.h"
|
||||||
|
#include "rtklib_rtcm3.h"
|
||||||
|
#include "rtklib_rtkcmn.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* adjust hourly rollover of rtcm 2 time -------------------------------------*/
|
||||||
|
void adjhour(rtcm_t *rtcm, double zcnt)
|
||||||
|
{
|
||||||
|
double tow,hour,sec;
|
||||||
|
int week;
|
||||||
|
|
||||||
|
/* if no time, get cpu time */
|
||||||
|
if (rtcm->time.time == 0) rtcm->time = utc2gpst(timeget());
|
||||||
|
tow = time2gpst(rtcm->time,&week);
|
||||||
|
hour = floor(tow/3600.0);
|
||||||
|
sec = tow-hour*3600.0;
|
||||||
|
if (zcnt<sec-1800.0) zcnt += 3600.0;
|
||||||
|
else if (zcnt>sec+1800.0) zcnt-=3600.0;
|
||||||
|
rtcm->time = gpst2time(week,hour*3600+zcnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* get observation data index ------------------------------------------------*/
|
||||||
|
int obsindex(obs_t *obs, gtime_t time, int sat)
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
|
||||||
|
for (i = 0;i<obs->n;i++)
|
||||||
|
{
|
||||||
|
if (obs->data[i].sat == sat) return i; /* field already exists */
|
||||||
|
}
|
||||||
|
if (i>=MAXOBS) return -1; /* overflow */
|
||||||
|
|
||||||
|
/* add new field */
|
||||||
|
obs->data[i].time = time;
|
||||||
|
obs->data[i].sat = sat;
|
||||||
|
for (j = 0;j<NFREQ;j++)
|
||||||
|
{
|
||||||
|
obs->data[i].L[j] = obs->data[i].P[j] = 0.0;
|
||||||
|
obs->data[i].D[j] = 0.0;
|
||||||
|
obs->data[i].SNR[j] = obs->data[i].LLI[j] = obs->data[i].code[j] = 0;
|
||||||
|
}
|
||||||
|
obs->n++;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 1/9: differential gps correction/partial correction set -------*/
|
||||||
|
int decode_type1(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
int i = 48,fact,udre,prn,sat,iod;
|
||||||
|
double prc,rrc;
|
||||||
|
|
||||||
|
trace(4,"decode_type1: len=%d\n",rtcm->len);
|
||||||
|
|
||||||
|
while (i+40<=rtcm->len*8)
|
||||||
|
{
|
||||||
|
fact = getbitu(rtcm->buff,i, 1); i += 1;
|
||||||
|
udre = getbitu(rtcm->buff,i, 2); i += 2;
|
||||||
|
prn = getbitu(rtcm->buff,i, 5); i += 5;
|
||||||
|
prc = getbits(rtcm->buff,i,16); i += 16;
|
||||||
|
rrc = getbits(rtcm->buff,i, 8); i += 8;
|
||||||
|
iod = getbits(rtcm->buff,i, 8); i += 8;
|
||||||
|
if (prn == 0) prn = 32;
|
||||||
|
if (prc == 0x80000000||rrc == 0xFFFF8000)
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 1 prc/rrc indicates satellite problem: prn=%d\n",prn);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (rtcm->dgps)
|
||||||
|
{
|
||||||
|
sat = satno(SYS_GPS,prn);
|
||||||
|
rtcm->dgps[sat-1].t0 = rtcm->time;
|
||||||
|
rtcm->dgps[sat-1].prc = prc*(fact?0.32:0.02);
|
||||||
|
rtcm->dgps[sat-1].rrc = rrc*(fact?0.032:0.002);
|
||||||
|
rtcm->dgps[sat-1].iod = iod;
|
||||||
|
rtcm->dgps[sat-1].udre = udre;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 3: reference station parameter --------------------------------*/
|
||||||
|
int decode_type3(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
int i = 48;
|
||||||
|
|
||||||
|
trace(4,"decode_type3: len=%d\n",rtcm->len);
|
||||||
|
|
||||||
|
if (i+96<=rtcm->len*8)
|
||||||
|
{
|
||||||
|
rtcm->sta.pos[0] = getbits(rtcm->buff,i,32)*0.01; i += 32;
|
||||||
|
rtcm->sta.pos[1] = getbits(rtcm->buff,i,32)*0.01; i += 32;
|
||||||
|
rtcm->sta.pos[2] = getbits(rtcm->buff,i,32)*0.01;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 3 length error: len=%d\n",rtcm->len);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 14: gps time of week ------------------------------------------*/
|
||||||
|
int decode_type14(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
double zcnt;
|
||||||
|
int i = 48,week,hour,leaps;
|
||||||
|
|
||||||
|
trace(4,"decode_type14: len=%d\n",rtcm->len);
|
||||||
|
|
||||||
|
zcnt = getbitu(rtcm->buff,24,13);
|
||||||
|
if (i+24<=rtcm->len*8)
|
||||||
|
{
|
||||||
|
week = getbitu(rtcm->buff,i,10); i += 10;
|
||||||
|
hour = getbitu(rtcm->buff,i, 8); i += 8;
|
||||||
|
leaps = getbitu(rtcm->buff,i, 6);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 14 length error: len=%d\n",rtcm->len);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
week = adjgpsweek(week);
|
||||||
|
rtcm->time = gpst2time(week,hour*3600.0+zcnt*0.6);
|
||||||
|
rtcm->nav.leaps = leaps;
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 16: gps special message ---------------------------------------*/
|
||||||
|
int decode_type16(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
int i = 48,n = 0;
|
||||||
|
|
||||||
|
trace(4,"decode_type16: len=%d\n",rtcm->len);
|
||||||
|
|
||||||
|
while (i+8<=rtcm->len*8&&n<90)
|
||||||
|
{
|
||||||
|
rtcm->msg[n++] = getbitu(rtcm->buff,i,8); i += 8;
|
||||||
|
}
|
||||||
|
rtcm->msg[n] = '\0';
|
||||||
|
|
||||||
|
trace(3,"rtcm2 16 message: %s\n",rtcm->msg);
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 17: gps ephemerides -------------------------------------------*/
|
||||||
|
int decode_type17(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
eph_t eph = {0};
|
||||||
|
double toc,sqrtA;
|
||||||
|
int i = 48,week,prn,sat;
|
||||||
|
|
||||||
|
trace(4,"decode_type17: len=%d\n",rtcm->len);
|
||||||
|
|
||||||
|
if (i+480<=rtcm->len*8)
|
||||||
|
{
|
||||||
|
week = getbitu(rtcm->buff,i,10); i += 10;
|
||||||
|
eph.idot = getbits(rtcm->buff,i,14)*TWO_N43*SC2RAD; i += 14;
|
||||||
|
eph.iode = getbitu(rtcm->buff,i, 8); i += 8;
|
||||||
|
toc = getbitu(rtcm->buff,i,16)*16.0; i += 16;
|
||||||
|
eph.f1 = getbits(rtcm->buff,i,16)*TWO_N43; i += 16;
|
||||||
|
eph.f2 = getbits(rtcm->buff,i, 8)*TWO_N55; i += 8;
|
||||||
|
eph.crs = getbits(rtcm->buff,i,16)*TWO_N5; i += 16;
|
||||||
|
eph.deln = getbits(rtcm->buff,i,16)*TWO_N43*SC2RAD; i += 16;
|
||||||
|
eph.cuc = getbits(rtcm->buff,i,16)*TWO_N29; i += 16;
|
||||||
|
eph.e = getbitu(rtcm->buff,i,32)*TWO_N33; i += 32;
|
||||||
|
eph.cus = getbits(rtcm->buff,i,16); i += 16;
|
||||||
|
sqrtA = getbitu(rtcm->buff,i,32)*TWO_N19; i += 32;
|
||||||
|
eph.toes = getbitu(rtcm->buff,i,16); i += 16;
|
||||||
|
eph.OMG0 = getbits(rtcm->buff,i,32)*TWO_N31*SC2RAD; i += 32;
|
||||||
|
eph.cic = getbits(rtcm->buff,i,16)*TWO_N29; i += 16;
|
||||||
|
eph.i0 = getbits(rtcm->buff,i,32)*TWO_N31*SC2RAD; i += 32;
|
||||||
|
eph.cis = getbits(rtcm->buff,i,16)*TWO_N29; i += 16;
|
||||||
|
eph.omg = getbits(rtcm->buff,i,32)*TWO_N31*SC2RAD; i += 32;
|
||||||
|
eph.crc = getbits(rtcm->buff,i,16)*TWO_N5; i += 16;
|
||||||
|
eph.OMGd = getbits(rtcm->buff,i,24)*TWO_N43*SC2RAD; i += 24;
|
||||||
|
eph.M0 = getbits(rtcm->buff,i,32)*TWO_N31*SC2RAD; i += 32;
|
||||||
|
eph.iodc = getbitu(rtcm->buff,i,10); i += 10;
|
||||||
|
eph.f0 = getbits(rtcm->buff,i,22)*TWO_N31; i += 22;
|
||||||
|
prn = getbitu(rtcm->buff,i, 5); i += 5+3;
|
||||||
|
eph.tgd[0] = getbits(rtcm->buff,i, 8)*TWO_N31; i += 8;
|
||||||
|
eph.code = getbitu(rtcm->buff,i, 2); i += 2;
|
||||||
|
eph.sva = getbitu(rtcm->buff,i, 4); i += 4;
|
||||||
|
eph.svh = getbitu(rtcm->buff,i, 6); i += 6;
|
||||||
|
eph.flag = getbitu(rtcm->buff,i, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 17 length error: len=%d\n",rtcm->len);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (prn == 0) prn = 32;
|
||||||
|
sat = satno(SYS_GPS,prn);
|
||||||
|
eph.sat = sat;
|
||||||
|
eph.week = adjgpsweek(week);
|
||||||
|
eph.toe = gpst2time(eph.week,eph.toes);
|
||||||
|
eph.toc = gpst2time(eph.week,toc);
|
||||||
|
eph.ttr = rtcm->time;
|
||||||
|
eph.A = sqrtA*sqrtA;
|
||||||
|
rtcm->nav.eph[sat-1] = eph;
|
||||||
|
rtcm->ephsat = sat;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 18: rtk uncorrected carrier-phase -----------------------------*/
|
||||||
|
int decode_type18(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
gtime_t time;
|
||||||
|
double usec,cp,tt;
|
||||||
|
int i = 48,index,freq,sync = 1,code,sys,prn,sat,loss;
|
||||||
|
|
||||||
|
trace(4,"decode_type18: len=%d\n",rtcm->len);
|
||||||
|
|
||||||
|
if (i+24<=rtcm->len*8)
|
||||||
|
{
|
||||||
|
freq = getbitu(rtcm->buff,i, 2); i += 2+2;
|
||||||
|
usec = getbitu(rtcm->buff,i,20); i += 20;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 18 length error: len=%d\n",rtcm->len);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (freq&0x1)
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 18 not supported frequency: freq=%d\n",freq);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
freq>>=1;
|
||||||
|
|
||||||
|
while (i+48<=rtcm->len*8&&rtcm->obs.n<MAXOBS)
|
||||||
|
{
|
||||||
|
sync = getbitu(rtcm->buff,i, 1); i += 1;
|
||||||
|
code = getbitu(rtcm->buff,i, 1); i += 1;
|
||||||
|
sys = getbitu(rtcm->buff,i, 1); i += 1;
|
||||||
|
prn = getbitu(rtcm->buff,i, 5); i += 5+3;
|
||||||
|
loss = getbitu(rtcm->buff,i, 5); i += 5;
|
||||||
|
cp = getbits(rtcm->buff,i,32); i += 32;
|
||||||
|
if (prn == 0) prn = 32;
|
||||||
|
if (!(sat = satno(sys?SYS_GLO:SYS_GPS,prn)))
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 18 satellite number error: sys=%d prn=%d\n",sys,prn);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
time = timeadd(rtcm->time,usec*1E-6);
|
||||||
|
if (sys) time = utc2gpst(time); /* convert glonass time to gpst */
|
||||||
|
|
||||||
|
tt = timediff(rtcm->obs.data[0].time,time);
|
||||||
|
if (rtcm->obsflag||fabs(tt)>1E-9)
|
||||||
|
{
|
||||||
|
rtcm->obs.n = rtcm->obsflag = 0;
|
||||||
|
}
|
||||||
|
if ((index = obsindex(&rtcm->obs,time,sat)) >= 0)
|
||||||
|
{
|
||||||
|
rtcm->obs.data[index].L[freq] = -cp/256.0;
|
||||||
|
rtcm->obs.data[index].LLI[freq] = rtcm->loss[sat-1][freq]!=loss;
|
||||||
|
rtcm->obs.data[index].code[freq] =
|
||||||
|
!freq?(code?CODE_L1P:CODE_L1C):(code?CODE_L2P:CODE_L2C);
|
||||||
|
rtcm->loss[sat-1][freq] = loss;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rtcm->obsflag = !sync;
|
||||||
|
return sync?0:1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 19: rtk uncorrected pseudorange -------------------------------*/
|
||||||
|
int decode_type19(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
gtime_t time;
|
||||||
|
double usec,pr,tt;
|
||||||
|
int i = 48,index,freq,sync = 1,code,sys,prn,sat;
|
||||||
|
|
||||||
|
trace(4,"decode_type19: len=%d\n",rtcm->len);
|
||||||
|
|
||||||
|
if (i+24<=rtcm->len*8)
|
||||||
|
{
|
||||||
|
freq = getbitu(rtcm->buff,i, 2); i += 2+2;
|
||||||
|
usec = getbitu(rtcm->buff,i,20); i += 20;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 19 length error: len=%d\n",rtcm->len);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (freq&0x1)
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 19 not supported frequency: freq=%d\n",freq);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
freq>>=1;
|
||||||
|
|
||||||
|
while (i+48<=rtcm->len*8&&rtcm->obs.n<MAXOBS)
|
||||||
|
{
|
||||||
|
sync = getbitu(rtcm->buff,i, 1); i += 1;
|
||||||
|
code = getbitu(rtcm->buff,i, 1); i += 1;
|
||||||
|
sys = getbitu(rtcm->buff,i, 1); i += 1;
|
||||||
|
prn = getbitu(rtcm->buff,i, 5); i += 5+8;
|
||||||
|
pr = getbitu(rtcm->buff,i,32); i += 32;
|
||||||
|
if (prn == 0) prn = 32;
|
||||||
|
if (!(sat = satno(sys?SYS_GLO:SYS_GPS,prn)))
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 19 satellite number error: sys=%d prn=%d\n",sys,prn);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
time = timeadd(rtcm->time,usec*1E-6);
|
||||||
|
if (sys) time = utc2gpst(time); /* convert glonass time to gpst */
|
||||||
|
|
||||||
|
tt = timediff(rtcm->obs.data[0].time,time);
|
||||||
|
if (rtcm->obsflag||fabs(tt)>1E-9)
|
||||||
|
{
|
||||||
|
rtcm->obs.n = rtcm->obsflag = 0;
|
||||||
|
}
|
||||||
|
if ((index = obsindex(&rtcm->obs,time,sat))>=0)
|
||||||
|
{
|
||||||
|
rtcm->obs.data[index].P[freq] = pr*0.02;
|
||||||
|
rtcm->obs.data[index].code[freq] =
|
||||||
|
!freq?(code?CODE_L1P:CODE_L1C):(code?CODE_L2P:CODE_L2C);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rtcm->obsflag = !sync;
|
||||||
|
return sync?0:1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 22: extended reference station parameter ----------------------*/
|
||||||
|
int decode_type22(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
double del[2][3] = {{0}},hgt = 0.0;
|
||||||
|
int i = 48,j,noh;
|
||||||
|
|
||||||
|
trace(4,"decode_type22: len=%d\n",rtcm->len);
|
||||||
|
|
||||||
|
if (i+24<=rtcm->len*8)
|
||||||
|
{
|
||||||
|
del[0][0] = getbits(rtcm->buff,i,8)/25600.0; i += 8;
|
||||||
|
del[0][1] = getbits(rtcm->buff,i,8)/25600.0; i += 8;
|
||||||
|
del[0][2] = getbits(rtcm->buff,i,8)/25600.0; i += 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 22 length error: len=%d\n",rtcm->len);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (i+24<=rtcm->len*8)
|
||||||
|
{
|
||||||
|
i += 5; noh = getbits(rtcm->buff,i,1); i += 1;
|
||||||
|
hgt = noh?0.0:getbitu(rtcm->buff,i,18)/25600.0;
|
||||||
|
i += 18;
|
||||||
|
}
|
||||||
|
if (i+24<=rtcm->len*8)
|
||||||
|
{
|
||||||
|
del[1][0] = getbits(rtcm->buff,i,8)/1600.0; i += 8;
|
||||||
|
del[1][1] = getbits(rtcm->buff,i,8)/1600.0; i += 8;
|
||||||
|
del[1][2] = getbits(rtcm->buff,i,8)/1600.0;
|
||||||
|
}
|
||||||
|
rtcm->sta.deltype = 1; /* xyz */
|
||||||
|
for (j = 0;j<3;j++) rtcm->sta.del[j] = del[0][j];
|
||||||
|
rtcm->sta.hgt = hgt;
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 23: antenna type definition record ----------------------------*/
|
||||||
|
int decode_type23(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 24: antenna reference point (arp) -----------------------------*/
|
||||||
|
int decode_type24(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 31: differential glonass correction ---------------------------*/
|
||||||
|
int decode_type31(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 32: differential glonass reference station parameters ---------*/
|
||||||
|
int decode_type32(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 34: glonass partial differential correction set ---------------*/
|
||||||
|
int decode_type34(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 36: glonass special message -----------------------------------*/
|
||||||
|
int decode_type36(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 37: gnss system time offset -----------------------------------*/
|
||||||
|
int decode_type37(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode type 59: proprietary message ---------------------------------------*/
|
||||||
|
int decode_type59(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* decode rtcm ver.2 message -------------------------------------------------*/
|
||||||
|
int decode_rtcm2(rtcm_t *rtcm)
|
||||||
|
{
|
||||||
|
double zcnt;
|
||||||
|
int staid,seqno,stah,ret = 0,type = getbitu(rtcm->buff,8,6);
|
||||||
|
|
||||||
|
trace(3,"decode_rtcm2: type=%2d len=%3d\n",type,rtcm->len);
|
||||||
|
|
||||||
|
if ((zcnt = getbitu(rtcm->buff,24,13)*0.6)>=3600.0)
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 modified z-count error: zcnt=%.1f\n",zcnt);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
adjhour(rtcm,zcnt);
|
||||||
|
staid = getbitu(rtcm->buff,14,10);
|
||||||
|
seqno = getbitu(rtcm->buff,37, 3);
|
||||||
|
stah = getbitu(rtcm->buff,45, 3);
|
||||||
|
if (seqno-rtcm->seqno!=1&&seqno-rtcm->seqno!=-7)
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 message outage: seqno=%d->%d\n",rtcm->seqno,seqno);
|
||||||
|
}
|
||||||
|
rtcm->seqno = seqno;
|
||||||
|
rtcm->stah = stah;
|
||||||
|
|
||||||
|
if (rtcm->outtype)
|
||||||
|
{
|
||||||
|
sprintf(rtcm->msgtype,"RTCM %2d (%4d) zcnt=%7.1f staid=%3d seqno=%d",
|
||||||
|
type,rtcm->len,zcnt,staid,seqno);
|
||||||
|
}
|
||||||
|
if (type == 3||type == 22||type == 23||type == 24)
|
||||||
|
{
|
||||||
|
if (rtcm->staid!=0&&staid!=rtcm->staid)
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 station id changed: %d->%d\n",rtcm->staid,staid);
|
||||||
|
}
|
||||||
|
rtcm->staid = staid;
|
||||||
|
}
|
||||||
|
if (rtcm->staid!=0&&staid!=rtcm->staid)
|
||||||
|
{
|
||||||
|
trace(2,"rtcm2 station id invalid: %d %d\n",staid,rtcm->staid);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 1: ret = decode_type1 (rtcm); break;
|
||||||
|
case 3: ret = decode_type3 (rtcm); break;
|
||||||
|
case 9: ret = decode_type1 (rtcm); break;
|
||||||
|
case 14: ret = decode_type14(rtcm); break;
|
||||||
|
case 16: ret = decode_type16(rtcm); break;
|
||||||
|
case 17: ret = decode_type17(rtcm); break;
|
||||||
|
case 18: ret = decode_type18(rtcm); break;
|
||||||
|
case 19: ret = decode_type19(rtcm); break;
|
||||||
|
case 22: ret = decode_type22(rtcm); break;
|
||||||
|
case 23: ret = decode_type23(rtcm); break; /* not supported */
|
||||||
|
case 24: ret = decode_type24(rtcm); break; /* not supported */
|
||||||
|
case 31: ret = decode_type31(rtcm); break; /* not supported */
|
||||||
|
case 32: ret = decode_type32(rtcm); break; /* not supported */
|
||||||
|
case 34: ret = decode_type34(rtcm); break; /* not supported */
|
||||||
|
case 36: ret = decode_type36(rtcm); break; /* not supported */
|
||||||
|
case 37: ret = decode_type37(rtcm); break; /* not supported */
|
||||||
|
case 59: ret = decode_type59(rtcm); break; /* not supported */
|
||||||
|
}
|
||||||
|
if (ret>=0)
|
||||||
|
{
|
||||||
|
if (1<=type&&type<=99) rtcm->nmsg2[type]++; else rtcm->nmsg2[0]++;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
80
src/algorithms/libs/rtklib/rtklib_rtcm2.h
Normal file
80
src/algorithms/libs/rtklib/rtklib_rtcm2.h
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*!
|
||||||
|
* \file rtklib_rtcm2.h
|
||||||
|
* \brief RTCM v2 functions headers
|
||||||
|
* \authors <ul>
|
||||||
|
* <li> 2007-2013, T. Takasu
|
||||||
|
* <li> 2017, Javier Arribas
|
||||||
|
* <li> 2017, Carles Fernandez
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* This is a derived work from RTKLIB http://www.rtklib.com/
|
||||||
|
* The original source code at https://github.com/tomojitakasu/RTKLIB is
|
||||||
|
* released under the BSD 2-clause license with an additional exclusive clause
|
||||||
|
* that does not apply here. This additional clause is reproduced below:
|
||||||
|
*
|
||||||
|
* " The software package includes some companion executive binaries or shared
|
||||||
|
* libraries necessary to execute APs on Windows. These licenses succeed to the
|
||||||
|
* original ones of these software. "
|
||||||
|
*
|
||||||
|
* Neither the executive binaries nor the shared libraries are required by, used
|
||||||
|
* or included in GNSS-SDR.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* Copyright (C) 2007-2013, T. Takasu
|
||||||
|
* Copyright (C) 2017, Javier Arribas
|
||||||
|
* Copyright (C) 2017, Carles Fernandez
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_RTKLIB_RTCM2_H_
|
||||||
|
#define GNSS_SDR_RTKLIB_RTCM2_H_
|
||||||
|
|
||||||
|
#include "rtklib.h"
|
||||||
|
|
||||||
|
|
||||||
|
void adjhour(rtcm_t *rtcm, double zcnt);
|
||||||
|
int obsindex(obs_t *obs, gtime_t time, int sat);
|
||||||
|
int decode_type1(rtcm_t *rtcm);
|
||||||
|
int decode_type3(rtcm_t *rtcm);
|
||||||
|
int decode_type14(rtcm_t *rtcm);
|
||||||
|
int decode_type16(rtcm_t *rtcm);
|
||||||
|
int decode_type17(rtcm_t *rtcm);
|
||||||
|
int decode_type18(rtcm_t *rtcm);
|
||||||
|
int decode_type19(rtcm_t *rtcm);
|
||||||
|
int decode_type22(rtcm_t *rtcm);
|
||||||
|
int decode_type23(rtcm_t *rtcm);
|
||||||
|
int decode_type24(rtcm_t *rtcm);
|
||||||
|
int decode_type31(rtcm_t *rtcm);
|
||||||
|
int decode_type32(rtcm_t *rtcm);
|
||||||
|
int decode_type34(rtcm_t *rtcm);
|
||||||
|
int decode_type36(rtcm_t *rtcm);
|
||||||
|
int decode_type37(rtcm_t *rtcm);
|
||||||
|
int decode_type59(rtcm_t *rtcm);
|
||||||
|
int decode_rtcm2(rtcm_t *rtcm);
|
||||||
|
|
||||||
|
#endif
|
2727
src/algorithms/libs/rtklib/rtklib_rtcm3.cc
Normal file
2727
src/algorithms/libs/rtklib/rtklib_rtcm3.cc
Normal file
File diff suppressed because it is too large
Load Diff
262
src/algorithms/libs/rtklib/rtklib_rtcm3.h
Normal file
262
src/algorithms/libs/rtklib/rtklib_rtcm3.h
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
/*!
|
||||||
|
* \file rtklib_rtcm3.h
|
||||||
|
* \brief RTCM v3 functions headers
|
||||||
|
* \authors <ul>
|
||||||
|
* <li> 2007-2013, T. Takasu
|
||||||
|
* <li> 2017, Javier Arribas
|
||||||
|
* <li> 2017, Carles Fernandez
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* This is a derived work from RTKLIB http://www.rtklib.com/
|
||||||
|
* The original source code at https://github.com/tomojitakasu/RTKLIB is
|
||||||
|
* released under the BSD 2-clause license with an additional exclusive clause
|
||||||
|
* that does not apply here. This additional clause is reproduced below:
|
||||||
|
*
|
||||||
|
* " The software package includes some companion executive binaries or shared
|
||||||
|
* libraries necessary to execute APs on Windows. These licenses succeed to the
|
||||||
|
* original ones of these software. "
|
||||||
|
*
|
||||||
|
* Neither the executive binaries nor the shared libraries are required by, used
|
||||||
|
* or included in GNSS-SDR.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* Copyright (C) 2007-2013, T. Takasu
|
||||||
|
* Copyright (C) 2017, Javier Arribas
|
||||||
|
* Copyright (C) 2017, Carles Fernandez
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_RTKLIB_RTCM3_H_
|
||||||
|
#define GNSS_SDR_RTKLIB_RTCM3_H_
|
||||||
|
|
||||||
|
#include "rtklib.h"
|
||||||
|
|
||||||
|
/* constants -----------------------------------------------------------------*/
|
||||||
|
|
||||||
|
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]={
|
||||||
|
/* GPS: ref [13] table 3.5-87, ref [14][15] table 3.5-91 */
|
||||||
|
"" ,"1C","1P","1W","1Y","1M","" ,"2C","2P","2W","2Y","2M", /* 1-12 */
|
||||||
|
"" ,"" ,"2S","2L","2X","" ,"" ,"" ,"" ,"5I","5Q","5X", /* 13-24 */
|
||||||
|
"" ,"" ,"" ,"" ,"" ,"1S","1L","1X" /* 25-32 */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const char *msm_sig_glo[32]={
|
||||||
|
/* GLONASS: ref [13] table 3.5-93, ref [14][15] table 3.5-97 */
|
||||||
|
"" ,"1C","1P","" ,"" ,"" ,"" ,"2C","2P","" ,"3I","3Q",
|
||||||
|
"3X","" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,
|
||||||
|
"" ,"" ,"" ,"" ,"" ,"" ,"" ,""
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const char *msm_sig_gal[32]={
|
||||||
|
/* Galileo: ref [15] table 3.5-100 */
|
||||||
|
"" ,"1C","1A","1B","1X","1Z","" ,"6C","6A","6B","6X","6Z",
|
||||||
|
"" ,"7I","7Q","7X","" ,"8I","8Q","8X","" ,"5I","5Q","5X",
|
||||||
|
"" ,"" ,"" ,"" ,"" ,"" ,"" ,""
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const char *msm_sig_qzs[32]={
|
||||||
|
/* QZSS: ref [15] table 3.5-103 */
|
||||||
|
"" ,"1C","" ,"" ,"" ,"" ,"" ,"" ,"6S","6L","6X","" ,
|
||||||
|
"" ,"" ,"2S","2L","2X","" ,"" ,"" ,"" ,"5I","5Q","5X",
|
||||||
|
"" ,"" ,"" ,"" ,"" ,"1S","1L","1X"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const char *msm_sig_sbs[32]={
|
||||||
|
/* SBAS: ref [13] table 3.5-T+005 */
|
||||||
|
"" ,"1C","" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,
|
||||||
|
"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"5I","5Q","5X",
|
||||||
|
"" ,"" ,"" ,"" ,"" ,"" ,"" ,""
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const char *msm_sig_cmp[32]={
|
||||||
|
/* BeiDou: ref [15] table 3.5-106 */
|
||||||
|
"" ,"1I","1Q","1X","" ,"" ,"" ,"6I","6Q","6X","" ,"" ,
|
||||||
|
"" ,"7I","7Q","7X","" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,
|
||||||
|
"" ,"" ,"" ,"" ,"" ,"" ,"" ,""
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ssr update intervals ------------------------------------------------------*/
|
||||||
|
const double ssrudint[16]={
|
||||||
|
1,2,5,10,15,30,60,120,240,300,600,900,1800,3600,7200,10800
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ssr 3 and 7 signal and tracking mode ids ----------------------------------*/
|
||||||
|
const int codes_gps[]={
|
||||||
|
CODE_L1C,CODE_L1P,CODE_L1W,CODE_L1Y,CODE_L1M,CODE_L2C,CODE_L2D,CODE_L2S,
|
||||||
|
CODE_L2L,CODE_L2X,CODE_L2P,CODE_L2W,CODE_L2Y,CODE_L2M,CODE_L5I,CODE_L5Q,
|
||||||
|
CODE_L5X
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const int codes_glo[]={
|
||||||
|
CODE_L1C,CODE_L1P,CODE_L2C,CODE_L2P
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const int codes_gal[]={
|
||||||
|
CODE_L1A,CODE_L1B,CODE_L1C,CODE_L1X,CODE_L1Z,CODE_L5I,CODE_L5Q,CODE_L5X,
|
||||||
|
CODE_L7I,CODE_L7Q,CODE_L7X,CODE_L8I,CODE_L8Q,CODE_L8X,CODE_L6A,CODE_L6B,
|
||||||
|
CODE_L6C,CODE_L6X,CODE_L6Z
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const int codes_qzs[]={
|
||||||
|
CODE_L1C,CODE_L1S,CODE_L1L,CODE_L2S,CODE_L2L,CODE_L2X,CODE_L5I,CODE_L5Q,
|
||||||
|
CODE_L5X,CODE_L6S,CODE_L6L,CODE_L6X,CODE_L1X
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const int codes_bds[]={
|
||||||
|
CODE_L1I,CODE_L1Q,CODE_L1X,CODE_L7I,CODE_L7Q,CODE_L7X,CODE_L6I,CODE_L6Q,
|
||||||
|
CODE_L6X
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const int codes_sbs[]={
|
||||||
|
CODE_L1C,CODE_L5I,CODE_L5Q,CODE_L5X
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
double getbitg(const unsigned char *buff, int pos, int len);
|
||||||
|
void adjweek(rtcm_t *rtcm, double tow);
|
||||||
|
int adjbdtweek(int week);
|
||||||
|
void adjday_glot(rtcm_t *rtcm, double tod);
|
||||||
|
double adjcp(rtcm_t *rtcm, int sat, int freq, double cp);
|
||||||
|
int lossoflock(rtcm_t *rtcm, int sat, int freq, int lock);
|
||||||
|
unsigned char snratio(double snr);
|
||||||
|
int obsindex(obs_t *obs, gtime_t time, int sat);
|
||||||
|
int test_staid(rtcm_t *rtcm, int staid);
|
||||||
|
|
||||||
|
int decode_head1001(rtcm_t *rtcm, int *sync);
|
||||||
|
int decode_type1001(rtcm_t *rtcm);
|
||||||
|
int decode_type1002(rtcm_t *rtcm);
|
||||||
|
int decode_type1003(rtcm_t *rtcm);
|
||||||
|
int decode_type1004(rtcm_t *rtcm);
|
||||||
|
double getbits_38(const unsigned char *buff, int pos);
|
||||||
|
int decode_type1005(rtcm_t *rtcm);
|
||||||
|
|
||||||
|
int decode_type1006(rtcm_t *rtcm);
|
||||||
|
int decode_type1007(rtcm_t *rtcm);
|
||||||
|
int decode_type1008(rtcm_t *rtcm);
|
||||||
|
int decode_head1009(rtcm_t *rtcm, int *sync);
|
||||||
|
|
||||||
|
int decode_type1009(rtcm_t *rtcm);
|
||||||
|
int decode_type1010(rtcm_t *rtcm);
|
||||||
|
int decode_type1011(rtcm_t *rtcm);
|
||||||
|
int decode_type1012(rtcm_t *rtcm);
|
||||||
|
int decode_type1013(rtcm_t *rtcm);
|
||||||
|
int decode_type1019(rtcm_t *rtcm);
|
||||||
|
int decode_type1020(rtcm_t *rtcm);
|
||||||
|
int decode_type1021(rtcm_t *rtcm);
|
||||||
|
int decode_type1022(rtcm_t *rtcm);
|
||||||
|
int decode_type1023(rtcm_t *rtcm);
|
||||||
|
int decode_type1024(rtcm_t *rtcm);
|
||||||
|
int decode_type1025(rtcm_t *rtcm);
|
||||||
|
int decode_type1026(rtcm_t *rtcm);
|
||||||
|
int decode_type1027(rtcm_t *rtcm);
|
||||||
|
int decode_type1029(rtcm_t *rtcm);
|
||||||
|
int decode_type1030(rtcm_t *rtcm);
|
||||||
|
int decode_type1031(rtcm_t *rtcm);
|
||||||
|
int decode_type1032(rtcm_t *rtcm);
|
||||||
|
int decode_type1033(rtcm_t *rtcm);
|
||||||
|
int decode_type1034(rtcm_t *rtcm);
|
||||||
|
int decode_type1035(rtcm_t *rtcm);
|
||||||
|
int decode_type1037(rtcm_t *rtcm);
|
||||||
|
int decode_type1038(rtcm_t *rtcm);
|
||||||
|
int decode_type1039(rtcm_t *rtcm);
|
||||||
|
int decode_type1044(rtcm_t *rtcm);
|
||||||
|
int decode_type1045(rtcm_t *rtcm);
|
||||||
|
int decode_type1046(rtcm_t *rtcm);
|
||||||
|
int decode_type1047(rtcm_t *rtcm);
|
||||||
|
int decode_type1063(rtcm_t *rtcm);
|
||||||
|
int decode_ssr1_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
|
||||||
|
double *udint, int *refd, int *hsize);
|
||||||
|
int decode_ssr2_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
|
||||||
|
double *udint, int *hsize);
|
||||||
|
int decode_ssr7_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
|
||||||
|
double *udint, int *dispe, int *mw, int *hsize);
|
||||||
|
int decode_ssr1(rtcm_t *rtcm, int sys);
|
||||||
|
int decode_ssr2(rtcm_t *rtcm, int sys);
|
||||||
|
int decode_ssr3(rtcm_t *rtcm, int sys);
|
||||||
|
int decode_ssr4(rtcm_t *rtcm, int sys);
|
||||||
|
int decode_ssr5(rtcm_t *rtcm, int sys);
|
||||||
|
int decode_ssr6(rtcm_t *rtcm, int sys);
|
||||||
|
int decode_ssr7(rtcm_t *rtcm, int sys);
|
||||||
|
void sigindex(int sys, const unsigned char *code, const int *freq, int n,
|
||||||
|
const char *opt, int *ind);
|
||||||
|
void save_msm_obs(rtcm_t *rtcm, int sys, msm_h_t *h, const double *r,
|
||||||
|
const double *pr, const double *cp, const double *rr,
|
||||||
|
const double *rrf, const double *cnr, const int *lock,
|
||||||
|
const int *ex, const int *half);
|
||||||
|
int decode_msm_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
|
||||||
|
msm_h_t *h, int *hsize);
|
||||||
|
|
||||||
|
int decode_msm0(rtcm_t *rtcm, int sys);
|
||||||
|
int decode_msm4(rtcm_t *rtcm, int sys);
|
||||||
|
int decode_msm5(rtcm_t *rtcm, int sys);
|
||||||
|
int decode_msm6(rtcm_t *rtcm, int sys);
|
||||||
|
int decode_msm7(rtcm_t *rtcm, int sys);
|
||||||
|
int decode_type1230(rtcm_t *rtcm);
|
||||||
|
|
||||||
|
int decode_rtcm3(rtcm_t *rtcm);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user