1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-17 15:47:15 +00:00

Re-enabling the GPS L1 warm start ephemeris assistance stored in XML file

This commit is contained in:
Javier Arribas
2016-05-03 12:34:38 +02:00
parent eb8539a725
commit 3d2e72c790
11 changed files with 234 additions and 118 deletions

View File

@@ -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,115 @@ 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)

View File

@@ -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

View File

@@ -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,15 +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() << ")";
}
HybridPvt::~HybridPvt()
{}
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)
{

View File

@@ -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

View File

@@ -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,

View File

@@ -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,

View File

@@ -130,6 +130,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,

View File

@@ -124,6 +124,13 @@ 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,