From fc32c076df8e28cf2cf454fd052532011255b445 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 18 Oct 2021 17:24:02 +0200 Subject: [PATCH] Add generation of IGM01 messages --- src/algorithms/PVT/libs/rtcm.cc | 41 +++++++++++++++++++------ src/algorithms/PVT/libs/rtcm.h | 7 ++++- src/algorithms/PVT/libs/rtcm_printer.cc | 16 ++++++++++ src/algorithms/PVT/libs/rtcm_printer.h | 3 ++ 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/src/algorithms/PVT/libs/rtcm.cc b/src/algorithms/PVT/libs/rtcm.cc index 0f9c96ebe..4af60dfa1 100644 --- a/src/algorithms/PVT/libs/rtcm.cc +++ b/src/algorithms/PVT/libs/rtcm.cc @@ -3250,12 +3250,40 @@ std::string Rtcm::get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV, } -std::string Rtcm::get_IGM01_header(const Galileo_HAS_data& has_data, uint8_t nsys) +std::vector Rtcm::print_IGM01(const Galileo_HAS_data& has_data) +{ + std::vector msgs; + const uint8_t nsys = has_data.Nsys; + bool ssr_multiple_msg_indicator = true; + for (uint8_t sys = 0; sys < nsys; sys++) + { + if (sys == nsys - 1) + { + ssr_multiple_msg_indicator = false; // last message of a sequence + } + const std::string header = Rtcm::get_IGM01_header(has_data, sys, ssr_multiple_msg_indicator); + const std::string sat_data = Rtcm::get_IGM01_content_sat(has_data, sys); + std::string message = build_message(header + sat_data); + if (server_is_running) + { + rtcm_message_queue->push(message); + } + msgs.push_back(message); + } + return msgs; +} + + +std::string Rtcm::get_IGM01_header(const Galileo_HAS_data& has_data, uint8_t nsys, bool ssr_multiple_msg_indicator) { std::string header; - uint32_t tow = 0; - uint16_t ssr_provider_id = 0; // ? - uint8_t igm_version = 0; + + uint32_t tow = 0; // TODO + uint16_t ssr_provider_id = 0; // ? + uint8_t igm_version = 0; // ? + uint8_t ssr_solution_id = 0; // ? + auto iod_ssr = has_data.header.iod_id % 15; // ?? HAS IOD is 0-31 + bool regional_indicator = false; // ? uint8_t subtype_msg_number = 0; if (has_data.gnss_id_mask[nsys] == 0) // GPS @@ -3267,10 +3295,6 @@ std::string Rtcm::get_IGM01_header(const Galileo_HAS_data& has_data, uint8_t nsy subtype_msg_number = 61; } - uint8_t ssr_solution_id = 0; // ? - bool ssr_multiple_msg_indicator = false; - bool regional_indicator = false; - uint8_t validity_index = has_data.validity_interval_index_orbit_corrections; uint16_t validity_seconds = has_data.get_validity_interval_s(validity_index); uint8_t ssr_update_interval = 0; @@ -3342,7 +3366,6 @@ std::string Rtcm::get_IGM01_header(const Galileo_HAS_data& has_data, uint8_t nsy } } - auto iod_ssr = has_data.header.iod_id % 15; // ?? HAS IOD is 0-31 uint8_t Nsat = has_data.get_num_satellites()[nsys]; Rtcm::set_DF002(4076); // Always “4076” for IGS Proprietary Messages diff --git a/src/algorithms/PVT/libs/rtcm.h b/src/algorithms/PVT/libs/rtcm.h index 8b48e6303..ac03ed2c7 100644 --- a/src/algorithms/PVT/libs/rtcm.h +++ b/src/algorithms/PVT/libs/rtcm.h @@ -337,6 +337,11 @@ public: bool divergence_free, bool more_messages); + /*! + * \brief Prints messages of type IGM01 (SSR Orbit Correction) + */ + std::vector print_IGM01(const Galileo_HAS_data& has_data); + uint32_t lock_time(const Gps_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro); //!< Returns the time period in which GPS L1 signals have been continually tracked. uint32_t lock_time(const Gps_CNAV_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro); //!< Returns the time period in which GPS L2 signals have been continually tracked. uint32_t lock_time(const Galileo_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro); //!< Returns the time period in which Galileo signals have been continually tracked. @@ -477,7 +482,7 @@ private: std::string get_MSM_6_content_signal_data(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const std::map& observables); std::string get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& ephCNAV, const Galileo_Ephemeris& ephFNAV, const Glonass_Gnav_Ephemeris& ephGNAV, double obs_time, const std::map& observables); - std::string get_IGM01_header(const Galileo_HAS_data& has_data, uint8_t nsys); + std::string get_IGM01_header(const Galileo_HAS_data& has_data, uint8_t nsys, bool ssr_multiple_msg_indicator); std::string get_IGM01_content_sat(const Galileo_HAS_data& has_data, uint8_t nsys_index); diff --git a/src/algorithms/PVT/libs/rtcm_printer.cc b/src/algorithms/PVT/libs/rtcm_printer.cc index 1b84bc7fc..620f2d50c 100644 --- a/src/algorithms/PVT/libs/rtcm_printer.cc +++ b/src/algorithms/PVT/libs/rtcm_printer.cc @@ -19,6 +19,7 @@ #include "rtcm_printer.h" #include "galileo_ephemeris.h" +#include "galileo_has_data.h" #include "glonass_gnav_ephemeris.h" #include "glonass_gnav_utc_model.h" #include "gnss_sdr_filesystem.h" @@ -1599,6 +1600,21 @@ bool Rtcm_Printer::Print_Rtcm_MSM(uint32_t msm_number, const Gps_Ephemeris& gps_ } +bool Rtcm_Printer::Print_Rtcm_IGM01(const Galileo_HAS_data& has_data) +{ + const std::vector msgs = rtcm->print_IGM01(has_data); + if (msgs.empty()) + { + return false; + } + for (const auto& s : msgs) + { + Rtcm_Printer::Print_Message(s); + } + return true; +} + + int Rtcm_Printer::init_serial(const std::string& serial_device) { /* diff --git a/src/algorithms/PVT/libs/rtcm_printer.h b/src/algorithms/PVT/libs/rtcm_printer.h index f710fca98..7b3fdacbe 100644 --- a/src/algorithms/PVT/libs/rtcm_printer.h +++ b/src/algorithms/PVT/libs/rtcm_printer.h @@ -40,6 +40,7 @@ class Gps_CNAV_Ephemeris; class Gps_Ephemeris; class Rtcm; class Rtklib_Solver; +class Galileo_HAS_data; /*! * \brief This class provides a implementation of a subset of the RTCM Standard 10403.2 messages @@ -178,6 +179,8 @@ private: bool divergence_free, bool more_messages); + bool Print_Rtcm_IGM01(const Galileo_HAS_data& has_data); // SSR Orbit Corrections + int32_t init_serial(const std::string& serial_device); // serial port control void close_serial() const; bool Print_Message(const std::string& message);