mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 20:20:35 +00:00
Enable Assited GNSS for Galileo signals
This commit is contained in:
parent
8c79c1aa91
commit
2a69e63534
@ -388,6 +388,47 @@ bool gnss_sdr_supl_client::load_ephemeris_xml(const std::string file_name)
|
||||
}
|
||||
|
||||
|
||||
bool gnss_sdr_supl_client::load_gal_ephemeris_xml(const std::string file_name)
|
||||
{
|
||||
std::ifstream ifs;
|
||||
try
|
||||
{
|
||||
ifs.close();
|
||||
ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
|
||||
boost::archive::xml_iarchive xml(ifs);
|
||||
gal_ephemeris_map.clear();
|
||||
xml >> boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", this->gal_ephemeris_map);
|
||||
LOG(INFO) << "Loaded Ephemeris map data with " << this->gal_ephemeris_map.size() << " satellites";
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG(WARNING) << e.what() << "File: " << file_name;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool gnss_sdr_supl_client::load_cnav_ephemeris_xml(const std::string file_name)
|
||||
{
|
||||
std::ifstream ifs;
|
||||
try
|
||||
{
|
||||
ifs.close();
|
||||
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_ephemeris_map", this->gps_cnav_ephemeris_map);
|
||||
LOG(INFO) << "Loaded 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 gnss_sdr_supl_client::save_ephemeris_map_xml(const std::string file_name, std::map<int, Gps_Ephemeris> eph_map)
|
||||
{
|
||||
if (eph_map.empty() == false)
|
||||
|
@ -46,6 +46,8 @@ extern "C"
|
||||
#include "gps_acq_assist.h"
|
||||
#include "gps_ref_time.h"
|
||||
#include "gps_ref_location.h"
|
||||
#include "gps_cnav_ephemeris.h"
|
||||
#include "galileo_ephemeris.h"
|
||||
#include <boost/archive/xml_oarchive.hpp>
|
||||
#include <boost/archive/xml_iarchive.hpp>
|
||||
#include <boost/serialization/map.hpp>
|
||||
@ -77,6 +79,8 @@ public:
|
||||
int request;
|
||||
// ephemeris map
|
||||
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;
|
||||
// almanac map
|
||||
std::map<int, Gps_Almanac> gps_almanac_map;
|
||||
|
||||
@ -107,10 +111,20 @@ public:
|
||||
void read_supl_data();
|
||||
|
||||
/*!
|
||||
* \brief Read ephemeris map from XML file
|
||||
* \brief Read GPS NAV ephemeris map from XML file
|
||||
*/
|
||||
bool load_ephemeris_xml(const std::string file_name);
|
||||
|
||||
/*!
|
||||
* \brief Read GPS CNAV ephemeris map from XML file
|
||||
*/
|
||||
bool load_cnav_ephemeris_xml(const std::string file_name);
|
||||
|
||||
/*!
|
||||
* \brief Read Galileo ephemeris map from XML file
|
||||
*/
|
||||
bool load_gal_ephemeris_xml(const std::string file_name);
|
||||
|
||||
/*!
|
||||
* \brief Save ephemeris map to XML file.
|
||||
*/
|
||||
|
@ -204,7 +204,7 @@ bool ControlThread::read_assistance_from_XML()
|
||||
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);
|
||||
|
||||
std::cout << "SUPL: Try read GPS ephemeris from XML file " << eph_xml_filename << std::endl;
|
||||
std::cout << "SUPL: Try read GNSS ephemeris from XML file " << eph_xml_filename << std::endl;
|
||||
if (supl_client_ephemeris_.load_ephemeris_xml(eph_xml_filename) == true)
|
||||
{
|
||||
std::map<int, Gps_Ephemeris>::const_iterator gps_eph_iter;
|
||||
@ -218,6 +218,20 @@ bool ControlThread::read_assistance_from_XML()
|
||||
}
|
||||
ret = true;
|
||||
}
|
||||
else if (supl_client_ephemeris_.load_ephemeris_xml(eph_xml_filename) == true)
|
||||
{
|
||||
std::map<int, Galileo_Ephemeris>::const_iterator gal_eph_iter;
|
||||
for (gal_eph_iter = supl_client_ephemeris_.gal_ephemeris_map.cbegin();
|
||||
gal_eph_iter != supl_client_ephemeris_.gal_ephemeris_map.cend();
|
||||
gal_eph_iter++)
|
||||
{
|
||||
std::cout << "SUPL: Read XML Ephemeris for Galileo SV " << gal_eph_iter->first << std::endl;
|
||||
std::shared_ptr<Galileo_Ephemeris> tmp_obj = std::make_shared<Galileo_Ephemeris>(gal_eph_iter->second);
|
||||
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
|
||||
}
|
||||
ret = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
std::cout << "ERROR: SUPL client error reading XML" << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user