[hamradio-commits] [gnss-sdr] 200/236: Re-enabling the GPS L1 warm start ephemeris assistance stored in XML file. Now GNSS-SDR is able to load auto-stored ephemeris from previous runs to speed up the position fix.

Carles Fernandez carles_fernandez-guest at moszumanska.debian.org
Tue Apr 26 16:02:53 UTC 2016


This is an automated email from the git hooks/post-receive script.

carles_fernandez-guest pushed a commit to branch next
in repository gnss-sdr.

commit 5cdd6b2cc9ddf1dae2a797180e287c229774cade
Author: Javier Arribas <javiarribas at gmail.com>
Date:   Wed Apr 20 12:58:54 2016 +0200

    Re-enabling the GPS L1 warm start ephemeris assistance stored in
    XML file. Now GNSS-SDR is able to load auto-stored ephemeris from
    previous runs to speed up the position fix.
---
 src/algorithms/PVT/adapters/gps_l1_ca_pvt.cc       | 110 ++++++++++++++++++-
 src/algorithms/PVT/adapters/gps_l1_ca_pvt.h        |   3 +
 src/algorithms/PVT/adapters/hybrid_pvt.cc          |  53 ++++++++-
 src/algorithms/PVT/adapters/hybrid_pvt.h           |   3 +
 .../PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc        |   7 +-
 .../PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h         |   8 ++
 .../PVT/gnuradio_blocks/hybrid_pvt_cc.cc           |   5 +
 src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.h |   8 ++
 src/core/libs/gnss_sdr_supl_client.cc              |  22 ++--
 src/core/receiver/control_thread.cc                | 122 ++++-----------------
 src/core/receiver/control_thread.h                 |   8 +-
 11 files changed, 236 insertions(+), 113 deletions(-)

diff --git a/src/algorithms/PVT/adapters/gps_l1_ca_pvt.cc b/src/algorithms/PVT/adapters/gps_l1_ca_pvt.cc
index 705515c..ebc873a 100644
--- a/src/algorithms/PVT/adapters/gps_l1_ca_pvt.cc
+++ b/src/algorithms/PVT/adapters/gps_l1_ca_pvt.cc
@@ -33,6 +33,9 @@
 
 #include "gps_l1_ca_pvt.h"
 #include <glog/logging.h>
+#include <boost/archive/xml_oarchive.hpp>
+#include <boost/archive/xml_iarchive.hpp>
+#include <boost/serialization/map.hpp>
 #include "configuration_interface.h"
 
 using google::LogMessage;
@@ -79,14 +82,119 @@ GpsL1CaPvt::GpsL1CaPvt(ConfigurationInterface* configuration,
     bool flag_rtcm_server;
     flag_rtcm_server = configuration->property(role + ".flag_rtcm_server", false);
 
+
+    // getting names from the config file, if available
+    // default filename for assistance data
+    const std::string eph_default_xml_filename = "./gps_ephemeris.xml";
+    const std::string utc_default_xml_filename = "./gps_utc_model.xml";
+    const std::string iono_default_xml_filename = "./gps_iono.xml";
+    const std::string ref_time_default_xml_filename = "./gps_ref_time.xml";
+    const std::string ref_location_default_xml_filename = "./gps_ref_location.xml";
+    eph_xml_filename_= configuration->property("GNSS-SDR.SUPL_gps_ephemeris_xml", eph_default_xml_filename);
+    //std::string utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_utc_model.xml", utc_default_xml_filename);
+    //std::string iono_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_iono_xml", iono_default_xml_filename);
+    //std::string ref_time_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ref_time_xml", ref_time_default_xml_filename);
+    //std::string ref_location_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ref_location_xml", ref_location_default_xml_filename);
+
     // make PVT object
     pvt_ = gps_l1_ca_make_pvt_cc(in_streams_, dump_, dump_filename_, averaging_depth, flag_averaging, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname, flag_rtcm_server, flag_rtcm_tty_port, rtcm_dump_devname );
     DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")";
+
+
+}
+
+bool GpsL1CaPvt::save_assistance_to_XML()
+{
+    // return variable (true == succeeded)
+    bool ret = false;
+
+    LOG(INFO) << "SUPL: Try to save GPS ephemeris to XML file " << eph_xml_filename_;
+
+    std::map<int,Gps_Ephemeris> eph_map=pvt_->get_GPS_L1_ephemeris_map();
+    if (eph_map.size() > 0)
+        {
+            try
+                {
+                    std::ofstream ofs(eph_xml_filename_.c_str(), std::ofstream::trunc | std::ofstream::out);
+                    boost::archive::xml_oarchive xml(ofs);
+                    xml << boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", eph_map);
+                    ofs.close();
+                    LOG(INFO) << "Saved GPS L1 Ephemeris map data";
+                }
+            catch (std::exception& e)
+                {
+                    LOG(ERROR) << e.what();
+                    return false;
+                }
+            return true;
+        }
+    else
+        {
+            LOG(WARNING) << "Failed to save Ephemeris, map is empty";
+            return false;
+        }
+    // Only try to save {utc, iono, ref time, ref location} if SUPL is enabled
+//    bool enable_gps_supl_assistance = configuration_->property("GNSS-SDR.SUPL_gps_enabled", false);
+//    if (enable_gps_supl_assistance == true)
+//        {
+//            // try to save utc model xml file
+//            std::map<int, Gps_Utc_Model> utc_copy = global_gps_utc_model_map.get_map_copy();
+//            if (supl_client_acquisition_.save_utc_map_xml(utc_xml_filename, utc_copy) == true)
+//                {
+//                    LOG(INFO) << "SUPL: Successfully saved UTC Model XML file";
+//                    //ret = true;
+//                }
+//            else
+//                {
+//                    LOG(INFO) << "SUPL: Error while trying to save utc XML file";
+//                    //ret = false;
+//                }
+//            // try to save iono model xml file
+//            std::map<int, Gps_Iono> iono_copy = global_gps_iono_map.get_map_copy();
+//            if (supl_client_acquisition_.save_iono_map_xml(iono_xml_filename, iono_copy) == true)
+//                {
+//                    LOG(INFO) << "SUPL: Successfully saved IONO Model XML file";
+//                    //ret = true;
+//                }
+//            else
+//                {
+//                    LOG(INFO) << "SUPL: Error while trying to save iono XML file";
+//                    //ret = false;
+//                }
+//            // try to save ref time xml file
+//            std::map<int, Gps_Ref_Time> ref_time_copy = global_gps_ref_time_map.get_map_copy();
+//            if (supl_client_acquisition_.save_ref_time_map_xml(ref_time_xml_filename, ref_time_copy) == true)
+//                {
+//                    LOG(INFO) << "SUPL: Successfully saved Ref Time XML file";
+//                    //ret = true;
+//                }
+//            else
+//                {
+//                    LOG(INFO) << "SUPL: Error while trying to save ref time XML file";
+//                    //ref = false;
+//                }
+//            // try to save ref location xml file
+//            std::map<int, Gps_Ref_Location> ref_location_copy = global_gps_ref_location_map.get_map_copy();
+//            if (supl_client_acquisition_.save_ref_location_map_xml(ref_location_xml_filename, ref_location_copy) == true)
+//                {
+//                    LOG(INFO) << "SUPL: Successfully saved Ref Location XML file";
+//                    //ref = true;
+//                }
+//            else
+//                {
+//                    LOG(INFO) << "SUPL: Error while trying to save ref location XML file";
+//                    //ret = false;
+//                }
+//        }
+    return ret;
 }
 
 
+
 GpsL1CaPvt::~GpsL1CaPvt()
-{}
+{
+    save_assistance_to_XML();
+}
 
 
 void GpsL1CaPvt::connect(gr::top_block_sptr top_block)
diff --git a/src/algorithms/PVT/adapters/gps_l1_ca_pvt.h b/src/algorithms/PVT/adapters/gps_l1_ca_pvt.h
index bb15a05..87f33dd 100644
--- a/src/algorithms/PVT/adapters/gps_l1_ca_pvt.h
+++ b/src/algorithms/PVT/adapters/gps_l1_ca_pvt.h
@@ -90,6 +90,9 @@ private:
     std::string role_;
     unsigned int in_streams_;
     unsigned int out_streams_;
+
+    std::string eph_xml_filename_;
+    bool save_assistance_to_XML();
 };
 
 #endif
diff --git a/src/algorithms/PVT/adapters/hybrid_pvt.cc b/src/algorithms/PVT/adapters/hybrid_pvt.cc
index 00bbe55..3983928 100644
--- a/src/algorithms/PVT/adapters/hybrid_pvt.cc
+++ b/src/algorithms/PVT/adapters/hybrid_pvt.cc
@@ -33,6 +33,9 @@
 
 #include "hybrid_pvt.h"
 #include <glog/logging.h>
+#include <boost/archive/xml_oarchive.hpp>
+#include <boost/archive/xml_iarchive.hpp>
+#include <boost/serialization/map.hpp>
 #include "configuration_interface.h"
 
 
@@ -79,14 +82,62 @@ HybridPvt::HybridPvt(ConfigurationInterface* configuration,
     rtcm_dump_devname = configuration->property(role + ".rtcm_dump_devname", default_rtcm_dump_devname);
     bool flag_rtcm_server;
     flag_rtcm_server = configuration->property(role + ".flag_rtcm_server", false);
+
+    // getting names from the config file, if available
+    // default filename for assistance data
+    const std::string eph_default_xml_filename = "./gps_ephemeris.xml";
+    const std::string utc_default_xml_filename = "./gps_utc_model.xml";
+    const std::string iono_default_xml_filename = "./gps_iono.xml";
+    const std::string ref_time_default_xml_filename = "./gps_ref_time.xml";
+    const std::string ref_location_default_xml_filename = "./gps_ref_location.xml";
+    eph_xml_filename_= configuration->property("GNSS-SDR.SUPL_gps_ephemeris_xml", eph_default_xml_filename);
+    //std::string utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_utc_model.xml", utc_default_xml_filename);
+    //std::string iono_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_iono_xml", iono_default_xml_filename);
+    //std::string ref_time_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ref_time_xml", ref_time_default_xml_filename);
+    //std::string ref_location_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ref_location_xml", ref_location_default_xml_filename);
+
+
     // make PVT object
     pvt_ = hybrid_make_pvt_cc(in_streams_, dump_, dump_filename_, averaging_depth, flag_averaging, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname, flag_rtcm_server, flag_rtcm_tty_port, rtcm_dump_devname);
     DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")";
 }
 
+bool HybridPvt::save_assistance_to_XML()
+{
+    // return variable (true == succeeded)
+    bool ret = false;
+
+    LOG(INFO) << "SUPL: Try to save GPS ephemeris to XML file " << eph_xml_filename_;
+
+    std::map<int,Gps_Ephemeris> eph_map=pvt_->get_GPS_L1_ephemeris_map();
+    if (eph_map.size() > 0)
+        {
+            try
+                {
+                    std::ofstream ofs(eph_xml_filename_.c_str(), std::ofstream::trunc | std::ofstream::out);
+                    boost::archive::xml_oarchive xml(ofs);
+                    xml << boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", eph_map);
+                    ofs.close();
+                    LOG(INFO) << "Saved GPS L1 Ephemeris map data";
+                }
+            catch (std::exception& e)
+                {
+                    LOG(ERROR) << e.what();
+                    return false;
+                }
+            return true;
+        }
+    else
+        {
+            LOG(WARNING) << "Failed to save Ephemeris, map is empty";
+            return false;
+        }
+}
 
 HybridPvt::~HybridPvt()
-{}
+{
+    save_assistance_to_XML();
+}
 
 
 void HybridPvt::connect(gr::top_block_sptr top_block)
diff --git a/src/algorithms/PVT/adapters/hybrid_pvt.h b/src/algorithms/PVT/adapters/hybrid_pvt.h
index e7669a0..5863c60 100644
--- a/src/algorithms/PVT/adapters/hybrid_pvt.h
+++ b/src/algorithms/PVT/adapters/hybrid_pvt.h
@@ -88,6 +88,9 @@ private:
     std::string role_;
     unsigned int in_streams_;
     unsigned int out_streams_;
+
+    std::string eph_xml_filename_;
+    bool save_assistance_to_XML();
 };
 
 #endif
diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc
index 9f0e624..91b2a55 100644
--- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc
+++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc
@@ -57,7 +57,7 @@ void gps_l1_ca_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg)
                     // ### GPS EPHEMERIS ###
                     std::shared_ptr<Gps_Ephemeris> gps_eph;
                     gps_eph = boost::any_cast<std::shared_ptr<Gps_Ephemeris>>(pmt::any_ref(msg));
-                    DLOG(INFO) << "Ephemeris record has arrived from SAT ID "
+                    LOG(INFO) << "Ephemeris record has arrived from SAT ID "
                             << gps_eph->i_satellite_PRN << " (Block "
                             <<  gps_eph->satelliteBlock[gps_eph->i_satellite_PRN] << ")"
                             << "inserted with Toe="<< gps_eph->d_Toe<<" and GPS Week="
@@ -144,6 +144,11 @@ void gps_l1_ca_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg)
 }
 
 
+std::map<int,Gps_Ephemeris> gps_l1_ca_pvt_cc::get_GPS_L1_ephemeris_map()
+{
+    return d_ls_pvt->gps_ephemeris_map;
+}
+
 gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels,
         bool dump, std::string dump_filename,
         int averaging_depth,
diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h
index 837d6a5..f322f59 100644
--- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h
+++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h
@@ -125,6 +125,14 @@ private:
     std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
 
 public:
+
+    /*!
+     * \brief Get latest set of GPS L1 ephemeris from PVT block
+     *
+     * It is used to save the assistance data at the receiver shutdown
+     */
+    std::map<int,Gps_Ephemeris> get_GPS_L1_ephemeris_map();
+
     ~gps_l1_ca_pvt_cc (); //!< Default destructor
 
     int general_work (int noutput_items, gr_vector_int &ninput_items,
diff --git a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc
index 2a47058..561713e 100644
--- a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc
+++ b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc
@@ -131,6 +131,11 @@ void hybrid_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg)
 
 
 
+std::map<int,Gps_Ephemeris> hybrid_pvt_cc::get_GPS_L1_ephemeris_map()
+{
+    return d_ls_pvt->gps_ephemeris_map;
+}
+
 hybrid_pvt_cc::hybrid_pvt_cc(unsigned int nchannels, bool dump, std::string dump_filename,
         int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port,
         std::string nmea_dump_filename, std::string nmea_dump_devname,
diff --git a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.h
index 4fb746b..b68d2e0 100644
--- a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.h
+++ b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.h
@@ -124,6 +124,14 @@ private:
     bool pseudoranges_pairCompare_min(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b);
 
 public:
+
+    /*!
+     * \brief Get latest set of GPS L1 ephemeris from PVT block
+     *
+     * It is used to save the assistance data at the receiver shutdown
+     */
+    std::map<int,Gps_Ephemeris> get_GPS_L1_ephemeris_map();
+
     ~hybrid_pvt_cc (); //!< Default destructor
 
     int general_work (int noutput_items, gr_vector_int &ninput_items,
diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc
index 629c8f9..5f4679d 100644
--- a/src/core/libs/gnss_sdr_supl_client.cc
+++ b/src/core/libs/gnss_sdr_supl_client.cc
@@ -372,11 +372,11 @@ bool gnss_sdr_supl_client::load_ephemeris_xml(const std::string file_name)
             gps_ephemeris_map.clear();
             xml >> boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", this->gps_ephemeris_map);
             ifs.close();
-            LOG(INFO) << "Loaded Ephemeris map data";
+            LOG(INFO) << "Loaded Ephemeris map data with "<<this->gps_ephemeris_map.size()<<" satellites";
     }
     catch (std::exception& e)
     {
-            LOG(ERROR) << e.what() << "File: " << file_name;
+            LOG(WARNING) << e.what() << "File: " << file_name;
             return false;
     }
     return true;
@@ -396,7 +396,7 @@ bool gnss_sdr_supl_client::save_ephemeris_map_xml(const std::string file_name, s
                 }
             catch (std::exception& e)
                 {
-                    LOG(ERROR) << e.what();
+                    LOG(WARNING) << e.what();
                     return false;
                 }
             return true;
@@ -420,7 +420,7 @@ bool gnss_sdr_supl_client::load_utc_xml(const std::string file_name)
     }
     catch (std::exception& e)
     {
-        LOG(ERROR) << e.what() << "File: " << file_name;
+        LOG(WARNING) << e.what() << "File: " << file_name;
         return false;
     }
     return true;
@@ -440,7 +440,7 @@ bool gnss_sdr_supl_client::save_utc_map_xml(const std::string file_name, std::ma
                 }
             catch (std::exception& e)
                 {
-                    LOG(ERROR) << e.what();
+                    LOG(WARNING) << e.what();
                     return false;
                 }
             return true;
@@ -464,7 +464,7 @@ bool gnss_sdr_supl_client::load_iono_xml(const std::string file_name)
         }
     catch (std::exception& e)
         {
-            LOG(ERROR) << e.what() << "File: " << file_name;
+            LOG(WARNING) << e.what() << "File: " << file_name;
             return false;
         }
     return true;
@@ -484,7 +484,7 @@ bool gnss_sdr_supl_client::save_iono_map_xml(const std::string file_name, std::m
                 }
             catch (std::exception& e)
                 {
-                    LOG(ERROR) << e.what();
+                    LOG(WARNING) << e.what();
                     return false;
                 }
             return true;
@@ -508,7 +508,7 @@ bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name)
     }
     catch (std::exception& e)
     {
-        LOG(ERROR) << e.what() << "File: " << file_name;
+        LOG(WARNING) << e.what() << "File: " << file_name;
         return false;
     }
     return true;
@@ -528,7 +528,7 @@ bool gnss_sdr_supl_client::save_ref_time_map_xml(const std::string file_name, st
                 }
             catch (std::exception& e)
                 {
-                    LOG(ERROR) << e.what();
+                    LOG(WARNING) << e.what();
                     return false;
                 }
             return true;
@@ -552,7 +552,7 @@ bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name)
     }
     catch (std::exception& e)
     {
-            LOG(ERROR) << e.what() << "File: " << file_name;
+            LOG(WARNING) << e.what() << "File: " << file_name;
             return false;
     }
     return true;
@@ -572,7 +572,7 @@ bool gnss_sdr_supl_client::save_ref_location_map_xml(const std::string file_name
                 }
             catch (std::exception& e)
                 {
-                    LOG(ERROR) << e.what();
+                    LOG(WARNING) << e.what();
                     return false;
                 }
             return true;
diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc
index 078647a..a34f0d1 100644
--- a/src/core/receiver/control_thread.cc
+++ b/src/core/receiver/control_thread.cc
@@ -121,6 +121,9 @@ void ControlThread::run()
             LOG(ERROR) << "Unable to start flowgraph";
             return;
         }
+
+    //launch GNSS assistance process AFTER the flowgraph is running because the GNURadio asynchronous queues must be already running to transport msgs
+    assist_GNSS();
     // start the keyboard_listener thread
     keyboard_thread_ = boost::thread(&ControlThread::keyboard_listener, this);
 
@@ -247,98 +250,8 @@ bool ControlThread::read_assistance_from_XML()
     return ret;
 }
 
-
-//todo: The save assistance function needs to be moved to the PVT block because now the global maps are deprecated, and PVT is the only block that have all the information
-//bool ControlThread::save_assistance_to_XML()
-//{
-//    // return variable (true == succeeded)
-//    bool ret = false;
-//    // getting names from the config file, if available
-//    std::string eph_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_xml", eph_default_xml_filename);
-//    std::string utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_utc_model.xml", utc_default_xml_filename);
-//    std::string iono_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_iono_xml", iono_default_xml_filename);
-//    std::string ref_time_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ref_time_xml", ref_time_default_xml_filename);
-//    std::string ref_location_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ref_location_xml", ref_location_default_xml_filename);
-//
-//    LOG(INFO) << "SUPL: Try to save GPS ephemeris to XML file " << eph_xml_filename;
-//    std::map<int, Gps_Ephemeris> eph_copy = global_gps_ephemeris_map.get_map_copy();
-//    if (supl_client_ephemeris_.save_ephemeris_map_xml(eph_xml_filename, eph_copy) == true)
-//        {
-//            LOG(INFO) << "SUPL: Successfully saved ephemeris XML file";
-//            ret = true;
-//        }
-//    else
-//        {
-//            LOG(INFO) << "SUPL: Error while trying to save ephemeris XML file. Maybe an empty map?";
-//            ret = false;
-//        }
-//    // Only try to save {utc, iono, ref time, ref location} if SUPL is enabled
-//    bool enable_gps_supl_assistance = configuration_->property("GNSS-SDR.SUPL_gps_enabled", false);
-//    if (enable_gps_supl_assistance == true)
-//        {
-//            // try to save utc model xml file
-//            std::map<int, Gps_Utc_Model> utc_copy = global_gps_utc_model_map.get_map_copy();
-//            if (supl_client_acquisition_.save_utc_map_xml(utc_xml_filename, utc_copy) == true)
-//                {
-//                    LOG(INFO) << "SUPL: Successfully saved UTC Model XML file";
-//                    //ret = true;
-//                }
-//            else
-//                {
-//                    LOG(INFO) << "SUPL: Error while trying to save utc XML file";
-//                    //ret = false;
-//                }
-//            // try to save iono model xml file
-//            std::map<int, Gps_Iono> iono_copy = global_gps_iono_map.get_map_copy();
-//            if (supl_client_acquisition_.save_iono_map_xml(iono_xml_filename, iono_copy) == true)
-//                {
-//                    LOG(INFO) << "SUPL: Successfully saved IONO Model XML file";
-//                    //ret = true;
-//                }
-//            else
-//                {
-//                    LOG(INFO) << "SUPL: Error while trying to save iono XML file";
-//                    //ret = false;
-//                }
-//            // try to save ref time xml file
-//            std::map<int, Gps_Ref_Time> ref_time_copy = global_gps_ref_time_map.get_map_copy();
-//            if (supl_client_acquisition_.save_ref_time_map_xml(ref_time_xml_filename, ref_time_copy) == true)
-//                {
-//                    LOG(INFO) << "SUPL: Successfully saved Ref Time XML file";
-//                    //ret = true;
-//                }
-//            else
-//                {
-//                    LOG(INFO) << "SUPL: Error while trying to save ref time XML file";
-//                    //ref = false;
-//                }
-//            // try to save ref location xml file
-//            std::map<int, Gps_Ref_Location> ref_location_copy = global_gps_ref_location_map.get_map_copy();
-//            if (supl_client_acquisition_.save_ref_location_map_xml(ref_location_xml_filename, ref_location_copy) == true)
-//                {
-//                    LOG(INFO) << "SUPL: Successfully saved Ref Location XML file";
-//                    //ref = true;
-//                }
-//            else
-//                {
-//                    LOG(INFO) << "SUPL: Error while trying to save ref location XML file";
-//                    //ret = false;
-//                }
-//        }
-//    return ret;
-//}
-
-
-void ControlThread::init()
+void ControlThread::assist_GNSS()
 {
-    // Instantiates a control queue, a GNSS flowgraph, and a control message factory
-    control_queue_ = gr::msg_queue::make(0);
-    flowgraph_ = std::make_shared<GNSSFlowgraph>(configuration_, control_queue_);
-    control_message_factory_ = std::make_shared<ControlMessageFactory>();
-    stop_ = false;
-    processed_control_messages_ = 0;
-    applied_actions_ = 0;
-
     //######### GNSS Assistance #################################
     // GNSS Assistance configuration
     bool enable_gps_supl_assistance = configuration_->property("GNSS-SDR.SUPL_gps_enabled", false);
@@ -379,7 +292,9 @@ void ControlThread::init()
             if (SUPL_read_gps_assistance_xml == true)
                 {
                     // read assistance from file
-                    //if (read_assistance_from_XML()) {}
+                    if (read_assistance_from_XML()) {
+                        std::cout<<"GPS assistance data loaded from local XML file."<<std::endl;
+                    }
                 }
             else
                 {
@@ -414,11 +329,11 @@ void ControlThread::init()
                         {
                             std::cout << "ERROR: SUPL client for Ephemeris returned " << error << std::endl;
                             std::cout << "Please check internet connection and SUPL server configuration" << error << std::endl;
-                            //std::cout << "Trying to read ephemeris from XML file" << std::endl;
-                            //if (read_assistance_from_XML() == false)
-                            //    {
-                            //        std::cout << "ERROR: Could not read Ephemeris file: Disabling SUPL assistance.." << std::endl;
-                            //    }
+                            std::cout << "Trying to read ephemeris from XML file" << std::endl;
+                            if (read_assistance_from_XML() == false)
+                                {
+                                    std::cout << "ERROR: Could not read Ephemeris file: Disabling SUPL assistance.." << std::endl;
+                                }
                         }
 
                     // Request almanac , IONO and UTC Model
@@ -443,7 +358,7 @@ void ControlThread::init()
                                     flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
                                 }
                             if (supl_client_ephemeris_.gps_utc.valid == true)
-			        {
+                    {
                                     std::cout << "SUPL: Received GPS UTC Model" << std::endl;
                                     std::shared_ptr<Gps_Utc_Model> tmp_obj= std::make_shared<Gps_Utc_Model>(supl_client_ephemeris_.gps_utc);
                                     flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
@@ -492,6 +407,17 @@ void ControlThread::init()
                 }
         }
 }
+void ControlThread::init()
+{
+    // Instantiates a control queue, a GNSS flowgraph, and a control message factory
+    control_queue_ = gr::msg_queue::make(0);
+    flowgraph_ = std::make_shared<GNSSFlowgraph>(configuration_, control_queue_);
+    control_message_factory_ = std::make_shared<ControlMessageFactory>();
+    stop_ = false;
+    processed_control_messages_ = 0;
+    applied_actions_ = 0;
+
+}
 
 
 void ControlThread::read_control_messages()
diff --git a/src/core/receiver/control_thread.h b/src/core/receiver/control_thread.h
index faf38a1..546f646 100644
--- a/src/core/receiver/control_thread.h
+++ b/src/core/receiver/control_thread.h
@@ -127,7 +127,6 @@ private:
     bool read_assistance_from_XML();
 
     // Save {ephemeris, iono, utc, ref loc, ref time} assistance to a local XML file
-    //bool save_assistance_to_XML();
 
     void read_control_messages();
 
@@ -138,6 +137,13 @@ private:
      */
     void gps_acq_assist_data_collector();
     
+
+    /*
+     * Read initial GNSS assistance from SUPL server or local XML files
+     */
+    void assist_GNSS();
+
+
     void apply_action(unsigned int what);
     std::shared_ptr<GNSSFlowgraph> flowgraph_;
     std::shared_ptr<ConfigurationInterface> configuration_;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git



More information about the pkg-hamradio-commits mailing list