mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 07:13:03 +00:00 
			
		
		
		
	Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into tracking_debug
This commit is contained in:
		| @@ -752,18 +752,34 @@ endif() | ||||
|  | ||||
|  | ||||
|  | ||||
| ################################################################################ | ||||
| # Log4cpp - http://log4cpp.sourceforge.net/ | ||||
| ################################################################################ | ||||
| find_package(LOG4CPP) | ||||
| set_package_properties(LOG4CPP PROPERTIES | ||||
|     URL "http://log4cpp.sourceforge.net/" | ||||
|     DESCRIPTION "Library of C++ classes for flexible logging to files" | ||||
|     PURPOSE "Required by GNU Radio." | ||||
|     TYPE REQUIRED | ||||
| ) | ||||
| if(NOT LOG4CPP_FOUND) | ||||
|     message(FATAL_ERROR "*** Log4cpp is required to build gnss-sdr") | ||||
| endif() | ||||
|  | ||||
|  | ||||
|  | ||||
| ################################################################################ | ||||
| # Dectect availability of std::filesystem | ||||
| ################################################################################ | ||||
| set(FILESYSTEM_FOUND FALSE) | ||||
| if(NOT (GNURADIO_VERSION VERSION_LESS 3.8)) | ||||
| if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND LOG4CPP_READY_FOR_CXX17) | ||||
|     # Check if we have std::filesystem | ||||
|     if(NOT (CMAKE_VERSION VERSION_LESS 3.8)) | ||||
|         if(POLICY CMP0057) | ||||
|             cmake_policy(SET CMP0057 NEW) | ||||
|         endif() | ||||
|         if(NOT ENABLE_UNIT_TESTING_EXTRA) # Workaround for GPSTk | ||||
|             find_package(FILESYSTEM) | ||||
|             find_package(FILESYSTEM COMPONENTS Final Experimental) | ||||
|             set_package_properties(FILESYSTEM PROPERTIES | ||||
|                 URL "https://en.cppreference.com/w/cpp/filesystem" | ||||
|                 DESCRIPTION "Provides facilities for performing operations on file systems and their components" | ||||
| @@ -894,8 +910,6 @@ endif() | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| ################################################################################ | ||||
| # VOLK - Vector-Optimized Library of Kernels | ||||
| ################################################################################ | ||||
| @@ -912,22 +926,6 @@ endif() | ||||
|  | ||||
|  | ||||
|  | ||||
| ################################################################################ | ||||
| # Log4cpp - http://log4cpp.sourceforge.net/ | ||||
| ################################################################################ | ||||
| find_package(LOG4CPP) | ||||
| set_package_properties(LOG4CPP PROPERTIES | ||||
|     URL "http://log4cpp.sourceforge.net/" | ||||
|     DESCRIPTION "Library of C++ classes for flexible logging to files" | ||||
|     PURPOSE "Required by GNU Radio." | ||||
|     TYPE REQUIRED | ||||
| ) | ||||
| if(NOT LOG4CPP_FOUND) | ||||
|     message(FATAL_ERROR "*** Log4cpp is required to build gnss-sdr") | ||||
| endif() | ||||
|  | ||||
|  | ||||
|  | ||||
| ################################################################################ | ||||
| # volk_gnsssdr module - GNSS-SDR's own VOLK library | ||||
| ################################################################################ | ||||
|   | ||||
| @@ -39,6 +39,20 @@ find_path(LOG4CPP_INCLUDE_DIR log4cpp/Category.hh | ||||
|   $ENV{LOG4CPP_ROOT}/include | ||||
| ) | ||||
|  | ||||
| if(LOG4CPP_INCLUDE_DIR) | ||||
|     file(STRINGS ${LOG4CPP_INCLUDE_DIR}/log4cpp/Priority.hh _log4cpp_Priority) | ||||
|     set(_log4cpp_cxx17 TRUE) | ||||
|     foreach(_loop_var IN LISTS _log4cpp_Priority) | ||||
|         string(STRIP "${_loop_var}" _file_line) | ||||
|         if("throw(std::invalid_argument);" STREQUAL "${_file_line}") | ||||
|             set(_log4cpp_cxx17 FALSE) | ||||
|         endif() | ||||
|     endforeach() | ||||
|     if(${_log4cpp_cxx17}) | ||||
|         set(LOG4CPP_READY_FOR_CXX17 TRUE) | ||||
|     endif() | ||||
| endif() | ||||
|  | ||||
| set(LOG4CPP_NAMES log4cpp) | ||||
| find_library(LOG4CPP_LIBRARY | ||||
|   NAMES ${LOG4CPP_NAMES} | ||||
|   | ||||
| @@ -30,6 +30,9 @@ add_library(pvt_gr_blocks ${PVT_GR_BLOCKS_SOURCES} ${PVT_GR_BLOCKS_HEADERS}) | ||||
|  | ||||
| if(${FILESYSTEM_FOUND}) | ||||
|     target_compile_definitions(pvt_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|     if(${find_experimental}) | ||||
|         target_compile_definitions(pvt_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|     endif() | ||||
|     target_link_libraries(pvt_gr_blocks PRIVATE std::filesystem) | ||||
| else() | ||||
|     target_link_libraries(pvt_gr_blocks PRIVATE Boost::filesystem Boost::system) | ||||
|   | ||||
| @@ -83,10 +83,15 @@ | ||||
| #include <sys/msg.h>                    // for msgctl | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #include <filesystem> | ||||
| #include <system_error> | ||||
| namespace fs = std::filesystem; | ||||
| namespace errorlib = std; | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/path.hpp> | ||||
| #include <boost/system/error_code.hpp>  // for error_code | ||||
|   | ||||
| @@ -63,6 +63,9 @@ add_library(pvt_libs ${PVT_LIB_SOURCES} ${PVT_LIB_HEADERS}) | ||||
|  | ||||
| if(${FILESYSTEM_FOUND}) | ||||
|     target_compile_definitions(pvt_libs PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|     if(${find_experimental}) | ||||
|         target_compile_definitions(pvt_libs PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|     endif() | ||||
|     target_link_libraries(pvt_libs PRIVATE std::filesystem) | ||||
| else() | ||||
|     target_link_libraries(pvt_libs PRIVATE Boost::filesystem Boost::system) | ||||
|   | ||||
| @@ -33,15 +33,6 @@ | ||||
| #include "geojson_printer.h" | ||||
| #include "pvt_solution.h" | ||||
| #include <boost/date_time/posix_time/posix_time.hpp> | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #include <filesystem> | ||||
| #include <system_error> | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| #endif | ||||
| #include <glog/logging.h> | ||||
| #include <cstdio>     // for remove | ||||
| #include <ctime>      // for tm | ||||
| @@ -51,9 +42,20 @@ | ||||
| #include <sstream>    // for stringstream | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| namespace fs = std::filesystem; | ||||
| #include <system_error> | ||||
| namespace errorlib = std; | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| namespace fs = boost::filesystem; | ||||
| namespace errorlib = boost::system; | ||||
| #endif | ||||
|   | ||||
| @@ -33,15 +33,6 @@ | ||||
| #include "gpx_printer.h" | ||||
| #include "rtklib_solver.h" | ||||
| #include <boost/date_time/posix_time/posix_time.hpp> | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #include <filesystem> | ||||
| #include <system_error> | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| #endif | ||||
| #include <glog/logging.h> | ||||
| #include <cstdio>     // for remove | ||||
| #include <ctime>      // for tm | ||||
| @@ -51,9 +42,20 @@ | ||||
| #include <sstream>    // for stringstream | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| namespace fs = std::filesystem; | ||||
| #include <system_error> | ||||
| namespace errorlib = std; | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| namespace fs = boost::filesystem; | ||||
| namespace errorlib = boost::system; | ||||
| #endif | ||||
|   | ||||
| @@ -33,15 +33,6 @@ | ||||
| #include "kml_printer.h" | ||||
| #include "rtklib_solver.h" | ||||
| #include <boost/date_time/posix_time/posix_time.hpp> | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #include <filesystem> | ||||
| #include <system_error> | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| #endif | ||||
| #include <glog/logging.h> | ||||
| #include <cstdio>     // for remove | ||||
| #include <cstdlib>    // for mkstemp | ||||
| @@ -55,9 +46,20 @@ | ||||
| #include <sys/types.h>  //for mode_t | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| namespace fs = std::filesystem; | ||||
| #include <system_error> | ||||
| namespace errorlib = std; | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| namespace fs = boost::filesystem; | ||||
| namespace errorlib = boost::system; | ||||
| #endif | ||||
|   | ||||
| @@ -36,15 +36,6 @@ | ||||
| #include "nmea_printer.h" | ||||
| #include "rtklib_solution.h" | ||||
| #include "rtklib_solver.h" | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #include <filesystem> | ||||
| #include <system_error> | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| #endif | ||||
| #include <glog/logging.h> | ||||
| #include <cstdint> | ||||
| #include <exception> | ||||
| @@ -53,9 +44,20 @@ | ||||
| #include <termios.h> | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| namespace fs = std::filesystem; | ||||
| #include <system_error> | ||||
| namespace errorlib = std; | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| namespace fs = boost::filesystem; | ||||
| namespace errorlib = boost::system; | ||||
| #endif | ||||
|   | ||||
| @@ -53,15 +53,6 @@ | ||||
| #include <boost/date_time/gregorian/gregorian.hpp> | ||||
| #include <boost/date_time/local_time/local_time.hpp> | ||||
| #include <boost/date_time/time_zone_base.hpp> | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #include <filesystem> | ||||
| #include <system_error> | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| #endif | ||||
| #include <glog/logging.h> | ||||
| #include <algorithm>  // for min and max | ||||
| #include <cmath>      // for floor | ||||
| @@ -76,9 +67,20 @@ | ||||
| #include <vector> | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| namespace fs = std::filesystem; | ||||
| #include <system_error> | ||||
| namespace errorlib = std; | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| namespace fs = boost::filesystem; | ||||
| namespace errorlib = boost::system; | ||||
| #endif | ||||
|   | ||||
| @@ -39,16 +39,6 @@ | ||||
| #include "gps_cnav_ephemeris.h" | ||||
| #include "gps_ephemeris.h" | ||||
| #include "rtcm.h" | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #include <filesystem> | ||||
| #include <system_error> | ||||
| #else | ||||
| #include <boost/date_time/posix_time/posix_time.hpp> | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_codes | ||||
| #endif | ||||
| #include <glog/logging.h> | ||||
| #include <cstdio>     // for remove | ||||
| #include <ctime>      // for tm | ||||
| @@ -59,9 +49,20 @@ | ||||
| #include <unistd.h>   // for close, write | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| namespace fs = std::filesystem; | ||||
| #include <system_error> | ||||
| namespace errorlib = std; | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| namespace fs = boost::filesystem; | ||||
| namespace errorlib = boost::system; | ||||
| #endif | ||||
|   | ||||
| @@ -68,6 +68,9 @@ add_library(acquisition_gr_blocks ${ACQ_GR_BLOCKS_SOURCES} ${ACQ_GR_BLOCKS_HEADE | ||||
|  | ||||
| if(${FILESYSTEM_FOUND}) | ||||
|     target_compile_definitions(acquisition_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|     if(${find_experimental}) | ||||
|         target_compile_definitions(acquisition_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|     endif() | ||||
|     target_link_libraries(acquisition_gr_blocks PRIVATE std::filesystem) | ||||
| else() | ||||
|     target_link_libraries(acquisition_gr_blocks PRIVATE Boost::filesystem) | ||||
|   | ||||
| @@ -40,7 +40,11 @@ | ||||
| #include "gnss_sdr_create_directory.h" | ||||
| #include "gnss_synchro.h" | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| #else | ||||
| #include <filesystem> | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/path.hpp> | ||||
| #endif | ||||
| @@ -58,7 +62,11 @@ | ||||
| #include <map> | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| namespace fs = boost::filesystem; | ||||
| #endif | ||||
|   | ||||
| @@ -35,7 +35,11 @@ | ||||
| #include "gnss_sdr_create_directory.h" | ||||
| #include "gps_sdr_signal_processing.h" | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| #else | ||||
| #include <filesystem> | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/path.hpp> | ||||
| #endif | ||||
| @@ -48,7 +52,11 @@ | ||||
| #include <sstream> | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| namespace fs = boost::filesystem; | ||||
| #endif | ||||
|   | ||||
| @@ -90,6 +90,9 @@ add_library(algorithms_libs ${GNSS_SPLIBS_SOURCES} ${GNSS_SPLIBS_HEADERS}) | ||||
|  | ||||
| if(${FILESYSTEM_FOUND}) | ||||
|     target_compile_definitions(algorithms_libs PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|     if(${find_experimental}) | ||||
|         target_compile_definitions(algorithms_libs PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|     endif() | ||||
|     target_link_libraries(algorithms_libs PRIVATE std::filesystem) | ||||
| else() | ||||
|     target_link_libraries(algorithms_libs PRIVATE Boost::filesystem Boost::system) | ||||
| @@ -141,6 +144,9 @@ add_library(gnss_sdr_flags gnss_sdr_flags.cc gnss_sdr_flags.h) | ||||
|  | ||||
| if(${FILESYSTEM_FOUND}) | ||||
|     target_compile_definitions(gnss_sdr_flags PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|     if(${find_experimental}) | ||||
|         add_definitions(-DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|     endif() | ||||
|     target_link_libraries(gnss_sdr_flags PRIVATE std::filesystem) | ||||
| else() | ||||
|     target_link_libraries(gnss_sdr_flags PRIVATE Boost::filesystem) | ||||
|   | ||||
| @@ -29,22 +29,24 @@ | ||||
|  */ | ||||
|  | ||||
| #include "gnss_sdr_create_directory.h" | ||||
| #include <exception>  // for exception | ||||
| #include <fstream>    // for ofstream | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #include <filesystem> | ||||
| #include <system_error> | ||||
| namespace errorlib = std; | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| #endif | ||||
| #include <exception>  // for exception | ||||
| #include <fstream>    // for ofstream | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| namespace fs = std::filesystem; | ||||
| namespace errorlib = std; | ||||
| #else | ||||
| namespace fs = boost::filesystem; | ||||
| namespace errorlib = boost::system; | ||||
| #endif | ||||
|   | ||||
| @@ -30,18 +30,20 @@ | ||||
|  | ||||
|  | ||||
| #include "gnss_sdr_flags.h" | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #include <filesystem> | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>  // for exists | ||||
| #endif | ||||
| #include <cstdint> | ||||
| #include <iostream> | ||||
| #include <string> | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| namespace fs = std::filesystem; | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>  // for exists | ||||
| namespace fs = boost::filesystem; | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -30,6 +30,9 @@ add_library(obs_gr_blocks ${OBS_GR_BLOCKS_SOURCES} ${OBS_GR_BLOCKS_HEADERS}) | ||||
|  | ||||
| if(${FILESYSTEM_FOUND}) | ||||
|     target_compile_definitions(obs_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|     if(${find_experimental}) | ||||
|         target_compile_definitions(obs_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|     endif() | ||||
|     target_link_libraries(obs_gr_blocks PRIVATE std::filesystem) | ||||
| else() | ||||
|     target_link_libraries(obs_gr_blocks PRIVATE Boost::filesystem) | ||||
|   | ||||
| @@ -46,13 +46,19 @@ | ||||
| #include <utility>    // for move | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/path.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
| #endif | ||||
|  | ||||
|  | ||||
| hybrid_observables_gs_sptr hybrid_observables_gs_make(unsigned int nchannels_in, unsigned int nchannels_out, bool dump, bool dump_mat, std::string dump_filename) | ||||
| { | ||||
|     return hybrid_observables_gs_sptr(new hybrid_observables_gs(nchannels_in, nchannels_out, dump, dump_mat, std::move(dump_filename))); | ||||
|   | ||||
| @@ -78,6 +78,9 @@ add_library(tracking_gr_blocks | ||||
|  | ||||
| if(${FILESYSTEM_FOUND}) | ||||
|     target_compile_definitions(tracking_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|     if(${find_experimental}) | ||||
|         target_compile_definitions(tracking_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|     endif() | ||||
|     target_link_libraries(tracking_gr_blocks PRIVATE std::filesystem) | ||||
| else() | ||||
|     target_link_libraries(tracking_gr_blocks PRIVATE Boost::filesystem) | ||||
|   | ||||
| @@ -67,8 +67,13 @@ | ||||
| #include <map> | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/path.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
|   | ||||
| @@ -60,8 +60,13 @@ | ||||
| #include <map> | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/path.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
|   | ||||
| @@ -33,6 +33,7 @@ set(TRACKING_LIB_SOURCES | ||||
|     cpu_multicorrelator.cc | ||||
|     cpu_multicorrelator_real_codes.cc | ||||
|     cpu_multicorrelator_16sc.cc | ||||
|     cubature_filter.cc | ||||
|     lock_detectors.cc | ||||
|     tcp_communication.cc | ||||
|     tcp_packet_data.cc | ||||
| @@ -50,6 +51,7 @@ set(TRACKING_LIB_HEADERS | ||||
|     cpu_multicorrelator.h | ||||
|     cpu_multicorrelator_real_codes.h | ||||
|     cpu_multicorrelator_16sc.h | ||||
|     cubature_filter.h | ||||
|     lock_detectors.h | ||||
|     tcp_communication.h | ||||
|     tcp_packet_data.h | ||||
|   | ||||
							
								
								
									
										199
									
								
								src/algorithms/tracking/libs/cubature_filter.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										199
									
								
								src/algorithms/tracking/libs/cubature_filter.cc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,199 @@ | ||||
| /*! | ||||
|  * \file cubature_filter.cc | ||||
|  * \brief Interface of a library with Bayesian noise statistic estimation | ||||
|  * | ||||
|  * Cubature_Filter implements the functionality of the Cubature Kalman | ||||
|  * Filter, which uses multidimensional cubature rules to estimate the | ||||
|  * time evolution of a nonlinear system. | ||||
|  * | ||||
|  * [1] I Arasaratnam and S Haykin. Cubature kalman filters. IEEE | ||||
|  * Transactions on Automatic Control, 54(6):1254–1269,2009. | ||||
|  * | ||||
|  * \authors <ul> | ||||
|  *          <li> Gerald LaMountain, 2019. gerald(at)ece.neu.edu | ||||
|  *          <li> Jordi Vila-Valls 2019. jvila(at)cttc.es | ||||
|  *          </ul> | ||||
|  * ------------------------------------------------------------------------- | ||||
|  * | ||||
|  * Copyright (C) 2010-2019  (see AUTHORS file for a list of contributors) | ||||
|  * | ||||
|  * GNSS-SDR is a software defined Global Navigation | ||||
|  *          Satellite Systems receiver | ||||
|  * | ||||
|  * This file is part of GNSS-SDR. | ||||
|  * | ||||
|  * GNSS-SDR is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * GNSS-SDR is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #include "cubature_filter.h" | ||||
|  | ||||
|  | ||||
| Cubature_filter::Cubature_filter() | ||||
| { | ||||
|     int nx = 1; | ||||
|     x_pred_out = arma::zeros(nx, 1); | ||||
|     P_x_pred_out = arma::eye(nx, nx) * (nx + 1); | ||||
|  | ||||
|     x_est = x_pred_out; | ||||
|     P_x_est = P_x_pred_out; | ||||
| } | ||||
|  | ||||
|  | ||||
| Cubature_filter::Cubature_filter(int nx) | ||||
| { | ||||
|     x_pred_out = arma::zeros(nx, 1); | ||||
|     P_x_pred_out = arma::eye(nx, nx) * (nx + 1); | ||||
|  | ||||
|     x_est = x_pred_out; | ||||
|     P_x_est = P_x_pred_out; | ||||
| } | ||||
|  | ||||
|  | ||||
| Cubature_filter::Cubature_filter(const arma::vec& x_pred_0, const arma::mat& P_x_pred_0) | ||||
| { | ||||
|     x_pred_out = x_pred_0; | ||||
|     P_x_pred_out = P_x_pred_0; | ||||
|  | ||||
|     x_est = x_pred_out; | ||||
|     P_x_est = P_x_pred_out; | ||||
| } | ||||
|  | ||||
|  | ||||
| Cubature_filter::~Cubature_filter() = default; | ||||
|  | ||||
|  | ||||
| void Cubature_filter::initialize(const arma::mat& x_pred_0, const arma::mat& P_x_pred_0) | ||||
| { | ||||
|     x_pred_out = x_pred_0; | ||||
|     P_x_pred_out = P_x_pred_0; | ||||
|  | ||||
|     x_est = x_pred_out; | ||||
|     P_x_est = P_x_pred_out; | ||||
| } | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Perform the prediction step of the cubature Kalman filter | ||||
|  */ | ||||
| void Cubature_filter::predict_sequential(const arma::vec& x_post, const arma::mat& P_x_post, Model_Function* transition_fcn, const arma::mat& noise_covariance) | ||||
| { | ||||
|     // Compute number of cubature points | ||||
|     int nx = x_post.n_elem; | ||||
|     int np = 2 * nx; | ||||
|  | ||||
|     // Generator Matrix | ||||
|     arma::mat gen_one = arma::join_horiz(arma::eye(nx, nx), -1.0 * arma::eye(nx, nx)); | ||||
|  | ||||
|     // Initialize predicted mean and covariance | ||||
|     arma::vec x_pred = arma::zeros(nx, 1); | ||||
|     arma::mat P_x_pred = arma::zeros(nx, nx); | ||||
|  | ||||
|     // Factorize posterior covariance | ||||
|     arma::mat Sm_post = arma::chol(P_x_post, "lower"); | ||||
|  | ||||
|     // Propagate and evaluate cubature points | ||||
|     arma::vec Xi_post; | ||||
|     arma::vec Xi_pred; | ||||
|  | ||||
|     for (uint8_t i = 0; i < np; i++) | ||||
|         { | ||||
|             Xi_post = Sm_post * (std::sqrt(static_cast<float>(np) / 2.0) * gen_one.col(i)) + x_post; | ||||
|             Xi_pred = (*transition_fcn)(Xi_post); | ||||
|  | ||||
|             x_pred = x_pred + Xi_pred; | ||||
|             P_x_pred = P_x_pred + Xi_pred * Xi_pred.t(); | ||||
|         } | ||||
|  | ||||
|     // Estimate predicted state and error covariance | ||||
|     x_pred = x_pred / static_cast<float>(np); | ||||
|     P_x_pred = P_x_pred / static_cast<float>(np) - x_pred * x_pred.t() + noise_covariance; | ||||
|  | ||||
|     // Store predicted state and error covariance | ||||
|     x_pred_out = x_pred; | ||||
|     P_x_pred_out = P_x_pred; | ||||
| } | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Perform the update step of the cubature Kalman filter | ||||
|  */ | ||||
| void Cubature_filter::update_sequential(const arma::vec& z_upd, const arma::vec& x_pred, const arma::mat& P_x_pred, Model_Function* measurement_fcn, const arma::mat& noise_covariance) | ||||
| { | ||||
|     // Compute number of cubature points | ||||
|     int nx = x_pred.n_elem; | ||||
|     int nz = z_upd.n_elem; | ||||
|     int np = 2 * nx; | ||||
|  | ||||
|     // Generator Matrix | ||||
|     arma::mat gen_one = arma::join_horiz(arma::eye(nx, nx), -1.0 * arma::eye(nx, nx)); | ||||
|  | ||||
|     // Evaluate predicted measurement and covariances | ||||
|     arma::mat z_pred = arma::zeros(nz, 1); | ||||
|     arma::mat P_zz_pred = arma::zeros(nz, nz); | ||||
|     arma::mat P_xz_pred = arma::zeros(nx, nz); | ||||
|  | ||||
|     // Factorize predicted covariance | ||||
|     arma::mat Sm_pred = arma::chol(P_x_pred, "lower"); | ||||
|  | ||||
|     // Propagate and evaluate cubature points | ||||
|     arma::vec Xi_pred; | ||||
|     arma::vec Zi_pred; | ||||
|     for (uint8_t i = 0; i < np; i++) | ||||
|         { | ||||
|             Xi_pred = Sm_pred * (std::sqrt(static_cast<float>(np) / 2.0) * gen_one.col(i)) + x_pred; | ||||
|             Zi_pred = (*measurement_fcn)(Xi_pred); | ||||
|  | ||||
|             z_pred = z_pred + Zi_pred; | ||||
|             P_zz_pred = P_zz_pred + Zi_pred * Zi_pred.t(); | ||||
|             P_xz_pred = P_xz_pred + Xi_pred * Zi_pred.t(); | ||||
|         } | ||||
|  | ||||
|     // Estimate measurement covariance and cross covariances | ||||
|     z_pred = z_pred / static_cast<float>(np); | ||||
|     P_zz_pred = P_zz_pred / static_cast<float>(np) - z_pred * z_pred.t() + noise_covariance; | ||||
|     P_xz_pred = P_xz_pred / static_cast<float>(np) - x_pred * z_pred.t(); | ||||
|  | ||||
|     // Estimate cubature Kalman gain | ||||
|     arma::mat W_k = P_xz_pred * arma::inv(P_zz_pred); | ||||
|  | ||||
|     // Estimate and store the updated state and error covariance | ||||
|     x_est = x_pred + W_k * (z_upd - z_pred); | ||||
|     P_x_est = P_x_pred - W_k * P_zz_pred * W_k.t(); | ||||
| } | ||||
|  | ||||
|  | ||||
| arma::mat Cubature_filter::get_x_pred() const | ||||
| { | ||||
|     return x_pred_out; | ||||
| } | ||||
|  | ||||
|  | ||||
| arma::mat Cubature_filter::get_P_x_pred() const | ||||
| { | ||||
|     return P_x_pred_out; | ||||
| } | ||||
|  | ||||
|  | ||||
| arma::mat Cubature_filter::get_x_est() const | ||||
| { | ||||
|     return x_est; | ||||
| } | ||||
|  | ||||
|  | ||||
| arma::mat Cubature_filter::get_P_x_est() const | ||||
| { | ||||
|     return P_x_est; | ||||
| } | ||||
							
								
								
									
										84
									
								
								src/algorithms/tracking/libs/cubature_filter.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								src/algorithms/tracking/libs/cubature_filter.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,84 @@ | ||||
| /*! | ||||
|  * \file cubature_filter.h | ||||
|  * \brief Interface of a library with Bayesian noise statistic estimation | ||||
|  * | ||||
|  * Cubature_Filter implements the functionality of the Cubature Kalman | ||||
|  * Filter, which uses multidimensional cubature rules to estimate the | ||||
|  * time evolution of a nonlinear system. | ||||
|  * | ||||
|  * [1] I Arasaratnam and S Haykin. Cubature kalman filters. IEEE | ||||
|  * Transactions on Automatic Control, 54(6):1254–1269,2009. | ||||
|  * | ||||
|  * \authors <ul> | ||||
|  *          <li> Gerald LaMountain, 2019. gerald(at)ece.neu.edu | ||||
|  *          <li> Jordi Vila-Valls 2019. jvila(at)cttc.es | ||||
|  *          </ul> | ||||
|  * ------------------------------------------------------------------------- | ||||
|  * | ||||
|  * Copyright (C) 2010-2019  (see AUTHORS file for a list of contributors) | ||||
|  * | ||||
|  * GNSS-SDR is a software defined Global Navigation | ||||
|  *          Satellite Systems receiver | ||||
|  * | ||||
|  * This file is part of GNSS-SDR. | ||||
|  * | ||||
|  * GNSS-SDR is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * GNSS-SDR is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #ifndef GNSS_SDR_CUBATURE_FILTER_H_ | ||||
| #define GNSS_SDR_CUBATURE_FILTER_H_ | ||||
|  | ||||
| #include <armadillo> | ||||
| #include <gnuradio/gr_complex.h> | ||||
|  | ||||
| // Abstract model function | ||||
| class Model_Function{ | ||||
|     public: | ||||
|         Model_Function() {}; | ||||
|         virtual arma::vec operator() (arma::vec input) = 0; | ||||
|         virtual ~Model_Function() = default; | ||||
| }; | ||||
|  | ||||
| class Cubature_filter | ||||
| { | ||||
| public: | ||||
|     // Constructors and destructors | ||||
|     Cubature_filter(); | ||||
|     Cubature_filter(int nx); | ||||
|     Cubature_filter(const arma::vec& x_pred_0, const arma::mat& P_x_pred_0); | ||||
|     ~Cubature_filter(); | ||||
|  | ||||
|     // Reinitialization function | ||||
|     void initialize(const arma::mat& x_pred_0, const arma::mat& P_x_pred_0); | ||||
|  | ||||
|     // Prediction and estimation | ||||
|     void predict_sequential(const arma::vec& x_post, const arma::mat& P_x_post, Model_Function* transition_fcn, const arma::mat& noise_covariance); | ||||
|     void update_sequential(const arma::vec& z_upd, const arma::vec& x_pred, const arma::mat& P_x_pred, Model_Function* measurement_fcn, const arma::mat& noise_covariance); | ||||
|  | ||||
|     // Getters | ||||
|     arma::mat get_x_pred() const; | ||||
|     arma::mat get_P_x_pred() const; | ||||
|     arma::mat get_x_est() const; | ||||
|     arma::mat get_P_x_est() const; | ||||
|  | ||||
| private: | ||||
|     arma::vec x_pred_out; | ||||
|     arma::mat P_x_pred_out; | ||||
|     arma::vec x_est; | ||||
|     arma::mat P_x_est; | ||||
| }; | ||||
|  | ||||
| #endif | ||||
| @@ -21,6 +21,9 @@ add_executable(gnss-sdr ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) | ||||
|  | ||||
| if(${FILESYSTEM_FOUND}) | ||||
|     target_compile_definitions(gnss-sdr PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|     if(${find_experimental}) | ||||
|         target_compile_definitions(gnss-sdr PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|     endif() | ||||
|     target_link_libraries(gnss-sdr PRIVATE std::filesystem) | ||||
| else() | ||||
|     target_link_libraries(gnss-sdr PRIVATE Boost::filesystem Boost::system) | ||||
|   | ||||
| @@ -46,21 +46,13 @@ | ||||
| #include <boost/exception/diagnostic_information.hpp>  // for diagnostic_informatio | ||||
| #include <boost/exception/exception.hpp>               // for exception | ||||
| #include <boost/thread/exceptions.hpp>                 // for thread_resource_error | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #include <filesystem> | ||||
| #include <system_error> | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>  // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>        // for path, operator<< | ||||
| #include <boost/system/error_code.hpp>      // for error_code | ||||
| #endif | ||||
| #include <gflags/gflags.h>  // for ShutDownCommandLineFlags | ||||
| #include <glog/logging.h>   // for FLAGS_log_dir | ||||
| #include <chrono>           // for time_point | ||||
| #include <exception>        // for exception | ||||
| #include <iostream>         // for operator<<, endl | ||||
| #include <memory>           // for unique_ptr | ||||
| #include <string>           // for string | ||||
| #include <gflags/gflags.h>                             // for ShutDownCommandLineFlags | ||||
| #include <glog/logging.h>                              // for FLAGS_log_dir | ||||
| #include <chrono>                                      // for time_point | ||||
| #include <exception>                                   // for exception | ||||
| #include <iostream>                                    // for operator<<, endl | ||||
| #include <memory>                                      // for unique_ptr | ||||
| #include <string>                                      // for string | ||||
|  | ||||
| #if CUDA_GPU_ACCEL | ||||
| // For the CUDA runtime routines (prefixed with "cuda_") | ||||
| @@ -68,9 +60,20 @@ | ||||
| #endif | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| namespace fs = std::filesystem; | ||||
| #include <system_error> | ||||
| namespace errorlib = std; | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem/operations.hpp>   // for create_directories, exists | ||||
| #include <boost/filesystem/path.hpp>         // for path, operator<< | ||||
| #include <boost/filesystem/path_traits.hpp>  // for filesystem | ||||
| #include <boost/system/error_code.hpp>       // for error_code | ||||
| namespace fs = boost::filesystem; | ||||
| namespace errorlib = boost::system; | ||||
| #endif | ||||
|   | ||||
| @@ -356,6 +356,9 @@ if(ENABLE_UNIT_TESTING) | ||||
|     add_executable(run_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cc) | ||||
|     if(${FILESYSTEM_FOUND}) | ||||
|         target_compile_definitions(run_tests PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|         if(${find_experimental}) | ||||
|             target_compile_definitions(run_tests PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|         endif() | ||||
|         target_link_libraries(run_tests PRIVATE std::filesystem) | ||||
|     else() | ||||
|         target_link_libraries(run_tests PRIVATE Boost::filesystem Boost::system) | ||||
| @@ -447,6 +450,9 @@ if(ENABLE_FPGA) | ||||
|     ) | ||||
|     if(${FILESYSTEM_FOUND}) | ||||
|         target_compile_definitions(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|         if(${find_experimental}) | ||||
|             target_compile_definitions(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|         endif() | ||||
|         target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE std::filesystem) | ||||
|     else() | ||||
|         target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE Boost::filesystem Boost::system) | ||||
| @@ -492,6 +498,9 @@ function(add_system_test executable) | ||||
|     add_executable(${executable} ${SYSTEM_TEST_SOURCES}) | ||||
|     if(${FILESYSTEM_FOUND}) | ||||
|         target_compile_definitions(${executable} PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|         if(${find_experimental}) | ||||
|             target_compile_definitions(${executable} PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|         endif() | ||||
|         target_link_libraries(${executable} PRIVATE std::filesystem) | ||||
|     else() | ||||
|         target_link_libraries(${executable} PRIVATE Boost::filesystem Boost::system) | ||||
| @@ -585,6 +594,9 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) | ||||
|     ) | ||||
|     if(${FILESYSTEM_FOUND}) | ||||
|         target_compile_definitions(flowgraph_test PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|         if(${find_experimental}) | ||||
|             target_compile_definitions(flowgraph_test PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|         endif() | ||||
|         target_link_libraries(flowgraph_test PRIVATE std::filesystem) | ||||
|     else() | ||||
|         target_link_libraries(flowgraph_test PRIVATE Boost::filesystem Boost::system) | ||||
| @@ -634,6 +646,9 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) | ||||
|     ) | ||||
|     if(${FILESYSTEM_FOUND}) | ||||
|         target_compile_definitions(gnss_block_test PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|         if(${find_experimental}) | ||||
|             target_compile_definitions(gnss_block_test PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|         endif() | ||||
|         target_link_libraries(gnss_block_test PRIVATE std::filesystem) | ||||
|     else() | ||||
|         target_link_libraries(gnss_block_test PRIVATE Boost::filesystem Boost::system) | ||||
| @@ -681,6 +696,9 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) | ||||
|     ) | ||||
|     if(${FILESYSTEM_FOUND}) | ||||
|         target_compile_definitions(gnuradio_block_test PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|         if(${find_experimental}) | ||||
|             target_compile_definitions(gnuradio_block_test PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|         endif() | ||||
|         target_link_libraries(gnuradio_block_test PRIVATE std::filesystem) | ||||
|     else() | ||||
|         target_link_libraries(gnuradio_block_test PRIVATE Boost::filesystem Boost::system) | ||||
| @@ -781,9 +799,13 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) | ||||
|         ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc | ||||
|         ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc | ||||
|         ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc | ||||
|         ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc | ||||
|     ) | ||||
|     if(${FILESYSTEM_FOUND}) | ||||
|         target_compile_definitions(trk_test PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|         if(${find_experimental}) | ||||
|             target_compile_definitions(trk_test PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|         endif() | ||||
|         target_link_libraries(trk_test PRIVATE std::filesystem) | ||||
|     else() | ||||
|         target_link_libraries(trk_test PRIVATE Boost::filesystem Boost::system) | ||||
| @@ -825,6 +847,9 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) | ||||
|     ) | ||||
|     if(${FILESYSTEM_FOUND}) | ||||
|         target_compile_definitions(control_thread_test PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|         if(${find_experimental}) | ||||
|             target_compile_definitions(control_thread_test PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|         endif() | ||||
|         target_link_libraries(control_thread_test PRIVATE std::filesystem) | ||||
|     else() | ||||
|         target_link_libraries(control_thread_test PRIVATE Boost::filesystem Boost::system) | ||||
|   | ||||
| @@ -99,6 +99,7 @@ DECLARE_string(log_dir); | ||||
| #endif | ||||
|  | ||||
| #include "unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc" | ||||
| #include "unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc" | ||||
| #include "unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc" | ||||
| #include "unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc" | ||||
| #include "unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc" | ||||
|   | ||||
| @@ -38,8 +38,13 @@ | ||||
| #include <random> | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
|   | ||||
| @@ -55,17 +55,23 @@ | ||||
| #include <utility> | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #include <filesystem> | ||||
| #include <system_error> | ||||
| namespace fs = std::filesystem; | ||||
| namespace errorlib = std; | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem.hpp> | ||||
| #include <boost/system/error_code.hpp> | ||||
| #include <boost/system/error_code.hpp>  // for error_code | ||||
| namespace fs = boost::filesystem; | ||||
| namespace errorlib = boost::system; | ||||
| #endif | ||||
|  | ||||
|  | ||||
| DEFINE_string(config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test."); | ||||
| DEFINE_string(acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used."); | ||||
| DEFINE_string(acq_test_implementation, std::string("GPS_L1_CA_PCPS_Acquisition"), "Acquisition block implementation under test. Alternatives: GPS_L1_CA_PCPS_Acquisition, GPS_L1_CA_PCPS_Acquisition_Fine_Doppler, Galileo_E1_PCPS_Ambiguous_Acquisition, GLONASS_L1_CA_PCPS_Acquisition, GLONASS_L2_CA_PCPS_Acquisition, GPS_L2_M_PCPS_Acquisition, Galileo_E5a_Pcps_Acquisition, GPS_L5i_PCPS_Acquisition"); | ||||
|   | ||||
| @@ -59,8 +59,13 @@ | ||||
| #endif | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
|   | ||||
| @@ -59,8 +59,13 @@ | ||||
| #endif | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
|   | ||||
| @@ -60,13 +60,19 @@ | ||||
| #endif | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
| #endif | ||||
|  | ||||
|  | ||||
| // ######## GNURADIO BLOCK MESSAGE RECEVER ######### | ||||
| class GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx; | ||||
|  | ||||
|   | ||||
| @@ -59,8 +59,13 @@ | ||||
| #endif | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
|   | ||||
| @@ -60,8 +60,13 @@ | ||||
| #endif | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| /*! | ||||
|  * \file bayesian_estimation_positivity_test.cc | ||||
|  * \brief  This file implements timing tests for the Bayesian covariance estimator | ||||
|  * \author Gerald LaMountain, 20168. gerald(at)ece.neu.edu | ||||
|  * \file bayesian_estimation_test.cc | ||||
|  * \brief  This file implements feasability test for the BCE library. | ||||
|  * \author Gerald LaMountain, 2018. gerald(at)ece.neu.edu | ||||
|  * | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -0,0 +1,160 @@ | ||||
| /*! | ||||
|  * \file cubature_filter_test.cc | ||||
|  * \brief  This file implements numerical accuracy test for the CKF library. | ||||
|  * \author Gerald LaMountain, 2019. gerald(at)ece.neu.edu | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  * | ||||
|  * Copyright (C) 2010-2019  (see AUTHORS file for a list of contributors) | ||||
|  * | ||||
|  * GNSS-SDR is a software defined Global Navigation | ||||
|  *          Satellite Systems receiver | ||||
|  * | ||||
|  * This file is part of GNSS-SDR. | ||||
|  * | ||||
|  * GNSS-SDR is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * GNSS-SDR is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #include "cubature_filter.h" | ||||
| #include <armadillo> | ||||
| #include <gtest/gtest.h> | ||||
| #include <random> | ||||
|  | ||||
| #define CUBATURE_TEST_N_TRIALS 1000 | ||||
|  | ||||
| class Transition_Model : public Model_Function | ||||
| { | ||||
| public: | ||||
|     Transition_Model(arma::mat kf_F) { coeff_mat = kf_F; }; | ||||
|     virtual arma::vec operator()(arma::vec input) { return coeff_mat * input; }; | ||||
|  | ||||
| private: | ||||
|     arma::mat coeff_mat; | ||||
| }; | ||||
|  | ||||
| class Measurement_Model : public Model_Function | ||||
| { | ||||
| public: | ||||
|     Measurement_Model(arma::mat kf_H) { coeff_mat = kf_H; }; | ||||
|     virtual arma::vec operator()(arma::vec input) { return coeff_mat * input; }; | ||||
|  | ||||
| private: | ||||
|     arma::mat coeff_mat; | ||||
| }; | ||||
|  | ||||
| TEST(CubatureFilterComputationTest, CubatureFilterTest) | ||||
| { | ||||
|     Cubature_filter kf_cubature; | ||||
|  | ||||
|     arma::vec kf_x; | ||||
|     arma::mat kf_P_x; | ||||
|  | ||||
|     arma::vec kf_x_pre; | ||||
|     arma::mat kf_P_x_pre; | ||||
|  | ||||
|     arma::vec ckf_x_pre; | ||||
|     arma::mat ckf_P_x_pre; | ||||
|  | ||||
|     arma::vec kf_x_post; | ||||
|     arma::mat kf_P_x_post; | ||||
|  | ||||
|     arma::vec ckf_x_post; | ||||
|     arma::mat ckf_P_x_post; | ||||
|  | ||||
|     arma::mat kf_F; | ||||
|     arma::mat kf_H; | ||||
|  | ||||
|     arma::mat kf_Q; | ||||
|     arma::mat kf_R; | ||||
|  | ||||
|     arma::vec eta; | ||||
|     arma::vec nu; | ||||
|  | ||||
|     arma::vec kf_y; | ||||
|     arma::mat kf_P_y; | ||||
|     arma::mat kf_K; | ||||
|  | ||||
|     Model_Function* transition_function; | ||||
|     Model_Function* measurement_function; | ||||
|  | ||||
|     //--- Perform initializations ------------------------------ | ||||
|  | ||||
|     std::random_device r; | ||||
|     std::default_random_engine e1(r()); | ||||
|     std::normal_distribution<float> normal_dist(0, 5); | ||||
|     std::uniform_real_distribution<float> uniform_dist(0.1, 5.0); | ||||
|  | ||||
|     uint8_t nx = 0; | ||||
|     uint8_t ny = 0; | ||||
|  | ||||
|     for (uint16_t k = 0; k < CUBATURE_TEST_N_TRIALS; k++) | ||||
|         { | ||||
|             nx = std::rand() % 5 + 1; | ||||
|             ny = std::rand() % 5 + 1; | ||||
|  | ||||
|             kf_x = arma::randn<arma::vec>(nx, 1); | ||||
|  | ||||
|             kf_P_x_post = 5.0 * arma::diagmat(arma::randu<arma::vec>(nx, 1)); | ||||
|             kf_x_post = arma::mvnrnd(kf_x, kf_P_x_post); | ||||
|  | ||||
|             kf_cubature.initialize(kf_x_post, kf_P_x_post); | ||||
|  | ||||
|             // Prediction Step | ||||
|             kf_F = arma::randu<arma::mat>(nx, nx); | ||||
|             kf_Q = arma::diagmat(arma::randu<arma::vec>(nx, 1)); | ||||
|  | ||||
|             transition_function = new Transition_Model(kf_F); | ||||
|             arma::mat ttx = (*transition_function)(kf_x_post); | ||||
|  | ||||
|             kf_cubature.predict_sequential(kf_x_post, kf_P_x_post, transition_function, kf_Q); | ||||
|  | ||||
|             ckf_x_pre = kf_cubature.get_x_pred(); | ||||
|             ckf_P_x_pre = kf_cubature.get_P_x_pred(); | ||||
|  | ||||
|             kf_x_pre = kf_F * kf_x_post; | ||||
|             kf_P_x_pre = kf_F * kf_P_x_post * kf_F.t() + kf_Q; | ||||
|  | ||||
|             EXPECT_TRUE(arma::approx_equal(ckf_x_pre, kf_x_pre, "absdiff", 0.01)); | ||||
|             EXPECT_TRUE(arma::approx_equal(ckf_P_x_pre, kf_P_x_pre, "absdiff", 0.01)); | ||||
|  | ||||
|             // Update Step | ||||
|             kf_H = arma::randu<arma::mat>(ny, nx); | ||||
|             kf_R = arma::diagmat(arma::randu<arma::vec>(ny, 1)); | ||||
|  | ||||
|             eta = arma::mvnrnd(arma::zeros<arma::vec>(nx, 1), kf_Q); | ||||
|             nu = arma::mvnrnd(arma::zeros<arma::vec>(ny, 1), kf_R); | ||||
|  | ||||
|             kf_y = kf_H * (kf_F * kf_x + eta) + nu; | ||||
|  | ||||
|             measurement_function = new Measurement_Model(kf_H); | ||||
|             kf_cubature.update_sequential(kf_y, kf_x_pre, kf_P_x_pre, measurement_function, kf_R); | ||||
|  | ||||
|             ckf_x_post = kf_cubature.get_x_est(); | ||||
|             ckf_P_x_post = kf_cubature.get_P_x_est(); | ||||
|  | ||||
|             kf_P_y = kf_H * kf_P_x_pre * kf_H.t() + kf_R; | ||||
|             kf_K = (kf_P_x_pre * kf_H.t()) * arma::inv(kf_P_y); | ||||
|  | ||||
|             kf_x_post = kf_x_pre + kf_K * (kf_y - kf_H * kf_x_pre); | ||||
|             kf_P_x_post = (arma::eye(nx, nx) - kf_K * kf_H) * kf_P_x_pre; | ||||
|  | ||||
|             EXPECT_TRUE(arma::approx_equal(ckf_x_post, kf_x_post, "absdiff", 0.01)); | ||||
|             EXPECT_TRUE(arma::approx_equal(ckf_P_x_post, kf_P_x_post, "absdiff", 0.01)); | ||||
|  | ||||
|             delete transition_function; | ||||
|             delete measurement_function; | ||||
|         } | ||||
| } | ||||
| @@ -61,8 +61,13 @@ | ||||
| #endif | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
|   | ||||
| @@ -60,8 +60,13 @@ | ||||
| #endif | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
|   | ||||
| @@ -76,8 +76,13 @@ | ||||
| #endif | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
|   | ||||
| @@ -60,8 +60,13 @@ | ||||
| #include <vector> | ||||
|  | ||||
| #if HAS_STD_FILESYSTEM | ||||
| #if HAS_STD_FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| namespace fs = std::experimental::filesystem; | ||||
| #else | ||||
| #include <filesystem> | ||||
| namespace fs = std::filesystem; | ||||
| #endif | ||||
| #else | ||||
| #include <boost/filesystem.hpp> | ||||
| namespace fs = boost::filesystem; | ||||
|   | ||||
| @@ -58,6 +58,9 @@ add_executable(front-end-cal ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) | ||||
|  | ||||
| if(${FILESYSTEM_FOUND}) | ||||
|     target_compile_definitions(front-end-cal PRIVATE -DHAS_STD_FILESYSTEM=1) | ||||
|     if(${find_experimental}) | ||||
|         target_compile_definitions(front-end-cal PRIVATE -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1) | ||||
|     endif() | ||||
|     target_link_libraries(front-end-cal PRIVATE std::filesystem) | ||||
| else() | ||||
|     target_link_libraries(front-end-cal PRIVATE Boost::filesystem Boost::system) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Javier Arribas
					Javier Arribas