1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-04 18:00:49 +00:00

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

This commit is contained in:
Carles Fernandez 2018-10-06 14:22:57 +02:00
commit e8efd981ac
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 45 additions and 26 deletions

View File

@ -370,13 +370,13 @@ void gnss_sdr_supl_client::read_supl_data()
bool gnss_sdr_supl_client::load_ephemeris_xml(const std::string file_name) bool gnss_sdr_supl_client::load_ephemeris_xml(const std::string file_name)
{ {
std::ifstream ifs;
try try
{ {
std::ifstream ifs(file_name.c_str(), std::ifstream::binary | std::ifstream::in); ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs); boost::archive::xml_iarchive xml(ifs);
gps_ephemeris_map.clear(); gps_ephemeris_map.clear();
xml >> boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", this->gps_ephemeris_map); xml >> boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", this->gps_ephemeris_map);
ifs.close();
LOG(INFO) << "Loaded Ephemeris map data with " << this->gps_ephemeris_map.size() << " satellites"; LOG(INFO) << "Loaded Ephemeris map data with " << this->gps_ephemeris_map.size() << " satellites";
} }
catch (std::exception& e) catch (std::exception& e)
@ -384,6 +384,7 @@ bool gnss_sdr_supl_client::load_ephemeris_xml(const std::string file_name)
LOG(WARNING) << e.what() << "File: " << file_name; LOG(WARNING) << e.what() << "File: " << file_name;
return false; return false;
} }
ifs.close();
return true; return true;
} }
@ -392,12 +393,13 @@ bool gnss_sdr_supl_client::save_ephemeris_map_xml(const std::string file_name, s
{ {
if (eph_map.empty() == false) if (eph_map.empty() == false)
{ {
std::ofstream ofs;
try try
{ {
std::ofstream ofs(file_name.c_str(), std::ofstream::trunc | std::ofstream::out); ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs); boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", eph_map); xml << boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", eph_map);
ofs.close();
LOG(INFO) << "Saved Ephemeris map data"; LOG(INFO) << "Saved Ephemeris map data";
} }
catch (std::exception& e) catch (std::exception& e)
@ -405,6 +407,7 @@ bool gnss_sdr_supl_client::save_ephemeris_map_xml(const std::string file_name, s
LOG(WARNING) << e.what(); LOG(WARNING) << e.what();
return false; return false;
} }
ofs.close();
return true; return true;
} }
else else
@ -417,12 +420,13 @@ bool gnss_sdr_supl_client::save_ephemeris_map_xml(const std::string file_name, s
bool gnss_sdr_supl_client::load_utc_xml(const std::string file_name) bool gnss_sdr_supl_client::load_utc_xml(const std::string file_name)
{ {
std::ifstream ifs;
try try
{ {
std::ifstream ifs(file_name.c_str(), std::ifstream::binary | std::ifstream::in); ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs); boost::archive::xml_iarchive xml(ifs);
xml >> boost::serialization::make_nvp("GNSS-SDR_utc_map", this->gps_utc); xml >> boost::serialization::make_nvp("GNSS-SDR_utc_map", this->gps_utc);
ifs.close();
LOG(INFO) << "Loaded UTC model data"; LOG(INFO) << "Loaded UTC model data";
} }
catch (std::exception& e) catch (std::exception& e)
@ -430,6 +434,7 @@ bool gnss_sdr_supl_client::load_utc_xml(const std::string file_name)
LOG(WARNING) << e.what() << "File: " << file_name; LOG(WARNING) << e.what() << "File: " << file_name;
return false; return false;
} }
ifs.close();
return true; return true;
} }
@ -438,12 +443,12 @@ bool gnss_sdr_supl_client::save_utc_map_xml(const std::string file_name, std::ma
{ {
if (utc_map.empty() == false) if (utc_map.empty() == false)
{ {
std::ofstream ofs;
try try
{ {
std::ofstream ofs(file_name.c_str(), std::ofstream::trunc | std::ofstream::out); ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs); boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_utc_map", utc_map); xml << boost::serialization::make_nvp("GNSS-SDR_utc_map", utc_map);
ofs.close();
LOG(INFO) << "Saved UTC Model data"; LOG(INFO) << "Saved UTC Model data";
} }
catch (std::exception& e) catch (std::exception& e)
@ -451,6 +456,7 @@ bool gnss_sdr_supl_client::save_utc_map_xml(const std::string file_name, std::ma
LOG(WARNING) << e.what(); LOG(WARNING) << e.what();
return false; return false;
} }
ofs.close();
return true; return true;
} }
else else
@ -463,12 +469,12 @@ bool gnss_sdr_supl_client::save_utc_map_xml(const std::string file_name, std::ma
bool gnss_sdr_supl_client::load_iono_xml(const std::string file_name) bool gnss_sdr_supl_client::load_iono_xml(const std::string file_name)
{ {
std::ifstream ifs;
try try
{ {
std::ifstream ifs(file_name.c_str(), std::ifstream::binary | std::ifstream::in); ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs); boost::archive::xml_iarchive xml(ifs);
xml >> boost::serialization::make_nvp("GNSS-SDR_iono_map", this->gps_iono); xml >> boost::serialization::make_nvp("GNSS-SDR_iono_map", this->gps_iono);
ifs.close();
LOG(INFO) << "Loaded IONO model data"; LOG(INFO) << "Loaded IONO model data";
} }
catch (std::exception& e) catch (std::exception& e)
@ -476,6 +482,7 @@ bool gnss_sdr_supl_client::load_iono_xml(const std::string file_name)
LOG(WARNING) << e.what() << "File: " << file_name; LOG(WARNING) << e.what() << "File: " << file_name;
return false; return false;
} }
ifs.close();
return true; return true;
} }
@ -484,12 +491,12 @@ bool gnss_sdr_supl_client::save_iono_map_xml(const std::string file_name, std::m
{ {
if (iono_map.empty() == false) if (iono_map.empty() == false)
{ {
std::ofstream ofs;
try try
{ {
std::ofstream ofs(file_name.c_str(), std::ofstream::trunc | std::ofstream::out); ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs); boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_iono_map", iono_map); xml << boost::serialization::make_nvp("GNSS-SDR_iono_map", iono_map);
ofs.close();
LOG(INFO) << "Saved IONO Model data"; LOG(INFO) << "Saved IONO Model data";
} }
catch (std::exception& e) catch (std::exception& e)
@ -497,6 +504,7 @@ bool gnss_sdr_supl_client::save_iono_map_xml(const std::string file_name, std::m
LOG(WARNING) << e.what(); LOG(WARNING) << e.what();
return false; return false;
} }
ofs.close();
return true; return true;
} }
else else
@ -509,12 +517,12 @@ bool gnss_sdr_supl_client::save_iono_map_xml(const std::string file_name, std::m
bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name) bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name)
{ {
std::ifstream ifs;
try try
{ {
std::ifstream ifs(file_name.c_str(), std::ifstream::binary | std::ifstream::in); ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs); boost::archive::xml_iarchive xml(ifs);
xml >> boost::serialization::make_nvp("GNSS-SDR_ref_time_map", this->gps_time); xml >> boost::serialization::make_nvp("GNSS-SDR_ref_time_map", this->gps_time);
ifs.close();
LOG(INFO) << "Loaded Ref Time data"; LOG(INFO) << "Loaded Ref Time data";
} }
catch (std::exception& e) catch (std::exception& e)
@ -522,6 +530,7 @@ bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name)
LOG(WARNING) << e.what() << "File: " << file_name; LOG(WARNING) << e.what() << "File: " << file_name;
return false; return false;
} }
ifs.close();
return true; return true;
} }
@ -530,12 +539,13 @@ bool gnss_sdr_supl_client::save_ref_time_map_xml(const std::string file_name, st
{ {
if (ref_time_map.empty() == false) if (ref_time_map.empty() == false)
{ {
std::ofstream ofs;
try try
{ {
std::ofstream ofs(file_name.c_str(), std::ofstream::trunc | std::ofstream::out); ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs); boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_ref_time_map", ref_time_map); xml << boost::serialization::make_nvp("GNSS-SDR_ref_time_map", ref_time_map);
ofs.close();
LOG(INFO) << "Saved Ref Time data"; LOG(INFO) << "Saved Ref Time data";
} }
catch (std::exception& e) catch (std::exception& e)
@ -543,6 +553,7 @@ bool gnss_sdr_supl_client::save_ref_time_map_xml(const std::string file_name, st
LOG(WARNING) << e.what(); LOG(WARNING) << e.what();
return false; return false;
} }
ofs.close();
return true; return true;
} }
else else
@ -555,12 +566,12 @@ bool gnss_sdr_supl_client::save_ref_time_map_xml(const std::string file_name, st
bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name) bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name)
{ {
std::ifstream ifs;
try try
{ {
std::ifstream ifs(file_name.c_str(), std::ifstream::binary | std::ifstream::in); ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs); boost::archive::xml_iarchive xml(ifs);
xml >> boost::serialization::make_nvp("GNSS-SDR_ref_location_map", this->gps_ref_loc); xml >> boost::serialization::make_nvp("GNSS-SDR_ref_location_map", this->gps_ref_loc);
ifs.close();
LOG(INFO) << "Loaded Ref Location data"; LOG(INFO) << "Loaded Ref Location data";
} }
catch (std::exception& e) catch (std::exception& e)
@ -568,6 +579,7 @@ bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name)
LOG(WARNING) << e.what() << "File: " << file_name; LOG(WARNING) << e.what() << "File: " << file_name;
return false; return false;
} }
ifs.close();
return true; return true;
} }
@ -576,12 +588,12 @@ bool gnss_sdr_supl_client::save_ref_location_map_xml(const std::string file_name
{ {
if (ref_location_map.empty() == false) if (ref_location_map.empty() == false)
{ {
std::ofstream ofs;
try try
{ {
std::ofstream ofs(file_name.c_str(), std::ofstream::trunc | std::ofstream::out); ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs); boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_ref_location_map", ref_location_map); xml << boost::serialization::make_nvp("GNSS-SDR_ref_location_map", ref_location_map);
ofs.close();
LOG(INFO) << "Saved Ref Location data"; LOG(INFO) << "Saved Ref Location data";
} }
catch (std::exception& e) catch (std::exception& e)
@ -589,6 +601,7 @@ bool gnss_sdr_supl_client::save_ref_location_map_xml(const std::string file_name
LOG(WARNING) << e.what(); LOG(WARNING) << e.what();
return false; return false;
} }
ofs.close();
return true; return true;
} }
else else

View File

@ -179,6 +179,7 @@ endif(ENABLE_UNIT_TESTING_MINIMAL)
################################################################################ ################################################################################
# Optional generator # Optional generator
################################################################################ ################################################################################
option(ENABLE_GNSS_SIM_INSTALL "Enable the installation of gnss_sim on the fly" ON)
if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)
if(ENABLE_FPGA) if(ENABLE_FPGA)
set(CROSS_INSTALL_DIR "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}") set(CROSS_INSTALL_DIR "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
@ -189,11 +190,11 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)
set(CROSS_INSTALL_DIR "") set(CROSS_INSTALL_DIR "")
endif(ENABLE_FPGA) endif(ENABLE_FPGA)
find_package(GnssSimulator QUIET) find_package(GnssSimulator QUIET)
if(GNSS-SIMULATOR_FOUND) if(GNSS-SIMULATOR_FOUND OR NOT ENABLE_GNSS_SIM_INSTALL)
add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}") add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}")
add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/brdc3540.14n") add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/brdc3540.14n")
add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/circle.csv") add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/circle.csv")
else(GNSS-SIMULATOR_FOUND) else(GNSS-SIMULATOR_FOUND OR NOT ENABLE_GNSS_SIM_INSTALL)
ExternalProject_Add( ExternalProject_Add(
gnss-sim gnss-sim
GIT_REPOSITORY https://bitbucket.org/jarribas/gnss-simulator GIT_REPOSITORY https://bitbucket.org/jarribas/gnss-simulator
@ -219,7 +220,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)
add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/brdc3540.14n") add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/brdc3540.14n")
add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/circle.csv") add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/circle.csv")
endif(ENABLE_INSTALL_TESTS) endif(ENABLE_INSTALL_TESTS)
endif(GNSS-SIMULATOR_FOUND) endif(GNSS-SIMULATOR_FOUND OR NOT ENABLE_GNSS_SIM_INSTALL)
################################################################################ ################################################################################
# Local installation of GPSTk http://www.gpstk.org/ # Local installation of GPSTk http://www.gpstk.org/

View File

@ -478,3 +478,4 @@
</second> </second>
</item> </item>
</GNSS-SDR_ephemeris_map> </GNSS-SDR_ephemeris_map>
</boost_serialization>

View File

@ -355,3 +355,4 @@
</second> </second>
</item> </item>
</GNSS-SDR_gnss_synchro_map> </GNSS-SDR_gnss_synchro_map>
</boost_serialization>

View File

@ -318,6 +318,8 @@ rtk_t configure_rtklib_options()
rtkinit(&rtk, &rtklib_configuration_options); rtkinit(&rtk, &rtklib_configuration_options);
return rtk; return rtk;
} }
//todo: add test cases for Galileo E1, E5 and GPS L5 //todo: add test cases for Galileo E1, E5 and GPS L5
TEST(RTKLibSolverTest, test1) TEST(RTKLibSolverTest, test1)
{ {
@ -371,20 +373,21 @@ TEST(RTKLibSolverTest, test1)
//load from xml (boost serialize) //load from xml (boost serialize)
std::string file_name = path + "data/rtklib_test/obs_test1.xml"; std::string file_name = path + "data/rtklib_test/obs_test1.xml";
std::ifstream ifs;
try try
{ {
std::ifstream ifs(file_name.c_str(), std::ifstream::binary | std::ifstream::in); ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs); boost::archive::xml_iarchive xml(ifs);
gnss_synchro_map.clear(); gnss_synchro_map.clear();
xml >> boost::serialization::make_nvp("GNSS-SDR_gnss_synchro_map", gnss_synchro_map); xml >> boost::serialization::make_nvp("GNSS-SDR_gnss_synchro_map", gnss_synchro_map);
ifs.close();
std::cout << "Loaded gnss_synchro map data with " << gnss_synchro_map.size() << " pseudoranges" << std::endl; std::cout << "Loaded gnss_synchro map data with " << gnss_synchro_map.size() << " pseudoranges" << std::endl;
} }
catch (std::exception& e) catch (std::exception& e)
{ {
std::cout << e.what() << "File: " << file_name; std::cout << e.what() << "File: " << file_name;
} }
ifs.close();
// solve // solve
bool pvt_valid = false; bool pvt_valid = false;