1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 20:50:33 +00:00

Fix CNAV telemetry reader

This commit is contained in:
Antonio Ramos 2018-03-06 13:23:22 +01:00
parent 40be1e3ad4
commit 21fff4e696
3 changed files with 31 additions and 32 deletions

View File

@ -132,7 +132,7 @@ bool rtklib_solver::get_PVT(const std::map<int,Gnss_Synchro> & gnss_observables_
for(gnss_observables_iter = gnss_observables_map.cbegin();
gnss_observables_iter != gnss_observables_map.cend();
gnss_observables_iter++)
gnss_observables_iter++) //CHECK INCONSISTENCY when combining GLONASS + other system
{
switch(gnss_observables_iter->second.System)
{

View File

@ -194,7 +194,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
P1_C1 = nav->cbias[obs->sat-1][1];
P2_C2 = nav->cbias[obs->sat-1][2];
std::string d_dump_filename = "/home/antonio/data/dump_prange.dat";
std::string d_dump_filename = "/home/aramos/dump_prange.dat";
std::ofstream d_file;
d_file.exceptions (std::ifstream::failbit | std::ifstream::badbit );
d_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary | std::ios::app);
@ -208,7 +208,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
/* if no P1-P2 DCB, use TGD instead */
if(P1_P2 == 0.0 and sys == SYS_GPS)
{
P1_P2 = (gamma_ - 1.0) * gettgd(obs->sat, nav);
P1_P2 = gettgd(obs->sat, nav);
}
else if(P1_P2 == 0.0 and sys == SYS_GAL)
{
@ -247,7 +247,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
else if(obs->code[i] != CODE_NONE and obs->code[j] == CODE_NONE)
{//CHECK!!
P1 += P1_C1; /* C1->P1 */
PC = P1 + P1_P2 / (gamma_ - 1.0);
PC = P1 + P1_P2;
}
else if(obs->code[i] == CODE_NONE and obs->code[j] != CODE_NONE)
{
@ -255,7 +255,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
{//CHECK!!
P2 += P2_C2; /* C2->P2 */
//PC = P2 - gamma_ * P1_P2 / (1.0 - gamma_);
PC = P2 + P1_P2 / (gamma_ - 1.0) - ISCl2;
PC = P2 + P1_P2 - ISCl2;
}
else if(sys == SYS_GAL)
{
@ -267,8 +267,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
{
if(obs->code[j] == CODE_L2S) /* L1 + L2 */
{
//PC = (P2 + ISCl2 - gamma_ * (P1 + ISCl1)) / (1.0 - gamma_) - P1_P2 / (gamma_ - 1.0);
PC = (P1 + P2) / 2.0;
PC = (P2 + ISCl2 - gamma_ * (P1 + ISCl1)) / (1.0 - gamma_) - P1_P2;
}
if(obs->code[j] == CODE_L5X) /* L1 + L5 */
{

View File

@ -180,7 +180,7 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset<GPS_CNAV_DATA_PAGE_BIT
ephemeris_record.i_satellite_PRN = PRN;
d_TOW = static_cast<double>(read_navigation_unsigned(data_bits, CNAV_TOW));
d_TOW = d_TOW * CNAV_TOW_LSB;
d_TOW *= CNAV_TOW_LSB;
ephemeris_record.d_TOW = d_TOW;
alert_flag = static_cast<bool>(read_navigation_bool(data_bits, CNAV_ALERT_FLAG));
@ -194,24 +194,24 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset<GPS_CNAV_DATA_PAGE_BIT
ephemeris_record.i_GPS_week = static_cast<int>(read_navigation_unsigned(data_bits, CNAV_WN));
ephemeris_record.i_signal_health = static_cast<int>(read_navigation_unsigned(data_bits, CNAV_HEALTH));
ephemeris_record.d_Top = static_cast<double>(read_navigation_unsigned(data_bits, CNAV_TOP1));
ephemeris_record.d_Top = ephemeris_record.d_Top * CNAV_TOP1_LSB;
ephemeris_record.d_Top *= CNAV_TOP1_LSB;
ephemeris_record.d_URA0 = static_cast<double>(read_navigation_signed(data_bits, CNAV_URA));
ephemeris_record.d_Toe1 = static_cast<double>(read_navigation_unsigned(data_bits, CNAV_TOE1));
ephemeris_record.d_Toe1 = ephemeris_record.d_Toe1 * CNAV_TOE1_LSB;
ephemeris_record.d_Toe1 *= CNAV_TOE1_LSB;
ephemeris_record.d_DELTA_A = static_cast<double>(read_navigation_signed(data_bits, CNAV_DELTA_A));
ephemeris_record.d_DELTA_A = ephemeris_record.d_DELTA_A * CNAV_DELTA_A_LSB;
ephemeris_record.d_DELTA_A *= CNAV_DELTA_A_LSB;
ephemeris_record.d_A_DOT = static_cast<double>(read_navigation_signed(data_bits, CNAV_A_DOT));
ephemeris_record.d_A_DOT = ephemeris_record.d_A_DOT * CNAV_A_DOT_LSB;
ephemeris_record.d_A_DOT *= CNAV_A_DOT_LSB;
ephemeris_record.d_Delta_n = static_cast<double>(read_navigation_signed(data_bits, CNAV_DELTA_N0));
ephemeris_record.d_Delta_n = ephemeris_record.d_Delta_n * CNAV_DELTA_N0_LSB;
ephemeris_record.d_Delta_n *= CNAV_DELTA_N0_LSB;
ephemeris_record.d_DELTA_DOT_N = static_cast<double>(read_navigation_signed(data_bits, CNAV_DELTA_N0_DOT));
ephemeris_record.d_DELTA_DOT_N = ephemeris_record.d_DELTA_DOT_N * CNAV_DELTA_N0_DOT_LSB;
ephemeris_record.d_DELTA_DOT_N *= CNAV_DELTA_N0_DOT_LSB;
ephemeris_record.d_M_0 = static_cast<double>(read_navigation_signed(data_bits, CNAV_M0));
ephemeris_record.d_M_0 = ephemeris_record.d_M_0 * CNAV_M0_LSB;
ephemeris_record.d_M_0 *= CNAV_M0_LSB;
ephemeris_record.d_e_eccentricity = static_cast<double>(read_navigation_unsigned(data_bits, CNAV_E_ECCENTRICITY));
ephemeris_record.d_e_eccentricity = ephemeris_record.d_e_eccentricity * CNAV_E_ECCENTRICITY_LSB;
ephemeris_record.d_e_eccentricity *= CNAV_E_ECCENTRICITY_LSB;
ephemeris_record.d_OMEGA = static_cast<double>(read_navigation_signed(data_bits, CNAV_OMEGA));
ephemeris_record.d_OMEGA = ephemeris_record.d_OMEGA * CNAV_OMEGA_LSB;
ephemeris_record.d_OMEGA *= CNAV_OMEGA_LSB;
ephemeris_record.b_integrity_status_flag = static_cast<bool>(read_navigation_bool(data_bits, CNAV_INTEGRITY_FLAG));
ephemeris_record.b_l2c_phasing_flag = static_cast<bool>(read_navigation_bool(data_bits, CNAV_L2_PHASING_FLAG));
@ -220,42 +220,42 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset<GPS_CNAV_DATA_PAGE_BIT
break;
case 11: // Ephemeris 2/2
ephemeris_record.d_Toe2 = static_cast<double>(read_navigation_unsigned(data_bits, CNAV_TOE2));
ephemeris_record.d_Toe2 = ephemeris_record.d_Toe2 * CNAV_TOE2_LSB;
ephemeris_record.d_Toe2 *= CNAV_TOE2_LSB;
ephemeris_record.d_OMEGA0 = static_cast<double>(read_navigation_signed(data_bits, CNAV_OMEGA0));
ephemeris_record.d_OMEGA0 = ephemeris_record.d_OMEGA0 * CNAV_OMEGA0_LSB;
ephemeris_record.d_OMEGA0 *= CNAV_OMEGA0_LSB;
ephemeris_record.d_DELTA_OMEGA_DOT = static_cast<double>(read_navigation_signed(data_bits, CNAV_DELTA_OMEGA_DOT));
ephemeris_record.d_DELTA_OMEGA_DOT = ephemeris_record.d_DELTA_OMEGA_DOT * CNAV_DELTA_OMEGA_DOT_LSB;
ephemeris_record.d_DELTA_OMEGA_DOT *= CNAV_DELTA_OMEGA_DOT_LSB;
ephemeris_record.d_i_0 = static_cast<double>(read_navigation_signed(data_bits, CNAV_I0));
ephemeris_record.d_i_0 = ephemeris_record.d_i_0 * CNAV_I0_LSB;
ephemeris_record.d_i_0 *= CNAV_I0_LSB;
ephemeris_record.d_IDOT = static_cast<double>(read_navigation_signed(data_bits, CNAV_I0_DOT));
ephemeris_record.d_IDOT = ephemeris_record.d_IDOT * CNAV_I0_DOT_LSB;
ephemeris_record.d_IDOT *= CNAV_I0_DOT_LSB;
ephemeris_record.d_Cis = static_cast<double>(read_navigation_signed(data_bits, CNAV_CIS));
ephemeris_record.d_Cis = ephemeris_record.d_Cis * CNAV_CIS_LSB;
ephemeris_record.d_Cis *= CNAV_CIS_LSB;
ephemeris_record.d_Cic = static_cast<double>(read_navigation_signed(data_bits, CNAV_CIC));
ephemeris_record.d_Cic = ephemeris_record.d_Cic * CNAV_CIC_LSB;
ephemeris_record.d_Cic *= CNAV_CIC_LSB;
ephemeris_record.d_Crs = static_cast<double>(read_navigation_signed(data_bits, CNAV_CRS));
ephemeris_record.d_Crs = ephemeris_record.d_Crs * CNAV_CRS_LSB;
ephemeris_record.d_Crs *= CNAV_CRS_LSB;
ephemeris_record.d_Crc = static_cast<double>(read_navigation_signed(data_bits, CNAV_CRC));
ephemeris_record.d_Cic = ephemeris_record.d_Cic * CNAV_CRC_LSB;
ephemeris_record.d_Crc *= CNAV_CRC_LSB;
ephemeris_record.d_Cus = static_cast<double>(read_navigation_signed(data_bits, CNAV_CUS));
ephemeris_record.d_Cus = ephemeris_record.d_Cus * CNAV_CUS_LSB;
ephemeris_record.d_Cus *= CNAV_CUS_LSB;
ephemeris_record.d_Cuc = static_cast<double>(read_navigation_signed(data_bits, CNAV_CUC));
ephemeris_record.d_Cuc = ephemeris_record.d_Cuc * CNAV_CUS_LSB;
ephemeris_record.d_Cuc *= CNAV_CUC_LSB;
b_flag_ephemeris_2 = true;
break;
case 30: // (CLOCK, IONO, GRUP DELAY)
//clock
ephemeris_record.d_Toc = static_cast<double>(read_navigation_unsigned(data_bits, CNAV_TOC));
ephemeris_record.d_Toc = ephemeris_record.d_Toc * CNAV_TOC_LSB;
ephemeris_record.d_Toc *= CNAV_TOC_LSB;
ephemeris_record.d_URA0 = static_cast<double>(read_navigation_signed(data_bits, CNAV_URA_NED0));
ephemeris_record.d_URA1 = static_cast<double>(read_navigation_unsigned(data_bits, CNAV_URA_NED1));
ephemeris_record.d_URA2 = static_cast<double>(read_navigation_unsigned(data_bits, CNAV_URA_NED2));
ephemeris_record.d_A_f0 = static_cast<double>(read_navigation_signed(data_bits, CNAV_AF0));
ephemeris_record.d_A_f0 = ephemeris_record.d_A_f0 * CNAV_AF0_LSB;
ephemeris_record.d_A_f0 *= CNAV_AF0_LSB;
ephemeris_record.d_A_f1 = static_cast<double>(read_navigation_signed(data_bits, CNAV_AF1));
ephemeris_record.d_A_f1 = ephemeris_record.d_A_f1 * CNAV_AF1_LSB;
ephemeris_record.d_A_f1 *= CNAV_AF1_LSB;
ephemeris_record.d_A_f2 = static_cast<double>(read_navigation_signed(data_bits, CNAV_AF2));
ephemeris_record.d_A_f2 = ephemeris_record.d_A_f2 * CNAV_AF2_LSB;
ephemeris_record.d_A_f2 *= CNAV_AF2_LSB;
//group delays
//Check if the grup delay values are not available. See IS-GPS-200, Table 30-IV.
//Bit string "1000000000000" is -4096 in 2 complement