From db5d218f069e4506ccf7ae3732fdcf2ec7574712 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 4 Nov 2023 15:41:21 +0100 Subject: [PATCH 01/16] pvt_conf.h: initialize all variables --- src/algorithms/PVT/libs/pvt_conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/PVT/libs/pvt_conf.h b/src/algorithms/PVT/libs/pvt_conf.h index bf4a3501a..517465350 100644 --- a/src/algorithms/PVT/libs/pvt_conf.h +++ b/src/algorithms/PVT/libs/pvt_conf.h @@ -90,7 +90,7 @@ public: bool pre_2009_file = false; bool dump = false; bool dump_mat = true; - bool log_source_timetag; + bool log_source_timetag = false; bool use_e6_for_pvt = true; bool use_has_corrections = true; bool use_unhealthy_sats = false; From 392b557a0ab0cdb7e6a885565cceb8bcf1f2442e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 4 Nov 2023 15:42:05 +0100 Subject: [PATCH 02/16] four_bit_cpx_file_signal_source: initialize all variables --- .../signal_source/adapters/four_bit_cpx_file_signal_source.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc b/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc index fecf2d28f..cdc1dfc8b 100644 --- a/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc @@ -45,7 +45,8 @@ FourBitCpxFileSignalSource::FourBitCpxFileSignalSource( } else { - LOG(WARNING) << sample_type_ << " unrecognized sample type. Assuming: "; + reverse_interleaving_ = false; + LOG(WARNING) << sample_type_ << " unrecognized sample type. Assuming: iq"; } if (in_streams > 0) From 955770eb11e7a1c61dabc82e2780ae29508c300e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 5 Nov 2023 10:13:11 +0100 Subject: [PATCH 03/16] Fix performance inefficiency detected by Coverity Scan --- .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 6 +++--- src/algorithms/PVT/libs/rtklib_solver.cc | 14 ++++++------- src/algorithms/PVT/libs/rtklib_solver.h | 5 +++-- .../pvt/nmea_printer_test.cc | 2 +- .../pvt/rinex_printer_test.cc | 20 +++++++++---------- .../pvt/rtklib_solver_test.cc | 2 +- 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 050e474e8..fc79642ea 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -534,19 +534,19 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, { // setup two PVT solvers: internal solver for rx clock and user solver // user PVT solver - d_user_pvt_solver = std::make_shared(rtk, dump_ls_pvt_filename, d_type_of_rx, d_dump, d_dump_mat, conf_); + d_user_pvt_solver = std::make_shared(rtk, conf_, dump_ls_pvt_filename, d_type_of_rx, d_dump, d_dump_mat); d_user_pvt_solver->set_pre_2009_file(conf_.pre_2009_file); // internal PVT solver, mainly used to estimate the receiver clock rtk_t internal_rtk = rtk; internal_rtk.opt.mode = PMODE_SINGLE; // use single positioning mode in internal PVT solver - d_internal_pvt_solver = std::make_shared(internal_rtk, dump_ls_pvt_filename, d_type_of_rx, false, false, conf_); + d_internal_pvt_solver = std::make_shared(internal_rtk, conf_, dump_ls_pvt_filename, d_type_of_rx, false, false); d_internal_pvt_solver->set_pre_2009_file(conf_.pre_2009_file); } else { // only one solver, customized by the user options - d_internal_pvt_solver = std::make_shared(rtk, dump_ls_pvt_filename, d_type_of_rx, d_dump, d_dump_mat, conf_); + d_internal_pvt_solver = std::make_shared(rtk, conf_, dump_ls_pvt_filename, d_type_of_rx, d_dump, d_dump_mat); d_internal_pvt_solver->set_pre_2009_file(conf_.pre_2009_file); d_user_pvt_solver = d_internal_pvt_solver; } diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index faf8af5f0..c7528749c 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -45,16 +45,16 @@ Rtklib_Solver::Rtklib_Solver(const rtk_t &rtk, + const Pvt_Conf &conf, const std::string &dump_filename, uint32_t type_of_rx, bool flag_dump_to_file, - bool flag_dump_to_mat, - Pvt_Conf conf) : d_dump_filename(dump_filename), - d_rtk(rtk), - d_conf(std::move(conf)), - d_type_of_rx(type_of_rx), - d_flag_dump_enabled(flag_dump_to_file), - d_flag_dump_mat_enabled(flag_dump_to_mat) + bool flag_dump_to_mat) : d_dump_filename(dump_filename), + d_rtk(rtk), + d_conf(std::move(conf)), + d_type_of_rx(type_of_rx), + d_flag_dump_enabled(flag_dump_to_file), + d_flag_dump_mat_enabled(flag_dump_to_mat) { // see freq index at src/algorithms/libs/rtklib/rtklib_rtkcmn.cc // function: satwavelen diff --git a/src/algorithms/PVT/libs/rtklib_solver.h b/src/algorithms/PVT/libs/rtklib_solver.h index f24a37b2a..3fcb50172 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.h +++ b/src/algorithms/PVT/libs/rtklib_solver.h @@ -82,11 +82,12 @@ class Rtklib_Solver : public Pvt_Solution { public: Rtklib_Solver(const rtk_t& rtk, + const Pvt_Conf& conf, const std::string& dump_filename, uint32_t type_of_rx, bool flag_dump_to_file, - bool flag_dump_to_mat, - Pvt_Conf conf); + bool flag_dump_to_mat); + ~Rtklib_Solver(); bool get_PVT(const std::map& gnss_observables_map, double kf_update_interval_s); diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc b/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc index 5c56c6f7f..eac226411 100644 --- a/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc @@ -147,7 +147,7 @@ TEST_F(NmeaPrinterTest, PrintLine) std::string filename("nmea_test.nmea"); Pvt_Conf conf; conf.use_e6_for_pvt = false; - std::shared_ptr pvt_solution = std::make_shared(rtk, "filename", 1, false, false, conf); + std::shared_ptr pvt_solution = std::make_shared(rtk, conf, "filename", 1, false, false); boost::posix_time::ptime pt(boost::gregorian::date(1994, boost::date_time::Nov, 19), boost::posix_time::hours(22) + boost::posix_time::minutes(54) + boost::posix_time::seconds(46)); diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc b/src/tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc index a4a4fe90a..8885e7367 100644 --- a/src/tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc @@ -145,7 +145,7 @@ TEST_F(RinexPrinterTest, GalileoObsHeader) { Pvt_Conf conf; conf.use_e6_for_pvt = false; - auto pvt_solution = std::make_shared(rtk, "filename", 4, false, false, conf); + auto pvt_solution = std::make_shared(rtk, conf, "filename", 4, false, false); auto eph = Galileo_Ephemeris(); eph.PRN = 1; pvt_solution->galileo_ephemeris_map[1] = eph; @@ -233,7 +233,7 @@ TEST_F(RinexPrinterTest, GlonassObsHeader) { Pvt_Conf conf; conf.use_e6_for_pvt = false; - auto pvt_solution = std::make_shared(rtk, "filename", 28, false, false, conf); + auto pvt_solution = std::make_shared(rtk, conf, "filename", 28, false, false); auto eph = Glonass_Gnav_Ephemeris(); eph.PRN = 1; pvt_solution->glonass_gnav_ephemeris_map[1] = eph; @@ -295,7 +295,7 @@ TEST_F(RinexPrinterTest, MixedObsHeader) eph_gps.PRN = 1; Pvt_Conf conf; conf.use_e6_for_pvt = false; - auto pvt_solution = std::make_shared(rtk, "filename", 106, false, false, conf); + auto pvt_solution = std::make_shared(rtk, conf, "filename", 106, false, false); pvt_solution->galileo_ephemeris_map[1] = eph_gal; pvt_solution->gps_ephemeris_map[1] = eph_gps; @@ -367,7 +367,7 @@ TEST_F(RinexPrinterTest, MixedObsHeaderGpsGlo) eph_gps.PRN = 1; Pvt_Conf conf; conf.use_e6_for_pvt = false; - auto pvt_solution = std::make_shared(rtk, "filename", 26, false, false, conf); + auto pvt_solution = std::make_shared(rtk, conf, "filename", 26, false, false); pvt_solution->glonass_gnav_ephemeris_map[1] = eph_glo; pvt_solution->gps_ephemeris_map[1] = eph_gps; @@ -436,7 +436,7 @@ TEST_F(RinexPrinterTest, GalileoObsLog) eph.PRN = 1; Pvt_Conf conf; conf.use_e6_for_pvt = false; - auto pvt_solution = std::make_shared(rtk, "filename", 4, false, false, conf); + auto pvt_solution = std::make_shared(rtk, conf, "filename", 4, false, false); pvt_solution->galileo_ephemeris_map[1] = eph; std::map gnss_observables_map; @@ -518,7 +518,7 @@ TEST_F(RinexPrinterTest, GlonassObsLog) eph.PRN = 22; Pvt_Conf conf; conf.use_e6_for_pvt = false; - auto pvt_solution = std::make_shared(rtk, "filename", 23, false, false, conf); + auto pvt_solution = std::make_shared(rtk, conf, "filename", 23, false, false); pvt_solution->glonass_gnav_ephemeris_map[1] = eph; std::map gnss_observables_map; @@ -602,7 +602,7 @@ TEST_F(RinexPrinterTest, GpsObsLogDualBand) eph_cnav.PRN = 1; Pvt_Conf conf; conf.use_e6_for_pvt = false; - auto pvt_solution = std::make_shared(rtk, "filename", 7, false, false, conf); + auto pvt_solution = std::make_shared(rtk, conf, "filename", 7, false, false); pvt_solution->gps_ephemeris_map[1] = eph; pvt_solution->gps_cnav_ephemeris_map[1] = eph_cnav; std::map gnss_observables_map; @@ -692,7 +692,7 @@ TEST_F(RinexPrinterTest, GalileoObsLogDualBand) { Pvt_Conf conf; conf.use_e6_for_pvt = false; - auto pvt_solution = std::make_shared(rtk, "filename", 14, false, false, conf); + auto pvt_solution = std::make_shared(rtk, conf, "filename", 14, false, false); auto eph = Galileo_Ephemeris(); eph.PRN = 1; pvt_solution->galileo_ephemeris_map[1] = eph; @@ -794,7 +794,7 @@ TEST_F(RinexPrinterTest, MixedObsLog) eph_gal.PRN = 1; Pvt_Conf conf; conf.use_e6_for_pvt = false; - auto pvt_solution = std::make_shared(rtk, "filename", 9, false, false, conf); + auto pvt_solution = std::make_shared(rtk, conf, "filename", 9, false, false); pvt_solution->gps_ephemeris_map[1] = eph_gps; pvt_solution->galileo_ephemeris_map[1] = eph_gal; std::map gnss_observables_map; @@ -920,7 +920,7 @@ TEST_F(RinexPrinterTest, MixedObsLogGpsGlo) eph_glo.PRN = 1; Pvt_Conf conf; conf.use_e6_for_pvt = false; - auto pvt_solution = std::make_shared(rtk, "filename", 26, false, false, conf); + auto pvt_solution = std::make_shared(rtk, conf, "filename", 26, false, false); pvt_solution->gps_ephemeris_map[1] = eph_gps; pvt_solution->glonass_gnav_ephemeris_map[1] = eph_glo; std::map gnss_observables_map; diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc b/src/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc index 805ffdb9e..fe2aa27af 100644 --- a/src/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc @@ -386,7 +386,7 @@ TEST(RTKLibSolverTest, test1) Pvt_Conf conf; conf.use_e6_for_pvt = false; - auto d_ls_pvt = std::make_unique(rtk, nchannels, dump_filename, 1, flag_dump_to_file, save_to_mat, conf); + auto d_ls_pvt = std::make_unique(rtk, conf, nchannels, dump_filename, 1, flag_dump_to_file, save_to_mat); d_ls_pvt->set_averaging_depth(1); // load ephemeris From 2dfd79d45c96dce9b2336a83bdb1b0b2304d87d2 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 5 Nov 2023 10:14:36 +0100 Subject: [PATCH 04/16] Avoid potential undefined behaviour detected by Coverity Scan --- .../observables/gnuradio_blocks/hybrid_observables_gs.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc index d32f0ba68..8569dde24 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc @@ -431,6 +431,10 @@ bool hybrid_observables_gs::interp_trk_obs(Gnss_Synchro &interpolated_obs, uint3 // 1st: copy the nearest gnss_synchro data for that channel interpolated_obs = d_gnss_synchro_history->get(ch, nearest_element); + if (interpolated_obs.fs == 0LL) + { + return false; + } // 2nd: Linear interpolation: y(t) = y(t1) + (y(t2) - y(t1)) * (t - t1) / (t2 - t1) const double T_rx_s = static_cast(rx_clock) / static_cast(interpolated_obs.fs); From f6a1777a2103ac772ba655e18a8829f1d67f0ba1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 5 Nov 2023 10:16:26 +0100 Subject: [PATCH 05/16] Fix defect detected by Coverity Scan --- src/algorithms/PVT/libs/rinex_printer.cc | 20 ++++++------------ src/algorithms/PVT/libs/rinex_printer.h | 26 ++++++++++++++++-------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index ceb62548f..fe01e7cd8 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -65,14 +65,6 @@ Rinex_Printer::Rinex_Printer(int32_t conf_version, d_pre_2009_file(false) { - // RINEX v3.02 codes - satelliteSystem["GPS"] = "G"; - satelliteSystem["GLONASS"] = "R"; - satelliteSystem["SBAS payload"] = "S"; - satelliteSystem["Galileo"] = "E"; - satelliteSystem["Beidou"] = "C"; - satelliteSystem["Mixed"] = "M"; - observationCode["GPS_L1_CA"] = "1C"; // "1C" GPS L1 C/A observationCode["GPS_L1_P"] = "1P"; // "1P" GPS L1 P observationCode["GPS_L1_Z_TRACKING"] = "1W"; // "1W" GPS L1 Z-tracking and similar (AS on) @@ -6364,7 +6356,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem["Mixed"]; + line += satelliteSystem.find("Mixed")->second; line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -6724,7 +6716,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem["Mixed"]; + line += satelliteSystem.find("Mixed")->second; line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -7049,7 +7041,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem["Mixed"]; + line += satelliteSystem.find("Mixed")->second; line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -8199,7 +8191,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem["Mixed"]; + line += satelliteSystem.find("Mixed")->second; line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -8571,7 +8563,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem["Mixed"]; + line += satelliteSystem.find("Mixed")->second; line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -9215,7 +9207,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem["Mixed"]; + line += satelliteSystem.find("Mixed")->second; line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); diff --git a/src/algorithms/PVT/libs/rinex_printer.h b/src/algorithms/PVT/libs/rinex_printer.h index 537f2167a..3d1c42229 100644 --- a/src/algorithms/PVT/libs/rinex_printer.h +++ b/src/algorithms/PVT/libs/rinex_printer.h @@ -39,14 +39,15 @@ #define GNSS_SDR_RINEX_PRINTER_H #include -#include // for int32_t -#include // for strtol, strtod -#include // for fstream -#include // for setprecision -#include // for map -#include // for stringstream -#include // for string -#include +#include // for int32_t +#include // for strtol, strtod +#include // for fstream +#include // for setprecision +#include // for map +#include // for stringstream +#include // for string +#include // for unordered_map +#include // for vector /** \addtogroup PVT @@ -232,6 +233,14 @@ public: private: + const std::unordered_map satelliteSystem = { + {"GPS", "G"}, + {"GLONASS", "R"}, + {"SBAS payload", "S"}, + {"Galileo", "E"}, + {"Beidou", "C"}, + {"Mixed", "M"}}; // RINEX v3.02 codes + /* * Generates the GPS Observation data header */ @@ -984,7 +993,6 @@ private: inline std::string asFixWidthString(int x, int width, char fill_digit) const; - std::map satelliteSystem; // GPS, GLONASS, SBAS payload, Galileo or Beidou std::map observationType; // PSEUDORANGE, CARRIER_PHASE, DOPPLER, SIGNAL_STRENGTH std::map observationCode; // GNSS observation descriptors From 4ec232fe2d6b8eefd33c6b8d21b14d9e8460b522 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 5 Nov 2023 12:53:47 +0100 Subject: [PATCH 06/16] Fix defects detected by Coverity Scan --- src/algorithms/PVT/libs/rinex_printer.cc | 325 ++++++++++++++++++----- 1 file changed, 260 insertions(+), 65 deletions(-) diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index fe01e7cd8..f6deb47f9 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -4979,7 +4979,10 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } if (gps_ephemeris_iter->second.PRN < 10) { line += std::string("0"); @@ -5289,7 +5292,10 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } if (gps_ephemeris_iter->second.PRN < 10) { line += std::string("0"); @@ -5453,7 +5459,10 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Galileo")->second; + } if (galileo_ephemeris_iter->second.PRN < 10) { line += std::string("0"); @@ -5713,7 +5722,10 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } if (glonass_gnav_ephemeris_iter->second.PRN < 10) { line += std::string("0"); @@ -5882,7 +5894,10 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond; + if (satelliteSystem.find("Beidou") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Beidou")->second; + } if (bds_ephemeris_iter->second.PRN < 10) { line += std::string("0"); @@ -6020,7 +6035,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -6178,7 +6196,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem // -------- SYS / OBS TYPES // one line per available system line.clear(); - line += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } line += std::string(2, ' '); std::stringstream strm; d_numberTypesObservations = 4; @@ -6296,7 +6317,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem line.clear(); line += Rinex_Printer::rightJustify(std::to_string(0), 3); // Number of satellites in list line += std::string(1, ' '); - line += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } line += Rinex_Printer::rightJustify(std::to_string(0), 2); // Slot Number line += std::string(1, ' '); line += Rinex_Printer::rightJustify(std::to_string(0), 2); // Frequency Number @@ -6356,7 +6380,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("Mixed")->second; + if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Mixed")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -6507,7 +6534,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps { // one line per available system line.clear(); - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } line += std::string(2, ' '); std::stringstream strm; d_numberTypesObservations = 4; @@ -6550,7 +6580,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps number_of_observations_glo = number_of_observations_glo + 4; } line.clear(); - line += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_glo), 3); if (found_1G != std::string::npos) @@ -6656,7 +6689,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps line.clear(); line += Rinex_Printer::rightJustify(std::to_string(0), 3); // Number of satellites in list line += std::string(1, ' '); - line += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } line += Rinex_Printer::rightJustify(std::to_string(0), 2); // Slot Number line += std::string(1, ' '); line += Rinex_Printer::rightJustify(std::to_string(0), 2); // Frequency Number @@ -6716,7 +6752,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("Mixed")->second; + if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Mixed")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -6864,7 +6903,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris // -------- SYS / OBS TYPES // one line per available system line.clear(); - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } line += std::string(2, ' '); std::stringstream strm; d_numberTypesObservations = 4; @@ -6907,7 +6949,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris number_of_observations_glo = number_of_observations_glo + 4; } line.clear(); - line += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_glo), 3); if (found_1G != std::string::npos) @@ -6981,7 +7026,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris line.clear(); line += Rinex_Printer::rightJustify(std::to_string(0), 3); // Number of satellites in list line += std::string(1, ' '); - line += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } line += Rinex_Printer::rightJustify(std::to_string(0), 2); // Slot Number line += std::string(1, ' '); line += Rinex_Printer::rightJustify(std::to_string(0), 2); // Frequency Number @@ -7041,7 +7089,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("Mixed")->second; + if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Mixed")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -7205,7 +7256,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& number_of_observations_gal = number_of_observations_gal + 4; } - line += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Galileo")->second; + } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_gal), 3); @@ -7293,7 +7347,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& number_of_observations_glo = number_of_observations_glo + 4; } - line += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_glo), 3); @@ -7383,7 +7440,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -7541,7 +7601,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph // -------- SYS / OBS TYPES // one line per available system line.clear(); - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } line += std::string(2, ' '); std::stringstream strm; d_numberTypesObservations = 4; @@ -7651,7 +7714,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -7800,7 +7866,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris { number_of_observations_gps = number_of_observations_gps + 4; } - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } line += std::string(2, ' '); std::stringstream strm; d_numberTypesObservations = number_of_observations_gps; @@ -7906,7 +7975,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -8061,7 +8133,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph { number_of_observations_gps = number_of_observations_gps + 4; } - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } line += std::string(2, ' '); std::stringstream strm; d_numberTypesObservations = number_of_observations_gps; @@ -8191,7 +8266,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("Mixed")->second; + if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Mixed")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -8346,7 +8424,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps { number_of_observations_gps = number_of_observations_gps + 4; } - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } line += std::string(2, ' '); std::stringstream strm; d_numberTypesObservations = number_of_observations_gps; @@ -8442,7 +8523,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps { number_of_observations_gal = number_of_observations_gal + 4; } - line += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Galileo")->second; + } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_gal), 3); if (found_1B != std::string::npos) @@ -8563,7 +8647,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("Mixed")->second; + if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Mixed")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -8712,7 +8799,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris { number_of_observations_gps = number_of_observations_gps + 4; } - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } line += std::string(2, ' '); std::stringstream strm; d_numberTypesObservations = number_of_observations_gps; @@ -8788,7 +8878,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris { number_of_observations_gal = number_of_observations_gal + 4; } - line += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Galileo")->second; + } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_gal), 3); if (found_1B != std::string::npos) @@ -8914,7 +9007,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& } line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Galileo")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -9079,7 +9175,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& line.clear(); - line += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Galileo")->second; + } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations), 3); @@ -9207,7 +9306,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("Mixed")->second; + if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Mixed")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -9343,7 +9445,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps // -------- SYS / OBS TYPES // one line per available system line.clear(); - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } line += std::string(2, ' '); std::stringstream strm; d_numberTypesObservations = 4; @@ -9401,7 +9506,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps } line.clear(); - line += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Galileo")->second; + } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_gal), 3); @@ -9524,7 +9632,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Beidou_Dnav_Epheme line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - line += satelliteSystem.find("Beidou")->second; + if (satelliteSystem.find("Beidou") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Beidou")->second; + } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); Rinex_Printer::lengthCheck(line); @@ -9667,7 +9778,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Beidou_Dnav_Epheme line.clear(); - line += satelliteSystem.find("Beidou")->second; + if (satelliteSystem.find("Beidou") != satelliteSystem.cend()) + { + line += satelliteSystem.find("Beidou")->second; + } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations), 3); @@ -10093,7 +10207,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeri observables_iter != observables.cend(); observables_iter++) { - line += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } if (static_cast(observables_iter->second.PRN) < 10) { line += std::string(1, '0'); @@ -10213,7 +10330,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeri { std::string lineObs; lineObs.clear(); - lineObs += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GLONASS")->second; + } if (static_cast(observables_iter->second.PRN) < 10) { lineObs += std::string(1, '0'); @@ -10430,7 +10550,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep observables_iter != observablesG1C.cend(); observables_iter++) { - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } if (static_cast(observables_iter->second.PRN) < 10) { line += std::string(1, '0'); @@ -10442,7 +10565,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep observables_iter != observablesR1C.cend(); observables_iter++) { - line += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } if (static_cast(observables_iter->second.PRN) < 10) { line += std::string(1, '0'); @@ -10454,7 +10580,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep observables_iter != observablesR2C.cend(); observables_iter++) { - line += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GLONASS")->second; + } if (static_cast(observables_iter->second.PRN) < 10) { line += std::string(1, '0'); @@ -10481,11 +10610,17 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep // Specify system only if in version 3 if (s == "G") { - lineObs += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GPS")->second; + } } if (s == "R") { - lineObs += satelliteSystem.find("GLONASS")->second; // should not happen + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GLONASS")->second; + } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) { @@ -10554,7 +10689,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep lineObs.clear(); if (d_version == 3) { - lineObs += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GLONASS")->second; + } if (static_cast(*it) < 10) { lineObs += std::string(1, '0'); @@ -10742,11 +10880,17 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g // Specify system only if in version 3 if (s == "G") { - lineObs += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GPS")->second; + } } if (s == "R") { - lineObs += satelliteSystem.find("GLONASS")->second; // should not happen + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GLONASS")->second; + } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) { @@ -10812,7 +10956,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g it++) { lineObs.clear(); - lineObs += satelliteSystem.find("GLONASS")->second; + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GLONASS")->second; + } if (static_cast(*it) < 10) { lineObs += std::string(1, '0'); @@ -11000,11 +11147,17 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga s.assign(1, observables_iter->second.System); if (s == "E") { - lineObs += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("Galileo")->second; + } } if (s == "R") { - lineObs += satelliteSystem.find("GLONASS")->second; // should not happen + if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GLONASS")->second; + } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) { @@ -11068,7 +11221,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga it++) { lineObs.clear(); - lineObs += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("Galileo")->second; + } if (static_cast(*it) < 10) { lineObs += std::string(1, '0'); @@ -11201,7 +11357,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, d observables_iter != observables.cend(); observables_iter++) { - line += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + line += satelliteSystem.find("GPS")->second; + } if (static_cast(observables_iter->second.PRN) < 10) { line += std::string(1, '0'); @@ -11322,7 +11481,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, d { std::string lineObs; lineObs.clear(); - lineObs += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GPS")->second; + } if (static_cast(observables_iter->second.PRN) < 10) { lineObs += std::string(1, '0'); @@ -11449,7 +11611,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e { std::string lineObs; lineObs.clear(); - lineObs += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GPS")->second; + } if (static_cast(observables_iter->second.PRN) < 10) { lineObs += std::string(1, '0'); @@ -11673,7 +11838,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c it++) { lineObs.clear(); - lineObs += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GPS")->second; + } if (static_cast(*it) < 10) { lineObs += std::string(1, '0'); @@ -11926,7 +12094,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep it++) { lineObs.clear(); - lineObs += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("Galileo")->second; + } if (static_cast(*it) < 10) { lineObs += std::string(1, '0'); @@ -12148,11 +12319,17 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep s.assign(1, observables_iter->second.System); if (s == "G") { - lineObs += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GPS")->second; + } } if (s == "E") { - lineObs += satelliteSystem.find("Galileo")->second; // should not happen + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("Galileo")->second; + } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) { @@ -12216,7 +12393,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep it++) { lineObs.clear(); - lineObs += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("Galileo")->second; + } if (static_cast(*it) < 10) { lineObs += std::string(1, '0'); @@ -12469,7 +12649,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e it++) { lineObs.clear(); - lineObs += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GPS")->second; + } if (static_cast(*it) < 10) { lineObs += std::string(1, '0'); @@ -12531,7 +12714,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e it++) { lineObs.clear(); - lineObs += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("Galileo")->second; + } if (static_cast(*it) < 10) { lineObs += std::string(1, '0'); @@ -12802,7 +12988,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep it++) { lineObs.clear(); - lineObs += satelliteSystem.find("GPS")->second; + if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("GPS")->second; + } if (static_cast(*it) < 10) { lineObs += std::string(1, '0'); @@ -12875,7 +13064,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep it++) { lineObs.clear(); - lineObs += satelliteSystem.find("Galileo")->second; + if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("Galileo")->second; + } if (static_cast(*it) < 10) { lineObs += std::string(1, '0'); @@ -13060,7 +13252,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris it++) { lineObs.clear(); - lineObs += satelliteSystem.find("Beidou")->second; + if (satelliteSystem.find("Beidou") != satelliteSystem.cend()) + { + lineObs += satelliteSystem.find("Beidou")->second; + } if (static_cast(*it) < 10) { lineObs += std::string(1, '0'); From 7d9d090a212806d14ce77820d885c3a4d9f2a797 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 5 Nov 2023 17:59:55 +0100 Subject: [PATCH 07/16] Make clang-tidy happy --- src/algorithms/PVT/libs/rtklib_solver.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index c7528749c..44f568531 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -51,7 +51,7 @@ Rtklib_Solver::Rtklib_Solver(const rtk_t &rtk, bool flag_dump_to_file, bool flag_dump_to_mat) : d_dump_filename(dump_filename), d_rtk(rtk), - d_conf(std::move(conf)), + d_conf(conf), d_type_of_rx(type_of_rx), d_flag_dump_enabled(flag_dump_to_file), d_flag_dump_mat_enabled(flag_dump_to_mat) From ab4cc295e891aa5cf6c8dea8abd33dd8966f218d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 6 Nov 2023 14:01:42 +0100 Subject: [PATCH 08/16] volk_gnsssdr: Fix syntax for Python 3.12 Without breaking older versions, including 2.7 --- docs/CHANGELOG.md | 2 ++ .../cmake/Modules/VolkPython.cmake | 2 +- .../gen/volk_gnsssdr_compile_utils.py | 26 +++++++++++-------- .../gen/volk_gnsssdr_kernel_defs.py | 6 +++-- .../gen/volk_gnsssdr_tmpl_utils.py | 17 ++++++------ .../volk_gnsssdr/lib/CMakeLists.txt | 2 +- .../volk_gnsssdr_modtool_generate.py | 4 +-- 7 files changed, 33 insertions(+), 26 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 581c9f239..930a5c59c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -34,6 +34,8 @@ All notable changes to GNSS-SDR will be documented in this file. ### Improvements in Portability: - Updated local `cpu_features` library to v0.9.0. +- `volk_gnsssdr`: fix syntax for Python 3.12 without breaking backward + compatibility with Python 2.7. ### Improvements in Repeatability: diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake index 325e93a1f..3730e8e7f 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake @@ -221,7 +221,7 @@ function(VOLK_UNIQUE_TARGET desc) file(RELATIVE_PATH reldir ${PROJECT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib unique = hashlib.sha256(b'${reldir}${ARGN}').hexdigest()[:5] -print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))" +print(re.sub(r'\\W', '_', '${desc} ${reldir} ' + unique))" OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE) add_custom_target(${_target} ALL DEPENDS ${ARGN}) endfunction() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_compile_utils.py b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_compile_utils.py index dcd26d25d..0a763ddca 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_compile_utils.py +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_compile_utils.py @@ -8,7 +8,7 @@ from __future__ import print_function -import optparse +import argparse import volk_gnsssdr_arch_defs import volk_gnsssdr_machine_defs @@ -20,6 +20,7 @@ def do_arch_flags_list(compiler): output.append(','.join(fields)) print(';'.join(output)) + def do_machines_list(arch_names): output = list() for machine in volk_gnsssdr_machine_defs.machines: @@ -28,6 +29,7 @@ def do_machines_list(arch_names): output.append(machine.name) print(';'.join(output)) + def do_machine_flags_list(compiler, machine_name): output = list() machine = volk_gnsssdr_machine_defs.machine_dict[machine_name] @@ -35,16 +37,18 @@ def do_machine_flags_list(compiler, machine_name): output.extend(arch.get_flags(compiler)) print(' '.join(output)) + def main(): - parser = optparse.OptionParser() - parser.add_option('--mode', type='string') - parser.add_option('--compiler', type='string') - parser.add_option('--archs', type='string') - parser.add_option('--machine', type='string') - (opts, args) = parser.parse_args() + parser = argparse.ArgumentParser() + parser.add_argument('--mode', type=str) + parser.add_argument('--compiler', type=str) + parser.add_argument('--archs', type=str) + parser.add_argument('--machine', type=str) + args = parser.parse_args() - if opts.mode == 'arch_flags': return do_arch_flags_list(opts.compiler.lower()) - if opts.mode == 'machines': return do_machines_list(opts.archs.split(';')) - if opts.mode == 'machine_flags': return do_machine_flags_list(opts.compiler.lower(), opts.machine) + if args.mode == 'arch_flags': return do_arch_flags_list(args.compiler.lower()) + if args.mode == 'machines': return do_machines_list(args.archs.split(';')) + if args.mode == 'machine_flags': return do_machine_flags_list(args.compiler.lower(), args.machine) -if __name__ == '__main__': main() +if __name__ == '__main__': + main() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_kernel_defs.py b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_kernel_defs.py index e919caa09..84c217ec4 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_kernel_defs.py +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_kernel_defs.py @@ -16,7 +16,7 @@ import glob ######################################################################## # Strip comments from a c/cpp file. # Input is code string, output is code string without comments. -# https://stackoverflow.com/questions/241327/remove-c-and-c-comments-using-python +# https://stackoverflow.com/questions/241327/python-snippet-to-remove-c-and-c-comments ######################################################################## def comment_remover(text): def replacer(match): @@ -120,7 +120,7 @@ class impl_class(object): self.args = list() fcn_args = the_rest.split(',') for fcn_arg in fcn_args: - arg_matcher = re.compile(r'^\s*(.*\W)\s*(\w+)\s*$', re.DOTALL | re.MULTILINE) + arg_matcher = re.compile(r'^\s*(.*[^\w])\s*(\w+)\s*$', re.DOTALL | re.MULTILINE) m = arg_matcher.match(fcn_arg) arg_type, arg_name = m.groups() self.args.append((arg_type, arg_name)) @@ -164,6 +164,8 @@ class kernel_class(object): kern_name=self.name, header=sub_hdr, body=body, )) assert(self._impls) + if "generic" not in [impl.name for impl in self._impls]: + raise Exception("{} does not have a generic protokernel.".format(self.name)) self.has_dispatcher = False for impl in self._impls: if impl.name == 'dispatcher': diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_tmpl_utils.py b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_tmpl_utils.py index 9a2379e15..3baf83bd7 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_tmpl_utils.py +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/volk_gnsssdr_tmpl_utils.py @@ -11,7 +11,7 @@ from __future__ import print_function import os import re import sys -import optparse +import argparse import volk_gnsssdr_arch_defs import volk_gnsssdr_machine_defs import volk_gnsssdr_kernel_defs @@ -34,13 +34,14 @@ def __parse_tmpl(_tmpl, **kwargs): return str(Template(_tmpl).render(**defs)) def main(): - parser = optparse.OptionParser() - parser.add_option('--input', type='string') - parser.add_option('--output', type='string') - (opts, args) = parser.parse_args() + parser = argparse.ArgumentParser() + parser.add_argument('--input', type=str) + parser.add_argument('--output', type=str) + args, extras = parser.parse_known_args() - output = __parse_tmpl(open(opts.input).read(), args=args) - if opts.output: open(opts.output, 'w').write(output) + output = __parse_tmpl(open(args.input).read(), args=extras) + if args.output: open(args.output, 'w').write(output) else: print(output) -if __name__ == '__main__': main() +if __name__ == '__main__': + main() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index 2d5553917..f22441f69 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -113,7 +113,7 @@ macro(check_arch arch_name) set(have_flag have${flag}) # make the have_flag have nice alphanum chars (just for looks/not necessary) execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import re; print(re.sub('\\W', '_', '${have_flag}'))" + COMMAND ${PYTHON_EXECUTABLE} -c "import re; print(re.sub(r'\\W', '_', '${have_flag}'))" OUTPUT_VARIABLE have_flag OUTPUT_STRIP_TRAILING_WHITESPACE ) if(VOLK_FLAG_CHECK_FLAGS) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/volk_gnsssdr_modtool_generate.py b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/volk_gnsssdr_modtool_generate.py index a8fe52b58..6a9a8ca11 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/volk_gnsssdr_modtool_generate.py +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/volk_gnsssdr_modtool_generate.py @@ -290,9 +290,7 @@ class volk_gnsssdr_modtool(object): inserted = False; insert = False for otherline in otherlines: - - if (re.match('\s*', otherline) == None or re.match('\s*#.*', otherline) == None): - + if re.match(r'\s*', otherline) is None or re.match(r'\s*#.*', otherline) is None: insert = True; if insert and not inserted: inserted = True; From 419172ae3b62ff7ebc5420d4f104ae0e01d1961c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 7 Nov 2023 11:40:47 +0100 Subject: [PATCH 09/16] Rinex_Printer: Better usage of unordered_map --- src/algorithms/PVT/libs/rinex_printer.cc | 459 +++++++++++++---------- 1 file changed, 260 insertions(+), 199 deletions(-) diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index f6deb47f9..f140270d4 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -187,9 +187,9 @@ Rinex_Printer::Rinex_Printer(int32_t conf_version, Rinex_Printer::navGloFile.open(navGlofilename, std::ios::out | std::ios::in | std::ios::app); Rinex_Printer::navBdsFile.open(navBdsfilename, std::ios::out | std::ios::in | std::ios::app); - if (!Rinex_Printer::navFile.is_open() or !Rinex_Printer::obsFile.is_open() or - !Rinex_Printer::sbsFile.is_open() or !Rinex_Printer::navGalFile.is_open() or - !Rinex_Printer::navMixFile.is_open() or !Rinex_Printer::navGloFile.is_open()) + if (!Rinex_Printer::navFile.is_open() || !Rinex_Printer::obsFile.is_open() or + !Rinex_Printer::sbsFile.is_open() || !Rinex_Printer::navGalFile.is_open() or + !Rinex_Printer::navMixFile.is_open() || !Rinex_Printer::navGloFile.is_open()) { std::cout << "RINEX files cannot be saved. Wrong permissions?\n"; } @@ -374,7 +374,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 7: // GPS L1 C/A + GPS L2C - if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) + if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) { const std::string signal("1C 2S"); rinex_obs_header(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, rx_time, signal); @@ -385,7 +385,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 8: // GPS L1 + GPS L5 - if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) + if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) { const std::string signal("1C L5"); rinex_obs_header(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, rx_time, signal); @@ -396,7 +396,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 9: // GPS L1 C/A + Galileo E1B - if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) + if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { const std::string gal_signal("1B"); rinex_obs_header(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gal_signal); @@ -407,7 +407,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 10: // GPS L1 C/A + Galileo E5a - if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) + if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { const std::string gal_signal("5X"); rinex_obs_header(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gal_signal); @@ -418,7 +418,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 11: // GPS L1 C/A + Galileo E5b - if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) + if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { const std::string gal_signal("7X"); rinex_obs_header(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gal_signal); @@ -429,7 +429,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 13: // L5+E5a - if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) + if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) { const std::string gal_signal("5X"); const std::string gps_signal("L5"); @@ -507,7 +507,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 26: // GPS L1 C/A + GLONASS L1 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { const std::string glo_signal("1G"); rinex_obs_header(obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, glo_signal); @@ -530,7 +530,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 27: // Galileo E1B + GLONASS L1 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) { const std::string glo_signal("1G"); const std::string gal_signal("1B"); @@ -542,7 +542,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 28: // GPS L2C + GLONASS L1 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) { const std::string glo_signal("1G"); rinex_obs_header(obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, glo_signal); @@ -553,7 +553,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 29: // GPS L1 C/A + GLONASS L2 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { const std::string glo_signal("2G"); rinex_obs_header(obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, glo_signal); @@ -576,7 +576,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 30: // Galileo E1B + GLONASS L2 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) { const std::string glo_signal("2G"); const std::string gal_signal("1B"); @@ -588,7 +588,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 31: // GPS L2C + GLONASS L2 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) { const std::string glo_signal("2G"); rinex_obs_header(obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, glo_signal); @@ -691,7 +691,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 106: // GPS L1 C/A + Galileo E1B + Galileo E6B - if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) + if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { const std::string gal_signal("1B E6"); rinex_obs_header(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gal_signal); @@ -736,7 +736,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons break; case 501: // BeiDou B1I + GPS L1 C/A - if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) and (beidou_dnav_ephemeris_iter != pvt_solver->beidou_dnav_ephemeris_map.cend())) + if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) && (beidou_dnav_ephemeris_iter != pvt_solver->beidou_dnav_ephemeris_map.cend())) { const std::string bds_signal("B1"); // rinex_obs_header(obsFile, gps_ephemeris_iter->second, beidou_dnav_ephemeris_iter->second, rx_time, bds_signal); @@ -746,7 +746,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons break; case 502: // BeiDou B1I + Galileo E1B - if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) and (beidou_dnav_ephemeris_iter != pvt_solver->beidou_dnav_ephemeris_map.cend())) + if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) && (beidou_dnav_ephemeris_iter != pvt_solver->beidou_dnav_ephemeris_map.cend())) { const std::string bds_signal("B1"); const std::string gal_signal("1B"); @@ -838,7 +838,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons if (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) { log_rinex_obs(obsFile, gps_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated and (pvt_solver->gps_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navFile, pvt_solver->gps_utc_model, pvt_solver->gps_iono, gps_ephemeris_iter->second); @@ -852,7 +852,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, gps_cnav_ephemeris_iter->second, rx_time, gnss_observables_map); } - if (!d_rinex_header_updated and (pvt_solver->gps_cnav_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_cnav_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_cnav_utc_model); update_nav_header(navFile, pvt_solver->gps_cnav_utc_model, pvt_solver->gps_cnav_iono); @@ -864,7 +864,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "1B"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -876,7 +876,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "5X"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -888,7 +888,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "7X"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -896,10 +896,10 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 7: // GPS L1 C/A + GPS L2C - if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) + if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) { log_rinex_obs(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated and (pvt_solver->gps_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navFile, pvt_solver->gps_utc_model, pvt_solver->gps_iono, gps_ephemeris_iter->second); @@ -908,10 +908,10 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 8: // L1+L5 - if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) + if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) { log_rinex_obs(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated and ((pvt_solver->gps_cnav_utc_model.A0 != 0) or (pvt_solver->gps_utc_model.A0 != 0))) + if (!d_rinex_header_updated && ((pvt_solver->gps_cnav_utc_model.A0 != 0) || (pvt_solver->gps_utc_model.A0 != 0))) { if (pvt_solver->gps_cnav_utc_model.A0 != 0) { @@ -928,10 +928,10 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 9: // GPS L1 C/A + Galileo E1B - if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) + if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { log_rinex_obs(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated and (pvt_solver->gps_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navMixFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); @@ -940,11 +940,11 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 13: // L5+E5a - if ((gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) + if ((gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend()) && (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) { log_rinex_obs(obsFile, gps_cnav_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gnss_observables_map); } - if (!d_rinex_header_updated and (pvt_solver->gps_cnav_utc_model.A0 != 0) and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_cnav_utc_model.A0 != 0) && (pvt_solver->galileo_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_cnav_utc_model); update_nav_header(navMixFile, pvt_solver->gps_cnav_utc_model, pvt_solver->gps_cnav_iono, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); @@ -956,7 +956,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "1B 5X"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -968,7 +968,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "1B 7X"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -980,7 +980,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "5X 7X"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -992,7 +992,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, glonass_gnav_ephemeris_iter->second, rx_time, gnss_observables_map, "1C"); } - if (!d_rinex_header_updated and (pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) + if (!d_rinex_header_updated && (pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) { update_nav_header(navGloFile, pvt_solver->glonass_gnav_utc_model, pvt_solver->glonass_gnav_almanac); update_obs_header(obsFile, pvt_solver->glonass_gnav_utc_model); @@ -1004,7 +1004,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, glonass_gnav_ephemeris_iter->second, rx_time, gnss_observables_map, "2C"); } - if (!d_rinex_header_updated and (pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) + if (!d_rinex_header_updated && (pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) { update_nav_header(navGloFile, pvt_solver->glonass_gnav_utc_model, pvt_solver->glonass_gnav_almanac); update_obs_header(obsFile, pvt_solver->glonass_gnav_utc_model); @@ -1016,7 +1016,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, glonass_gnav_ephemeris_iter->second, rx_time, gnss_observables_map, "1C 2C"); } - if (!d_rinex_header_updated and (pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) + if (!d_rinex_header_updated && (pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) { update_nav_header(navMixFile, pvt_solver->glonass_gnav_utc_model, pvt_solver->glonass_gnav_almanac); update_obs_header(obsFile, pvt_solver->glonass_gnav_utc_model); @@ -1024,10 +1024,10 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 26: // GPS L1 C/A + GLONASS L1 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { log_rinex_obs(obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated and (pvt_solver->gps_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navMixFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->glonass_gnav_utc_model, pvt_solver->glonass_gnav_almanac); @@ -1036,11 +1036,11 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 27: // Galileo E1B + GLONASS L1 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, gnss_observables_map); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->galileo_utc_model); update_nav_header(navMixFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model, pvt_solver->glonass_gnav_utc_model, pvt_solver->glonass_gnav_almanac); @@ -1048,11 +1048,11 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 28: // GPS L2C + GLONASS L1 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) { log_rinex_obs(obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, gnss_observables_map); } - if (!d_rinex_header_updated and (pvt_solver->gps_cnav_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_cnav_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_cnav_utc_model); update_nav_header(navMixFile, pvt_solver->gps_cnav_iono, pvt_solver->gps_cnav_utc_model, pvt_solver->glonass_gnav_utc_model, pvt_solver->glonass_gnav_almanac); @@ -1060,10 +1060,10 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 29: // GPS L1 C/A + GLONASS L2 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { log_rinex_obs(obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated and (pvt_solver->gps_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navMixFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->glonass_gnav_utc_model, pvt_solver->glonass_gnav_almanac); @@ -1072,11 +1072,11 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 30: // Galileo E1B + GLONASS L2 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, gnss_observables_map); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->galileo_utc_model); update_nav_header(navMixFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model, pvt_solver->glonass_gnav_utc_model, pvt_solver->glonass_gnav_almanac); @@ -1084,11 +1084,11 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 31: // GPS L2C + GLONASS L2 C/A - if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) + if ((glonass_gnav_ephemeris_iter != pvt_solver->glonass_gnav_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) { log_rinex_obs(obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, rx_time, gnss_observables_map); } - if (!d_rinex_header_updated and (pvt_solver->gps_cnav_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_cnav_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_cnav_utc_model); update_nav_header(navMixFile, pvt_solver->gps_cnav_iono, pvt_solver->gps_cnav_utc_model, pvt_solver->glonass_gnav_utc_model, pvt_solver->glonass_gnav_almanac); @@ -1096,10 +1096,10 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 32: // L1+E1+L5+E5a - if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) + if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend()) && (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) { log_rinex_obs(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated and ((pvt_solver->gps_cnav_utc_model.A0 != 0) or (pvt_solver->gps_utc_model.A0 != 0)) and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && ((pvt_solver->gps_cnav_utc_model.A0 != 0) || (pvt_solver->gps_utc_model.A0 != 0)) && (pvt_solver->galileo_utc_model.A0 != 0)) { if (pvt_solver->gps_cnav_utc_model.A0 != 0) { @@ -1116,10 +1116,10 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 33: // L1+E1+E5a - if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) and (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) + if ((gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) && (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend())) { log_rinex_obs(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated and (pvt_solver->gps_utc_model.A0 != 0) and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0) && (pvt_solver->galileo_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navMixFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); @@ -1132,7 +1132,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "E6"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -1144,7 +1144,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "1B E6"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -1156,7 +1156,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "5X E6"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -1168,7 +1168,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "7X E6"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -1180,7 +1180,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "1B 5X E6"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -1192,7 +1192,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, "1B 7X E6"); } - if (!d_rinex_header_updated and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->galileo_utc_model.A0 != 0)) { update_nav_header(navGalFile, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); update_obs_header(obsFile, pvt_solver->galileo_utc_model); @@ -1200,10 +1200,10 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 106: // GPS L1 C/A + Galileo E1B + Galileo E6B - if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) + if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { log_rinex_obs(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated and (pvt_solver->gps_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navMixFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); @@ -1218,7 +1218,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { // we have Galileo ephemeris, maybe from assistance log_rinex_obs(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated and (pvt_solver->gps_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navMixFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); @@ -1229,7 +1229,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { // we do not have galileo ephemeris, print only GPS data log_rinex_obs(obsFile, gps_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated and (pvt_solver->gps_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navFile, pvt_solver->gps_utc_model, pvt_solver->gps_iono, gps_ephemeris_iter->second); @@ -1244,7 +1244,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, beidou_dnav_ephemeris_iter->second, rx_time, gnss_observables_map, "B1"); } - if (!d_rinex_header_updated and (pvt_solver->beidou_dnav_utc_model.A0_UTC != 0)) + if (!d_rinex_header_updated && (pvt_solver->beidou_dnav_utc_model.A0_UTC != 0)) { update_obs_header(obsFile, pvt_solver->beidou_dnav_utc_model); update_nav_header(navFile, pvt_solver->beidou_dnav_utc_model, pvt_solver->beidou_dnav_iono); @@ -1256,7 +1256,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, beidou_dnav_ephemeris_iter->second, rx_time, gnss_observables_map, "B3"); } - if (!d_rinex_header_updated and (pvt_solver->beidou_dnav_utc_model.A0_UTC != 0)) + if (!d_rinex_header_updated && (pvt_solver->beidou_dnav_utc_model.A0_UTC != 0)) { update_obs_header(obsFile, pvt_solver->beidou_dnav_utc_model); update_nav_header(navFile, pvt_solver->beidou_dnav_utc_model, pvt_solver->beidou_dnav_iono); @@ -1269,7 +1269,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, rx_time, gnss_observables_map, true); } - if (!d_rinex_header_updated and (pvt_solver->gps_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navFile, pvt_solver->gps_utc_model, pvt_solver->gps_iono, gps_ephemeris_iter->second); @@ -1283,7 +1283,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, true); } - if (!d_rinex_header_updated and (pvt_solver->gps_utc_model.A0 != 0) and (pvt_solver->galileo_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0) && (pvt_solver->galileo_utc_model.A0 != 0) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navMixFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); @@ -4979,9 +4979,10 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond; + line += satsys->second; } if (gps_ephemeris_iter->second.PRN < 10) { @@ -5292,9 +5293,10 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond; + line += satsys->second; } if (gps_ephemeris_iter->second.PRN < 10) { @@ -5459,9 +5461,10 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond; + line += satsys_gal->second; } if (galileo_ephemeris_iter->second.PRN < 10) { @@ -5722,9 +5725,10 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond; + line += satsys->second; } if (glonass_gnav_ephemeris_iter->second.PRN < 10) { @@ -5894,9 +5898,10 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond; + line += satsys_bds->second; } if (bds_ephemeris_iter->second.PRN < 10) { @@ -6035,9 +6040,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys_glo = satelliteSystem.find("GLONASS"); + if (satsys_glo != satelliteSystem.cend()) { - line += satelliteSystem.find("GLONASS")->second; + line += satsys_glo->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -6196,9 +6202,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem // -------- SYS / OBS TYPES // one line per available system line.clear(); - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } line += std::string(2, ' '); std::stringstream strm; @@ -6317,9 +6324,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem line.clear(); line += Rinex_Printer::rightJustify(std::to_string(0), 3); // Number of satellites in list line += std::string(1, ' '); - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } line += Rinex_Printer::rightJustify(std::to_string(0), 2); // Slot Number line += std::string(1, ' '); @@ -6380,9 +6388,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + const auto satsys_mix = satelliteSystem.find("Mixed"); + if (satsys_mix != satelliteSystem.cend()) { - line += satelliteSystem.find("Mixed")->second; + line += satsys_mix->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -6534,9 +6543,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps { // one line per available system line.clear(); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GPS"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys->second; } line += std::string(2, ' '); std::stringstream strm; @@ -6580,9 +6590,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps number_of_observations_glo = number_of_observations_glo + 4; } line.clear(); - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys_glo = satelliteSystem.find("GLONASS"); + if (satsys_glo != satelliteSystem.cend()) { - line += satelliteSystem.find("GLONASS")->second; + line += satsys_glo->second; } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_glo), 3); @@ -6689,9 +6700,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps line.clear(); line += Rinex_Printer::rightJustify(std::to_string(0), 3); // Number of satellites in list line += std::string(1, ' '); - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } line += Rinex_Printer::rightJustify(std::to_string(0), 2); // Slot Number line += std::string(1, ' '); @@ -6752,9 +6764,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + const auto satsys_mix = satelliteSystem.find("Mixed"); + if (satsys_mix != satelliteSystem.cend()) { - line += satelliteSystem.find("Mixed")->second; + line += satsys_mix->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -6903,9 +6916,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris // -------- SYS / OBS TYPES // one line per available system line.clear(); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } line += std::string(2, ' '); std::stringstream strm; @@ -6949,9 +6963,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris number_of_observations_glo = number_of_observations_glo + 4; } line.clear(); - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys_glo = satelliteSystem.find("GLONASS"); + if (satsys_glo != satelliteSystem.cend()) { - line += satelliteSystem.find("GLONASS")->second; + line += satsys_glo->second; } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_glo), 3); @@ -7026,9 +7041,9 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris line.clear(); line += Rinex_Printer::rightJustify(std::to_string(0), 3); // Number of satellites in list line += std::string(1, ' '); - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + if (satsys_glo != satelliteSystem.cend()) { - line += satelliteSystem.find("GLONASS")->second; + line += satsys_glo->second; } line += Rinex_Printer::rightJustify(std::to_string(0), 2); // Slot Number line += std::string(1, ' '); @@ -7089,9 +7104,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + const auto satsys_mix = satelliteSystem.find("Mixed"); + if (satsys_mix != satelliteSystem.cend()) { - line += satelliteSystem.find("Mixed")->second; + line += satsys_mix->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -7256,9 +7272,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& number_of_observations_gal = number_of_observations_gal + 4; } - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("Galileo"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("Galileo")->second; + line += satsys->second; } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_gal), 3); @@ -7347,9 +7364,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& number_of_observations_glo = number_of_observations_glo + 4; } - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys_glo = satelliteSystem.find("GLONASS"); + if (satsys_glo != satelliteSystem.cend()) { - line += satelliteSystem.find("GLONASS")->second; + line += satsys_glo->second; } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_glo), 3); @@ -7440,9 +7458,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -7601,9 +7620,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph // -------- SYS / OBS TYPES // one line per available system line.clear(); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GPS"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys->second; } line += std::string(2, ' '); std::stringstream strm; @@ -7714,9 +7734,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -7866,9 +7887,9 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris { number_of_observations_gps = number_of_observations_gps + 4; } - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + if (satsys_gps != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } line += std::string(2, ' '); std::stringstream strm; @@ -7975,9 +7996,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph line += d_stringVersion; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -8133,9 +8155,9 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph { number_of_observations_gps = number_of_observations_gps + 4; } - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + if (satsys_gps != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } line += std::string(2, ' '); std::stringstream strm; @@ -8266,9 +8288,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + const auto satsys_mix = satelliteSystem.find("Mixed"); + if (satsys_mix != satelliteSystem.cend()) { - line += satelliteSystem.find("Mixed")->second; + line += satsys_mix->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -8424,9 +8447,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps { number_of_observations_gps = number_of_observations_gps + 4; } - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } line += std::string(2, ' '); std::stringstream strm; @@ -8523,9 +8547,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps { number_of_observations_gal = number_of_observations_gal + 4; } - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("Galileo"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("Galileo")->second; + line += satsys->second; } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_gal), 3); @@ -8647,9 +8672,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + const auto satsys_mix = satelliteSystem.find("Mixed"); + if (satsys_mix != satelliteSystem.cend()) { - line += satelliteSystem.find("Mixed")->second; + line += satsys_mix->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -8799,9 +8825,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris { number_of_observations_gps = number_of_observations_gps + 4; } - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } line += std::string(2, ' '); std::stringstream strm; @@ -8878,9 +8905,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris { number_of_observations_gal = number_of_observations_gal + 4; } - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("Galileo"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("Galileo")->second; + line += satsys->second; } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_gal), 3); @@ -9007,9 +9035,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& } line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("Galileo"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("Galileo")->second; + line += satsys->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -9175,9 +9204,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& line.clear(); - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys_gal = satelliteSystem.find("Galileo"); + if (satsys_gal != satelliteSystem.cend()) { - line += satelliteSystem.find("Galileo")->second; + line += satsys_gal->second; } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations), 3); @@ -9306,9 +9336,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("Mixed") != satelliteSystem.cend()) + const auto satsys_mix = satelliteSystem.find("Mixed"); + if (satsys_mix != satelliteSystem.cend()) { - line += satelliteSystem.find("Mixed")->second; + line += satsys_mix->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -9445,9 +9476,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps // -------- SYS / OBS TYPES // one line per available system line.clear(); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } line += std::string(2, ' '); std::stringstream strm; @@ -9506,9 +9538,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps } line.clear(); - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("Galileo"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("Galileo")->second; + line += satsys->second; } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations_gal), 3); @@ -9632,9 +9665,10 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Beidou_Dnav_Epheme line += "3.02"; line += std::string(11, ' '); line += Rinex_Printer::leftJustify("OBSERVATION DATA", 20); - if (satelliteSystem.find("Beidou") != satelliteSystem.cend()) + const auto satsys_bds = satelliteSystem.find("Beidou"); + if (satsys_bds != satelliteSystem.cend()) { - line += satelliteSystem.find("Beidou")->second; + line += satsys_bds->second; } line += std::string(19, ' '); line += std::string("RINEX VERSION / TYPE"); @@ -9778,9 +9812,9 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Beidou_Dnav_Epheme line.clear(); - if (satelliteSystem.find("Beidou") != satelliteSystem.cend()) + if (satsys_bds != satelliteSystem.cend()) { - line += satelliteSystem.find("Beidou")->second; + line += satsys_bds->second; } line += std::string(2, ' '); line += Rinex_Printer::rightJustify(std::to_string(number_of_observations), 3); @@ -10207,9 +10241,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeri observables_iter != observables.cend(); observables_iter++) { - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -10330,9 +10365,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeri { std::string lineObs; lineObs.clear(); - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -10550,9 +10586,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep observables_iter != observablesG1C.cend(); observables_iter++) { - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GPS"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -10565,9 +10602,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep observables_iter != observablesR1C.cend(); observables_iter++) { - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -10580,9 +10618,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep observables_iter != observablesR2C.cend(); observables_iter++) { - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -10610,16 +10649,18 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep // Specify system only if in version 3 if (s == "G") { - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GPS"); + if (satsys != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GPS")->second; + line += satsys->second; } } if (s == "R") { - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) @@ -10689,9 +10730,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep lineObs.clear(); if (d_version == 3) { - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } if (static_cast(*it) < 10) { @@ -10880,16 +10922,18 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g // Specify system only if in version 3 if (s == "G") { - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } } if (s == "R") { - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) @@ -10956,9 +11000,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g it++) { lineObs.clear(); - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } if (static_cast(*it) < 10) { @@ -11147,16 +11192,18 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga s.assign(1, observables_iter->second.System); if (s == "E") { - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys_gal = satelliteSystem.find("Galileo"); + if (satsys_gal != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("Galileo")->second; + line += satsys_gal->second; } } if (s == "R") { - if (satelliteSystem.find("GLONASS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GLONASS"); + if (satsys != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GLONASS")->second; + line += satsys->second; } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) @@ -11221,9 +11268,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga it++) { lineObs.clear(); - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys_gal = satelliteSystem.find("Galileo"); + if (satsys_gal != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("Galileo")->second; + line += satsys_gal->second; } if (static_cast(*it) < 10) { @@ -11357,9 +11405,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, d observables_iter != observables.cend(); observables_iter++) { - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys = satelliteSystem.find("GPS"); + if (satsys != satelliteSystem.cend()) { - line += satelliteSystem.find("GPS")->second; + line += satsys->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -11481,9 +11530,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, d { std::string lineObs; lineObs.clear(); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -11611,9 +11661,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e { std::string lineObs; lineObs.clear(); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -11838,9 +11889,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c it++) { lineObs.clear(); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } if (static_cast(*it) < 10) { @@ -11856,7 +11908,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c { have_l2 = true; } - if (triple_band and sig_ == "L5" and have_l2 == false) + if (triple_band && sig_ == "L5" && have_l2 == false) { lineObs += std::string(62, ' '); } @@ -12094,9 +12146,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep it++) { lineObs.clear(); - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys_gal = satelliteSystem.find("Galileo"); + if (satsys_gal != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("Galileo")->second; + line += satsys_gal->second; } if (static_cast(*it) < 10) { @@ -12319,16 +12372,18 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep s.assign(1, observables_iter->second.System); if (s == "G") { - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } } if (s == "E") { - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys_gal = satelliteSystem.find("Galileo"); + if (satsys_gal != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("Galileo")->second; + line += satsys_gal->second; } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) @@ -12393,9 +12448,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep it++) { lineObs.clear(); - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys_gal = satelliteSystem.find("Galileo"); + if (satsys_gal != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("Galileo")->second; + line += satsys_gal->second; } if (static_cast(*it) < 10) { @@ -12649,9 +12705,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e it++) { lineObs.clear(); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } if (static_cast(*it) < 10) { @@ -12714,9 +12771,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e it++) { lineObs.clear(); - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys_gal = satelliteSystem.find("Galileo"); + if (satsys_gal != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("Galileo")->second; + line += satsys_gal->second; } if (static_cast(*it) < 10) { @@ -12988,9 +13046,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep it++) { lineObs.clear(); - if (satelliteSystem.find("GPS") != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("GPS")->second; + line += satsys_gps->second; } if (static_cast(*it) < 10) { @@ -13006,7 +13065,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep { have_l2 = true; } - if (triple_band and sig_ == "L5" and have_l2 == false) + if (triple_band && sig_ == "L5" && have_l2 == false) { lineObs += std::string(62, ' '); } @@ -13064,9 +13123,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep it++) { lineObs.clear(); - if (satelliteSystem.find("Galileo") != satelliteSystem.cend()) + const auto satsys_gal = satelliteSystem.find("Galileo"); + if (satsys_gal != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("Galileo")->second; + line += satsys_gal->second; } if (static_cast(*it) < 10) { @@ -13252,9 +13312,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris it++) { lineObs.clear(); - if (satelliteSystem.find("Beidou") != satelliteSystem.cend()) + const auto satsys_bds = satelliteSystem.find("Beidou"); + if (satsys_bds != satelliteSystem.cend()) { - lineObs += satelliteSystem.find("Beidou")->second; + line += satsys_bds->second; } if (static_cast(*it) < 10) { From b7378e4fd8714f440d375d4215f5c519270dcdc5 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 7 Nov 2023 11:58:42 +0100 Subject: [PATCH 10/16] Add guard to avoid division by zero --- .../gnuradio_blocks/galileo_telemetry_decoder_gs.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc index 37beb5d43..227bf8e05 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc @@ -1030,7 +1030,10 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( decode_FNAV_word(d_page_part_symbols.data(), d_frame_length_symbols, current_symbol.CN0_dB_hz); break; case 3: // CNAV - decode_CNAV_word(current_symbol.Tracking_sample_counter / static_cast(current_symbol.fs), d_page_part_symbols.data(), d_frame_length_symbols, current_symbol.CN0_dB_hz); + if (current_symbol.fs != 0LL) + { + decode_CNAV_word(current_symbol.Tracking_sample_counter / static_cast(current_symbol.fs), d_page_part_symbols.data(), d_frame_length_symbols, current_symbol.CN0_dB_hz); + } break; default: return -1; From 79b6312e3c1db57f2c44fca1bf640bf09084c5df Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 7 Nov 2023 13:19:57 +0100 Subject: [PATCH 11/16] Fix API usage error reported by Coverity Scan --- src/core/libs/gnss_sdr_supl_client.cc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index 73905ee25..51aabe4f7 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -248,17 +248,20 @@ void Gnss_Sdr_Supl_Client::read_supl_data() gps_almanac_map.insert(std::pair(a->prn, gps_almanac_entry)); gps_almanac_iterator = this->gps_almanac_map.find(a->prn); } - gps_almanac_iterator->second.PRN = a->prn; - gps_almanac_iterator->second.af0 = static_cast(a->AF0) * pow(2.0, -20); - gps_almanac_iterator->second.af1 = static_cast(a->AF1) * pow(2.0, -38); - gps_almanac_iterator->second.delta_i = static_cast(a->Ksii) * pow(2.0, -19); - gps_almanac_iterator->second.omega = static_cast(a->w) * pow(2.0, -23); - gps_almanac_iterator->second.OMEGA_0 = static_cast(a->OMEGA_0) * pow(2.0, -23); - gps_almanac_iterator->second.sqrtA = static_cast(a->A_sqrt) * pow(2.0, -11); - gps_almanac_iterator->second.OMEGAdot = static_cast(a->OMEGA_dot) * pow(2.0, -38); - gps_almanac_iterator->second.toa = static_cast(a->toa * pow(2.0, 12)); - gps_almanac_iterator->second.ecc = static_cast(a->e) * pow(2.0, -21); - gps_almanac_iterator->second.M_0 = static_cast(a->M0) * pow(2.0, -23); + if (gps_almanac_iterator != gps_almanac_map.end()) + { + gps_almanac_iterator->second.PRN = a->prn; + gps_almanac_iterator->second.af0 = static_cast(a->AF0) * pow(2.0, -20); + gps_almanac_iterator->second.af1 = static_cast(a->AF1) * pow(2.0, -38); + gps_almanac_iterator->second.delta_i = static_cast(a->Ksii) * pow(2.0, -19); + gps_almanac_iterator->second.omega = static_cast(a->w) * pow(2.0, -23); + gps_almanac_iterator->second.OMEGA_0 = static_cast(a->OMEGA_0) * pow(2.0, -23); + gps_almanac_iterator->second.sqrtA = static_cast(a->A_sqrt) * pow(2.0, -11); + gps_almanac_iterator->second.OMEGAdot = static_cast(a->OMEGA_dot) * pow(2.0, -38); + gps_almanac_iterator->second.toa = static_cast(a->toa * pow(2.0, 12)); + gps_almanac_iterator->second.ecc = static_cast(a->e) * pow(2.0, -21); + gps_almanac_iterator->second.M_0 = static_cast(a->M0) * pow(2.0, -23); + } } } From bf84a659a8019a80c6911351aa339d1e5cf50a3c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 7 Nov 2023 13:21:51 +0100 Subject: [PATCH 12/16] Rinex_Printer: fixes after last change, some improvements --- src/algorithms/PVT/libs/rinex_printer.cc | 106 +++++++++++------------ 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index f140270d4..9b0c2f814 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -5446,6 +5446,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map& eph_map) const { std::string line; + const auto satsys_gal = satelliteSystem.find("Galileo"); std::map::const_iterator galileo_ephemeris_iter; line.clear(); for (galileo_ephemeris_iter = eph_map.cbegin(); @@ -5461,7 +5462,6 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond; @@ -10359,16 +10359,16 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeri Rinex_Printer::lengthCheck(line); out << line << '\n'; + const auto satsys = satelliteSystem.find("GLONASS"); for (observables_iter = observables.cbegin(); observables_iter != observables.cend(); observables_iter++) { std::string lineObs; lineObs.clear(); - const auto satsys = satelliteSystem.find("GLONASS"); if (satsys != satelliteSystem.cend()) { - line += satsys->second; + lineObs += satsys->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -10582,14 +10582,14 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep if (d_version == 2) { // Add list of GPS satellites + const auto satsys_gps = satelliteSystem.find("GPS"); for (observables_iter = observablesG1C.cbegin(); observables_iter != observablesG1C.cend(); observables_iter++) { - const auto satsys = satelliteSystem.find("GPS"); - if (satsys != satelliteSystem.cend()) + if (satsys_gps != satelliteSystem.cend()) { - line += satsys->second; + line += satsys_gps->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -10598,14 +10598,14 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep line += std::to_string(static_cast(observables_iter->second.PRN)); } // Add list of GLONASS L1 satellites + const auto satsys_glo = satelliteSystem.find("GLONASS"); for (observables_iter = observablesR1C.cbegin(); observables_iter != observablesR1C.cend(); observables_iter++) { - const auto satsys = satelliteSystem.find("GLONASS"); - if (satsys != satelliteSystem.cend()) + if (satsys_glo != satelliteSystem.cend()) { - line += satsys->second; + line += satsys_glo->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -10618,10 +10618,9 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep observables_iter != observablesR2C.cend(); observables_iter++) { - const auto satsys = satelliteSystem.find("GLONASS"); - if (satsys != satelliteSystem.cend()) + if (satsys_glo != satelliteSystem.cend()) { - line += satsys->second; + line += satsys_glo->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -10649,18 +10648,18 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep // Specify system only if in version 3 if (s == "G") { - const auto satsys = satelliteSystem.find("GPS"); - if (satsys != satelliteSystem.cend()) + const auto satsys_gps = satelliteSystem.find("GPS"); + if (satsys_gps != satelliteSystem.cend()) { - line += satsys->second; + lineObs += satsys_gps->second; } } if (s == "R") { - const auto satsys = satelliteSystem.find("GLONASS"); - if (satsys != satelliteSystem.cend()) + const auto satsys_glo = satelliteSystem.find("GLONASS"); + if (satsys_glo != satelliteSystem.cend()) { - line += satsys->second; + lineObs += satsys_glo->second; } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) @@ -10733,7 +10732,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep const auto satsys = satelliteSystem.find("GLONASS"); if (satsys != satelliteSystem.cend()) { - line += satsys->second; + lineObs += satsys->second; } if (static_cast(*it) < 10) { @@ -10912,6 +10911,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g // -------- OBSERVATION record std::string s; std::string lineObs; + const auto satsys_gps = satelliteSystem.find("GPS"); + const auto satsys = satelliteSystem.find("GLONASS"); for (observables_iter = observablesG2S.cbegin(); observables_iter != observablesG2S.cend(); observables_iter++) @@ -10922,18 +10923,16 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g // Specify system only if in version 3 if (s == "G") { - const auto satsys_gps = satelliteSystem.find("GPS"); if (satsys_gps != satelliteSystem.cend()) { - line += satsys_gps->second; + lineObs += satsys_gps->second; } } if (s == "R") { - const auto satsys = satelliteSystem.find("GLONASS"); if (satsys != satelliteSystem.cend()) { - line += satsys->second; + lineObs += satsys->second; } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) @@ -11000,10 +10999,9 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g it++) { lineObs.clear(); - const auto satsys = satelliteSystem.find("GLONASS"); if (satsys != satelliteSystem.cend()) { - line += satsys->second; + lineObs += satsys->second; } if (static_cast(*it) < 10) { @@ -11183,6 +11181,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga std::string s; std::string lineObs; + const auto satsys_gal = satelliteSystem.find("Galileo"); + const auto satsys = satelliteSystem.find("GLONASS"); for (observables_iter = observablesE1B.cbegin(); observables_iter != observablesE1B.cend(); observables_iter++) @@ -11192,18 +11192,16 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga s.assign(1, observables_iter->second.System); if (s == "E") { - const auto satsys_gal = satelliteSystem.find("Galileo"); if (satsys_gal != satelliteSystem.cend()) { - line += satsys_gal->second; + lineObs += satsys_gal->second; } } if (s == "R") { - const auto satsys = satelliteSystem.find("GLONASS"); if (satsys != satelliteSystem.cend()) { - line += satsys->second; + lineObs += satsys->second; } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) @@ -11271,7 +11269,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga const auto satsys_gal = satelliteSystem.find("Galileo"); if (satsys_gal != satelliteSystem.cend()) { - line += satsys_gal->second; + lineObs += satsys_gal->second; } if (static_cast(*it) < 10) { @@ -11524,16 +11522,16 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, d Rinex_Printer::lengthCheck(line); out << line << '\n'; + const auto satsys_gps = satelliteSystem.find("GPS"); for (observables_iter = observables.cbegin(); observables_iter != observables.cend(); observables_iter++) { std::string lineObs; lineObs.clear(); - const auto satsys_gps = satelliteSystem.find("GPS"); if (satsys_gps != satelliteSystem.cend()) { - line += satsys_gps->second; + lineObs += satsys_gps->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -11655,16 +11653,16 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e Rinex_Printer::lengthCheck(line); out << line << '\n'; + const auto satsys_gps = satelliteSystem.find("GPS"); for (observables_iter = observables.cbegin(); observables_iter != observables.cend(); observables_iter++) { std::string lineObs; lineObs.clear(); - const auto satsys_gps = satelliteSystem.find("GPS"); if (satsys_gps != satelliteSystem.cend()) { - line += satsys_gps->second; + lineObs += satsys_gps->second; } if (static_cast(observables_iter->second.PRN) < 10) { @@ -11883,16 +11881,16 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c out << line << '\n'; std::string lineObs; + const auto satsys_gps = satelliteSystem.find("GPS"); std::pair::iterator, std::multimap::iterator> ret; for (it = available_prns.cbegin(); it != available_prns.cend(); it++) { lineObs.clear(); - const auto satsys_gps = satelliteSystem.find("GPS"); if (satsys_gps != satelliteSystem.cend()) { - line += satsys_gps->second; + lineObs += satsys_gps->second; } if (static_cast(*it) < 10) { @@ -12141,15 +12139,15 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep std::string lineObs; std::pair::iterator, std::multimap::iterator> ret; + const auto satsys_gal = satelliteSystem.find("Galileo"); for (it = available_prns.cbegin(); it != available_prns.cend(); it++) { lineObs.clear(); - const auto satsys_gal = satelliteSystem.find("Galileo"); if (satsys_gal != satelliteSystem.cend()) { - line += satsys_gal->second; + lineObs += satsys_gal->second; } if (static_cast(*it) < 10) { @@ -12363,6 +12361,9 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep std::string s; std::string lineObs; + const auto satsys_gps = satelliteSystem.find("GPS"); + const auto satsys_gal = satelliteSystem.find("Galileo"); + for (observables_iter = observablesG1C.cbegin(); observables_iter != observablesG1C.cend(); observables_iter++) @@ -12372,18 +12373,16 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep s.assign(1, observables_iter->second.System); if (s == "G") { - const auto satsys_gps = satelliteSystem.find("GPS"); if (satsys_gps != satelliteSystem.cend()) { - line += satsys_gps->second; + lineObs += satsys_gps->second; } } if (s == "E") { - const auto satsys_gal = satelliteSystem.find("Galileo"); if (satsys_gal != satelliteSystem.cend()) { - line += satsys_gal->second; + lineObs += satsys_gal->second; } // should not happen } if (static_cast(observables_iter->second.PRN) < 10) @@ -12448,10 +12447,9 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep it++) { lineObs.clear(); - const auto satsys_gal = satelliteSystem.find("Galileo"); if (satsys_gal != satelliteSystem.cend()) { - line += satsys_gal->second; + lineObs += satsys_gal->second; } if (static_cast(*it) < 10) { @@ -12699,16 +12697,16 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e std::string s; std::string lineObs; + const auto satsys_gps = satelliteSystem.find("GPS"); std::pair::iterator, std::multimap::iterator> ret; for (it = available_gps_prns.cbegin(); it != available_gps_prns.cend(); it++) { lineObs.clear(); - const auto satsys_gps = satelliteSystem.find("GPS"); if (satsys_gps != satelliteSystem.cend()) { - line += satsys_gps->second; + lineObs += satsys_gps->second; } if (static_cast(*it) < 10) { @@ -12766,15 +12764,15 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e out << lineObs << '\n'; } + const auto satsys_gal = satelliteSystem.find("Galileo"); for (it = available_gal_prns.cbegin(); it != available_gal_prns.cend(); it++) { lineObs.clear(); - const auto satsys_gal = satelliteSystem.find("Galileo"); if (satsys_gal != satelliteSystem.cend()) { - line += satsys_gal->second; + lineObs += satsys_gal->second; } if (static_cast(*it) < 10) { @@ -13040,16 +13038,16 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep std::string s; std::string lineObs; + const auto satsys_gps = satelliteSystem.find("GPS"); std::pair::iterator, std::multimap::iterator> ret; for (it = available_gps_prns.cbegin(); it != available_gps_prns.cend(); it++) { lineObs.clear(); - const auto satsys_gps = satelliteSystem.find("GPS"); if (satsys_gps != satelliteSystem.cend()) { - line += satsys_gps->second; + lineObs += satsys_gps->second; } if (static_cast(*it) < 10) { @@ -13118,15 +13116,15 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep out << lineObs << '\n'; } + const auto satsys_gal = satelliteSystem.find("Galileo"); for (it = available_gal_prns.cbegin(); it != available_gal_prns.cend(); it++) { lineObs.clear(); - const auto satsys_gal = satelliteSystem.find("Galileo"); if (satsys_gal != satelliteSystem.cend()) { - line += satsys_gal->second; + lineObs += satsys_gal->second; } if (static_cast(*it) < 10) { @@ -13306,16 +13304,16 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris out << line << '\n'; std::string lineObs; + const auto satsys_bds = satelliteSystem.find("Beidou"); std::pair::iterator, std::multimap::iterator> ret; for (it = available_prns.cbegin(); it != available_prns.cend(); it++) { lineObs.clear(); - const auto satsys_bds = satelliteSystem.find("Beidou"); if (satsys_bds != satelliteSystem.cend()) { - line += satsys_bds->second; + lineObs += satsys_bds->second; } if (static_cast(*it) < 10) { From 3ddfdb9167e44e81347271a6258cf0b2767bae2c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 7 Nov 2023 13:41:54 +0100 Subject: [PATCH 13/16] CI: set python-version in volk-gnsssdr-windows job --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ac057c239..bc1fb280f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -193,6 +193,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 + with: + python-version: '3.12' - name: Install dependencies run: | python -m pip install --upgrade pip From fe3d704c9d23ac158b6f27cacf9c8c737980d340 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 8 Nov 2023 11:57:15 +0100 Subject: [PATCH 14/16] Fix defects detected by Coverity Scan --- src/algorithms/PVT/libs/rinex_printer.cc | 2 +- src/core/libs/gnss_sdr_supl_client.cc | 110 ++++++++++++----------- 2 files changed, 59 insertions(+), 53 deletions(-) diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 9b0c2f814..6efd2de45 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -1269,7 +1269,7 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons { log_rinex_obs(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, rx_time, gnss_observables_map, true); } - if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) { update_obs_header(obsFile, pvt_solver->gps_utc_model); update_nav_header(navFile, pvt_solver->gps_utc_model, pvt_solver->gps_iono, gps_ephemeris_iter->second); diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index 51aabe4f7..6e4ec6d1d 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -281,48 +281,51 @@ void Gnss_Sdr_Supl_Client::read_supl_data() gps_ephemeris_map.insert(std::pair(e->prn, gps_eph)); gps_eph_iterator = this->gps_ephemeris_map.find(e->prn); } - if (gps_time.valid) + if (gps_eph_iterator != gps_ephemeris_map.end()) { - gps_eph_iterator->second.WN = assist.time.gps_week; - /* TS 44.031: GPSTOW, range 0-604799.92, resolution 0.08 sec, 23-bit presentation */ - gps_eph_iterator->second.tow = static_cast(assist.time.gps_tow) * 0.08; + if (gps_time.valid) + { + gps_eph_iterator->second.WN = assist.time.gps_week; + /* TS 44.031: GPSTOW, range 0-604799.92, resolution 0.08 sec, 23-bit presentation */ + gps_eph_iterator->second.tow = static_cast(assist.time.gps_tow) * 0.08; + } + else + { + gps_eph_iterator->second.WN = 0; + gps_eph_iterator->second.tow = 0; + } + gps_eph_iterator->second.PRN = e->prn; + // SV navigation model + gps_eph_iterator->second.code_on_L2 = e->bits; + gps_eph_iterator->second.SV_accuracy = e->ura; // User Range Accuracy (URA) + gps_eph_iterator->second.SV_health = e->health; + gps_eph_iterator->second.IODC = static_cast(e->IODC); + // miss P flag (1 bit) + // miss SF1 Reserved (87 bits) + gps_eph_iterator->second.TGD = static_cast(e->tgd) * T_GD_LSB; + gps_eph_iterator->second.toc = static_cast(e->toc) * T_OC_LSB; + gps_eph_iterator->second.af0 = static_cast(e->AF0) * A_F0_LSB; + gps_eph_iterator->second.af1 = static_cast(e->AF1) * A_F1_LSB; + gps_eph_iterator->second.af2 = static_cast(e->AF2) * A_F2_LSB; + gps_eph_iterator->second.Crc = static_cast(e->Crc) * C_RC_LSB; + gps_eph_iterator->second.delta_n = static_cast(e->delta_n) * DELTA_N_LSB; + gps_eph_iterator->second.M_0 = static_cast(e->M0) * M_0_LSB; + gps_eph_iterator->second.Cuc = static_cast(e->Cuc) * C_UC_LSB; + gps_eph_iterator->second.ecc = static_cast(e->e) * ECCENTRICITY_LSB; + gps_eph_iterator->second.Cus = static_cast(e->Cus) * C_US_LSB; + gps_eph_iterator->second.sqrtA = static_cast(e->A_sqrt) * SQRT_A_LSB; + gps_eph_iterator->second.toe = static_cast(e->toe) * T_OE_LSB; + // miss fit interval flag (1 bit) + gps_eph_iterator->second.AODO = e->AODA * AODO_LSB; + gps_eph_iterator->second.Cic = static_cast(e->Cic) * C_IC_LSB; + gps_eph_iterator->second.OMEGA_0 = static_cast(e->OMEGA_0) * OMEGA_0_LSB; + gps_eph_iterator->second.Cis = static_cast(e->Cis) * C_IS_LSB; + gps_eph_iterator->second.i_0 = static_cast(e->i0) * I_0_LSB; + gps_eph_iterator->second.Crs = static_cast(e->Crs) * C_RS_LSB; + gps_eph_iterator->second.omega = static_cast(e->w) * OMEGA_LSB; + gps_eph_iterator->second.OMEGAdot = static_cast(e->OMEGA_dot) * OMEGA_DOT_LSB; + gps_eph_iterator->second.idot = static_cast(e->i_dot) * I_DOT_LSB; } - else - { - gps_eph_iterator->second.WN = 0; - gps_eph_iterator->second.tow = 0; - } - gps_eph_iterator->second.PRN = e->prn; - // SV navigation model - gps_eph_iterator->second.code_on_L2 = e->bits; - gps_eph_iterator->second.SV_accuracy = e->ura; // User Range Accuracy (URA) - gps_eph_iterator->second.SV_health = e->health; - gps_eph_iterator->second.IODC = static_cast(e->IODC); - // miss P flag (1 bit) - // miss SF1 Reserved (87 bits) - gps_eph_iterator->second.TGD = static_cast(e->tgd) * T_GD_LSB; - gps_eph_iterator->second.toc = static_cast(e->toc) * T_OC_LSB; - gps_eph_iterator->second.af0 = static_cast(e->AF0) * A_F0_LSB; - gps_eph_iterator->second.af1 = static_cast(e->AF1) * A_F1_LSB; - gps_eph_iterator->second.af2 = static_cast(e->AF2) * A_F2_LSB; - gps_eph_iterator->second.Crc = static_cast(e->Crc) * C_RC_LSB; - gps_eph_iterator->second.delta_n = static_cast(e->delta_n) * DELTA_N_LSB; - gps_eph_iterator->second.M_0 = static_cast(e->M0) * M_0_LSB; - gps_eph_iterator->second.Cuc = static_cast(e->Cuc) * C_UC_LSB; - gps_eph_iterator->second.ecc = static_cast(e->e) * ECCENTRICITY_LSB; - gps_eph_iterator->second.Cus = static_cast(e->Cus) * C_US_LSB; - gps_eph_iterator->second.sqrtA = static_cast(e->A_sqrt) * SQRT_A_LSB; - gps_eph_iterator->second.toe = static_cast(e->toe) * T_OE_LSB; - // miss fit interval flag (1 bit) - gps_eph_iterator->second.AODO = e->AODA * AODO_LSB; - gps_eph_iterator->second.Cic = static_cast(e->Cic) * C_IC_LSB; - gps_eph_iterator->second.OMEGA_0 = static_cast(e->OMEGA_0) * OMEGA_0_LSB; - gps_eph_iterator->second.Cis = static_cast(e->Cis) * C_IS_LSB; - gps_eph_iterator->second.i_0 = static_cast(e->i0) * I_0_LSB; - gps_eph_iterator->second.Crs = static_cast(e->Crs) * C_RS_LSB; - gps_eph_iterator->second.omega = static_cast(e->w) * OMEGA_LSB; - gps_eph_iterator->second.OMEGAdot = static_cast(e->OMEGA_dot) * OMEGA_DOT_LSB; - gps_eph_iterator->second.idot = static_cast(e->i_dot) * I_DOT_LSB; } } @@ -343,18 +346,21 @@ void Gnss_Sdr_Supl_Client::read_supl_data() gps_acq_map.insert(std::pair(e->prn, gps_acq_assist)); gps_acq_iterator = this->gps_acq_map.find(e->prn); } - // fill the acquisition assistance structure - gps_acq_iterator->second.PRN = e->prn; - gps_acq_iterator->second.tow = static_cast(assist.acq_time); - gps_acq_iterator->second.Doppler0 = static_cast(e->doppler0); - gps_acq_iterator->second.Doppler1 = static_cast(e->doppler1); - gps_acq_iterator->second.dopplerUncertainty = static_cast(e->d_win); - gps_acq_iterator->second.Code_Phase = static_cast(e->code_ph); - gps_acq_iterator->second.Code_Phase_int = static_cast(e->code_ph_int); - gps_acq_iterator->second.Code_Phase_window = static_cast(e->code_ph_win); - gps_acq_iterator->second.Azimuth = static_cast(e->az); - gps_acq_iterator->second.Elevation = static_cast(e->el); - gps_acq_iterator->second.GPS_Bit_Number = static_cast(e->bit_num); + if (gps_acq_iterator != gps_acq_map.end()) + { + // fill the acquisition assistance structure + gps_acq_iterator->second.PRN = e->prn; + gps_acq_iterator->second.tow = static_cast(assist.acq_time); + gps_acq_iterator->second.Doppler0 = static_cast(e->doppler0); + gps_acq_iterator->second.Doppler1 = static_cast(e->doppler1); + gps_acq_iterator->second.dopplerUncertainty = static_cast(e->d_win); + gps_acq_iterator->second.Code_Phase = static_cast(e->code_ph); + gps_acq_iterator->second.Code_Phase_int = static_cast(e->code_ph_int); + gps_acq_iterator->second.Code_Phase_window = static_cast(e->code_ph_win); + gps_acq_iterator->second.Azimuth = static_cast(e->az); + gps_acq_iterator->second.Elevation = static_cast(e->el); + gps_acq_iterator->second.GPS_Bit_Number = static_cast(e->bit_num); + } } } } From f0c6a7184a3183ee436eec4396aec0ca78c706d4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 8 Nov 2023 16:33:26 +0100 Subject: [PATCH 15/16] Generate RINEX and HAS outputs for GPS L1 C/A + Galileo E1B + GPS L5 + Galileo E5a + Galileo E6B receiver --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 4 ++ .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 2 +- src/algorithms/PVT/libs/rinex_printer.cc | 58 ++++++++++++++++++- src/algorithms/PVT/libs/rinex_printer.h | 1 + src/algorithms/PVT/libs/rtklib_solver.cc | 4 ++ 5 files changed, 67 insertions(+), 2 deletions(-) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index 9bf6174ab..e03dcad5c 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -412,6 +412,10 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, { pvt_output_parameters.type_of_receiver = 107; // GPS L1 C/A + Galileo E6B } + if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count != 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (gal_E6_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) + { + pvt_output_parameters.type_of_receiver = 108; // GPS L1 C/A + Galileo E1B + GPS L5 + Galileo E5a + Galileo E6B + } // BeiDou B1I Receiver if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (gal_E6_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0)) { diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index fc79642ea..8e24687ba 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -434,7 +434,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, } // Initialize HAS simple printer - d_enable_has_messages = (((d_type_of_rx >= 100) && (d_type_of_rx < 107)) && (conf_.output_enabled)); + d_enable_has_messages = (((d_type_of_rx >= 100) && (d_type_of_rx < 109)) && (conf_.output_enabled)); if (d_enable_has_messages) { d_has_simple_printer = std::make_unique(); diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 6efd2de45..7b17a4295 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -724,6 +724,20 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons d_rinex_header_written = true; // do not write header anymore } break; + case 108: // GPS L1 C/A + Galileo E1B + GPS L5 + Galileo E5a + Galileo E6B + if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) and + (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) and + (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) + { + const std::string gal_signal("1B 5X E6"); + const std::string gps_signal("1C L5"); + rinex_obs_header(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gps_signal, gal_signal); + rinex_nav_header(navMixFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); + output_navfilename.push_back(navMixfilename); + log_rinex_nav(navMixFile, pvt_solver->gps_ephemeris_map, pvt_solver->galileo_ephemeris_map); + d_rinex_header_written = true; // do not write header anymore + } + break; case 500: // BDS B1I only if (beidou_dnav_ephemeris_iter != pvt_solver->beidou_dnav_ephemeris_map.cend()) { @@ -1237,7 +1251,33 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } } } - + break; + case 108: // GPS L1 C/A + Galileo E1B + GPS L5 + Galileo E5a + Galileo E6B + if (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) + { + if (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) + { + // we have Galileo ephemeris, maybe from assistance + log_rinex_obs(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gnss_observables_map); + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) + { + update_obs_header(obsFile, pvt_solver->gps_utc_model); + update_nav_header(navMixFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); + d_rinex_header_updated = true; + } + } + else + { + // we do not have galileo ephemeris, print only GPS data + log_rinex_obs(obsFile, gps_ephemeris_iter->second, rx_time, gnss_observables_map); + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) + { + update_obs_header(obsFile, pvt_solver->gps_utc_model); + update_nav_header(navFile, pvt_solver->gps_utc_model, pvt_solver->gps_iono, gps_ephemeris_iter->second); + d_rinex_header_updated = true; + } + } + } break; case 500: // BDS B1I only if (beidou_dnav_ephemeris_iter != pvt_solver->beidou_dnav_ephemeris_map.cend()) @@ -1374,6 +1414,16 @@ void Rinex_Printer::log_rinex_nav_gps_nav(int type_of_rx, const std::map> (); // d_has_obs_corr_map["L1 C/A"] = empty_map; From fcfc851aa562bdeaad5ab035dbe48efe124acd9e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 9 Nov 2023 08:53:29 +0100 Subject: [PATCH 16/16] Write HAS data file at PVT.output_path --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 1 + .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 2 +- src/algorithms/PVT/libs/pvt_conf.h | 1 + src/algorithms/PVT/libs/rinex_printer.cc | 33 ++++++------------- 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index e03dcad5c..0e47e01f9 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -861,6 +861,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, pvt_output_parameters.xml_output_path = configuration->property(role + ".xml_output_path", default_output_path); pvt_output_parameters.nmea_output_file_path = configuration->property(role + ".nmea_output_file_path", default_output_path); pvt_output_parameters.rtcm_output_file_path = configuration->property(role + ".rtcm_output_file_path", default_output_path); + pvt_output_parameters.has_output_file_path = configuration->property(role + ".has_output_file_path", default_output_path); // Read PVT MONITOR Configuration pvt_output_parameters.monitor_enabled = configuration->property(role + ".enable_monitor", false); diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 8e24687ba..ca63c6f31 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -437,7 +437,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, d_enable_has_messages = (((d_type_of_rx >= 100) && (d_type_of_rx < 109)) && (conf_.output_enabled)); if (d_enable_has_messages) { - d_has_simple_printer = std::make_unique(); + d_has_simple_printer = std::make_unique(conf_.has_output_file_path); } else { diff --git a/src/algorithms/PVT/libs/pvt_conf.h b/src/algorithms/PVT/libs/pvt_conf.h index 517465350..80f4494d5 100644 --- a/src/algorithms/PVT/libs/pvt_conf.h +++ b/src/algorithms/PVT/libs/pvt_conf.h @@ -46,6 +46,7 @@ public: std::string kml_output_path = std::string("."); std::string xml_output_path = std::string("."); std::string rtcm_output_file_path = std::string("."); + std::string has_output_file_path = std::string("."); std::string udp_addresses; std::string udp_eph_addresses; std::string log_source_timetag_file; diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 7b17a4295..516403dbb 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -1253,30 +1253,17 @@ void Rinex_Printer::print_rinex_annotation(const Rtklib_Solver* pvt_solver, cons } break; case 108: // GPS L1 C/A + Galileo E1B + GPS L5 + Galileo E5a + Galileo E6B - if (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) + if ((galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) and + (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend()) and + (gps_cnav_ephemeris_iter != pvt_solver->gps_cnav_ephemeris_map.cend())) { - if (galileo_ephemeris_iter != pvt_solver->galileo_ephemeris_map.cend()) - { - // we have Galileo ephemeris, maybe from assistance - log_rinex_obs(obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) - { - update_obs_header(obsFile, pvt_solver->gps_utc_model); - update_nav_header(navMixFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); - d_rinex_header_updated = true; - } - } - else - { - // we do not have galileo ephemeris, print only GPS data - log_rinex_obs(obsFile, gps_ephemeris_iter->second, rx_time, gnss_observables_map); - if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0)) - { - update_obs_header(obsFile, pvt_solver->gps_utc_model); - update_nav_header(navFile, pvt_solver->gps_utc_model, pvt_solver->gps_iono, gps_ephemeris_iter->second); - d_rinex_header_updated = true; - } - } + log_rinex_obs(obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, galileo_ephemeris_iter->second, rx_time, gnss_observables_map, true); + } + if (!d_rinex_header_updated && (pvt_solver->gps_utc_model.A0 != 0) && (pvt_solver->galileo_utc_model.A0 != 0) && (gps_ephemeris_iter != pvt_solver->gps_ephemeris_map.cend())) + { + update_obs_header(obsFile, pvt_solver->gps_utc_model); + update_nav_header(navMixFile, pvt_solver->gps_iono, pvt_solver->gps_utc_model, gps_ephemeris_iter->second, pvt_solver->galileo_iono, pvt_solver->galileo_utc_model); + d_rinex_header_updated = true; } break; case 500: // BDS B1I only