1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-07-04 19:03:14 +00:00

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

This commit is contained in:
Carles Fernandez 2018-10-18 15:47:49 +02:00
commit 13ebaf4907
10 changed files with 294 additions and 44 deletions

View File

@ -474,6 +474,25 @@ bool gnss_sdr_supl_client::load_utc_xml(const std::string file_name)
}
bool gnss_sdr_supl_client::load_gal_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_gal_utc_map", this->gal_utc);
LOG(INFO) << "Loaded Galileo UTC model data";
}
catch (std::exception& e)
{
LOG(WARNING) << e.what() << "File: " << file_name;
return false;
}
return true;
}
bool gnss_sdr_supl_client::save_utc_map_xml(const std::string file_name, std::map<int, Gps_Utc_Model> utc_map)
{
if (utc_map.empty() == false)
@ -520,6 +539,25 @@ bool gnss_sdr_supl_client::load_iono_xml(const std::string file_name)
}
bool gnss_sdr_supl_client::load_gal_iono_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_iono_gal_map", this->gal_iono);
LOG(INFO) << "Loaded Galileo IONO model data";
}
catch (std::exception& e)
{
LOG(WARNING) << e.what() << "File: " << file_name;
return false;
}
return true;
}
bool gnss_sdr_supl_client::save_iono_map_xml(const std::string file_name, std::map<int, Gps_Iono> iono_map)
{
if (iono_map.empty() == false)

View File

@ -48,6 +48,8 @@ extern "C"
#include "gps_ref_location.h"
#include "gps_cnav_ephemeris.h"
#include "galileo_ephemeris.h"
#include "galileo_utc_model.h"
#include "galileo_iono.h"
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/serialization/map.hpp>
@ -86,10 +88,12 @@ public:
// ionospheric model
Gps_Iono gps_iono;
Galileo_Iono gal_iono;
// reference time
Gps_Ref_Time gps_time;
// UTC model
Gps_Utc_Model gps_utc;
Galileo_Utc_Model gal_utc;
// reference location
Gps_Ref_Location gps_ref_loc;
// Acquisition Assistance map
@ -132,10 +136,15 @@ public:
std::map<int, Gps_Ephemeris> eph_map);
/*!
* \brief Read utc model from XML file
* \brief Read GPS utc model from XML file
*/
bool load_utc_xml(const std::string file_name);
/*!
* \brief Read Galileo utc model from XML file
*/
bool load_gal_utc_xml(const std::string file_name);
/*!
* \brief Save utc model map to XML file
* To be called by ControlThread::gps_utc_model_data_write_to_XML()
@ -148,6 +157,11 @@ public:
*/
bool load_iono_xml(const std::string file_name);
/*!
* \brief Read Galileo iono from XML file
*/
bool load_gal_iono_xml(const std::string file_name);
/*!
* \brief Save iono map to XML file
*/

View File

@ -201,10 +201,12 @@ bool ControlThread::read_assistance_from_XML()
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 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::cout << "Trying to read GNSS ephemeris from XML file(s): "
<< ((eph_xml_filename.compare(eph_default_xml_filename) != 0) ? eph_xml_filename + " " : "")
@ -253,39 +255,49 @@ bool ControlThread::read_assistance_from_XML()
}
ret = true;
}
if (supl_client_acquisition_.load_utc_xml(utc_xml_filename) == true)
{
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_acquisition_.load_iono_xml(iono_xml_filename) == true)
{
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_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 iono 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 iono 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;
}
// Only look for {utc, iono, ref time, ref location} if SUPL is enabled
// Only look for {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 read UTC model from XML
if (supl_client_acquisition_.load_utc_xml(utc_xml_filename) == true)
{
LOG(INFO) << "SUPL: Read XML UTC model";
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));
}
else
{
LOG(INFO) << "SUPL: couldn't read UTC model XML";
}
// Try to read Iono model from XML
if (supl_client_acquisition_.load_iono_xml(iono_xml_filename) == true)
{
LOG(INFO) << "SUPL: Read XML IONO model";
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));
}
else
{
LOG(INFO) << "SUPL: couldn't read IONO model XML";
}
// Try to read Ref Time from XML
if (supl_client_acquisition_.load_ref_time_xml(ref_time_xml_filename) == true)
{

View File

@ -169,6 +169,8 @@ private:
const std::string ref_location_default_xml_filename = "./gps_ref_location.xml";
const std::string eph_gal_default_xml_filename = "./gal_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_utc_default_xml_filename = "./gal_utc_model.xml";
};
#endif /*GNSS_SDR_CONTROL_THREAD_H_*/

View File

@ -32,6 +32,7 @@
#ifndef GNSS_SDR_GALILEO_IONO_H_
#define GNSS_SDR_GALILEO_IONO_H_
#include <boost/serialization/nvp.hpp>
/*!
* \brief This class is a storage for the GALILEO IONOSPHERIC data as described in Galileo ICD paragraph 5.1.6
@ -61,6 +62,30 @@ public:
* Default constructor
*/
Galileo_Iono();
template <class Archive>
/*!
* \brief Serialize is a boost standard method to be called by the boost XML serialization.
Here is used to save the iono data on disk file.
*/
inline void serialize(Archive& archive, const unsigned int version)
{
using boost::serialization::make_nvp;
if (version)
{
};
archive& make_nvp("ai0_5", ai0_5);
archive& make_nvp("ai1_5", ai1_5);
archive& make_nvp("ai2_5", ai2_5);
archive& make_nvp("Region1_flag_5", Region1_flag_5);
archive& make_nvp("Region2_flag_5", Region2_flag_5);
archive& make_nvp("Region3_flag_5", Region3_flag_5);
archive& make_nvp("Region4_flag_5", Region4_flag_5);
archive& make_nvp("Region5_flag_5", Region5_flag_5);
archive& make_nvp("TOW_5", TOW_5);
archive& make_nvp("WN_5", WN_5);
}
};
#endif

View File

@ -33,6 +33,7 @@
#ifndef GNSS_SDR_GALILEO_UTC_MODEL_H_
#define GNSS_SDR_GALILEO_UTC_MODEL_H_
#include <boost/serialization/nvp.hpp>
/*!
* \brief This class is a storage for the GALILEO UTC MODEL data as described in Galileo ICD
@ -58,6 +59,28 @@ public:
* Default constructor
*/
Galileo_Utc_Model();
template <class Archive>
/*!
* \brief Serialize is a boost standard method to be called by the boost XML serialization.
Here is used to save the UTC data on disk file.
*/
inline void serialize(Archive& archive, const unsigned int version)
{
using boost::serialization::make_nvp;
if (version)
{
};
archive& make_nvp("A0_6", A0_6);
archive& make_nvp("A1_6", A1_6);
archive& make_nvp("Delta_tLS_6", Delta_tLS_6);
archive& make_nvp("t0t_6", t0t_6);
archive& make_nvp("WNot_6", WNot_6);
archive& make_nvp("WN_LSF_6", WN_LSF_6);
archive& make_nvp("DN_6", DN_6);
archive& make_nvp("Delta_tLSF_6", Delta_tLSF_6);
}
};
#endif

View File

@ -42,5 +42,10 @@ DEFINE_bool(use_ref_motion_file, false, "Enable or disable the use of a referenc
DEFINE_int32(ref_motion_file_type, 1, "Type of reference motion file: 1- Spirent CSV motion file");
DEFINE_string(ref_motion_filename, std::string("motion.csv"), "Path and filename for the reference motion file");
DEFINE_string(pvt_solver_dump_filename, std::string("PVT_pvt.dat"), "Path and filename for the PVT solver binary dump file");
DEFINE_double(static_2D_error_m, 2.0, "Static scenario 2D (East, North) positioning error threshold [meters]");
DEFINE_double(static_3D_error_m, 5.0, "Static scenario 3D (East, North, Up) positioning error threshold [meters]");
DEFINE_double(accuracy_CEP, 2.0, "Static scenario 2D (East, North) accuracy Circular Error Position (CEP) threshold [meters]");
DEFINE_double(precision_SEP, 10.0, "Static scenario 3D (East, North, Up) precision Spherical Error Position (SEP) threshold [meters]");
DEFINE_double(dynamic_3D_position_RMSE, 10.0, "Dynamic scenario 3D (ECEF) accuracy RMSE threshold [meters]");
DEFINE_double(dynamic_3D_velocity_RMSE, 5.0, "Dynamic scenario 3D (ECEF) accuracy RMSE threshold [meters/second]");
#endif

View File

@ -634,10 +634,10 @@ void PositionSystemTest::check_results()
double accuracy_CEP = 0.62 * sqrt(sigma_N_2_accuracy) + 0.56 * sqrt(sigma_E_2_accuracy);
double precision_SEP = 0.51 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision);
EXPECT_LT(static_2D_error_m, 2.0);
EXPECT_LT(static_2D_error_m, 5.0);
ASSERT_LT(accuracy_CEP, 2.0);
ASSERT_LT(precision_SEP, 5.0);
EXPECT_LT(static_2D_error_m, FLAGS_static_2D_error_m);
EXPECT_LT(static_2D_error_m, FLAGS_static_2D_error_m);
ASSERT_LT(accuracy_CEP, FLAGS_accuracy_CEP);
ASSERT_LT(precision_SEP, FLAGS_precision_SEP);
if (FLAGS_plot_position_test == true)
{
@ -841,8 +841,8 @@ void PositionSystemTest::check_results()
//ERROR CHECK
//todo: reduce the error tolerance or enable the option to pass the error tolerance by parameter
EXPECT_LT(rmse_R_eb_e, 10.0); //3D RMS positioning error less than 10 meters
EXPECT_LT(rmse_V_eb_e, 5.0); //3D RMS speed error less than 5 meters/s (18 km/h)
EXPECT_LT(rmse_R_eb_e, FLAGS_dynamic_3D_position_RMSE); //3D RMS positioning error less than 10 meters
EXPECT_LT(rmse_V_eb_e, FLAGS_dynamic_3D_velocity_RMSE); //3D RMS speed error less than 5 meters/s (18 km/h)
}
}

View File

@ -32,6 +32,8 @@ include_directories(
${GPSTK_INCLUDE_DIR}
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
add_executable(rinex2assist ${CMAKE_CURRENT_SOURCE_DIR}/main.cc)
target_link_libraries(rinex2assist
@ -45,7 +47,6 @@ if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK)
add_dependencies(rinex2assist gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION})
endif(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK)
add_custom_command(TARGET rinex2assist POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:rinex2assist>
${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:rinex2assist>)

View File

@ -32,6 +32,10 @@
#include "gps_ephemeris.h"
#include "galileo_ephemeris.h"
#include "gps_utc_model.h"
#include "gps_iono.h"
#include "galileo_utc_model.h"
#include "galileo_iono.h"
#include <gflags/gflags.h>
#include <gpstk/Rinex3NavHeader.hpp>
#include <gpstk/Rinex3NavData.hpp>
@ -49,30 +53,31 @@ int main(int argc, char** argv)
"This program comes with ABSOLUTELY NO WARRANTY;\n" +
"See COPYING file to see a copy of the General Public License.\n \n" +
"Usage: \n" +
" rinex2assist <RINEX Nav file input> [<XML file output>]");
" rinex2assist <RINEX Nav file input>");
google::SetUsageMessage(intro_help);
google::SetVersionString("1.0");
google::ParseCommandLineFlags(&argc, &argv, true);
if ((argc < 2) or (argc > 3))
if ((argc != 2))
{
std::cerr << "Usage:" << std::endl;
std::cerr << " " << argv[0]
<< " <RINEX Nav file input> [<XML file output>]"
<< " <RINEX Nav file input>"
<< std::endl;
google::ShutDownCommandLineFlags();
return 1;
}
std::string xml_filename;
if (argc == 3)
{
xml_filename = argv[2];
}
std::map<int, Gps_Ephemeris> eph_map;
std::map<int, Galileo_Ephemeris> eph_gal_map;
Gps_Utc_Model gps_utc_model;
Gps_Iono gps_iono;
Galileo_Utc_Model gal_utc_model;
Galileo_Iono gal_iono;
int i = 0;
int j = 0;
try
@ -93,6 +98,52 @@ int main(int argc, char** argv)
return 1;
}
// Collect UTC parameters from RINEX header
if (hdr.fileSys.compare("G: (GPS)") == 0 || hdr.fileSys.compare("MIXED") == 0)
{
gps_utc_model.valid = (hdr.valid > 2147483648) ? true : false;
gps_utc_model.d_A1 = hdr.mapTimeCorr["GPUT"].A0;
gps_utc_model.d_A0 = hdr.mapTimeCorr["GPUT"].A1;
gps_utc_model.d_t_OT = hdr.mapTimeCorr["GPUT"].refSOW;
gps_utc_model.i_WN_T = hdr.mapTimeCorr["GPUT"].refWeek;
gps_utc_model.d_DeltaT_LS = hdr.leapSeconds;
gps_utc_model.i_WN_LSF = hdr.leapWeek;
gps_utc_model.i_DN = hdr.leapDay;
gps_utc_model.d_DeltaT_LSF = hdr.leapDelta;
// Collect iono parameters from RINEX header
gps_iono.valid = (hdr.mapIonoCorr["GPSA"].param[0] == 0) ? false : true;
gps_iono.d_alpha0 = hdr.mapIonoCorr["GPSA"].param[0];
gps_iono.d_alpha1 = hdr.mapIonoCorr["GPSA"].param[1];
gps_iono.d_alpha2 = hdr.mapIonoCorr["GPSA"].param[2];
gps_iono.d_alpha3 = hdr.mapIonoCorr["GPSA"].param[3];
gps_iono.d_beta0 = hdr.mapIonoCorr["GPSB"].param[0];
gps_iono.d_beta1 = hdr.mapIonoCorr["GPSB"].param[1];
gps_iono.d_beta2 = hdr.mapIonoCorr["GPSB"].param[2];
gps_iono.d_beta3 = hdr.mapIonoCorr["GPSB"].param[3];
}
if (hdr.fileSys.compare("E: (GAL)") == 0 || hdr.fileSys.compare("MIXED") == 0)
{
gal_utc_model.A0_6 = hdr.mapTimeCorr["GAUT"].A0;
gal_utc_model.A1_6 = hdr.mapTimeCorr["GAUT"].A1;
gal_utc_model.Delta_tLS_6 = hdr.leapSeconds;
gal_utc_model.t0t_6 = hdr.mapTimeCorr["GAUT"].refSOW;
gal_utc_model.WNot_6 = hdr.mapTimeCorr["GAUT"].refWeek;
gal_utc_model.WN_LSF_6 = hdr.leapWeek;
gal_utc_model.DN_6 = hdr.leapDay;
gal_utc_model.Delta_tLSF_6 = hdr.leapDelta;
gal_iono.ai0_5 = hdr.mapIonoCorr["GAL"].param[0];
gal_iono.ai1_5 = hdr.mapIonoCorr["GAL"].param[1];
gal_iono.ai2_5 = hdr.mapIonoCorr["GAL"].param[2];
gal_iono.Region1_flag_5 = false;
gal_iono.Region2_flag_5 = false;
gal_iono.Region3_flag_5 = false;
gal_iono.Region4_flag_5 = false;
gal_iono.Region5_flag_5 = false;
gal_iono.TOW_5 = 0.0;
gal_iono.WN_5 = 0.0;
}
// Read navigation data
while (rnffs >> rne)
{
@ -185,7 +236,7 @@ int main(int argc, char** argv)
return 1;
}
// Write XML
// Write XML ephemeris
if (i != 0)
{
std::ofstream ofs;
@ -201,10 +252,11 @@ int main(int argc, char** argv)
}
catch (std::exception& e)
{
std::cerr << "Problem creating the XML file: " << e.what() << std::endl;
std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << std::endl;
google::ShutDownCommandLineFlags();
return 1;
}
std::cout << "Generated file: " << xml_filename << std::endl;
}
if (j != 0)
{
@ -218,10 +270,88 @@ int main(int argc, char** argv)
}
catch (std::exception& e)
{
std::cerr << "Problem creating the XML file: " << e.what() << std::endl;
std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << std::endl;
google::ShutDownCommandLineFlags();
return 1;
}
std::cout << "Generated file: " << xml_filename << std::endl;
}
// Write XML UTC
if (gps_utc_model.valid)
{
std::ofstream ofs3;
xml_filename = "gps_UTC.xml";
try
{
ofs3.open(xml_filename.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs3);
xml << boost::serialization::make_nvp("GNSS-SDR_gps_utc", gps_utc_model);
}
catch (std::exception& e)
{
std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << std::endl;
google::ShutDownCommandLineFlags();
return 1;
}
std::cout << "Generated file: " << xml_filename << std::endl;
}
// Write XML iono
if (gps_iono.valid)
{
std::ofstream ofs4;
xml_filename = "gps_iono.xml";
try
{
ofs4.open(xml_filename.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs4);
xml << boost::serialization::make_nvp("GNSS-SDR_gps_iono", gps_iono);
}
catch (std::exception& e)
{
std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << std::endl;
google::ShutDownCommandLineFlags();
return 1;
}
std::cout << "Generated file: " << xml_filename << std::endl;
}
if (gal_utc_model.A0_6 != 0)
{
std::ofstream ofs5;
xml_filename = "gal_utc.xml";
try
{
ofs5.open(xml_filename.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs5);
xml << boost::serialization::make_nvp("GNSS-SDR_gal_utc", gal_utc_model);
}
catch (std::exception& e)
{
std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << std::endl;
google::ShutDownCommandLineFlags();
return 1;
}
std::cout << "Generated file: " << xml_filename << std::endl;
}
if (gal_iono.ai0_5 != 0)
{
std::ofstream ofs7;
xml_filename = "gal_iono.xml";
try
{
ofs7.open(xml_filename.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs7);
xml << boost::serialization::make_nvp("GNSS-SDR_gal_iono", gal_iono);
}
catch (std::exception& e)
{
std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << std::endl;
google::ShutDownCommandLineFlags();
return 1;
}
std::cout << "Generated file: " << xml_filename << std::endl;
}
google::ShutDownCommandLineFlags();
return 0;