mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-18 21:23:02 +00:00
Add Glonass assistance
This commit is contained in:
parent
5ea5292166
commit
15c4d62096
@ -548,6 +548,50 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
|
||||
{
|
||||
LOG(INFO) << "Failed to save GPS CNAV UTC model parameters, not valid data";
|
||||
}
|
||||
|
||||
// save GLONASS GNAV ephemeris to XML file
|
||||
file_name = "glo_gnav_ephemeris.xml";
|
||||
if (d_ls_pvt->glonass_gnav_ephemeris_map.empty() == false)
|
||||
{
|
||||
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_gnav_ephemeris_map", d_ls_pvt->glonass_gnav_ephemeris_map);
|
||||
LOG(INFO) << "Saved GLONASS GNAV ephemeris map data";
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG(WARNING) << e.what();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(INFO) << "Failed to save GLONASS GNAV ephemeris, map is empty";
|
||||
}
|
||||
|
||||
// save GLONASS UTC model parameters to XML file
|
||||
file_name = "glo_utc_model.xml";
|
||||
if (d_ls_pvt->glonass_gnav_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_gnav_utc_model", d_ls_pvt->glonass_gnav_utc_model);
|
||||
LOG(INFO) << "Saved GLONASS UTC model parameters";
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG(WARNING) << e.what();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(INFO) << "Failed to save GLONASS GNAV ephemeris, not valid data";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -509,6 +509,53 @@ bool save_cnav_ephemeris_map_xml(const std::string file_name, std::map<int, Gps_
|
||||
}
|
||||
|
||||
|
||||
bool gnss_sdr_supl_client::load_gnav_ephemeris_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);
|
||||
gps_cnav_ephemeris_map.clear();
|
||||
xml >> boost::serialization::make_nvp("GNSS-SDR_gnav_ephemeris_map", this->glonass_gnav_ephemeris_map);
|
||||
LOG(INFO) << "Loaded GLONASS ephemeris map data with " << this->gps_cnav_ephemeris_map.size() << " satellites";
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG(WARNING) << e.what() << "File: " << file_name;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool save_gnav_ephemeris_map_xml(const std::string file_name, std::map<int, Glonass_Gnav_Ephemeris> eph_map)
|
||||
{
|
||||
if (eph_map.empty() == false)
|
||||
{
|
||||
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_gnav_ephemeris_map", eph_map);
|
||||
LOG(INFO) << "Saved GLONASS GNAV ephemeris map data";
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG(WARNING) << e.what();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(WARNING) << "Failed to save GLONASS GNAV ephemeris, map is empty";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool gnss_sdr_supl_client::load_utc_xml(const std::string file_name)
|
||||
{
|
||||
std::ifstream ifs;
|
||||
@ -739,6 +786,52 @@ bool gnss_sdr_supl_client::save_gal_iono_xml(const std::string file_name, Galile
|
||||
}
|
||||
|
||||
|
||||
bool gnss_sdr_supl_client::load_glo_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_glo_utc_model", this->glo_gnav_utc);
|
||||
LOG(INFO) << "Loaded UTC model data";
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG(WARNING) << e.what() << "File: " << file_name;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool gnss_sdr_supl_client::save_glo_utc_xml(const std::string file_name, Glonass_Gnav_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_glo_utc_model", utc);
|
||||
LOG(INFO) << "Saved Glonass UTC Model data";
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG(WARNING) << e.what();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(WARNING) << "Failed to save Glonass UTC model, no valid data";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name)
|
||||
{
|
||||
std::ifstream ifs;
|
||||
|
@ -51,6 +51,8 @@ extern "C"
|
||||
#include "galileo_ephemeris.h"
|
||||
#include "galileo_utc_model.h"
|
||||
#include "galileo_iono.h"
|
||||
#include "glonass_gnav_ephemeris.h"
|
||||
#include "glonass_gnav_utc_model.h"
|
||||
#include <boost/archive/xml_oarchive.hpp>
|
||||
#include <boost/archive/xml_iarchive.hpp>
|
||||
#include <boost/serialization/map.hpp>
|
||||
@ -84,6 +86,8 @@ public:
|
||||
std::map<int, Gps_Ephemeris> gps_ephemeris_map;
|
||||
std::map<int, Galileo_Ephemeris> gal_ephemeris_map;
|
||||
std::map<int, Gps_CNAV_Ephemeris> gps_cnav_ephemeris_map;
|
||||
std::map<int, Glonass_Gnav_Ephemeris> glonass_gnav_ephemeris_map;
|
||||
|
||||
// almanac map
|
||||
std::map<int, Gps_Almanac> gps_almanac_map;
|
||||
|
||||
@ -96,6 +100,7 @@ public:
|
||||
Gps_Utc_Model gps_utc;
|
||||
Galileo_Utc_Model gal_utc;
|
||||
Gps_CNAV_Utc_Model gps_cnav_utc;
|
||||
Glonass_Gnav_Utc_Model glo_gnav_utc;
|
||||
// reference location
|
||||
Gps_Ref_Location gps_ref_loc;
|
||||
// Acquisition Assistance map
|
||||
@ -149,6 +154,17 @@ public:
|
||||
bool save_gal_ephemeris_map_xml(const std::string file_name,
|
||||
std::map<int, Galileo_Ephemeris> eph_map);
|
||||
|
||||
/*!
|
||||
* \brief Read GLONASS GNAV ephemeris map from XML file
|
||||
*/
|
||||
bool load_gnav_ephemeris_xml(const std::string file_name);
|
||||
|
||||
/*!
|
||||
* \brief Save GLONASS GNAV ephemeris map to XML file.
|
||||
*/
|
||||
bool save_gnav_ephemeris_map_xml(const std::string file_name,
|
||||
std::map<int, Glonass_Gnav_Ephemeris> eph_map);
|
||||
|
||||
/*!
|
||||
* \brief Read GPS utc model from XML file
|
||||
*/
|
||||
@ -202,6 +218,16 @@ public:
|
||||
*/
|
||||
bool save_gal_iono_xml(const std::string file_name, Galileo_Iono& iono);
|
||||
|
||||
/*!
|
||||
* \brief Read Glonass utc model from XML file
|
||||
*/
|
||||
bool load_glo_utc_xml(const std::string file_name);
|
||||
|
||||
/*!
|
||||
* \brief Save Glonass UTC model map to XML file
|
||||
*/
|
||||
bool save_glo_utc_xml(const std::string file_name, Glonass_Gnav_Utc_Model& utc);
|
||||
|
||||
/*!
|
||||
* \brief Read ref time from XML file
|
||||
*/
|
||||
|
@ -47,6 +47,8 @@
|
||||
#include "gps_iono.h"
|
||||
#include "gps_utc_model.h"
|
||||
#include "gps_almanac.h"
|
||||
#include "glonass_gnav_ephemeris.h"
|
||||
#include "glonass_gnav_utc_model.h"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/chrono.hpp>
|
||||
#include <glog/logging.h>
|
||||
@ -208,6 +210,8 @@ bool ControlThread::read_assistance_from_XML()
|
||||
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 cnav_utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_cnav_utc_model.xml", cnav_utc_default_xml_filename);
|
||||
std::string eph_glo_xml_filename = configuration_->property("GNSS-SDR.SUPL_glo_ephemeris_xml", eph_glo_gnav_default_xml_filename);
|
||||
std::string glo_utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_glo_utc_model.xml", glo_utc_default_xml_filename);
|
||||
|
||||
std::cout << "Trying to read GNSS ephemeris from XML file(s)..." << std::endl;
|
||||
|
||||
@ -302,6 +306,31 @@ bool ControlThread::read_assistance_from_XML()
|
||||
}
|
||||
}
|
||||
|
||||
if ((configuration_->property("Channels_1G.count", 0) > 0) or (configuration_->property("Channels_2G.count", 0) > 0))
|
||||
{
|
||||
if (supl_client_ephemeris_.load_gnav_ephemeris_xml(eph_glo_xml_filename) == true)
|
||||
{
|
||||
std::map<int, Glonass_Gnav_Ephemeris>::const_iterator glo_gnav_eph_iter;
|
||||
for (glo_gnav_eph_iter = supl_client_ephemeris_.glonass_gnav_ephemeris_map.cbegin();
|
||||
glo_gnav_eph_iter != supl_client_ephemeris_.glonass_gnav_ephemeris_map.cend();
|
||||
glo_gnav_eph_iter++)
|
||||
{
|
||||
std::cout << "From XML file: Read GLONASS GNAV ephemeris for satellite " << Gnss_Satellite("GLONASS", glo_gnav_eph_iter->second.i_satellite_PRN) << std::endl;
|
||||
std::shared_ptr<Glonass_Gnav_Ephemeris> tmp_obj = std::make_shared<Glonass_Gnav_Ephemeris>(glo_gnav_eph_iter->second);
|
||||
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
|
||||
}
|
||||
ret = true;
|
||||
}
|
||||
|
||||
if (supl_client_acquisition_.load_glo_utc_xml(glo_utc_xml_filename) == true)
|
||||
{
|
||||
std::shared_ptr<Glonass_Gnav_Utc_Model> tmp_obj = std::make_shared<Glonass_Gnav_Utc_Model>(supl_client_acquisition_.glo_gnav_utc);
|
||||
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
|
||||
std::cout << "From XML file: Read GLONASS UTC parameters." << std::endl;
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == false)
|
||||
{
|
||||
std::cout << "ERROR: SUPL client error reading XML" << std::endl;
|
||||
|
@ -172,6 +172,8 @@ private:
|
||||
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 cnav_utc_default_xml_filename = "./gps_cnav_utc_model.xml";
|
||||
const std::string eph_glo_gnav_default_xml_filename = "./glo_gnav_ephemeris.xml";
|
||||
const std::string glo_utc_default_xml_filename = "./glo_utc_model.xml";
|
||||
};
|
||||
|
||||
#endif /*GNSS_SDR_CONTROL_THREAD_H_*/
|
||||
|
Loading…
Reference in New Issue
Block a user