From 657a7298f352276a147956f7a2a3c4f8eff5d997 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 25 May 2022 14:43:01 +0200 Subject: [PATCH] Compute PVT with E6 only and xml assistance --- .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 11 +++++ src/algorithms/PVT/libs/rtklib_solver.cc | 48 +++++++++++++++++++ .../libs/rtklib/rtklib_conversions.cc | 4 ++ src/core/libs/gnss_sdr_supl_client.cc | 7 +++ 4 files changed, 70 insertions(+) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 83299a356..77468dcfe 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -651,6 +651,13 @@ rtklib_pvt_gs::~rtklib_pvt_gs() { ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out); boost::archive::xml_oarchive xml(ofs); + // Annotate as GPS week number + for (auto gal_eph_iter = d_internal_pvt_solver->galileo_ephemeris_map.begin(); + gal_eph_iter != d_internal_pvt_solver->galileo_ephemeris_map.end(); + ++gal_eph_iter) + { + gal_eph_iter->second.WN += 1024; + } xml << boost::serialization::make_nvp("GNSS-SDR_gal_ephemeris_map", d_internal_pvt_solver->galileo_ephemeris_map); LOG(INFO) << "Saved Galileo E1 Ephemeris map data"; } @@ -2049,6 +2056,10 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item store_valid_observable = true; } } + if (std::string(in[i][epoch].Signal) == std::string("E6")) + { + store_valid_observable = true; + } if (store_valid_observable) { diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index bfa3bd52b..1c9c0b3ea 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -407,6 +407,7 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ bool band1 = false; bool band2 = false; bool gal_e5_is_e5b = false; + bool gal_e6 = false; for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); ++gnss_observables_iter) @@ -514,6 +515,48 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ gal_e5_is_e5b = true; } } + if (sig_ == "E6") + { + gal_e6 = true; + galileo_ephemeris_iter = galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (galileo_ephemeris_iter != galileo_ephemeris_map.cend()) + { + bool found_E1_obs = false; + for (int i = 0; i < valid_obs; i++) + { + if (eph_data[i].sat == (static_cast(gnss_observables_iter->second.PRN + NSATGPS + NSATGLO))) + { + d_obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(d_obs_data[i + glo_valid_obs], + gnss_observables_iter->second, + galileo_ephemeris_iter->second.WN, + 0); // Band 1 (E6) + found_E1_obs = true; + break; + } + } + if (!found_E1_obs) + { + // insert Galileo E6 obs as new obs and also insert its ephemeris + // convert ephemeris from GNSS-SDR class to RTKLIB structure + eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second); + // convert observation from GNSS-SDR class to RTKLIB structure + const auto default_code_ = static_cast(CODE_NONE); + obsd_t newobs = {{0, 0}, '0', '0', {}, {}, + {default_code_, default_code_, default_code_}, + {}, {0.0, 0.0, 0.0}, {}}; + d_obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, + gnss_observables_iter->second, + galileo_ephemeris_iter->second.WN, + 0); // Band 1 (E6) + // std::cout << "Week " << galileo_ephemeris_iter->second.WN << '\n'; + valid_obs++; + } + } + else // the ephemeris are not available for this SV + { + DLOG(INFO) << "No ephemeris data for SV " << gnss_observables_iter->second.PRN; + } + } break; } case 'G': @@ -879,6 +922,11 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ { for (int j = 0; j < NFREQ; j++) { + if (j == 0 && gal_e6) + { + // frq = 3 corresponds to E6 in that function + nav_data.lam[i][j] = satwavelen(i + 1, 3, &nav_data); + } if (j == 2 && gal_e5_is_e5b) { // frq = 4 corresponds to E5B in that function diff --git a/src/algorithms/libs/rtklib/rtklib_conversions.cc b/src/algorithms/libs/rtklib/rtklib_conversions.cc index 45eacabcb..b7e50519c 100644 --- a/src/algorithms/libs/rtklib/rtklib_conversions.cc +++ b/src/algorithms/libs/rtklib/rtklib_conversions.cc @@ -75,6 +75,10 @@ obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro { rtklib_obs.code[band] = static_cast(CODE_L7X); } + if (sig_ == "E6") + { + rtklib_obs.code[band] = static_cast(CODE_L6B); + } break; case 'R': rtklib_obs.sat = gnss_synchro.PRN + NSATGPS; diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index e079b0a9f..33a6969f0 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -414,6 +414,13 @@ bool Gnss_Sdr_Supl_Client::load_gal_ephemeris_xml(const std::string& file_name) gal_ephemeris_map.clear(); xml >> boost::serialization::make_nvp("GNSS-SDR_gal_ephemeris_map", this->gal_ephemeris_map); LOG(INFO) << "Loaded Ephemeris map data with " << this->gal_ephemeris_map.size() << " satellites"; + // Convert to GPS week number + for (auto gal_eph_iter = this->gal_ephemeris_map.begin(); + gal_eph_iter != this->gal_ephemeris_map.end(); + ++gal_eph_iter) + { + gal_eph_iter->second.WN -= 1024; + } } catch (std::exception& e) {