mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-30 10:54:50 +00:00
Clean code
This commit is contained in:
parent
ecb4a4970a
commit
0057e60924
@ -247,19 +247,19 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_
|
||||
{
|
||||
if (eph_data[i].sat == static_cast<int>(gnss_observables_iter->second.PRN))
|
||||
{
|
||||
eph_t eph_aux = eph_to_rtklib(gps_cnav_ephemeris_iter->second);
|
||||
eph_data[i].tgd = eph_aux.tgd;
|
||||
eph_data[i].isc = eph_aux.isc;
|
||||
eph_data[i] = eph_to_rtklib(gps_cnav_ephemeris_iter->second);
|
||||
/* By the moment, GPS L2 observables are not used in pseudorange computations
|
||||
obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs],
|
||||
gnss_observables_iter->second,
|
||||
eph_data[i].week,
|
||||
1); //Band 2 (L2)
|
||||
1); //Band 2 (L2) */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /*
|
||||
{
|
||||
/* By the moment, GPS L2 observables are not used in pseudorange computations
|
||||
// 3. If not found, insert the GPS L2 ephemeris and the observation
|
||||
//convert ephemeris from GNSS-SDR class to RTKLIB structure
|
||||
eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second);
|
||||
|
@ -54,8 +54,6 @@
|
||||
#include "rtklib_ephemeris.h"
|
||||
#include "rtklib_ionex.h"
|
||||
#include "rtklib_sbas.h"
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
/* pseudorange measurement error variance ------------------------------------*/
|
||||
double varerr(const prcopt_t *opt, double el, int sys)
|
||||
@ -132,6 +130,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
|
||||
double P1_P2 = 0.0;
|
||||
double P1_C1 = 0.0;
|
||||
double P2_C2 = 0.0;
|
||||
//Intersignal corrections (m). See GPS IS-200 CNAV message
|
||||
double ISCl1 = 0.0;
|
||||
double ISCl2 = 0.0;
|
||||
double ISCl5i = 0.0;
|
||||
@ -154,8 +153,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
|
||||
{
|
||||
j = 2;
|
||||
}
|
||||
|
||||
if (sys == SYS_GPS)
|
||||
else if (sys == SYS_GPS or sys == SYS_GLO)
|
||||
{
|
||||
if (obs->code[1] != CODE_NONE)
|
||||
{
|
||||
@ -203,18 +201,6 @@ 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/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);
|
||||
double tmp_double = static_cast<double>(obs->sat);
|
||||
d_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
d_file.write(reinterpret_cast<char *>(&P1), sizeof(double));
|
||||
d_file.write(reinterpret_cast<char *>(&P2), sizeof(double));
|
||||
d_file.write(reinterpret_cast<char *>(&P1_P2), sizeof(double));
|
||||
d_file.write(reinterpret_cast<char *>(&P1_C1), sizeof(double));
|
||||
d_file.write(reinterpret_cast<char *>(&P2_C2), sizeof(double));
|
||||
|
||||
/* if no P1-P2 DCB, use TGD instead */
|
||||
if (P1_P2 == 0.0)
|
||||
{
|
||||
@ -227,12 +213,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
|
||||
ISCl2 = getiscl2(obs->sat, nav);
|
||||
ISCl5i = getiscl5i(obs->sat, nav);
|
||||
ISCl5q = getiscl5q(obs->sat, nav);
|
||||
d_file.write(reinterpret_cast<char *>(&ISCl1), sizeof(double));
|
||||
d_file.write(reinterpret_cast<char *>(&ISCl2), sizeof(double));
|
||||
d_file.write(reinterpret_cast<char *>(&ISCl5i), sizeof(double));
|
||||
d_file.write(reinterpret_cast<char *>(&ISCl5q), sizeof(double));
|
||||
}
|
||||
d_file.write(reinterpret_cast<char *>(&P1_P2), sizeof(double));
|
||||
|
||||
//CHECK IF IT IS STILL NEEDED
|
||||
if (opt->ionoopt == IONOOPT_IFLC)
|
||||
@ -263,19 +244,26 @@ 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;
|
||||
}
|
||||
else if (obs->code[i] == CODE_NONE and obs->code[j] != CODE_NONE)
|
||||
{
|
||||
if (sys == SYS_GPS)
|
||||
{ //CHECK!!
|
||||
{
|
||||
P2 += P2_C2; /* C2->P2 */
|
||||
//PC = P2 - gamma_ * P1_P2 / (1.0 - gamma_);
|
||||
if (obs->code[j] == CODE_L2S) //L2 single freq.
|
||||
{
|
||||
PC = P2 + P1_P2 - ISCl2;
|
||||
}
|
||||
else if (sys == SYS_GAL)
|
||||
else if (obs->code[j] == CODE_L5X) //L5 single freq.
|
||||
{
|
||||
PC = P2 + P1_P2 - ISCl5i;
|
||||
}
|
||||
}
|
||||
else if (sys == SYS_GAL) // Gal. E5a single freq.
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
@ -285,9 +273,12 @@ 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;
|
||||
//By the moment, GPS L2 pseudoranges are not used
|
||||
//PC = (P2 + ISCl2 - gamma_ * (P1 + ISCl1)) / (1.0 - gamma_) - P1_P2;
|
||||
P1 += P1_C1; /* C1->P1 */
|
||||
PC = P1 + P1_P2;
|
||||
}
|
||||
if (obs->code[j] == CODE_L5X) /* L1 + L5 */
|
||||
else if (obs->code[j] == CODE_L5X) /* L1 + L5 */
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -296,8 +287,6 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
d_file.write(reinterpret_cast<char *>(&PC), sizeof(double));
|
||||
d_file.close();
|
||||
if (opt->sateph == EPHOPT_SBAS)
|
||||
{
|
||||
PC -= P1_C1;
|
||||
|
@ -157,6 +157,11 @@ public:
|
||||
archive& make_nvp("d_IDOT", d_IDOT); //!< Rate of Inclination Angle [semi-circles/s]
|
||||
archive& make_nvp("i_GPS_week", i_GPS_week); //!< GPS week number, aka WN [week]
|
||||
archive& make_nvp("d_TGD", d_TGD); //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
|
||||
archive& make_nvp("d_ISCL1", d_ISCL1); //!< Estimated Group Delay Differential: L1P(Y)-L1C/A correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
|
||||
archive& make_nvp("d_ISCL2", d_ISCL2); //!< Estimated Group Delay Differential: L1P(Y)-L2C correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
|
||||
archive& make_nvp("d_ISCL5I", d_ISCL5I); //!< Estimated Group Delay Differential: L1P(Y)-L5i correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
|
||||
archive& make_nvp("d_ISCL5Q", d_ISCL5Q); //!< Estimated Group Delay Differential: L1P(Y)-L5q correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
|
||||
|
||||
archive& make_nvp("d_DELTA_A", d_DELTA_A); //!< Semi-major axis difference at reference time [m]
|
||||
archive& make_nvp("d_A_DOT", d_A_DOT); //!< Change rate in semi-major axis [m/s]
|
||||
archive& make_nvp("d_DELTA_OMEGA_DOT", d_DELTA_OMEGA_DOT); //!< Rate of Right Ascension difference [semi-circles/s]
|
||||
|
@ -187,7 +187,7 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset<GPS_CNAV_DATA_PAGE_BIT
|
||||
|
||||
page_type = static_cast<int>(read_navigation_unsigned(data_bits, CNAV_MSG_TYPE));
|
||||
|
||||
switch(page_type)
|
||||
switch (page_type)
|
||||
{
|
||||
case 10: // Ephemeris 1/2
|
||||
ephemeris_record.i_GPS_week = static_cast<int>(read_navigation_unsigned(data_bits, CNAV_WN));
|
||||
@ -259,23 +259,38 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset<GPS_CNAV_DATA_PAGE_BIT
|
||||
//Check if the grup delay values are not available. See IS-GPS-200, Table 30-IV.
|
||||
//Bit string "1000000000000" is -4096 in 2 complement
|
||||
ephemeris_record.d_TGD = static_cast<double>(read_navigation_signed(data_bits, CNAV_TGD));
|
||||
if(ephemeris_record.d_TGD < -4095.9) { ephemeris_record.d_TGD = 0.0; }
|
||||
if (ephemeris_record.d_TGD < -4095.9)
|
||||
{
|
||||
ephemeris_record.d_TGD = 0.0;
|
||||
}
|
||||
ephemeris_record.d_TGD *= CNAV_TGD_LSB;
|
||||
|
||||
ephemeris_record.d_ISCL1 = static_cast<double>(read_navigation_signed(data_bits, CNAV_ISCL1));
|
||||
if(ephemeris_record.d_ISCL1 < -4095.9) { ephemeris_record.d_ISCL1 = 0.0; }
|
||||
if (ephemeris_record.d_ISCL1 < -4095.9)
|
||||
{
|
||||
ephemeris_record.d_ISCL1 = 0.0;
|
||||
}
|
||||
ephemeris_record.d_ISCL1 *= CNAV_ISCL1_LSB;
|
||||
|
||||
ephemeris_record.d_ISCL2 = static_cast<double>(read_navigation_signed(data_bits, CNAV_ISCL2));
|
||||
if(ephemeris_record.d_ISCL2 < -4095.9) { ephemeris_record.d_ISCL2 = 0.0; }
|
||||
if (ephemeris_record.d_ISCL2 < -4095.9)
|
||||
{
|
||||
ephemeris_record.d_ISCL2 = 0.0;
|
||||
}
|
||||
ephemeris_record.d_ISCL2 *= CNAV_ISCL2_LSB;
|
||||
|
||||
ephemeris_record.d_ISCL5I = static_cast<double>(read_navigation_signed(data_bits, CNAV_ISCL5I));
|
||||
if(ephemeris_record.d_ISCL5I < -4095.9) { ephemeris_record.d_ISCL5I = 0.0; }
|
||||
if (ephemeris_record.d_ISCL5I < -4095.9)
|
||||
{
|
||||
ephemeris_record.d_ISCL5I = 0.0;
|
||||
}
|
||||
ephemeris_record.d_ISCL5I *= CNAV_ISCL5I_LSB;
|
||||
|
||||
ephemeris_record.d_ISCL5Q = static_cast<double>(read_navigation_signed(data_bits, CNAV_ISCL5Q));
|
||||
if(ephemeris_record.d_ISCL5Q < -4095.9) { ephemeris_record.d_ISCL5Q = 0.0; }
|
||||
if (ephemeris_record.d_ISCL5Q < -4095.9)
|
||||
{
|
||||
ephemeris_record.d_ISCL5Q = 0.0;
|
||||
}
|
||||
ephemeris_record.d_ISCL5Q *= CNAV_ISCL5Q_LSB;
|
||||
//iono
|
||||
iono_record.d_alpha0 = static_cast<double>(read_navigation_signed(data_bits, CNAV_ALPHA0));
|
||||
@ -308,7 +323,6 @@ void Gps_CNAV_Navigation_Message::decode_page(std::bitset<GPS_CNAV_DATA_PAGE_BIT
|
||||
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;
|
||||
|
||||
|
||||
utc_model_record.d_A0 = static_cast<double>(read_navigation_signed(data_bits, CNAV_A0));
|
||||
utc_model_record.d_A0 = utc_model_record.d_A0 * CNAV_A0_LSB;
|
||||
utc_model_record.d_A1 = static_cast<double>(read_navigation_signed(data_bits, CNAV_A1));
|
||||
|
Loading…
Reference in New Issue
Block a user