diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 26e101e85..d3ca165ac 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -505,7 +505,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Glonass_Gnav_Utc_M line += Rinex_Printer::rightJustify(month, 6); line += Rinex_Printer::rightJustify(day, 6); line += std::string(3, ' '); - line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(glonass_gnav_utc_model.d_tau_c, 16, 2), 19); + line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(glonass_gnav_utc_model.d_tau_c, 19, 2), 19); line += std::string(20, ' '); line += Rinex_Printer::leftJustify("CORR TO SYSTEM TIME", 20); Rinex_Printer::lengthCheck(line); @@ -767,7 +767,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps void Rinex_Printer::rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac) { if(glonass_gnav_almanac.i_satellite_freq_channel){} //Avoid compiler warning - //Avoid compiler warning, there is not time system correction between Galileo and GLONASS + //Avoid compiler warning, there is not time system correction between Galileo and GLONASS if(galileo_almanac.A_0G_10){} std::string line; @@ -2991,8 +2991,8 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map(galileo_ephemeris_iter->second.E5b_DVS_5) - + "11" + "1" + E1B_DVS + E1B_HS - + boost::lexical_cast(galileo_ephemeris_iter->second.E1B_DVS_5); + + "11" + "1" + E1B_DVS + E1B_HS + + boost::lexical_cast(galileo_ephemeris_iter->second.E1B_DVS_5); SVhealth_str = "000000000"; // *************** CHANGE THIS WHEN GALILEO SIGNAL IS VALID int SVhealth = Rinex_Printer::toInt(SVhealth_str, 9); line += Rinex_Printer::doub2for(static_cast(SVhealth), 18, 2); @@ -3319,12 +3319,24 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem out << line << std::endl; // -------- Line MARKER TYPE - line.clear(); - line += Rinex_Printer::leftJustify("GROUND_CRAFT", 20); // put a flag or a property - line += std::string(40, ' '); - line += Rinex_Printer::leftJustify("MARKER TYPE", 20); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; + if (version == 2) + { + line.clear(); + line += Rinex_Printer::leftJustify("GROUND_CRAFT", 20); // put a flag or a property + line += std::string(40, ' '); + line += Rinex_Printer::leftJustify("MARKER NUMBER", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } + if (version == 3) + { + line.clear(); + line += Rinex_Printer::leftJustify("GROUND_CRAFT", 20); // put a flag or a property + line += std::string(40, ' '); + line += Rinex_Printer::leftJustify("MARKER TYPE", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } // -------- Line OBSERVER / AGENCY line.clear(); @@ -3512,48 +3524,48 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem // -------- GLONASS SLOT / FRQ # (On;y version 3) if (version == 3) { - // -------- GLONASS SLOT / FRQ # - // TODO Need to provide system with list of all satellites and update this accordingly - line.clear(); - line += Rinex_Printer::rightJustify(boost::lexical_cast(0), 3); // Number of satellites in list - line += std::string(1, ' '); - line += satelliteSystem["GLONASS"]; - line += Rinex_Printer::rightJustify(boost::lexical_cast(0), 2); // Slot Number - line += std::string(1, ' '); - line += Rinex_Printer::rightJustify(boost::lexical_cast(0), 2); // Frequency Number - line += std::string(1, ' '); - line += std::string(60-line.size(), ' '); - line += Rinex_Printer::leftJustify("GLONASS SLOT / FRQ #", 20); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; + // -------- GLONASS SLOT / FRQ # + // TODO Need to provide system with list of all satellites and update this accordingly + line.clear(); + line += Rinex_Printer::rightJustify(boost::lexical_cast(0), 3); // Number of satellites in list + line += std::string(1, ' '); + line += satelliteSystem["GLONASS"]; + line += Rinex_Printer::rightJustify(boost::lexical_cast(0), 2); // Slot Number + line += std::string(1, ' '); + line += Rinex_Printer::rightJustify(boost::lexical_cast(0), 2); // Frequency Number + line += std::string(1, ' '); + line += std::string(60-line.size(), ' '); + line += Rinex_Printer::leftJustify("GLONASS SLOT / FRQ #", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; - // -------- GLONASS CODE/PHS/BIS - // No GLONASS Phase bias correction used to align code and phase observations. - line.clear(); - line += std::string(1, ' '); - line += observationType["PSEUDORANGE"]; - line += observationCode["GLONASS_G1_CA"]; - line += std::string(1, ' '); - line += Rinex_Printer::rightJustify(asString(0.0, 3), 8); - line += std::string(1, ' '); - line += observationType["PSEUDORANGE"]; - line += observationCode["GLONASS_G1_P"]; - line += std::string(1, ' '); - line += Rinex_Printer::rightJustify(asString(0.0, 3), 8); - line += std::string(1, ' '); - line += observationType["PSEUDORANGE"]; - line += observationCode["GLONASS_G2_CA"]; - line += std::string(1, ' '); - line += Rinex_Printer::rightJustify(asString(0.0, 3), 8); - line += std::string(1, ' '); - line += observationType["PSEUDORANGE"]; - line += observationCode["GLONASS_G2_P"]; - line += std::string(1, ' '); - line += Rinex_Printer::rightJustify(asString(0.0, 3), 8); - line += std::string(60-line.size(), ' '); - line += Rinex_Printer::leftJustify("GLONASS COD/PHS/BIS", 20); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; + // -------- GLONASS CODE/PHS/BIS + // No GLONASS Phase bias correction used to align code and phase observations. + line.clear(); + line += std::string(1, ' '); + line += observationType["PSEUDORANGE"]; + line += observationCode["GLONASS_G1_CA"]; + line += std::string(1, ' '); + line += Rinex_Printer::rightJustify(asString(0.0, 3), 8); + line += std::string(1, ' '); + line += observationType["PSEUDORANGE"]; + line += observationCode["GLONASS_G1_P"]; + line += std::string(1, ' '); + line += Rinex_Printer::rightJustify(asString(0.0, 3), 8); + line += std::string(1, ' '); + line += observationType["PSEUDORANGE"]; + line += observationCode["GLONASS_G2_CA"]; + line += std::string(1, ' '); + line += Rinex_Printer::rightJustify(asString(0.0, 3), 8); + line += std::string(1, ' '); + line += observationType["PSEUDORANGE"]; + line += observationCode["GLONASS_G2_P"]; + line += std::string(1, ' '); + line += Rinex_Printer::rightJustify(asString(0.0, 3), 8); + line += std::string(60-line.size(), ' '); + line += Rinex_Printer::leftJustify("GLONASS COD/PHS/BIS", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; } // -------- END OF HEADER @@ -3619,12 +3631,25 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps Rinex_Printer::lengthCheck(line); out << line << std::endl; - // -------- Line MARKER NAME - line.clear(); - line += Rinex_Printer::leftJustify("DEFAULT MARKER NAME", 60); // put a flag or a property, - line += Rinex_Printer::leftJustify("MARKER NAME", 20); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; + // -------- Line MARKER NAME / TYPE + if (version == 2) + { + line.clear(); + line += Rinex_Printer::leftJustify("GROUND_CRAFT", 20); // put a flag or a property + line += std::string(40, ' '); + line += Rinex_Printer::leftJustify("MARKER NUMBER", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } + if (version == 3) + { + line.clear(); + line += Rinex_Printer::leftJustify("GROUND_CRAFT", 20); // put a flag or a property + line += std::string(40, ' '); + line += Rinex_Printer::leftJustify("MARKER TYPE", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } // -------- Line MARKER TYPE line.clear(); @@ -3958,11 +3983,24 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris out << line << std::endl; // -------- Line MARKER NAME - line.clear(); - line += Rinex_Printer::leftJustify("DEFAULT MARKER NAME", 60); // put a flag or a property, - line += Rinex_Printer::leftJustify("MARKER NAME", 20); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; + if (version == 2) + { + line.clear(); + line += Rinex_Printer::leftJustify("GROUND_CRAFT", 20); // put a flag or a property + line += std::string(40, ' '); + line += Rinex_Printer::leftJustify("MARKER NUMBER", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } + if (version == 3) + { + line.clear(); + line += Rinex_Printer::leftJustify("GROUND_CRAFT", 20); // put a flag or a property + line += std::string(40, ' '); + line += Rinex_Printer::leftJustify("MARKER TYPE", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } // -------- Line MARKER TYPE line.clear(); @@ -4264,17 +4302,17 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& // -------- Line MARKER NAME line.clear(); line += Rinex_Printer::leftJustify("DEFAULT MARKER NAME", 60); // put a flag or a property, - line += Rinex_Printer::leftJustify("MARKER NAME", 20); + line += Rinex_Printer::leftJustify("MARKER TYPE", 20); Rinex_Printer::lengthCheck(line); out << line << std::endl; // -------- Line MARKER TYPE - //line.clear(); - //line += Rinex_Printer::leftJustify("NON_GEODETIC", 20); // put a flag or a property - //line += std::string(40, ' '); - //line += Rinex_Printer::leftJustify("MARKER TYPE", 20); - //Rinex_Printer::lengthCheck(line); - //out << line << std::endl; + line.clear(); + line += Rinex_Printer::leftJustify("NON_GEODETIC", 20); // put a flag or a property + line += std::string(40, ' '); + line += Rinex_Printer::leftJustify("MARKER TYPE", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; // -------- Line OBSERVER / AGENCY line.clear(); @@ -6133,9 +6171,9 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeri double seconds = fmod(glonass_t, 60); // Add extra 0 if seconds are < 10 if (seconds < 10) - { - line += std::string(1, '0'); - } + { + line += std::string(1, '0'); + } line += Rinex_Printer::asString(seconds, 7); line += std::string(2, ' '); // Epoch flag 0: OK 1: power failure between previous and current epoch <1: Special event diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index a507cfb75..897150a87 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -150,7 +150,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second); //convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0,0}, '0', '0', {}, {}, {}, {}, {}, {}}; - obs_data[valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs+glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, galileo_ephemeris_iter->second.WN_5, 0); @@ -295,7 +295,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ if (eph_data[i].sat == static_cast(gnss_observables_iter->second.PRN)) { eph_data[i] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); - obs_data[i] = insert_obs_to_rtklib(obs_data[i], + obs_data[i+glo_valid_obs] = insert_obs_to_rtklib(obs_data[i], gnss_observables_iter->second, gps_cnav_ephemeris_iter->second.i_GPS_week, 2);//Band 3 (L5) @@ -313,7 +313,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ obsd_t newobs = {{0,0}, '0', '0', {}, {}, {default_code_, default_code_, default_code_}, {}, {0.0, 0.0, 0.0}, {}}; - obs_data[valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs+glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, gps_cnav_ephemeris_iter->second.i_GPS_week, 2);//Band 3 (L5) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc index e3404a458..c5a69489a 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc @@ -194,6 +194,7 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols,int if (d_nav.have_new_ephemeris() == true) { // get object for this SV (mandatory) + d_nav.gnav_ephemeris.i_satellite_freq_channel = d_satellite.get_rf_link(); std::shared_ptr tmp_obj = std::make_shared(d_nav.get_ephemeris()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "GLONASS GNAV Ephemeris have been received on channel" << d_channel << " from satellite " << d_satellite; diff --git a/src/core/system_parameters/gnss_satellite.cc b/src/core/system_parameters/gnss_satellite.cc index 0bc4c51c8..9970455be 100644 --- a/src/core/system_parameters/gnss_satellite.cc +++ b/src/core/system_parameters/gnss_satellite.cc @@ -223,7 +223,13 @@ void Gnss_Satellite::set_PRN(unsigned int PRN_) } - +signed int Gnss_Satellite::get_rf_link() const +{ + // Get satellite's rf link. Identifies the GLONASS Frequency Channel + signed int rf_link_; + rf_link_ = rf_link; + return rf_link_; +} unsigned int Gnss_Satellite::get_PRN() const diff --git a/src/core/system_parameters/gnss_satellite.h b/src/core/system_parameters/gnss_satellite.h index 1db5691c2..75ea70ac1 100644 --- a/src/core/system_parameters/gnss_satellite.h +++ b/src/core/system_parameters/gnss_satellite.h @@ -50,12 +50,13 @@ public: Gnss_Satellite(); //!< Default Constructor. Gnss_Satellite(const std::string& system_, unsigned int PRN_); //!< Concrete GNSS satellite Constructor. ~Gnss_Satellite(); //!< Default Destructor. - void update_PRN(unsigned int PRN); //!< Updates the PRN Number when information is decoded, only applies to GLONASS GNAV messages + void update_PRN(unsigned int PRN); //!< Updates the PRN Number when information is decoded, only applies to GLONASS GNAV messages unsigned int get_PRN() const; //!< Gets satellite's PRN + signed int get_rf_link() const; //!< Gets the satellite's rf link std::string get_system() const; //!< Gets the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Beidou"} std::string get_system_short() const; //!< Gets the satellite system {"G", "R", "SBAS", "E", "C"} std::string get_block() const; //!< Gets the satellite block. If GPS, returns {"IIA", "IIR", "IIR-M", "IIF"} - std::string what_block(const std::string& system_, unsigned int PRN_); //!< Gets the block of a given satellite + std::string what_block(const std::string& system_, unsigned int PRN_); //!< Gets the block of a given satellite friend bool operator== (const Gnss_Satellite &, const Gnss_Satellite &); //!< operator== for comparison friend std::ostream& operator<<(std::ostream &, const Gnss_Satellite &); //!< operator<< for pretty printing //Gnss_Satellite& operator=(const Gnss_Satellite &);