1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-16 05:00:35 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Javier 2018-10-19 14:54:06 +02:00
commit 525f2df466
5 changed files with 98 additions and 10 deletions

View File

@ -414,7 +414,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
} }
else else
{ {
LOG(WARNING) << "Failed to save GPS L2CM or L5 Ephemeris, map is empty"; LOG(INFO) << "Failed to save GPS L2CM or L5 Ephemeris, map is empty";
} }
// save GPS L1 CA ephemeris to XML file // save GPS L1 CA ephemeris to XML file
@ -436,7 +436,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
} }
else else
{ {
LOG(WARNING) << "Failed to save GPS L1 CA Ephemeris, map is empty"; LOG(INFO) << "Failed to save GPS L1 CA Ephemeris, map is empty";
} }
// save Galileo E1 ephemeris to XML file // save Galileo E1 ephemeris to XML file
@ -458,7 +458,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
} }
else else
{ {
LOG(WARNING) << "Failed to save Galileo E1 Ephemeris, map is empty"; LOG(INFO) << "Failed to save Galileo E1 Ephemeris, map is empty";
} }
// save GLONASS GNAV ephemeris to XML file // save GLONASS GNAV ephemeris to XML file
@ -480,7 +480,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
} }
else else
{ {
LOG(WARNING) << "Failed to save GLONASS GNAV Ephemeris, map is empty"; LOG(INFO) << "Failed to save GLONASS GNAV Ephemeris, map is empty";
} }
// Save GPS UTC model parameters // Save GPS UTC model parameters
@ -502,7 +502,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
} }
else else
{ {
LOG(WARNING) << "Failed to save GPS UTC model parameters, not valid data"; LOG(INFO) << "Failed to save GPS UTC model parameters, not valid data";
} }
// Save Galileo UTC model parameters // Save Galileo UTC model parameters
@ -524,7 +524,29 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
} }
else else
{ {
LOG(WARNING) << "Failed to save Galileo UTC model parameters, not valid data"; LOG(INFO) << "Failed to save Galileo UTC model parameters, not valid data";
}
// Save GPS CNAV UTC model parameters
file_name = "gps_cnav_utc_model.xml";
if (d_ls_pvt->gps_cnav_utc_model.valid)
{
std::ofstream ofs;
try
{
ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_cnav_utc_model", d_ls_pvt->gps_cnav_utc_model);
LOG(INFO) << "Saved GPS CNAV UTC model parameters";
}
catch (std::exception& e)
{
LOG(WARNING) << e.what();
}
}
else
{
LOG(INFO) << "Failed to save GPS CNAV UTC model parameters, not valid data";
} }
} }

View File

@ -555,6 +555,52 @@ bool gnss_sdr_supl_client::save_utc_xml(const std::string file_name, Gps_Utc_Mod
} }
bool gnss_sdr_supl_client::load_cnav_utc_xml(const std::string file_name)
{
std::ifstream ifs;
try
{
ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs);
xml >> boost::serialization::make_nvp("GNSS-SDR_cnav_utc_model", this->gps_cnav_utc);
LOG(INFO) << "Loaded CNAV UTC model data";
}
catch (std::exception& e)
{
LOG(WARNING) << e.what() << "File: " << file_name;
return false;
}
return true;
}
bool gnss_sdr_supl_client::save_cnav_utc_xml(const std::string file_name, Gps_CNAV_Utc_Model& utc)
{
if (utc.valid)
{
std::ofstream ofs;
try
{
ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_cnav_utc_model", utc);
LOG(INFO) << "Saved GPS CNAV UTC model data";
}
catch (std::exception& e)
{
LOG(WARNING) << e.what();
return false;
}
}
else
{
LOG(WARNING) << "Failed to save GPS CNAV UTC model, no valid data";
return false;
}
return true;
}
bool gnss_sdr_supl_client::load_gal_utc_xml(const std::string file_name) bool gnss_sdr_supl_client::load_gal_utc_xml(const std::string file_name)
{ {
std::ifstream ifs; std::ifstream ifs;

View File

@ -43,6 +43,7 @@ extern "C"
#include "gps_iono.h" #include "gps_iono.h"
#include "gps_almanac.h" #include "gps_almanac.h"
#include "gps_utc_model.h" #include "gps_utc_model.h"
#include "gps_cnav_utc_model.h"
#include "gps_acq_assist.h" #include "gps_acq_assist.h"
#include "gps_ref_time.h" #include "gps_ref_time.h"
#include "gps_ref_location.h" #include "gps_ref_location.h"
@ -94,6 +95,7 @@ public:
// UTC model // UTC model
Gps_Utc_Model gps_utc; Gps_Utc_Model gps_utc;
Galileo_Utc_Model gal_utc; Galileo_Utc_Model gal_utc;
Gps_CNAV_Utc_Model gps_cnav_utc;
// reference location // reference location
Gps_Ref_Location gps_ref_loc; Gps_Ref_Location gps_ref_loc;
// Acquisition Assistance map // Acquisition Assistance map
@ -158,6 +160,17 @@ public:
*/ */
bool save_utc_xml(const std::string file_name, Gps_Utc_Model& utc); bool save_utc_xml(const std::string file_name, Gps_Utc_Model& utc);
/*!
* \brief Read CNAV GPS utc model from XML file
*/
bool load_cnav_utc_xml(const std::string file_name);
/*!
* \brief Save CNAV UTC model map to XML file
* To be called by ControlThread::gps_utc_model_data_write_to_XML()
*/
bool save_cnav_utc_xml(const std::string file_name, Gps_CNAV_Utc_Model& utc);
/*! /*!
* \brief Read Galileo utc model from XML file * \brief Read Galileo utc model from XML file
*/ */

View File

@ -218,11 +218,9 @@ bool ControlThread::read_assistance_from_XML()
std::string eph_gal_xml_filename = configuration_->property("GNSS-SDR.SUPL_gal_ephemeris_xml", eph_gal_default_xml_filename); std::string eph_gal_xml_filename = configuration_->property("GNSS-SDR.SUPL_gal_ephemeris_xml", eph_gal_default_xml_filename);
std::string eph_cnav_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_cnav_ephemeris_xml", eph_cnav_default_xml_filename); std::string eph_cnav_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_cnav_ephemeris_xml", eph_cnav_default_xml_filename);
std::string gal_utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_gal_utc_model.xml", gal_utc_default_xml_filename); std::string gal_utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_gal_utc_model.xml", gal_utc_default_xml_filename);
std::string cnav_utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_cnav_utc_model.xml", cnav_utc_default_xml_filename);
std::cout << "Trying to read GNSS ephemeris from XML file(s): " std::cout << "Trying to read GNSS ephemeris from XML file(s)..."
<< ((eph_xml_filename.compare(eph_default_xml_filename) != 0) ? eph_xml_filename + " " : "")
<< ((eph_gal_xml_filename.compare(eph_gal_default_xml_filename) != 0) ? eph_gal_xml_filename + " " : "")
<< ((eph_cnav_xml_filename.compare(eph_cnav_default_xml_filename) != 0) ? eph_gal_xml_filename : "")
<< std::endl; << std::endl;
if (supl_client_ephemeris_.load_ephemeris_xml(eph_xml_filename) == true) if (supl_client_ephemeris_.load_ephemeris_xml(eph_xml_filename) == true)
@ -299,6 +297,14 @@ bool ControlThread::read_assistance_from_XML()
ret = true; ret = true;
} }
if (supl_client_acquisition_.load_cnav_utc_xml(cnav_utc_xml_filename) == true)
{
std::shared_ptr<Gps_CNAV_Utc_Model> tmp_obj = std::make_shared<Gps_CNAV_Utc_Model>(supl_client_acquisition_.gps_cnav_utc);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
std::cout << "From XML file: Read GPS CNAV UTC parameters." << std::endl;
ret = true;
}
if (ret == false) if (ret == false)
{ {
std::cout << "ERROR: SUPL client error reading XML" << std::endl; std::cout << "ERROR: SUPL client error reading XML" << std::endl;

View File

@ -176,6 +176,7 @@ private:
const std::string eph_cnav_default_xml_filename = "./gps_cnav_ephemeris.xml"; const std::string eph_cnav_default_xml_filename = "./gps_cnav_ephemeris.xml";
const std::string gal_iono_default_xml_filename = "./gal_iono.xml"; const std::string gal_iono_default_xml_filename = "./gal_iono.xml";
const std::string gal_utc_default_xml_filename = "./gal_utc_model.xml"; const std::string gal_utc_default_xml_filename = "./gal_utc_model.xml";
const std::string cnav_utc_default_xml_filename = "./gps_cnav_utc_model.xml";
}; };
#endif /*GNSS_SDR_CONTROL_THREAD_H_*/ #endif /*GNSS_SDR_CONTROL_THREAD_H_*/