1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

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

This commit is contained in:
Javier 2018-10-21 19:20:30 +02:00
commit ae7be10325
13 changed files with 363 additions and 159 deletions

View File

@ -227,8 +227,14 @@ endif(NOT LINUX_DISTRIBUTION)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(OperatingSystem "Mac OS X")
set(OS_IS_MACOSX TRUE)
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
execute_process(COMMAND uname -v OUTPUT_VARIABLE DARWIN_VERSION)
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
if(${DARWIN_VERSION} MATCHES "18")
set(MACOS_MOJAVE TRUE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on macOS Mojave 10.14")
endif(${DARWIN_VERSION} MATCHES "18")
if(${DARWIN_VERSION} MATCHES "17")
set(MACOS_HIGH_SIERRA TRUE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")

View File

@ -64,10 +64,10 @@ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time
libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev \
libboost-serialization-dev liblog4cpp5-dev libuhd-dev gnuradio-dev gr-osmosdr \
libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev \
libgnutls-openssl-dev libpcap-dev python-mako python-six libmatio-dev googletest
libgnutls-openssl-dev libpcap-dev python-mako python-six libmatio-dev libgtest-dev
~~~~~~
Please note that `googletest` was named `libgtest-dev` in distributions older than Debian 9 "stretch" and Ubuntu 17.04 "zesty".
Please note that the required files from `libgtest-dev` were moved to `googletest` in Debian 9 "stretch" and Ubuntu 18.04 "bionic", and moved back again to `libgtest-dev` in Debian 10 "buster" and Ubuntu 18.10 "cosmic".
**Note for Ubuntu 14.04 LTS "trusty" users:** you will need to build from source and install GNU Radio manually, as explained below, since GNSS-SDR requires `gnuradio-dev` >= 3.7.3, and Ubuntu 14.04 came with 3.7.2. Install all the packages above BUT EXCEPT `libuhd-dev`, `gnuradio-dev` and `gr-osmosdr` (and remove them if they are already installed in your machine), and install those dependencies using PyBOMBS. The same applies to `libmatio-dev`: Ubuntu 14.04 came with 1.5.2 and the minimum required version is 1.5.3. Please do not install the `libmatio-dev` package and install `libtool`, `automake` and `libhdf5-dev` instead. A recent version of the library will be downloaded and built automatically if CMake does not find it installed.
@ -516,10 +516,7 @@ More details can be found in our tutorial about [GNSS-SDR configuration options
<a name="macosx">macOS and Mac OS X</a>
---------
### macOS 10.13 (High Sierra) and 10.12 (Sierra), Mac OS X 10.11 (El Capitan), 10.10 (Yosemite) and 10.9 (Mavericks).
If you still have not installed [Xcode](https://developer.apple.com/xcode/ "Xcode"), do it now from the App Store (it's free). You will also need the Xcode Command Line Tools. Launch the Terminal, found in /Applications/Utilities/, and type:
GNSS-SDR can be built on MacOS or Mac OS X, starting from 10.9 (Mavericks) and including 10.14 (Mojave). If you still have not installed [Xcode](https://developer.apple.com/xcode/ "Xcode"), do it now from the App Store (it's free). You will also need the Xcode Command Line Tools. Launch the Terminal, found in /Applications/Utilities/, and type:
~~~~~~
$ xcode-select --install
@ -558,7 +555,7 @@ You also might need to activate a Python installation. The list of installed ver
$ port select list python
~~~~~~
and you can activate a certain version (2.7 works well) by typing:
and you can activate a certain version by typing:
~~~~~~
$ sudo port select --set python python27

View File

@ -24,10 +24,10 @@ string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove \"$ENV{DESTDIR}${file}\"
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
RESULT_VARIABLE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")

View File

@ -133,18 +133,6 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
{
rtcm_msg_rate_ms[k] = rtcm_MT1097_rate_ms;
}
// 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);
// Infer the type of receiver
/*
@ -499,40 +487,9 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
}
bool RtklibPvt::save_assistance_to_XML()
{
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.empty() == false)
{
std::ofstream ofs;
try
{
ofs.open(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);
LOG(INFO) << "Saved GPS L1 Ephemeris map data";
}
catch (const std::exception& e)
{
LOG(WARNING) << e.what();
return false;
}
}
else
{
LOG(WARNING) << "Failed to save Ephemeris, map is empty";
return false;
}
return true; // return variable (true == succeeded)
}
RtklibPvt::~RtklibPvt()
{
rtkfree(&rtk);
save_assistance_to_XML();
}

View File

@ -40,7 +40,7 @@
class ConfigurationInterface;
/*!
* \brief This class implements a PvtInterface for Galileo E1
* \brief This class implements a PvtInterface for the RTKLIB PVT block
*/
class RtklibPvt : public PvtInterface
{
@ -87,8 +87,6 @@ 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

@ -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";
}
}

View File

@ -25,10 +25,10 @@ string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove \"$ENV{DESTDIR}${file}\"
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
RESULT_VARIABLE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")

View File

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

View File

@ -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
*/
@ -156,7 +172,6 @@ public:
/*!
* \brief Save UTC model map to XML file
* To be called by ControlThread::gps_utc_model_data_write_to_XML()
*/
bool save_utc_xml(const std::string file_name, Gps_Utc_Model& utc);
@ -167,7 +182,6 @@ public:
/*!
* \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);
@ -178,7 +192,6 @@ public:
/*!
* \brief Save Galileo UTC model map to XML file
* To be called by ControlThread::gal_utc_model_data_write_to_XML()
*/
bool save_gal_utc_xml(const std::string file_name, Galileo_Utc_Model& utc);
@ -202,6 +215,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
*/
@ -228,6 +251,7 @@ public:
* Prints SUPL data to std::cout. Use it for debug purposes only.
*/
void print_assistance();
gnss_sdr_supl_client();
~gnss_sdr_supl_client();
};

View 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>
@ -210,105 +212,156 @@ bool ControlThread::read_assistance_from_XML()
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 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 gal_iono_xml_filename = configuration_->property("GNSS-SDR.SUPL_gal_iono_xml", gal_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);
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 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 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;
if (supl_client_ephemeris_.load_ephemeris_xml(eph_xml_filename) == true)
if (configuration_->property("GNSS-SDR.AGNSS_XML_enabled", false) == true)
{
std::map<int, Gps_Ephemeris>::const_iterator gps_eph_iter;
for (gps_eph_iter = supl_client_ephemeris_.gps_ephemeris_map.cbegin();
gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.cend();
gps_eph_iter++)
eph_xml_filename = configuration_->property("GNSS-SDR.AGNSS_gps_ephemeris_xml", eph_default_xml_filename);
utc_xml_filename = configuration_->property("GNSS-SDR.AGNSS_gps_utc_model_xml", utc_default_xml_filename);
iono_xml_filename = configuration_->property("GNSS-SDR.AGNSS_gps_iono_xml", iono_default_xml_filename);
gal_iono_xml_filename = configuration_->property("GNSS-SDR.AGNSS_gal_iono_xml", gal_iono_default_xml_filename);
ref_time_xml_filename = configuration_->property("GNSS-SDR.AGNSS_gps_ref_time_xml", ref_time_default_xml_filename);
ref_location_xml_filename = configuration_->property("GNSS-SDR.AGNSS_gps_ref_location_xml", ref_location_default_xml_filename);
eph_gal_xml_filename = configuration_->property("GNSS-SDR.AGNSS_gal_ephemeris_xml", eph_gal_default_xml_filename);
eph_cnav_xml_filename = configuration_->property("GNSS-SDR.AGNSS_gps_cnav_ephemeris_xml", eph_cnav_default_xml_filename);
gal_utc_xml_filename = configuration_->property("GNSS-SDR.AGNSS_gal_utc_model_xml", gal_utc_default_xml_filename);
cnav_utc_xml_filename = configuration_->property("GNSS-SDR.AGNSS_cnav_utc_model_xml", cnav_utc_default_xml_filename);
eph_glo_xml_filename = configuration_->property("GNSS-SDR.AGNSS_glo_ephemeris_xml", eph_glo_gnav_default_xml_filename);
glo_utc_xml_filename = configuration_->property("GNSS-SDR.AGNSS_glo_utc_model_xml", glo_utc_default_xml_filename);
}
std::cout << "Trying to read GNSS ephemeris from XML file(s)..." << std::endl;
if (configuration_->property("Channels_1C.count", 0) > 0)
{
if (supl_client_ephemeris_.load_ephemeris_xml(eph_xml_filename) == true)
{
std::cout << "From XML file: Read NAV ephemeris for satellite " << Gnss_Satellite("GPS", gps_eph_iter->second.i_satellite_PRN) << std::endl;
std::shared_ptr<Gps_Ephemeris> tmp_obj = std::make_shared<Gps_Ephemeris>(gps_eph_iter->second);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
std::map<int, Gps_Ephemeris>::const_iterator gps_eph_iter;
for (gps_eph_iter = supl_client_ephemeris_.gps_ephemeris_map.cbegin();
gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.cend();
gps_eph_iter++)
{
std::cout << "From XML file: Read NAV ephemeris for satellite " << Gnss_Satellite("GPS", gps_eph_iter->second.i_satellite_PRN) << std::endl;
std::shared_ptr<Gps_Ephemeris> tmp_obj = std::make_shared<Gps_Ephemeris>(gps_eph_iter->second);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
ret = true;
}
ret = true;
}
if (supl_client_ephemeris_.load_gal_ephemeris_xml(eph_gal_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++)
if (supl_client_acquisition_.load_utc_xml(utc_xml_filename) == true)
{
std::cout << "From XML file: Read ephemeris for satellite " << Gnss_Satellite("Galileo", gal_eph_iter->second.i_satellite_PRN) << std::endl;
std::shared_ptr<Galileo_Ephemeris> tmp_obj = std::make_shared<Galileo_Ephemeris>(gal_eph_iter->second);
std::shared_ptr<Gps_Utc_Model> tmp_obj = std::make_shared<Gps_Utc_Model>(supl_client_acquisition_.gps_utc);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
std::cout << "From XML file: Read GPS UTC model parameters." << std::endl;
ret = true;
}
ret = true;
}
if (supl_client_ephemeris_.load_cnav_ephemeris_xml(eph_cnav_xml_filename) == true)
{
std::map<int, Gps_CNAV_Ephemeris>::const_iterator gps_cnav_eph_iter;
for (gps_cnav_eph_iter = supl_client_ephemeris_.gps_cnav_ephemeris_map.cbegin();
gps_cnav_eph_iter != supl_client_ephemeris_.gps_cnav_ephemeris_map.cend();
gps_cnav_eph_iter++)
if (supl_client_acquisition_.load_iono_xml(iono_xml_filename) == true)
{
std::cout << "From XML file: Read CNAV ephemeris for satellite " << Gnss_Satellite("GPS", gps_cnav_eph_iter->second.i_satellite_PRN) << std::endl;
std::shared_ptr<Gps_CNAV_Ephemeris> tmp_obj = std::make_shared<Gps_CNAV_Ephemeris>(gps_cnav_eph_iter->second);
std::shared_ptr<Gps_Iono> tmp_obj = std::make_shared<Gps_Iono>(supl_client_acquisition_.gps_iono);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
std::cout << "From XML file: Read GPS ionosphere model parameters." << std::endl;
ret = true;
}
ret = true;
}
if (supl_client_acquisition_.load_utc_xml(utc_xml_filename) == true)
if ((configuration_->property("Channels_1B.count", 0) > 0) or (configuration_->property("Channels_5X.count", 0) > 0))
{
std::shared_ptr<Gps_Utc_Model> tmp_obj = std::make_shared<Gps_Utc_Model>(supl_client_acquisition_.gps_utc);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
std::cout << "From XML file: Read GPS UTC parameters." << std::endl;
ret = true;
if (supl_client_ephemeris_.load_gal_ephemeris_xml(eph_gal_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 << "From XML file: Read ephemeris for satellite " << Gnss_Satellite("Galileo", gal_eph_iter->second.i_satellite_PRN) << 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;
}
if (supl_client_acquisition_.load_gal_iono_xml(gal_iono_xml_filename) == true)
{
std::shared_ptr<Galileo_Iono> tmp_obj = std::make_shared<Galileo_Iono>(supl_client_acquisition_.gal_iono);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
std::cout << "From XML file: Read Galileo ionosphere model parameters." << std::endl;
ret = true;
}
if (supl_client_acquisition_.load_gal_utc_xml(gal_utc_xml_filename) == true)
{
std::shared_ptr<Galileo_Utc_Model> tmp_obj = std::make_shared<Galileo_Utc_Model>(supl_client_acquisition_.gal_utc);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
std::cout << "From XML file: Read Galileo UTC model parameters." << std::endl;
ret = true;
}
}
if (supl_client_acquisition_.load_iono_xml(iono_xml_filename) == true)
if ((configuration_->property("Channels_2S.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0))
{
std::shared_ptr<Gps_Iono> tmp_obj = std::make_shared<Gps_Iono>(supl_client_acquisition_.gps_iono);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
std::cout << "From XML file: Read GPS iono parameters." << std::endl;
ret = true;
if (supl_client_ephemeris_.load_cnav_ephemeris_xml(eph_cnav_xml_filename) == true)
{
std::map<int, Gps_CNAV_Ephemeris>::const_iterator gps_cnav_eph_iter;
for (gps_cnav_eph_iter = supl_client_ephemeris_.gps_cnav_ephemeris_map.cbegin();
gps_cnav_eph_iter != supl_client_ephemeris_.gps_cnav_ephemeris_map.cend();
gps_cnav_eph_iter++)
{
std::cout << "From XML file: Read CNAV ephemeris for satellite " << Gnss_Satellite("GPS", gps_cnav_eph_iter->second.i_satellite_PRN) << std::endl;
std::shared_ptr<Gps_CNAV_Ephemeris> tmp_obj = std::make_shared<Gps_CNAV_Ephemeris>(gps_cnav_eph_iter->second);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
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 model parameters." << std::endl;
ret = true;
}
}
if (supl_client_acquisition_.load_gal_iono_xml(gal_iono_xml_filename) == true)
if ((configuration_->property("Channels_1G.count", 0) > 0) or (configuration_->property("Channels_2G.count", 0) > 0))
{
std::shared_ptr<Galileo_Iono> tmp_obj = std::make_shared<Galileo_Iono>(supl_client_acquisition_.gal_iono);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
std::cout << "From XML file: Read Galileo iono parameters." << std::endl;
ret = true;
}
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_gal_utc_xml(gal_utc_xml_filename) == true)
{
std::shared_ptr<Galileo_Utc_Model> tmp_obj = std::make_shared<Galileo_Utc_Model>(supl_client_acquisition_.gal_utc);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
std::cout << "From XML file: Read Galileo UTC parameters." << std::endl;
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 (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 model parameters." << std::endl;
ret = true;
}
}
if (ret == false)
{
std::cout << "ERROR: SUPL client error reading XML" << std::endl;
std::cout << "Disabling SUPL assistance..." << std::endl;
std::cout << "Error reading XML files" << std::endl;
std::cout << "Disabling GNSS assistance..." << std::endl;
}
// Only look for {ref time, ref location} if SUPL is enabled
@ -324,7 +377,7 @@ bool ControlThread::read_assistance_from_XML()
}
else
{
LOG(INFO) << "SUPL: couldn't read Ref Time XML";
LOG(INFO) << "SUPL: could not read Ref Time XML";
}
// Try to read Ref Location from XML
@ -336,7 +389,7 @@ bool ControlThread::read_assistance_from_XML()
}
else
{
LOG(INFO) << "SUPL: couldn't read Ref Location XML";
LOG(INFO) << "SUPL: could not read Ref Location XML";
}
}
@ -349,11 +402,11 @@ void ControlThread::assist_GNSS()
//######### GNSS Assistance #################################
// GNSS Assistance configuration
bool enable_gps_supl_assistance = configuration_->property("GNSS-SDR.SUPL_gps_enabled", false);
if (enable_gps_supl_assistance == true)
//SUPL SERVER TEST. Not operational yet!
bool enable_agnss_xml = configuration_->property("GNSS-SDR.AGNSS_XML_enabled", false);
if ((enable_gps_supl_assistance == true) and (enable_agnss_xml == false))
{
std::cout << "SUPL RRLP GPS assistance enabled!" << std::endl;
std::string default_acq_server = "supl.nokia.com";
std::string default_acq_server = "supl.google.com";
std::string default_eph_server = "supl.google.com";
supl_client_ephemeris_.server_name = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_server", default_acq_server);
supl_client_acquisition_.server_name = configuration_->property("GNSS-SDR.SUPL_gps_acquisition_server", default_eph_server);
@ -389,6 +442,7 @@ void ControlThread::assist_GNSS()
if (read_assistance_from_XML())
{
std::cout << "GNSS assistance data loaded from local XML file(s)." << std::endl;
std::cout << "No SUPL request has been performed." << std::endl;
}
}
else
@ -396,7 +450,7 @@ void ControlThread::assist_GNSS()
// Request ephemeris from SUPL server
int error;
supl_client_ephemeris_.request = 1;
std::cout << "SUPL: Try to read GPS ephemeris from SUPL server..." << std::endl;
std::cout << "SUPL: Try to read GPS ephemeris data from SUPL server..." << std::endl;
error = supl_client_ephemeris_.get_assistance(supl_mcc, supl_mns, supl_lac, supl_ci);
if (error == 0)
{
@ -405,35 +459,35 @@ void ControlThread::assist_GNSS()
gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.cend();
gps_eph_iter++)
{
std::cout << "SUPL: Received Ephemeris for GPS SV " << gps_eph_iter->first << std::endl;
std::cout << "SUPL: Received ephemeris data for satellite " << Gnss_Satellite("GPS", gps_eph_iter->second.i_satellite_PRN) << std::endl;
std::shared_ptr<Gps_Ephemeris> tmp_obj = std::make_shared<Gps_Ephemeris>(gps_eph_iter->second);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
//Save ephemeris to XML file
// Save ephemeris to XML file
std::string eph_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_xml", eph_default_xml_filename);
if (supl_client_ephemeris_.save_ephemeris_map_xml(eph_xml_filename, supl_client_ephemeris_.gps_ephemeris_map) == true)
{
std::cout << "SUPL: XML Ephemeris file created" << std::endl;
std::cout << "SUPL: XML ephemeris data file created" << std::endl;
}
else
{
std::cout << "SUPL: Failed to create XML Ephemeris file" << std::endl;
std::cout << "SUPL: Failed to create XML ephemeris data file" << std::endl;
}
}
else
{
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;
std::cout << "ERROR: SUPL client request for ephemeris data returned " << error << std::endl;
std::cout << "Please check your network connectivity and SUPL server configuration" << std::endl;
std::cout << "Trying to read AGNSS data from local XML file(s)..." << std::endl;
if (read_assistance_from_XML() == false)
{
std::cout << "ERROR: Could not read Ephemeris file: Disabling SUPL assistance." << std::endl;
std::cout << "ERROR: Could not read XML files: Disabling SUPL assistance." << std::endl;
}
}
// Request almanac , IONO and UTC Model
// Request almanac, IONO and UTC Model data
supl_client_ephemeris_.request = 0;
std::cout << "SUPL: Try read Almanac, Iono, Utc Model, Ref Time and Ref Location from SUPL server..." << std::endl;
std::cout << "SUPL: Try to read Almanac, Iono, Utc Model, Ref Time and Ref Location data from SUPL server..." << std::endl;
error = supl_client_ephemeris_.get_assistance(supl_mcc, supl_mns, supl_lac, supl_ci);
if (error == 0)
{
@ -442,33 +496,51 @@ void ControlThread::assist_GNSS()
gps_alm_iter != supl_client_ephemeris_.gps_almanac_map.cend();
gps_alm_iter++)
{
std::cout << "SUPL: Received Almanac for GPS SV " << gps_alm_iter->first << std::endl;
std::cout << "SUPL: Received almanac data for satellite " << Gnss_Satellite("GPS", gps_alm_iter->second.i_satellite_PRN) << std::endl;
std::shared_ptr<Gps_Almanac> tmp_obj = std::make_shared<Gps_Almanac>(gps_alm_iter->second);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
if (supl_client_ephemeris_.gps_iono.valid == true)
{
std::cout << "SUPL: Received GPS Iono" << std::endl;
std::cout << "SUPL: Received GPS Ionosphere model parameters" << std::endl;
std::shared_ptr<Gps_Iono> tmp_obj = std::make_shared<Gps_Iono>(supl_client_ephemeris_.gps_iono);
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::cout << "SUPL: Received GPS UTC model parameters" << 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));
}
// Save iono and UTC model data to xml file
std::string iono_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_iono_xml", iono_default_xml_filename);
if (supl_client_ephemeris_.save_iono_xml(iono_xml_filename, supl_client_ephemeris_.gps_iono) == true)
{
std::cout << "SUPL: Iono data file created" << std::endl;
}
else
{
std::cout << "SUPL: Failed to create Iono data file" << std::endl;
}
std::string utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_utc_model_xml", utc_default_xml_filename);
if (supl_client_ephemeris_.save_utc_xml(utc_xml_filename, supl_client_ephemeris_.gps_utc) == true)
{
std::cout << "SUPL: UTC model data file created" << std::endl;
}
else
{
std::cout << "SUPL: Failed to create UTC model data file" << std::endl;
}
}
else
{
std::cout << "ERROR: SUPL client for Almanac returned " << error << std::endl;
std::cout << "Please check internet connection and SUPL server configuration" << error << std::endl;
std::cout << "Disabling SUPL assistance." << std::endl;
std::cout << "ERROR: SUPL client for almanac data returned " << error << std::endl;
std::cout << "Please check your network connectivity and SUPL server configuration" << std::endl;
}
// Request acquisition assistance
supl_client_acquisition_.request = 2;
std::cout << "SUPL: Try read Acquisition assistance from SUPL server..." << std::endl;
std::cout << "SUPL: Try to read acquisition assistance data from SUPL server..." << std::endl;
error = supl_client_acquisition_.get_assistance(supl_mcc, supl_mns, supl_lac, supl_ci);
if (error == 0)
{
@ -477,30 +549,39 @@ void ControlThread::assist_GNSS()
gps_acq_iter != supl_client_acquisition_.gps_acq_map.cend();
gps_acq_iter++)
{
std::cout << "SUPL: Received Acquisition assistance for GPS SV " << gps_acq_iter->first << std::endl;
std::cout << "SUPL: Received acquisition assistance data for satellite " << Gnss_Satellite("GPS", gps_acq_iter->second.i_satellite_PRN) << std::endl;
global_gps_acq_assist_map.write(gps_acq_iter->second.i_satellite_PRN, gps_acq_iter->second);
}
if (supl_client_acquisition_.gps_ref_loc.valid == true)
{
std::cout << "SUPL: Received Ref Location (Acquisition Assistance)" << std::endl;
std::cout << "SUPL: Received Ref Location data (Acquisition Assistance)" << std::endl;
std::shared_ptr<Gps_Ref_Location> tmp_obj = std::make_shared<Gps_Ref_Location>(supl_client_acquisition_.gps_ref_loc);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
if (supl_client_acquisition_.gps_time.valid == true)
{
std::cout << "SUPL: Received Ref Time (Acquisition Assistance)" << std::endl;
std::cout << "SUPL: Received Ref Time data (Acquisition Assistance)" << std::endl;
std::shared_ptr<Gps_Ref_Time> tmp_obj = std::make_shared<Gps_Ref_Time>(supl_client_acquisition_.gps_time);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
}
else
{
std::cout << "ERROR: SUPL client for Acquisition assistance returned " << error << std::endl;
std::cout << "Please check internet connection and SUPL server configuration" << error << std::endl;
std::cout << "Disabling SUPL assistance.." << std::endl;
std::cout << "ERROR: SUPL client for acquisition assistance returned " << error << std::endl;
std::cout << "Please check your network connectivity and SUPL server configuration" << std::endl;
std::cout << "Disabling SUPL acquisition assistance." << std::endl;
}
}
}
if ((enable_gps_supl_assistance == false) and (enable_agnss_xml == true))
{
// read assistance from file
if (read_assistance_from_XML())
{
std::cout << "GNSS assistance data loaded from local XML file(s)." << std::endl;
}
}
}

View File

@ -177,6 +177,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_*/

View File

@ -25,6 +25,7 @@ set(SYSTEM_TESTING_LIB_SOURCES
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${Boost_INCLUDE_DIRS}
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${MATIO_INCLUDE_DIRS}

View File

@ -29,6 +29,7 @@ set(SIGNAL_PROCESSING_TESTING_LIB_SOURCES
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${Boost_INCLUDE_DIRS}
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${MATIO_INCLUDE_DIRS}