1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-16 05:00:35 +00:00

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

This commit is contained in:
Marc Majoral 2019-07-04 12:55:36 +02:00
commit c8ccd5ef91
273 changed files with 9234 additions and 5518 deletions

View File

@ -23,7 +23,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build, it is bad practice.\nTry 'cd build && cmake ..' instead.") message(FATAL_ERROR "Prevented in-tree build, it is bad practice.\nTry 'cd build && cmake ..' instead.")
endif() endif()
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12...3.14.5)
project(gnss-sdr CXX C) project(gnss-sdr CXX C)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
@ -34,73 +34,53 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
# Enable them at the command line by doing 'cmake -DENABLE_XXX=ON ..' # Enable them at the command line by doing 'cmake -DENABLE_XXX=ON ..'
################################################################################ ################################################################################
include(FeatureSummary) include(FeatureSummary)
# Support of optional RF front-ends # Support of optional RF front-ends
option(ENABLE_UHD "Enable the use of UHD (driver for all USRP devices)" ON) option(ENABLE_UHD "Enable the use of UHD (driver for all USRP devices)" ON)
add_feature_info(ENABLE_UHD ENABLE_UHD "Enables UHD_Signal_Source for using RF front-ends from the USRP family. Requires gr-uhd.")
option(ENABLE_OSMOSDR "Enable the use of OsmoSDR and other front-ends (RTL-based dongles, HackRF, bladeRF, etc.) as signal source" OFF) option(ENABLE_OSMOSDR "Enable the use of OsmoSDR and other front-ends (RTL-based dongles, HackRF, bladeRF, etc.) as signal source" OFF)
add_feature_info(ENABLE_OSMOSDR ENABLE_OSMOSDR "Enables Osmosdr_Signal_Source and RtlTcp_Signal_Source for using RF front-ends compatible with the OsmoSDR driver. Requires gr-osmosdr.")
option(ENABLE_FMCOMMS2 "Enable the use of FMCOMMS4-EBZ + ZedBoard hardware, requires gr-iio" OFF) option(ENABLE_FMCOMMS2 "Enable the use of FMCOMMS4-EBZ + ZedBoard hardware, requires gr-iio" OFF)
add_feature_info(ENABLE_FMCOMMS2 ENABLE_FMCOMMS2 "Enables Fmcomms2_Signal_Source for FMCOMMS2/3/4 devices. Requires gr-iio.")
option(ENABLE_PLUTOSDR "Enable the use of ADALM-PLUTO Evaluation Boards (Analog Devices Inc.), requires gr-iio" OFF) option(ENABLE_PLUTOSDR "Enable the use of ADALM-PLUTO Evaluation Boards (Analog Devices Inc.), requires gr-iio" OFF)
add_feature_info(ENABLE_PLUTOSDR ENABLE_PLUTOSDR "Enables Plutosdr_Signal_Source for using ADALM-PLUTO boards. Requires gr-iio.")
option(ENABLE_AD9361 "Enable the use of AD9361 direct to FPGA hardware, requires libiio" OFF) option(ENABLE_AD9361 "Enable the use of AD9361 direct to FPGA hardware, requires libiio" OFF)
add_feature_info(ENABLE_AD9361 ENABLE_AD9361 "Enables Ad9361_Fpga_Signal_Source for devices with the AD9361 chipset. Requires libiio.")
option(ENABLE_RAW_UDP "Enable the use of high-optimized custom UDP packet sample source, requires libpcap" OFF) option(ENABLE_RAW_UDP "Enable the use of high-optimized custom UDP packet sample source, requires libpcap" OFF)
add_feature_info(ENABLE_RAW_UDP ENABLE_RAW_UDP "Enables Custom_UDP_Signal_Source for custom UDP packet sample source. Requires libpcap.")
option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNU Radio driver" OFF) option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNU Radio driver" OFF)
add_feature_info(ENABLE_FLEXIBAND ENABLE_FLEXIBAND "Enables Flexiband_Signal_Source for using Teleorbit's Flexiband RF front-end. Requires gr-teleorbit.")
option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF) option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF)
add_feature_info(ENABLE_GN3S ENABLE_GN3S "Enables Gn3s_Signal_Source for using the GN3S v2 dongle. Requires gr-gn3s.")
option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF) option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF)
add_feature_info(ENABLE_ARRAY ENABLE_ARRAY "Enables Raw_Array_Signal_Source and Array_Signal_Conditioner for using CTTC's antenna array. Requires gr-dbfcttc.")
# Performance analysis tools # Performance analysis tools
option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF)
add_feature_info(ENABLE_GPERFTOOLS ENABLE_GPERFTOOLS "Enables performance analysis. Requires Gperftools.")
option(ENABLE_GPROF "Enable the use of the GNU profiler tool 'gprof'" OFF) option(ENABLE_GPROF "Enable the use of the GNU profiler tool 'gprof'" OFF)
add_feature_info(ENABLE_GPROF ENABLE_GPROF "Enables performance analysis with 'gprof'.")
# Code correctness # Code correctness
option(ENABLE_CLANG_TIDY "Enable the use of clang-tidy when compiling" OFF) option(ENABLE_CLANG_TIDY "Enable the use of clang-tidy when compiling" OFF)
add_feature_info(ENABLE_CLANG_TIDY ENABLE_CLANG_TIDY "Runs clang-tidy along with the compiler. Requires Clang.")
# Acceleration # Acceleration
option(ENABLE_PROFILING "Enable execution of volk_gnsssdr_profile at the end of the building" OFF) option(ENABLE_PROFILING "Enable execution of volk_gnsssdr_profile at the end of the building" OFF)
add_feature_info(ENABLE_PROFILING ENABLE_PROFILING "Runs volk_gnsssdr_profile at the end of the building.")
option(ENABLE_OPENCL "Enable building of processing blocks implemented with OpenCL (experimental)" OFF) option(ENABLE_OPENCL "Enable building of processing blocks implemented with OpenCL (experimental)" OFF)
add_feature_info(ENABLE_OPENCL ENABLE_OPENCL "Enables GPS_L1_CA_PCPS_OpenCl_Acquisition (experimental). Requires OpenCL.")
option(ENABLE_CUDA "Enable building of processing blocks implemented with CUDA (experimental, requires CUDA SDK)" OFF) option(ENABLE_CUDA "Enable building of processing blocks implemented with CUDA (experimental, requires CUDA SDK)" OFF)
add_feature_info(ENABLE_CUDA ENABLE_CUDA "Enables GPS_L1_CA_DLL_PLL_Tracking_GPU (experimental). Requires CUDA.")
option(ENABLE_FPGA "Enable building of processing blocks implemented with FPGA" OFF) option(ENABLE_FPGA "Enable building of processing blocks implemented with FPGA" OFF)
add_feature_info(ENABLE_FPGA ENABLE_FPGA "Enables building of processing blocks for FPGA off-loading.")
# Building and packaging options # Building and packaging options
option(ENABLE_GENERIC_ARCH "Builds a portable binary" OFF) option(ENABLE_GENERIC_ARCH "Builds a portable binary" OFF)
add_feature_info(ENABLE_GENERIC_ARCH ENABLE_GENERIC_ARCH "When disabled, flags such as '-march=native' are passed to the compiler.")
option(ENABLE_PACKAGING "Enable software packaging" OFF) option(ENABLE_PACKAGING "Enable software packaging" OFF)
add_feature_info(ENABLE_PACKAGING ENABLE_PACKAGING "Enables software packaging.")
option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF) option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF)
add_feature_info(ENABLE_OWN_GLOG ENABLE_OWN_GLOG "Forces the downloading and building of Google glog.")
option(ENABLE_OWN_ARMADILLO "Download and build Armadillo locally" OFF) option(ENABLE_OWN_ARMADILLO "Download and build Armadillo locally" OFF)
add_feature_info(ENABLE_OWN_ARMADILLO ENABLE_OWN_ARMADILLO "Forces the downloading and building of Armadillo.")
option(ENABLE_LOG "Enable logging" ON) option(ENABLE_LOG "Enable logging" ON)
add_feature_info(ENABLE_LOG ENABLE_LOG "Enables runtime internal logging with Google glog.")
if(ENABLE_PACKAGING) if(ENABLE_PACKAGING)
set(ENABLE_GENERIC_ARCH ON) set(ENABLE_GENERIC_ARCH ON)
@ -108,25 +88,26 @@ endif()
# Testing # Testing
option(ENABLE_UNIT_TESTING "Build unit tests" ON) option(ENABLE_UNIT_TESTING "Build unit tests" ON)
add_feature_info(ENABLE_UNIT_TESTING ENABLE_UNIT_TESTING "Enables building of Unit Tests.")
option(ENABLE_UNIT_TESTING_MINIMAL "Build a minimal set of unit tests" OFF) option(ENABLE_UNIT_TESTING_MINIMAL "Build a minimal set of unit tests" OFF)
add_feature_info(ENABLE_UNIT_TESTING_MINIMAL ENABLE_UNIT_TESTING_MINIMAL "Enables building a minimal set of Unit Tests.")
option(ENABLE_UNIT_TESTING_EXTRA "Download external files and build extra unit tests" OFF) option(ENABLE_UNIT_TESTING_EXTRA "Download external files and build extra unit tests" OFF)
add_feature_info(ENABLE_UNIT_TESTING_EXTRA ENABLE_UNIT_TESTING_EXTRA "Enables building of Extra Unit Tests and downloading of external data files.")
option(ENABLE_SYSTEM_TESTING "Build system tests" OFF) option(ENABLE_SYSTEM_TESTING "Build system tests" OFF)
add_feature_info(ENABLE_SYSTEM_TESTING ENABLE_SYSTEM_TESTING "Enables building of System Tests.")
option(ENABLE_SYSTEM_TESTING_EXTRA "Download external tools and build extra system tests" OFF) option(ENABLE_SYSTEM_TESTING_EXTRA "Download external tools and build extra system tests" OFF)
add_feature_info(ENABLE_SYSTEM_TESTING_EXTRA ENABLE_SYSTEM_TESTING_EXTRA "Enables building of Extra System Tests and downloading of external tools.")
option(ENABLE_GNSS_SIM_INSTALL "Enable the installation of gnss_sim on the fly" ON)
if(NOT (ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA))
set(ENABLE_GNSS_SIM_INSTALL OFF)
endif()
if(ENABLE_SYSTEM_TESTING_EXTRA) if(ENABLE_SYSTEM_TESTING_EXTRA)
set(ENABLE_SYSTEM_TESTING ON) set(ENABLE_SYSTEM_TESTING ON)
endif() endif()
option(ENABLE_OWN_GPSTK "Force to download, build and link GPSTk for system tests, even if it is already installed" OFF) option(ENABLE_OWN_GPSTK "Force to download, build and link GPSTk for system tests, even if it is already installed" OFF)
add_feature_info(ENABLE_OWN_GPSTK ENABLE_OWN_GPSTK "Forces the downloading and building of GPSTk for system tests.")
option(ENABLE_INSTALL_TESTS "Install QA code system-wide" OFF) option(ENABLE_INSTALL_TESTS "Install QA code system-wide" OFF)
if(ENABLE_FPGA) if(ENABLE_FPGA)
@ -143,7 +124,7 @@ if(NOT ${THIS_IS_A_RELEASE})
find_package(Git) find_package(Git)
set_package_properties(Git PROPERTIES set_package_properties(Git PROPERTIES
URL "https://git-scm.com" URL "https://git-scm.com"
DESCRIPTION "A free and open source distributed version control system (found: ${GIT_VERSION_STRING})" DESCRIPTION "A free and open source distributed version control system (found: v${GIT_VERSION_STRING})"
PURPOSE "Manage version control, get MINOR_VERSION name for version number." PURPOSE "Manage version control, get MINOR_VERSION name for version number."
TYPE REQUIRED TYPE REQUIRED
) )
@ -391,7 +372,6 @@ endif()
if(NOT CMAKE_MAKE_PROGRAM_PRETTY_NAME) if(NOT CMAKE_MAKE_PROGRAM_PRETTY_NAME)
set(CMAKE_MAKE_PROGRAM_PRETTY_NAME "${CMAKE_MAKE_PROGRAM}") set(CMAKE_MAKE_PROGRAM_PRETTY_NAME "${CMAKE_MAKE_PROGRAM}")
endif() endif()
add_feature_info(ENABLE_INSTALL_TESTS ENABLE_INSTALL_TESTS "Install test binaries when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} install'.")
@ -421,7 +401,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "9.500.x")
set(GNSSSDR_GTEST_LOCAL_VERSION "1.8.1") set(GNSSSDR_GTEST_LOCAL_VERSION "1.8.1")
set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master")
set(GNSSSDR_GPSTK_LOCAL_VERSION "2.10.6") set(GNSSSDR_GPSTK_LOCAL_VERSION "2.10.6")
set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.15") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.16")
set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.9") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.9")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.8.0") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.8.0")
@ -589,8 +569,6 @@ endif()
find_package(GOOGLETEST) find_package(GOOGLETEST)
set_package_properties(GOOGLETEST PROPERTIES set_package_properties(GOOGLETEST PROPERTIES
URL "https://github.com/google/googletest"
DESCRIPTION "Source code of Google's Testing Framework"
PURPOSE "Used for Unit and System Tests." PURPOSE "Used for Unit and System Tests."
TYPE REQUIRED TYPE REQUIRED
) )
@ -609,38 +587,19 @@ set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG)
find_package(UHD) find_package(UHD)
set_package_properties(UHD PROPERTIES set_package_properties(UHD PROPERTIES
URL "https://www.ettus.com/sdr-software/detail/usrp-hardware-driver"
PURPOSE "Used for communication with front-ends of the USRP family." PURPOSE "Used for communication with front-ends of the USRP family."
TYPE OPTIONAL TYPE OPTIONAL
) )
if(ENABLE_UHD) if(ENABLE_UHD)
if(NOT UHD_FOUND) if(NOT UHD_FOUND)
set(ENABLE_UHD OFF) set(ENABLE_UHD OFF)
set_package_properties(UHD PROPERTIES
DESCRIPTION "USRP Hardware Driver"
)
else() else()
set(GR_REQUIRED_COMPONENTS ${GR_REQUIRED_COMPONENTS} UHD) set(GR_REQUIRED_COMPONENTS ${GR_REQUIRED_COMPONENTS} UHD)
if(UHD_VERSION)
set_package_properties(UHD PROPERTIES
DESCRIPTION "USRP Hardware Driver (found: v${UHD_VERSION})"
)
else()
set_package_properties(UHD PROPERTIES
DESCRIPTION "USRP Hardware Driver"
)
endif() endif()
endif() endif()
else()
set_package_properties(UHD PROPERTIES
DESCRIPTION "USRP Hardware Driver"
)
endif()
find_package(GNURADIO) find_package(GNURADIO)
set_package_properties(GNURADIO PROPERTIES set_package_properties(GNURADIO PROPERTIES
URL "https://www.gnuradio.org/"
DESCRIPTION "The free and open software radio ecosystem (found: v${GNURADIO_VERSION})"
PURPOSE "Implements flowgraph scheduler, provides some processing blocks and classes to create new ones." PURPOSE "Implements flowgraph scheduler, provides some processing blocks and classes to create new ones."
TYPE REQUIRED TYPE REQUIRED
) )
@ -652,8 +611,6 @@ set_package_properties(GNURADIO PROPERTIES
################################################################################ ################################################################################
find_package(LOG4CPP) find_package(LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES 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." PURPOSE "Required by GNU Radio."
TYPE REQUIRED TYPE REQUIRED
) )
@ -670,10 +627,7 @@ set(FILESYSTEM_FOUND FALSE)
if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND LOG4CPP_READY_FOR_CXX17) if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND LOG4CPP_READY_FOR_CXX17)
# Check if we have std::filesystem # Check if we have std::filesystem
if(NOT (CMAKE_VERSION VERSION_LESS 3.8)) if(NOT (CMAKE_VERSION VERSION_LESS 3.8))
if(POLICY CMP0057) if((NOT ENABLE_UNIT_TESTING_EXTRA) AND (NOT ENABLE_SYSTEM_TESTING_EXTRA) AND (NOT ENABLE_FPGA)) # Workaround for GPSTk
cmake_policy(SET CMP0057 NEW)
endif()
if(NOT ENABLE_UNIT_TESTING_EXTRA) # Workaround for GPSTk
find_package(FILESYSTEM COMPONENTS Final Experimental) find_package(FILESYSTEM COMPONENTS Final Experimental)
set_package_properties(FILESYSTEM PROPERTIES set_package_properties(FILESYSTEM PROPERTIES
URL "https://en.cppreference.com/w/cpp/filesystem" URL "https://en.cppreference.com/w/cpp/filesystem"
@ -730,11 +684,11 @@ set_package_properties(Boost PROPERTIES
if(CMAKE_VERSION VERSION_GREATER 3.14) if(CMAKE_VERSION VERSION_GREATER 3.14)
set_package_properties(Boost PROPERTIES set_package_properties(Boost PROPERTIES
DESCRIPTION "Portable C++ source libraries (found: ${Boost_VERSION_STRING})" DESCRIPTION "Portable C++ source libraries (found: v${Boost_VERSION_STRING})"
) )
else() else()
set_package_properties(Boost PROPERTIES set_package_properties(Boost PROPERTIES
DESCRIPTION "Portable C++ source libraries (found: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION})" DESCRIPTION "Portable C++ source libraries (found: v${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION})"
) )
endif() endif()
@ -828,8 +782,6 @@ if(NOT VOLK_FOUND)
message(FATAL_ERROR "*** VOLK is required to build gnss-sdr") message(FATAL_ERROR "*** VOLK is required to build gnss-sdr")
endif() endif()
set_package_properties(VOLK PROPERTIES set_package_properties(VOLK PROPERTIES
URL "http://libvolk.org"
DESCRIPTION "Vector-Optimized Library of Kernels (found: ${VOLK_VERSION})"
PURPOSE "Provides an abstraction of optimized math routines targeting several SIMD processors." PURPOSE "Provides an abstraction of optimized math routines targeting several SIMD processors."
TYPE REQUIRED TYPE REQUIRED
) )
@ -841,7 +793,6 @@ set_package_properties(VOLK PROPERTIES
################################################################################ ################################################################################
find_package(VOLKGNSSSDR) find_package(VOLKGNSSSDR)
set_package_properties(VOLKGNSSSDR PROPERTIES set_package_properties(VOLKGNSSSDR PROPERTIES
DESCRIPTION "Vector-Optimized Library of Kernels for GNSS-SDR."
PURPOSE "Accelerates math routines targeting several SIMD processors." PURPOSE "Accelerates math routines targeting several SIMD processors."
TYPE REQUIRED TYPE REQUIRED
) )
@ -889,29 +840,36 @@ if(NOT VOLKGNSSSDR_FOUND)
endif() endif()
message(FATAL_ERROR "six - python 2 and 3 compatibility library required to build VOLK_GNSSSDR") message(FATAL_ERROR "six - python 2 and 3 compatibility library required to build VOLK_GNSSSDR")
endif() endif()
if(CMAKE_VERSION VERSION_GREATER 3.12)
if(Python3_FOUND)
set_package_properties(Python3 PROPERTIES set_package_properties(Python3 PROPERTIES
URL "https://www.python.org/" URL "https://www.python.org/"
DESCRIPTION "An interpreted, high-level, general-purpose programming language (found: ${Python3_VERSION})" PURPOSE "Required to build volk_gnsssdr."
TYPE REQUIRED
)
if(Python3_FOUND)
set_package_properties(Python3 PROPERTIES
DESCRIPTION "An interpreted, high-level, general-purpose programming language (found: v${Python3_VERSION})"
)
else()
set_package_properties(Python3 PROPERTIES
DESCRIPTION "An interpreted, high-level, general-purpose programming language"
PURPOSE "Another Python version will be used."
)
endif()
if(Python2_FOUND)
set_package_properties(Python2 PROPERTIES
URL "https://www.python.org/"
DESCRIPTION "An interpreted, high-level, general-purpose programming language (found: v${Python2_VERSION})"
PURPOSE "Required to build volk_gnsssdr." PURPOSE "Required to build volk_gnsssdr."
TYPE REQUIRED TYPE REQUIRED
) )
endif() endif()
if(Python2_FOUND)
set_package_properties(Python2 PROPERTIES
URL "https://www.python.org/"
DESCRIPTION "An interpreted, high-level, general-purpose programming language (found: ${Python2_VERSION})"
PURPOSE "Required to build volk_gnsssdr."
TYPE REQUIRED
)
endif() endif()
if(PYTHONINTERP_FOUND) if(PYTHONINTERP_FOUND)
set_package_properties(PythonInterp PROPERTIES set_package_properties(PythonInterp PROPERTIES
URL "https://www.python.org/" URL "https://www.python.org/"
DESCRIPTION "An interpreted, high-level, general-purpose programming language (found: ${PYTHON_VERSION_STRING})" DESCRIPTION "An interpreted, high-level, general-purpose programming language (found: v${PYTHON_VERSION_STRING})"
PURPOSE "Required to build volk_gnsssdr." PURPOSE "Required to build volk_gnsssdr."
TYPE REQUIRED TYPE REQUIRED
) )
@ -986,11 +944,10 @@ if(NOT VOLKGNSSSDR_FOUND)
endif() endif()
find_package(ORC) find_package(ORC)
set_package_properties(ORC PROPERTIES set_package_properties(ORC PROPERTIES
URL "https://gstreamer.freedesktop.org/modules/orc.html"
DESCRIPTION "The Optimized Inner Loops Runtime Compiler"
PURPOSE "Used by volk_gnsssdr." PURPOSE "Used by volk_gnsssdr."
TYPE OPTIONAL TYPE OPTIONAL
) )
if(NOT ORC_FOUND) if(NOT ORC_FOUND)
set(ORC_LIBRARIES "") set(ORC_LIBRARIES "")
set(ORC_INCLUDE_DIRS "") set(ORC_INCLUDE_DIRS "")
@ -1045,8 +1002,6 @@ endif()
set(LOCAL_GFLAGS false) set(LOCAL_GFLAGS false)
find_package(GFLAGS) find_package(GFLAGS)
set_package_properties(GFLAGS PROPERTIES set_package_properties(GFLAGS PROPERTIES
URL "https://github.com/gflags/gflags"
DESCRIPTION "C++ library that implements commandline flags processing"
PURPOSE "Used for commandline flags management." PURPOSE "Used for commandline flags management."
TYPE REQUIRED TYPE REQUIRED
) )
@ -1123,8 +1078,6 @@ if(NOT ${ENABLE_OWN_GLOG})
endif() endif()
endif() endif()
set_package_properties(GLOG PROPERTIES set_package_properties(GLOG PROPERTIES
URL "https://github.com/google/glog"
DESCRIPTION "C++ implementation of the Google logging module"
PURPOSE "Used for runtime internal logging." PURPOSE "Used for runtime internal logging."
TYPE REQUIRED TYPE REQUIRED
) )
@ -1398,8 +1351,6 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
if(NOT OS_IS_MACOSX) if(NOT OS_IS_MACOSX)
find_package(GFORTRAN) find_package(GFORTRAN)
set_package_properties(GFORTRAN PROPERTIES set_package_properties(GFORTRAN PROPERTIES
URL "http://gcc.gnu.org/wiki/GFortran"
DESCRIPTION "GNU Fortran project"
PURPOSE "Required by Armadillo." PURPOSE "Required by Armadillo."
TYPE REQUIRED TYPE REQUIRED
) )
@ -1478,10 +1429,18 @@ endif()
find_package(GnuTLS) find_package(GnuTLS)
set_package_properties(GnuTLS PROPERTIES set_package_properties(GnuTLS PROPERTIES
URL "https://www.gnutls.org/" URL "https://www.gnutls.org/"
DESCRIPTION "Transport Layer Security Library"
PURPOSE "Used for the SUPL protocol implementation." PURPOSE "Used for the SUPL protocol implementation."
TYPE REQUIRED TYPE REQUIRED
) )
if(GnuTLS_FOUND AND GNUTLS_VERSION_STRING)
set_package_properties(GnuTLS PROPERTIES
DESCRIPTION "Transport Layer Security Library (found: v${GNUTLS_VERSION_STRING})"
)
else()
set_package_properties(GnuTLS PROPERTIES
DESCRIPTION "Transport Layer Security Library"
)
endif()
find_library(GNUTLS_OPENSSL_LIBRARY NAMES gnutls-openssl libgnutls-openssl.so.27 find_library(GNUTLS_OPENSSL_LIBRARY NAMES gnutls-openssl libgnutls-openssl.so.27
HINTS /usr/lib HINTS /usr/lib
/usr/lib64 /usr/lib64
@ -1560,7 +1519,6 @@ endif()
################################################################################ ################################################################################
find_package(MATIO) find_package(MATIO)
set_package_properties(MATIO PROPERTIES set_package_properties(MATIO PROPERTIES
URL "https://github.com/tbeu/matio"
PURPOSE "Used to store processing block's results in MAT files readable from MATLAB/Octave." PURPOSE "Used to store processing block's results in MAT files readable from MATLAB/Octave."
TYPE REQUIRED TYPE REQUIRED
) )
@ -1570,16 +1528,21 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
endif() endif()
message(STATUS " Matio v${GNSSSDR_MATIO_LOCAL_VERSION} will be downloaded and built automatically") message(STATUS " Matio v${GNSSSDR_MATIO_LOCAL_VERSION} will be downloaded and built automatically")
message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.")
set_package_properties(MATIO PROPERTIES
DESCRIPTION "MATLAB MAT File I/O Library"
)
find_package(ZLIB) find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES set_package_properties(ZLIB PROPERTIES
URL "https://www.zlib.net/" URL "https://www.zlib.net/"
DESCRIPTION "A Massively Spiffy Yet Delicately Unobtrusive Compression Library"
PURPOSE "Required to build Matio." PURPOSE "Required to build Matio."
TYPE REQUIRED TYPE REQUIRED
) )
if(ZLIB_FOUND AND ZLIB_VERSION_STRING)
set_package_properties(ZLIB PROPERTIES
DESCRIPTION "A Massively Spiffy Yet Delicately Unobtrusive Compression Library (found: v${ZLIB_VERSION_STRING})"
)
else()
set_package_properties(ZLIB PROPERTIES
DESCRIPTION "A Massively Spiffy Yet Delicately Unobtrusive Compression Library"
)
endif()
if(ZLIB_FOUND) if(ZLIB_FOUND)
get_filename_component(ZLIB_BASE_DIR ${ZLIB_INCLUDE_DIRS} DIRECTORY) get_filename_component(ZLIB_BASE_DIR ${ZLIB_INCLUDE_DIRS} DIRECTORY)
if(OS_IS_LINUX) if(OS_IS_LINUX)
@ -1619,10 +1582,18 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
find_package(HDF5) find_package(HDF5)
set_package_properties(HDF5 PROPERTIES set_package_properties(HDF5 PROPERTIES
URL "https://support.hdfgroup.org/HDF5/" URL "https://support.hdfgroup.org/HDF5/"
DESCRIPTION "A versatile data model, a portable file format and a software library"
PURPOSE "Required to build Matio." PURPOSE "Required to build Matio."
TYPE REQUIRED TYPE REQUIRED
) )
if(HDF5_FOUND AND HDF5_VERSION)
set_package_properties(HDF5 PROPERTIES
DESCRIPTION "A versatile data model, a portable file format and a software library (found: v${HDF5_VERSION})"
)
else()
set_package_properties(HDF5 PROPERTIES
DESCRIPTION "A versatile data model, a portable file format and a software library"
)
endif()
if(HDF5_FOUND) if(HDF5_FOUND)
list(GET HDF5_LIBRARIES 0 HDF5_FIRST_DIR) list(GET HDF5_LIBRARIES 0 HDF5_FIRST_DIR)
get_filename_component(HDF5_BASE_DIR2 ${HDF5_FIRST_DIR} DIRECTORY) get_filename_component(HDF5_BASE_DIR2 ${HDF5_FIRST_DIR} DIRECTORY)
@ -1703,10 +1674,6 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
set_package_properties(MATIO PROPERTIES set_package_properties(MATIO PROPERTIES
PURPOSE "Matio v${GNSSSDR_MATIO_LOCAL_VERSION} will be downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." PURPOSE "Matio v${GNSSSDR_MATIO_LOCAL_VERSION} will be downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'."
) )
else()
set_package_properties(MATIO PROPERTIES
DESCRIPTION "MATLAB MAT File I/O Library (found: v${MATIO_VERSION_STRING})"
)
endif() endif()
@ -1716,14 +1683,10 @@ endif()
################################################################################ ################################################################################
find_package(PUGIXML) find_package(PUGIXML)
set_package_properties(PUGIXML PROPERTIES set_package_properties(PUGIXML PROPERTIES
URL "https://pugixml.org/"
PURPOSE "Used to handle Galileo almanac XML files published by the European GNSS Service Centre." PURPOSE "Used to handle Galileo almanac XML files published by the European GNSS Service Centre."
TYPE REQUIRED TYPE REQUIRED
) )
if(NOT PUGIXML_FOUND) if(NOT PUGIXML_FOUND)
set_package_properties(PUGIXML PROPERTIES
DESCRIPTION "Light-weight, simple and fast XML parser for C++"
)
message(STATUS " PugiXML v${GNSSSDR_PUGIXML_LOCAL_VERSION} will be downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") message(STATUS " PugiXML v${GNSSSDR_PUGIXML_LOCAL_VERSION} will be downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.")
set(PUGIXML_COMPILER -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}) set(PUGIXML_COMPILER -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER})
set(TOOLCHAIN_ARG "") set(TOOLCHAIN_ARG "")
@ -1773,16 +1736,6 @@ if(NOT PUGIXML_FOUND)
set_package_properties(PUGIXML PROPERTIES set_package_properties(PUGIXML PROPERTIES
PURPOSE "PugiXML v${GNSSSDR_PUGIXML_LOCAL_VERSION} will be downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." PURPOSE "PugiXML v${GNSSSDR_PUGIXML_LOCAL_VERSION} will be downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'."
) )
else()
if(PUGIXML_VERSION)
set_package_properties(PUGIXML PROPERTIES
DESCRIPTION "Light-weight, simple and fast XML parser for C++ (found: ${PUGIXML_VERSION})"
)
else()
set_package_properties(PUGIXML PROPERTIES
DESCRIPTION "Light-weight, simple and fast XML parser for C++"
)
endif()
endif() endif()
@ -2017,10 +1970,18 @@ endif()
find_package(Doxygen) find_package(Doxygen)
set_package_properties(Doxygen PROPERTIES set_package_properties(Doxygen PROPERTIES
URL "http://www.doxygen.nl" URL "http://www.doxygen.nl"
DESCRIPTION "Generates documentation from annotated C++ sources"
PURPOSE "Used to generate code documentation by doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} doc'" PURPOSE "Used to generate code documentation by doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} doc'"
TYPE OPTIONAL TYPE OPTIONAL
) )
if(DOXYGEN_FOUND AND DOXYGEN_VERSION)
set_package_properties(Doxygen PROPERTIES
DESCRIPTION "Generates documentation from annotated C++ sources (found: v${DOXYGEN_VERSION})"
)
else()
set_package_properties(Doxygen PROPERTIES
DESCRIPTION "Generates documentation from annotated C++ sources"
)
endif()
find_package(LATEX) find_package(LATEX)
set_package_properties(LATEX PROPERTIES set_package_properties(LATEX PROPERTIES
URL "https://www.latex-project.org" URL "https://www.latex-project.org"
@ -2072,7 +2033,7 @@ if(DOXYGEN_FOUND)
else() else()
message(STATUS " Doxygen has not been found in your system.") message(STATUS " Doxygen has not been found in your system.")
message(STATUS " You can get nice code documentation by using it!") message(STATUS " You can get nice code documentation by using it!")
message(STATUS " Get it from http://www.stack.nl/~dimitri/doxygen/index.html") message(STATUS " Get it from http://www.doxygen.nl/download.html")
if(OS_IS_LINUX) if(OS_IS_LINUX)
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(STATUS " or simply by doing 'sudo yum install doxygen-latex'.") message(STATUS " or simply by doing 'sudo yum install doxygen-latex'.")
@ -2092,8 +2053,6 @@ endif()
################################################################################ ################################################################################
find_package(OPENCL QUIET) find_package(OPENCL QUIET)
set_package_properties(OPENCL PROPERTIES set_package_properties(OPENCL PROPERTIES
URL "https://www.khronos.org/opencl/"
DESCRIPTION "Library for parallel programming"
PURPOSE "Used in some processing block implementations." PURPOSE "Used in some processing block implementations."
TYPE OPTIONAL TYPE OPTIONAL
) )
@ -2117,8 +2076,6 @@ if(ENABLE_OPENCL)
if(NOT OPENCL_FOUND) if(NOT OPENCL_FOUND)
message(STATUS "Processing blocks using OpenCL will not be built.") message(STATUS "Processing blocks using OpenCL will not be built.")
endif() endif()
else()
set(OPENCL_FOUND FALSE)
endif() endif()
@ -2132,6 +2089,20 @@ if(DEFINED ENV{CUDA_GPU_ACCEL})
endif() endif()
if(ENABLE_CUDA) if(ENABLE_CUDA)
if(CMAKE_VERSION VERSION_GREATER 3.11)
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
enable_language(CUDA)
set(CUDA_FOUND TRUE)
if(NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 11)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif()
else()
set(ENABLE_CUDA OFF)
endif()
else()
find_package(CUDA REQUIRED) find_package(CUDA REQUIRED)
set_package_properties(CUDA PROPERTIES set_package_properties(CUDA PROPERTIES
URL "https://developer.nvidia.com/cuda-downloads" URL "https://developer.nvidia.com/cuda-downloads"
@ -2139,6 +2110,12 @@ if(ENABLE_CUDA)
PURPOSE "Used in some processing block implementations." PURPOSE "Used in some processing block implementations."
TYPE REQUIRED TYPE REQUIRED
) )
if(NOT CUDA_FOUND)
set(ENABLE_CUDA OFF)
endif()
endif()
endif()
if(ENABLE_CUDA)
message(STATUS "NVIDIA CUDA GPU Acceleration will be enabled.") message(STATUS "NVIDIA CUDA GPU Acceleration will be enabled.")
message(STATUS " You can disable it with 'cmake -DENABLE_CUDA=OFF ..'") message(STATUS " You can disable it with 'cmake -DENABLE_CUDA=OFF ..'")
else() else()
@ -2153,13 +2130,14 @@ endif()
################################################################################ ################################################################################
find_package(PCAP) find_package(PCAP)
set_package_properties(PCAP PROPERTIES set_package_properties(PCAP PROPERTIES
URL "https://www.tcpdump.org"
DESCRIPTION "A portable C/C++ library for network traffic capture"
PURPOSE "Used for the custom UDP IP packet source." PURPOSE "Used for the custom UDP IP packet source."
TYPE OPTIONAL TYPE OPTIONAL
) )
if(PCAP_FOUND)
set(ENABLE_RAW_UDP ON)
endif()
if(ENABLE_RAW_UDP) if(ENABLE_RAW_UDP)
message(STATUS "High-optimized custom UDP IP packet source is enabled.") message(STATUS "Highly-optimized custom UDP IP packet source is enabled.")
message(STATUS " You can disable it with 'cmake -DENABLE_RAW_UDP=OFF ..'") message(STATUS " You can disable it with 'cmake -DENABLE_RAW_UDP=OFF ..'")
if(NOT PCAP_FOUND) if(NOT PCAP_FOUND)
message(FATAL_ERROR "PCAP required to compile custom UDP packet sample source (with ENABLE_RAW_UDP=ON)") message(FATAL_ERROR "PCAP required to compile custom UDP packet sample source (with ENABLE_RAW_UDP=ON)")
@ -2196,7 +2174,6 @@ endif()
find_package(GROSMOSDR) find_package(GROSMOSDR)
set_package_properties(GROSMOSDR PROPERTIES set_package_properties(GROSMOSDR PROPERTIES
URL "https://osmocom.org/projects/gr-osmosdr/wiki"
PURPOSE "Used for communication with OsmoSDR and other front-ends (HackRF, bladeRF, Realtek's RTL2832U-based dongles, etc.)." PURPOSE "Used for communication with OsmoSDR and other front-ends (HackRF, bladeRF, Realtek's RTL2832U-based dongles, etc.)."
TYPE OPTIONAL TYPE OPTIONAL
) )
@ -2204,29 +2181,15 @@ if(ENABLE_OSMOSDR)
if(GROSMOSDR_FOUND) if(GROSMOSDR_FOUND)
message(STATUS "The driver for OsmoSDR and other front-ends (HackRF, bladeRF, Realtek's RTL2832U-based dongles, etc.) will be compiled.") message(STATUS "The driver for OsmoSDR and other front-ends (HackRF, bladeRF, Realtek's RTL2832U-based dongles, etc.) will be compiled.")
message(STATUS " You can disable it with 'cmake -DENABLE_OSMOSDR=OFF ..'") message(STATUS " You can disable it with 'cmake -DENABLE_OSMOSDR=OFF ..'")
if(GROSMOSDR_VERSION)
set_package_properties(GROSMOSDR PROPERTIES
DESCRIPTION "osmocom GNU Radio blocks (found: ${GROSMOSDR_VERSION})"
)
else() else()
set_package_properties(GROSMOSDR PROPERTIES
DESCRIPTION "osmocom GNU Radio blocks"
)
endif()
else()
set_package_properties(GROSMOSDR PROPERTIES
DESCRIPTION "osmocom GNU Radio blocks"
)
if(ENABLE_PACKAGING) if(ENABLE_PACKAGING)
message(WARNING "gr-osmosdr has not been found. Source blocks depending on it will NOT be built.") message(WARNING "gr-osmosdr has not been found. Source blocks depending on it will NOT be built.")
else() else()
message(FATAL_ERROR "gr-osmosdr required to build gnss-sdr with the optional OSMOSDR driver") message(FATAL_ERROR "gr-osmosdr required to build gnss-sdr with the optional OSMOSDR driver")
endif() endif()
set(ENABLE_OSMOSDR OFF)
endif() endif()
else() else()
set_package_properties(GROSMOSDR PROPERTIES
DESCRIPTION "osmocom GNU Radio blocks"
)
message(STATUS "The (optional) driver for OsmoSDR and related front-ends is not enabled.") message(STATUS "The (optional) driver for OsmoSDR and related front-ends is not enabled.")
message(STATUS " Enable it with 'cmake -DENABLE_OSMOSDR=ON ..' to add support for OsmoSDR and other front-ends (HackRF, bladeRF, Realtek's RTL2832U-based USB dongles, etc.)") message(STATUS " Enable it with 'cmake -DENABLE_OSMOSDR=ON ..' to add support for OsmoSDR and other front-ends (HackRF, bladeRF, Realtek's RTL2832U-based USB dongles, etc.)")
endif() endif()
@ -2239,20 +2202,9 @@ endif()
############################################## ##############################################
find_package(GRIIO) find_package(GRIIO)
set_package_properties(GRIIO PROPERTIES set_package_properties(GRIIO PROPERTIES
URL "https://github.com/analogdevicesinc/gr-iio"
PURPOSE "Used for communication with PlutoSDR and FMCOMMS devices." PURPOSE "Used for communication with PlutoSDR and FMCOMMS devices."
TYPE OPTIONAL TYPE OPTIONAL
) )
if(GRIIO_FOUND AND GRIIO_VERSION)
set_package_properties(GRIIO PROPERTIES
DESCRIPTION "IIO blocks for GNU Radio (found: v${GRIIO_VERSION})"
)
else()
set_package_properties(GRIIO PROPERTIES
DESCRIPTION "IIO blocks for GNU Radio"
)
endif()
##################################################################### #####################################################################
@ -2262,19 +2214,9 @@ endif()
##################################################################### #####################################################################
find_package(LIBIIO) find_package(LIBIIO)
set_package_properties(LIBIIO PROPERTIES set_package_properties(LIBIIO PROPERTIES
URL "https://github.com/analogdevicesinc/libiio"
PURPOSE "Used for communication with the AD9361 chipset." PURPOSE "Used for communication with the AD9361 chipset."
TYPE OPTIONAL TYPE OPTIONAL
) )
if(LIBIIO_FOUND AND LIBIIO_VERSION)
set_package_properties(LIBIIO PROPERTIES
DESCRIPTION "A library for interfacing with Linux IIO devices (found: v${LIBIIO_VERSION})"
)
else()
set_package_properties(LIBIIO PROPERTIES
DESCRIPTION "A library for interfacing with Linux IIO devices"
)
endif()
############################################## ##############################################
@ -2298,7 +2240,6 @@ else()
endif() endif()
find_package(TELEORBIT) find_package(TELEORBIT)
set_package_properties(TELEORBIT PROPERTIES set_package_properties(TELEORBIT PROPERTIES
DESCRIPTION "The Teleorbit's Flexiband GNU Radio block."
PURPOSE "Used for communication with the Flexiband front-end." PURPOSE "Used for communication with the Flexiband front-end."
TYPE OPTIONAL TYPE OPTIONAL
) )
@ -2369,8 +2310,6 @@ endif()
################################################################################ ################################################################################
find_package(GPERFTOOLS) find_package(GPERFTOOLS)
set_package_properties(GPERFTOOLS PROPERTIES set_package_properties(GPERFTOOLS PROPERTIES
URL "https://github.com/gperftools/gperftools"
DESCRIPTION "Collection of performance analysis tools"
PURPOSE "Used for performance analysis." PURPOSE "Used for performance analysis."
TYPE OPTIONAL TYPE OPTIONAL
) )
@ -2507,6 +2446,36 @@ add_subdirectory(src)
################################################################################ ################################################################################
# Print summary # Print summary
################################################################################ ################################################################################
add_feature_info(ENABLE_UHD ENABLE_UHD "Enables UHD_Signal_Source for using RF front-ends from the USRP family. Requires gr-uhd.")
add_feature_info(ENABLE_OSMOSDR ENABLE_OSMOSDR "Enables Osmosdr_Signal_Source and RtlTcp_Signal_Source for using RF front-ends compatible with the OsmoSDR driver. Requires gr-osmosdr.")
add_feature_info(ENABLE_FMCOMMS2 ENABLE_FMCOMMS2 "Enables Fmcomms2_Signal_Source for FMCOMMS2/3/4 devices. Requires gr-iio.")
add_feature_info(ENABLE_PLUTOSDR ENABLE_PLUTOSDR "Enables Plutosdr_Signal_Source for using ADALM-PLUTO boards. Requires gr-iio.")
add_feature_info(ENABLE_AD9361 ENABLE_AD9361 "Enables Ad9361_Fpga_Signal_Source for devices with the AD9361 chipset. Requires libiio.")
add_feature_info(ENABLE_RAW_UDP ENABLE_RAW_UDP "Enables Custom_UDP_Signal_Source for custom UDP packet sample source. Requires libpcap.")
add_feature_info(ENABLE_FLEXIBAND ENABLE_FLEXIBAND "Enables Flexiband_Signal_Source for using Teleorbit's Flexiband RF front-end. Requires gr-teleorbit.")
add_feature_info(ENABLE_GN3S ENABLE_GN3S "Enables Gn3s_Signal_Source for using the GN3S v2 dongle. Requires gr-gn3s.")
add_feature_info(ENABLE_ARRAY ENABLE_ARRAY "Enables Raw_Array_Signal_Source and Array_Signal_Conditioner for using CTTC's antenna array. Requires gr-dbfcttc.")
add_feature_info(ENABLE_GPERFTOOLS ENABLE_GPERFTOOLS "Enables performance analysis. Requires Gperftools.")
add_feature_info(ENABLE_GPROF ENABLE_GPROF "Enables performance analysis with 'gprof'.")
add_feature_info(ENABLE_CLANG_TIDY ENABLE_CLANG_TIDY "Runs clang-tidy along with the compiler. Requires Clang.")
add_feature_info(ENABLE_PROFILING ENABLE_PROFILING "Runs volk_gnsssdr_profile at the end of the building.")
add_feature_info(ENABLE_OPENCL ENABLE_OPENCL "Enables GPS_L1_CA_PCPS_OpenCl_Acquisition (experimental). Requires OpenCL.")
add_feature_info(ENABLE_CUDA ENABLE_CUDA "Enables GPS_L1_CA_DLL_PLL_Tracking_GPU (experimental). Requires CUDA.")
add_feature_info(ENABLE_FPGA ENABLE_FPGA "Enables building of processing blocks for FPGA off-loading.")
add_feature_info(ENABLE_GENERIC_ARCH ENABLE_GENERIC_ARCH "When disabled, flags such as '-march=native' are passed to the compiler.")
add_feature_info(ENABLE_PACKAGING ENABLE_PACKAGING "Enables software packaging.")
add_feature_info(ENABLE_OWN_GLOG ENABLE_OWN_GLOG "Forces the downloading and building of Google glog.")
add_feature_info(ENABLE_OWN_ARMADILLO ENABLE_OWN_ARMADILLO "Forces the downloading and building of Armadillo.")
add_feature_info(ENABLE_LOG ENABLE_LOG "Enables runtime internal logging with Google glog.")
add_feature_info(ENABLE_UNIT_TESTING ENABLE_UNIT_TESTING "Enables building of Unit Tests.")
add_feature_info(ENABLE_UNIT_TESTING_MINIMAL ENABLE_UNIT_TESTING_MINIMAL "Enables building a minimal set of Unit Tests.")
add_feature_info(ENABLE_UNIT_TESTING_EXTRA ENABLE_UNIT_TESTING_EXTRA "Enables building of Extra Unit Tests and downloading of external data files.")
add_feature_info(ENABLE_SYSTEM_TESTING ENABLE_SYSTEM_TESTING "Enables building of System Tests.")
add_feature_info(ENABLE_SYSTEM_TESTING_EXTRA ENABLE_SYSTEM_TESTING_EXTRA "Enables building of Extra System Tests and downloading of external tools.")
add_feature_info(ENABLE_OWN_GPSTK ENABLE_OWN_GPSTK "Forces the downloading and building of GPSTk for system tests.")
add_feature_info(ENABLE_GNSS_SIM_INSTALL ENABLE_GNSS_SIM_INSTALL "Enables downloading and building of gnss-sim.")
add_feature_info(ENABLE_INSTALL_TESTS ENABLE_INSTALL_TESTS "Install test binaries when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} install'.")
message(STATUS "") message(STATUS "")
message(STATUS "***************************************") message(STATUS "***************************************")
message(STATUS "* SUMMARY REPORT *") message(STATUS "* SUMMARY REPORT *")

View File

@ -31,6 +31,11 @@
# Gflags::gflags # Gflags::gflags
# #
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
if(APPLE) if(APPLE)
find_path(GFlags_ROOT_DIR find_path(GFlags_ROOT_DIR
libgflags.dylib libgflags.dylib
@ -111,6 +116,35 @@ endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GFLAGS DEFAULT_MSG GFlags_LIBS GFlags_INCLUDE_DIRS) find_package_handle_standard_args(GFLAGS DEFAULT_MSG GFlags_LIBS GFlags_INCLUDE_DIRS)
if(GFLAGS_FOUND)
set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION})
unset(PACKAGE_VERSION)
list(GET GFlags_LIBS 0 FIRST_DIR)
get_filename_component(GFlags_LIBS_DIR ${FIRST_DIR} DIRECTORY)
if(EXISTS ${GFlags_LIBS_DIR}/cmake/gflags/gflags-config-version.cmake)
include(${GFlags_LIBS_DIR}/cmake/gflags/gflags-config-version.cmake)
endif()
if(PACKAGE_VERSION)
set(GFLAGS_VERSION ${PACKAGE_VERSION})
set_package_properties(GFLAGS PROPERTIES
DESCRIPTION "C++ library that implements commandline flags processing (found: v${GFLAGS_VERSION})"
)
else()
set_package_properties(GFLAGS PROPERTIES
DESCRIPTION "C++ library that implements commandline flags processing"
)
endif()
set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION})
else()
set_package_properties(GFLAGS PROPERTIES
DESCRIPTION "C++ library that implements commandline flags processing"
)
endif()
set_package_properties(GFLAGS PROPERTIES
URL "https://github.com/gflags/gflags"
)
if(GFLAGS_FOUND AND NOT TARGET Gflags::gflags) if(GFLAGS_FOUND AND NOT TARGET Gflags::gflags)
add_library(Gflags::gflags SHARED IMPORTED) add_library(Gflags::gflags SHARED IMPORTED)
set_target_properties(Gflags::gflags PROPERTIES set_target_properties(Gflags::gflags PROPERTIES

View File

@ -15,6 +15,10 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. # along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
find_library(GFORTRAN NAMES gfortran find_library(GFORTRAN NAMES gfortran
PATHS /usr/lib PATHS /usr/lib
/usr/lib64 /usr/lib64
@ -189,5 +193,10 @@ find_library(GFORTRAN NAMES gfortran
$ENV{GFORTRAN_ROOT}/lib $ENV{GFORTRAN_ROOT}/lib
) )
set_package_properties(GFORTRAN PROPERTIES
URL "http://gcc.gnu.org/wiki/GFortran"
DESCRIPTION "GNU Fortran library"
)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GFORTRAN DEFAULT_MSG GFORTRAN) find_package_handle_standard_args(GFORTRAN DEFAULT_MSG GFORTRAN)

View File

@ -31,6 +31,10 @@
# Glog::glog # Glog::glog
# #
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
if(NOT DEFINED GLOG_ROOT) if(NOT DEFINED GLOG_ROOT)
set(GLOG_ROOT /usr /usr/local) set(GLOG_ROOT /usr /usr/local)
endif() endif()
@ -41,6 +45,10 @@ else()
set(LIB_PATHS ${GLOG_ROOT} ${GLOG_ROOT}/lib) set(LIB_PATHS ${GLOG_ROOT} ${GLOG_ROOT}/lib)
endif() endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig)
pkg_check_modules(PC_GLOG libglog)
macro(_FIND_GLOG_LIBRARIES _var) macro(_FIND_GLOG_LIBRARIES _var)
find_library(${_var} find_library(${_var}
NAMES ${ARGN} NAMES ${ARGN}
@ -75,6 +83,7 @@ macro(_FIND_GLOG_LIBRARIES _var)
$ENV{GLOG_ROOT}/lib $ENV{GLOG_ROOT}/lib
${GLOG_ROOT}/lib64 ${GLOG_ROOT}/lib64
$ENV{GLOG_ROOT}/lib64 $ENV{GLOG_ROOT}/lib64
${PC_GLOG_LIBDIR}
PATH_SUFFIXES lib PATH_SUFFIXES lib
) )
mark_as_advanced(${_var}) mark_as_advanced(${_var})
@ -94,6 +103,7 @@ if(MSVC)
PATHS PATHS
${GLOG_ROOT}/src/windows ${GLOG_ROOT}/src/windows
${GLOG_ROOT}/src/windows/glog ${GLOG_ROOT}/src/windows/glog
${PC_GLOG_INCLUDEDIR}
) )
else() else()
# Linux/OS X builds # Linux/OS X builds
@ -102,6 +112,7 @@ else()
${GLOG_ROOT}/include/glog ${GLOG_ROOT}/include/glog
/usr/include/glog /usr/include/glog
/opt/local/include/glog # default location in Macports /opt/local/include/glog # default location in Macports
${PC_GLOG_INCLUDEDIR}
) )
endif() endif()
@ -118,15 +129,18 @@ else()
endif() endif()
endif() endif()
if(GLOG_FOUND)
message(STATUS "glog library found at ${GLOG_LIBRARIES}")
endif()
# handle the QUIETLY and REQUIRED arguments and set GLOG_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set GLOG_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLOG DEFAULT_MSG GLOG_LIBRARIES) find_package_handle_standard_args(GLOG DEFAULT_MSG GLOG_LIBRARIES)
if(GLOG_FOUND)
message(STATUS "glog library found at ${GLOG_LIBRARIES}")
if(PC_GLOG_VERSION)
set(GLOG_VERSION ${PC_GLOG_VERSION})
endif()
endif()
if(MSVC) if(MSVC)
string(REGEX REPLACE "/glog$" "" VAR_WITHOUT ${GLOG_INCLUDE_DIR}) string(REGEX REPLACE "/glog$" "" VAR_WITHOUT ${GLOG_INCLUDE_DIR})
string(REGEX REPLACE "/windows$" "" VAR_WITHOUT ${VAR_WITHOUT}) string(REGEX REPLACE "/windows$" "" VAR_WITHOUT ${VAR_WITHOUT})
@ -138,6 +152,20 @@ else()
string(REGEX REPLACE "/libglog.so" "" GLOG_LIBRARIES_DIR ${GLOG_LIBRARIES}) string(REGEX REPLACE "/libglog.so" "" GLOG_LIBRARIES_DIR ${GLOG_LIBRARIES})
endif() endif()
if(GLOG_FOUND AND GLOG_VERSION)
set_package_properties(GLOG PROPERTIES
DESCRIPTION "C++ implementation of the Google logging module (found: v${GLOG_VERSION})"
)
else()
set_package_properties(GLOG PROPERTIES
DESCRIPTION "C++ implementation of the Google logging module"
)
endif()
set_package_properties(GLOG PROPERTIES
URL "https://github.com/google/glog"
)
if(GLOG_FOUND AND NOT TARGET Glog::glog) if(GLOG_FOUND AND NOT TARGET Glog::glog)
add_library(Glog::glog SHARED IMPORTED) add_library(Glog::glog SHARED IMPORTED)
set_target_properties(Glog::glog PROPERTIES set_target_properties(Glog::glog PROPERTIES

View File

@ -19,6 +19,11 @@
# Find GNU Radio # Find GNU Radio
######################################################################## ########################################################################
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig) include(FindPkgConfig)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
@ -182,6 +187,8 @@ list(REMOVE_DUPLICATES GNURADIO_ALL_INCLUDE_DIRS)
list(REMOVE_DUPLICATES GNURADIO_ALL_LIBRARIES) list(REMOVE_DUPLICATES GNURADIO_ALL_LIBRARIES)
if(NOT PC_GNURADIO_RUNTIME_VERSION) if(NOT PC_GNURADIO_RUNTIME_VERSION)
set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION})
unset(PACKAGE_VERSION)
list(GET GNURADIO_BLOCKS_LIBRARIES 0 FIRST_DIR) list(GET GNURADIO_BLOCKS_LIBRARIES 0 FIRST_DIR)
get_filename_component(GNURADIO_BLOCKS_DIR ${FIRST_DIR} DIRECTORY) get_filename_component(GNURADIO_BLOCKS_DIR ${FIRST_DIR} DIRECTORY)
if(EXISTS ${GNURADIO_BLOCKS_DIR}/cmake/gnuradio/GnuradioConfigVersion.cmake) if(EXISTS ${GNURADIO_BLOCKS_DIR}/cmake/gnuradio/GnuradioConfigVersion.cmake)
@ -193,6 +200,7 @@ if(NOT PC_GNURADIO_RUNTIME_VERSION)
if(PACKAGE_VERSION) if(PACKAGE_VERSION)
set(PC_GNURADIO_RUNTIME_VERSION ${PACKAGE_VERSION}) set(PC_GNURADIO_RUNTIME_VERSION ${PACKAGE_VERSION})
endif() endif()
set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION})
endif() endif()
# Trick to find out that GNU Radio is >= 3.7.4 if pkgconfig is not present # Trick to find out that GNU Radio is >= 3.7.4 if pkgconfig is not present
@ -254,4 +262,15 @@ if(GNURADIO_VERSION)
endif() endif()
message(FATAL_ERROR "GNU Radio v${GNSSSDR_GNURADIO_MIN_VERSION} or later is required to build gnss-sdr.") message(FATAL_ERROR "GNU Radio v${GNSSSDR_GNURADIO_MIN_VERSION} or later is required to build gnss-sdr.")
endif() endif()
set_package_properties(GNURADIO PROPERTIES
DESCRIPTION "The free and open software radio ecosystem (found: v${GNURADIO_VERSION})"
)
else()
set_package_properties(GNURADIO PROPERTIES
DESCRIPTION "The free and open software radio ecosystem"
)
endif() endif()
set_package_properties(GNURADIO PROPERTIES
URL "https://www.gnuradio.org/"
)

View File

@ -26,6 +26,13 @@
# LIBGTEST_DEV_DIR # LIBGTEST_DEV_DIR
# GTEST_INCLUDE_DIRS # GTEST_INCLUDE_DIRS
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig)
pkg_check_modules(PC_GTEST gtest)
find_path(LIBGTEST_DEV_DIR find_path(LIBGTEST_DEV_DIR
NAMES src/gtest-all.cc NAMES src/gtest-all.cc
@ -33,6 +40,7 @@ find_path(LIBGTEST_DEV_DIR
${GTEST_DIR} ${GTEST_DIR}
${GTEST_DIR}/googletest ${GTEST_DIR}/googletest
/usr/src/googletest/googletest /usr/src/googletest/googletest
/usr/local/src/googletest/googletest
/usr/src/gtest /usr/src/gtest
/usr/include/gtest /usr/include/gtest
/opt/local/src/gtest-1.7.0 /opt/local/src/gtest-1.7.0
@ -44,8 +52,25 @@ find_path(GTEST_INCLUDE_DIRS
${GTEST_DIR}/googletest/include ${GTEST_DIR}/googletest/include
/usr/include /usr/include
/opt/local/src/gtest-1.7.0/include /opt/local/src/gtest-1.7.0/include
${PC_GTEST_INCLUDEDIR}
) )
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GOOGLETEST DEFAULT_MSG LIBGTEST_DEV_DIR GTEST_INCLUDE_DIRS) find_package_handle_standard_args(GOOGLETEST DEFAULT_MSG LIBGTEST_DEV_DIR GTEST_INCLUDE_DIRS)
if(GOOGLETEST_FOUND AND PC_GTEST_VERSION)
set(GOOGLETEST_VERSION ${PC_GTEST_VERSION})
set_package_properties(GOOGLETEST PROPERTIES
DESCRIPTION "Source code of Google's Testing Framework (found: v${GOOGLETEST_VERSION})"
)
else()
set_package_properties(GOOGLETEST PROPERTIES
DESCRIPTION "Source code of Google's Testing Framework"
)
endif()
set_package_properties(GOOGLETEST PROPERTIES
URL "https://github.com/google/googletest"
)
mark_as_advanced(LIBGTEST_DEV_DIR GTEST_INCLUDE_DIRS) mark_as_advanced(LIBGTEST_DEV_DIR GTEST_INCLUDE_DIRS)

View File

@ -40,6 +40,10 @@
# Gperftools::gperftools # Gperftools::gperftools
# #
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
find_library(GPERFTOOLS_TCMALLOC find_library(GPERFTOOLS_TCMALLOC
NAMES tcmalloc NAMES tcmalloc
HINTS ${Gperftools_ROOT_DIR}/lib HINTS ${Gperftools_ROOT_DIR}/lib
@ -124,6 +128,11 @@ if(GPERFTOOLS_FOUND AND NOT TARGET Gperftools::gperftools)
) )
endif() endif()
set_package_properties(GPERFTOOLS PROPERTIES
URL "https://github.com/gperftools/gperftools"
DESCRIPTION "Collection of performance analysis tools"
)
mark_as_advanced( mark_as_advanced(
GPERFTOOLS_TCMALLOC GPERFTOOLS_TCMALLOC
GPERFTOOLS_PROFILER GPERFTOOLS_PROFILER

View File

@ -22,6 +22,10 @@
# GPSTK_FOUND, If false, do not try to use GPSTK. # GPSTK_FOUND, If false, do not try to use GPSTK.
# GPSTK_LIBRARY, where to find the GPSTK library. # GPSTK_LIBRARY, where to find the GPSTK library.
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
find_path(GPSTK_INCLUDE_DIR gpstk/Rinex3ObsBase.hpp find_path(GPSTK_INCLUDE_DIR gpstk/Rinex3ObsBase.hpp
HINTS /usr/include HINTS /usr/include
/usr/local/include /usr/local/include
@ -44,10 +48,37 @@ find_library(GPSTK_LIBRARY NAMES ${GPSTK_NAMES}
$ENV{GPSTK_ROOT}/${CMAKE_INSTALL_LIBDIR} $ENV{GPSTK_ROOT}/${CMAKE_INSTALL_LIBDIR}
) )
# handle the QUIETLY and REQUIRED arguments and set GPSTK_FOUND to TRUE if # handle the QUIET and REQUIRED arguments and set GPSTK_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GPSTK DEFAULT_MSG GPSTK_LIBRARY GPSTK_INCLUDE_DIR) find_package_handle_standard_args(GPSTK DEFAULT_MSG GPSTK_LIBRARY GPSTK_INCLUDE_DIR)
if(GPSTK_FOUND)
set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION})
unset(PACKAGE_VERSION)
if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GPSTK/GPSTKConfigVersion.cmake)
include(${CMAKE_INSTALL_FULL_DATADIR}/cmake/GPSTK/GPSTKConfigVersion.cmake)
endif()
if(PACKAGE_VERSION)
set(GPSTK_VERSION ${PACKAGE_VERSION})
endif()
set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION})
endif()
if(GPSTK_FOUND AND GPSTK_VERSION)
set_package_properties(GPSTK PROPERTIES
DESCRIPTION "Library and suite of applications for satellite navigation (found: v${GPSTK_VERSION})"
)
else()
set_package_properties(GPSTK PROPERTIES
DESCRIPTION "Library and suite of applications for satellite navigation"
)
endif()
set_package_properties(GPSTK PROPERTIES
URL "http://www.gpstk.org"
)
mark_as_advanced(GPSTK_LIBRARY GPSTK_INCLUDE_DIR) mark_as_advanced(GPSTK_LIBRARY GPSTK_INCLUDE_DIR)
if(GPSTK_FOUND AND NOT TARGET Gpstk::gpstk) if(GPSTK_FOUND AND NOT TARGET Gpstk::gpstk)

View File

@ -19,6 +19,7 @@
# Find GR-DBFCTTC Module # Find GR-DBFCTTC Module
######################################################################## ########################################################################
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(PC_GR_DBFCTTC gr-dbfcttc) pkg_check_modules(PC_GR_DBFCTTC gr-dbfcttc)

View File

@ -19,6 +19,7 @@
# Find GR-GN3S Module # Find GR-GN3S Module
######################################################################## ########################################################################
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(PC_GR_GN3S gr-gn3s) pkg_check_modules(PC_GR_GN3S gr-gn3s)

View File

@ -20,7 +20,11 @@
# Gnuradio::iio # Gnuradio::iio
# #
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(PC_IIO gnuradio-iio) pkg_check_modules(PC_IIO gnuradio-iio)
@ -96,6 +100,19 @@ if(PC_IIO_VERSION)
set(GRIIO_VERSION ${PC_IIO_VERSION}) set(GRIIO_VERSION ${PC_IIO_VERSION})
endif() endif()
set_package_properties(GRIIO PROPERTIES
URL "https://github.com/analogdevicesinc/gr-iio"
)
if(GRIIO_FOUND AND GRIIO_VERSION)
set_package_properties(GRIIO PROPERTIES
DESCRIPTION "IIO blocks for GNU Radio (found: v${GRIIO_VERSION})"
)
else()
set_package_properties(GRIIO PROPERTIES
DESCRIPTION "IIO blocks for GNU Radio"
)
endif()
if(GRIIO_FOUND AND NOT TARGET Gnuradio::iio) if(GRIIO_FOUND AND NOT TARGET Gnuradio::iio)
add_library(Gnuradio::iio SHARED IMPORTED) add_library(Gnuradio::iio SHARED IMPORTED)
set_target_properties(Gnuradio::iio PROPERTIES set_target_properties(Gnuradio::iio PROPERTIES

View File

@ -38,7 +38,11 @@
# Gnuradio::osmosdr # Gnuradio::osmosdr
# #
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(GROSMOSDR_PKG gnuradio-osmosdr) pkg_check_modules(GROSMOSDR_PKG gnuradio-osmosdr)
@ -47,18 +51,17 @@ find_path(GROSMOSDR_INCLUDE_DIR
osmosdr/source.h osmosdr/source.h
osmosdr/api.h osmosdr/api.h
PATHS PATHS
${GROSMOSDR_PKG_INCLUDE_DIRS}
/usr/include /usr/include
/usr/local/include /usr/local/include
/opt/local/include /opt/local/include
${GROSMOSDR_ROOT}/include ${GROSMOSDR_ROOT}/include
$ENV{GROSMOSDR_ROOT}/include $ENV{GROSMOSDR_ROOT}/include
${GROSMOSDR_PKG_INCLUDEDIR}
) )
find_library(GROSMOSDR_LIBRARIES find_library(GROSMOSDR_LIBRARIES
NAMES gnuradio-osmosdr NAMES gnuradio-osmosdr
PATHS PATHS
${GROSMOSDR_PKG_LIBRARY_DIRS}
/usr/lib /usr/lib
/usr/local/lib /usr/local/lib
/opt/local/lib /opt/local/lib
@ -90,13 +93,29 @@ find_library(GROSMOSDR_LIBRARIES
$ENV{GROSMOSDR_ROOT}/lib $ENV{GROSMOSDR_ROOT}/lib
${GROSMOSDR_ROOT}/lib64 ${GROSMOSDR_ROOT}/lib64
$ENV{GROSMOSDR_ROOT}/lib64 $ENV{GROSMOSDR_ROOT}/lib64
${GROSMOSDR_PKG_LIBDIR}
) )
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GROSMOSDR DEFAULT_MSG GROSMOSDR_LIBRARIES GROSMOSDR_INCLUDE_DIR) find_package_handle_standard_args(GROSMOSDR DEFAULT_MSG GROSMOSDR_LIBRARIES GROSMOSDR_INCLUDE_DIR)
if(GROSMOSDR_PKG_VERSION) if(GROSMOSDR_PKG_VERSION)
set(GROSMOSDR_VERSION ${GROSMOSDR_PKG_VERSION}) set(GROSMOSDR_VERSION_AUX ${GROSMOSDR_PKG_VERSION})
string(REGEX REPLACE "^v" "" GROSMOSDR_VERSION ${GROSMOSDR_VERSION_AUX})
endif()
set_package_properties(GROSMOSDR PROPERTIES
URL "https://osmocom.org/projects/gr-osmosdr/wiki"
)
if(GROSMOSDR_FOUND AND GROSMOSDR_VERSION)
set_package_properties(GROSMOSDR PROPERTIES
DESCRIPTION "osmocom GNU Radio blocks (found: v${GROSMOSDR_VERSION})"
)
else()
set_package_properties(GROSMOSDR PROPERTIES
DESCRIPTION "osmocom GNU Radio blocks"
)
endif() endif()
if(GROSMOSDR_FOUND AND NOT TARGET Gnuradio::osmosdr) if(GROSMOSDR_FOUND AND NOT TARGET Gnuradio::osmosdr)

View File

@ -20,6 +20,11 @@
# Iio::iio # Iio::iio
# #
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(PC_LIBIIO libiio) pkg_check_modules(PC_LIBIIO libiio)
@ -89,6 +94,20 @@ if(PC_LIBIIO_VERSION)
set(LIBIIO_VERSION ${PC_LIBIIO_VERSION}) set(LIBIIO_VERSION ${PC_LIBIIO_VERSION})
endif() endif()
if(LIBIIO_FOUND AND LIBIIO_VERSION)
set_package_properties(LIBIIO PROPERTIES
DESCRIPTION "A library for interfacing with Linux IIO devices (found: v${LIBIIO_VERSION})"
)
else()
set_package_properties(LIBIIO PROPERTIES
DESCRIPTION "A library for interfacing with Linux IIO devices"
)
endif()
set_package_properties(LIBIIO PROPERTIES
URL "https://github.com/analogdevicesinc/libiio"
)
if(LIBIIO_FOUND AND NOT TARGET Iio::iio) if(LIBIIO_FOUND AND NOT TARGET Iio::iio)
add_library(Iio::iio SHARED IMPORTED) add_library(Iio::iio SHARED IMPORTED)
set_target_properties(Iio::iio PROPERTIES set_target_properties(Iio::iio PROPERTIES

View File

@ -1,97 +0,0 @@
# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors)
#
# 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/>.
# Tries to find libosmosdr.
#
# Usage of this module as follows:
#
# find_package(LIBOSMOSDR)
#
#
# Variables defined by this module:
#
# LIBOSMOSDR_FOUND System has libosmosdr libs/headers
# LIBOSMOSDR_LIBRARIES The libosmosdr libraries
# LIBOSMOSDR_INCLUDE_DIR The location of libosmosdr headers
#
# Provides the following imported target:
# Osmosdr::osmosdr
#
include(FindPkgConfig)
pkg_check_modules(LIBOSMOSDR_PKG libosmosdr)
find_path(LIBOSMOSDR_INCLUDE_DIR NAMES osmosdr.h
PATHS
${LIBOSMOSDR_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
${LIBOSMOSDR_ROOT}/include
$ENV{LIBOSMOSDR_ROOT}/include
${LIBOSMOSDR_PKG_INCLUDEDIR}
)
find_library(LIBOSMOSDR_LIBRARIES NAMES osmosdr
PATHS
${LIBOSMOSDR_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/powerpc-linux-gnuspe
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib/i386-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/x86_64-kfreebsd-gnu
/usr/lib/i386-kfreebsd-gnu
/usr/lib/m68k-linux-gnu
/usr/lib/sh4-linux-gnu
/usr/lib/sparc64-linux-gnu
/usr/lib/x86_64-linux-gnux32
/usr/lib/alpha-linux-gnu
/usr/lib64
${LIBOSMOSDR_ROOT}/lib
$ENV{LIBOSMOSDR_ROOT}/lib
${LIBOSMOSDR_ROOT}/lib64
$ENV{LIBOSMOSDR_ROOT}/lib64
${LIBOSMOSDR_PKG_LIBDIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBOSMOSDR DEFAULT_MSG LIBOSMOSDR_INCLUDE_DIR LIBOSMOSDR_LIBRARIES)
if(LIBOSMOSDR_FOUND AND NOT TARGET Osmosdr::osmosdr)
add_library(Osmosdr::osmosdr SHARED IMPORTED)
set_target_properties(Osmosdr::osmosdr PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${LIBOSMOSDR_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBOSMOSDR_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${LIBOSMOSDR_LIBRARIES}"
)
endif()
mark_as_advanced(LIBOSMOSDR_INCLUDE_DIR LIBOSMOSDR_LIBRARIES)

View File

@ -26,6 +26,14 @@
# Log4cpp::log4cpp # Log4cpp::log4cpp
# #
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig)
pkg_check_modules(PC_LOG4CPP log4cpp QUIET)
if(LOG4CPP_INCLUDE_DIR) if(LOG4CPP_INCLUDE_DIR)
# Already in cache, be silent # Already in cache, be silent
set(LOG4CPP_FIND_QUIETLY TRUE) set(LOG4CPP_FIND_QUIETLY TRUE)
@ -37,6 +45,7 @@ find_path(LOG4CPP_INCLUDE_DIR log4cpp/Category.hh
/usr/include /usr/include
${LOG4CPP_ROOT}/include ${LOG4CPP_ROOT}/include
$ENV{LOG4CPP_ROOT}/include $ENV{LOG4CPP_ROOT}/include
${PC_LOG4CPP_INCLUDEDIR}
) )
if(LOG4CPP_INCLUDE_DIR) if(LOG4CPP_INCLUDE_DIR)
@ -57,7 +66,7 @@ set(LOG4CPP_NAMES log4cpp)
find_library(LOG4CPP_LIBRARY find_library(LOG4CPP_LIBRARY
NAMES ${LOG4CPP_NAMES} NAMES ${LOG4CPP_NAMES}
HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib
${PC_LIBDIR} ${PC_LOG4CPP_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib/ ${CMAKE_INSTALL_PREFIX}/lib/
PATHS /usr/local/lib PATHS /usr/local/lib
/usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
@ -107,6 +116,30 @@ endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LOG4CPP DEFAULT_MSG LOG4CPP_INCLUDE_DIRS LOG4CPP_LIBRARIES) find_package_handle_standard_args(LOG4CPP DEFAULT_MSG LOG4CPP_INCLUDE_DIRS LOG4CPP_LIBRARIES)
set_package_properties(LOG4CPP PROPERTIES
URL "http://log4cpp.sourceforge.net/"
)
if(LOG4CPP_FOUND AND PC_LOG4CPP_VERSION)
set(LOG4CPP_VERSION ${PC_LOG4CPP_VERSION})
endif()
if(LOG4CPP_FOUND AND LOG4CPP_VERSION)
if(LOG4CPP_READY_FOR_CXX17)
set_package_properties(LOG4CPP PROPERTIES
DESCRIPTION "Library of C++ classes for flexible logging (found: v${LOG4CPP_VERSION}, C++17-ready)"
)
else()
set_package_properties(LOG4CPP PROPERTIES
DESCRIPTION "Library of C++ classes for flexible logging (found: v${LOG4CPP_VERSION})"
)
endif()
else()
set_package_properties(LOG4CPP PROPERTIES
DESCRIPTION "Library of C++ classes for flexible logging"
)
endif()
if (LOG4CPP_FOUND AND NOT TARGET Log4cpp::log4cpp) if (LOG4CPP_FOUND AND NOT TARGET Log4cpp::log4cpp)
add_library(Log4cpp::log4cpp SHARED IMPORTED) add_library(Log4cpp::log4cpp SHARED IMPORTED)
set_target_properties(Log4cpp::log4cpp PROPERTIES set_target_properties(Log4cpp::log4cpp PROPERTIES

View File

@ -62,6 +62,10 @@
#============================================================================= #=============================================================================
# #
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
# Look for the header file. # Look for the header file.
find_path(MATIO_INCLUDE_DIR find_path(MATIO_INCLUDE_DIR
NAMES matio.h NAMES matio.h
@ -100,7 +104,6 @@ if(MATIO_INCLUDE_DIR)
endif() endif()
if(MATIO_CONFIG_FILE) if(MATIO_CONFIG_FILE)
# Read and parse MATIO config header file for version number # Read and parse MATIO config header file for version number
file(STRINGS "${MATIO_INCLUDE_DIR}/${MATIO_CONFIG_FILE}" _matio_HEADER_CONTENTS REGEX "#define MATIO_((MAJOR|MINOR)_VERSION)|(RELEASE_LEVEL) ") file(STRINGS "${MATIO_INCLUDE_DIR}/${MATIO_CONFIG_FILE}" _matio_HEADER_CONTENTS REGEX "#define MATIO_((MAJOR|MINOR)_VERSION)|(RELEASE_LEVEL) ")
@ -131,6 +134,20 @@ else()
set(MATIO_INCLUDE_DIRS) set(MATIO_INCLUDE_DIRS)
endif() endif()
if(MATIO_FOUND AND MATIO_VERSION_STRING)
set_package_properties(MATIO PROPERTIES
DESCRIPTION "MATLAB MAT File I/O Library (found: v${MATIO_VERSION_STRING})"
)
else()
set_package_properties(MATIO PROPERTIES
DESCRIPTION "MATLAB MAT File I/O Library"
)
endif()
set_package_properties(MATIO PROPERTIES
URL "https://github.com/tbeu/matio"
)
if(MATIO_FOUND AND NOT TARGET Matio::matio) if(MATIO_FOUND AND NOT TARGET Matio::matio)
add_library(Matio::matio SHARED IMPORTED) add_library(Matio::matio SHARED IMPORTED)
set_target_properties(Matio::matio PROPERTIES set_target_properties(Matio::matio PROPERTIES

View File

@ -1,49 +0,0 @@
# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors)
#
# 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/>.
# - Try to find OpenBLAS library (not headers!)
#
# The following environment variable is optionally searched
# OPENBLAS_HOME: Base directory where all OpenBlas components are found
set(OPEN_BLAS_SEARCH_PATHS
/lib
/lib64/
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/OpenBLAS/lib
/opt/local/lib
/usr/lib/openblas-base
$ENV{OPENBLAS_HOME}/lib
${OPENBLAS_ROOT}/lib
$ENV{OPENBLAS_ROOT}/lib
${OPENBLAS_ROOT}/lib64
$ENV{OPENBLAS_ROOT}/lib64
)
find_library(OPENBLAS NAMES openblas PATHS ${OPEN_BLAS_SEARCH_PATHS})
if(OPENBLAS)
set(OPENBLAS_FOUND ON)
message(STATUS "Found OpenBLAS")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OPENBLAS DEFAULT_MSG OPENBLAS)
mark_as_advanced(OPENBLAS)

View File

@ -1,4 +1,4 @@
# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors) # Copyright (C) 2011-2019 (see AUTHORS file for a list of contributors)
# #
# This file is part of GNSS-SDR. # This file is part of GNSS-SDR.
# #
@ -20,7 +20,7 @@
# #
# - Try to find OpenCL # - Try to find OpenCL
# This module tries to find an OpenCL implementation on your system. It supports # This module tries to find an OpenCL implementation on your system. It supports
# AMD / ATI, Apple and NVIDIA implementations, but shoudl work, too. # AMD / ATI, Apple and NVIDIA implementations.
# #
# Once done this will define # Once done this will define
# OPENCL_FOUND - system has OpenCL # OPENCL_FOUND - system has OpenCL
@ -29,67 +29,86 @@
# #
# WIN32 should work, but is untested # WIN32 should work, but is untested
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
set(OPENCL_VERSION_STRING "0.1.0") function(_FIND_OPENCL_VERSION)
set(OPENCL_VERSION_MAJOR 0) include(CheckSymbolExists)
set(OPENCL_VERSION_MINOR 1) include(CMakePushCheckState)
set(OPENCL_VERSION_PATCH 0) set(CMAKE_REQUIRED_QUIET ${OPENCL_FIND_QUIETLY})
cmake_push_check_state()
foreach(VERSION "2_2" "2_1" "2_0" "1_2" "1_1" "1_0")
set(CMAKE_REQUIRED_INCLUDES "${OPENCL_INCLUDE_DIR}")
if(APPLE) if(APPLE)
find_library(OPENCL_LIBRARIES OpenCL DOC "OpenCL lib for OSX") check_symbol_exists(
find_path(OPENCL_INCLUDE_DIRS OpenCL/cl.h DOC "Include for OpenCL on OSX") CL_VERSION_${VERSION}
find_path(_OPENCL_CPP_INCLUDE_DIRS OpenCL/cl.hpp DOC "Include for OpenCL CPP bindings on OSX") "${OPENCL_INCLUDE_DIR}/Headers/cl.h"
OPENCL_VERSION_${VERSION}
)
else() else()
if(WIN32) check_symbol_exists(
find_path(OPENCL_INCLUDE_DIRS CL/cl.h) CL_VERSION_${VERSION}
find_path(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp) "${OPENCL_INCLUDE_DIR}/CL/cl.h"
OPENCL_VERSION_${VERSION}
# The AMD SDK currently installs both x86 and x86_64 libraries )
# This is only a hack to find out architecture
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
set(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86_64")
set(OPENCL_LIB_DIR "$ENV{ATIINTERNALSTREAMSDKROOT}/lib/x86_64")
else()
set(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86")
set(OPENCL_LIB_DIR "$ENV{ATIINTERNALSTREAMSDKROOT}/lib/x86")
endif() endif()
# find out if the user asked for a 64-bit build, and use the corresponding if(OPENCL_VERSION_${VERSION})
# 64 or 32 bit NVIDIA library paths to the search: string(REPLACE "_" "." VERSION "${VERSION}")
string(REGEX MATCH "Win64" ISWIN64 ${CMAKE_GENERATOR}) set(OPENCL_VERSION_STRING ${VERSION} PARENT_SCOPE)
if("${ISWIN64}" STREQUAL "Win64") string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}")
find_library(OPENCL_LIBRARIES OpenCL.lib ${OPENCL_LIB_DIR} $ENV{CUDA_LIB_PATH} $ENV{CUDA_PATH}/lib/x64) list(GET version_components 0 major_version)
else() list(GET version_components 1 minor_version)
find_library(OPENCL_LIBRARIES OpenCL.lib ${OPENCL_LIB_DIR} $ENV{CUDA_LIB_PATH} $ENV{CUDA_PATH}/lib/Win32) set(OPENCL_VERSION_MAJOR ${major_version} PARENT_SCOPE)
set(OPENCL_VERSION_MINOR ${minor_version} PARENT_SCOPE)
break()
endif() endif()
endforeach()
cmake_pop_check_state()
endfunction()
get_filename_component(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE) find_path(OPENCL_INCLUDE_DIR
NAMES
# On Win32 search relative to the library CL/cl.h OpenCL/cl.h
find_path(OPENCL_INCLUDE_DIRS CL/cl.h PATHS "${_OPENCL_INC_CAND}" $ENV{CUDA_INC_PATH} $ENV{CUDA_PATH}/include) PATHS
find_path(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS "${_OPENCL_INC_CAND}" $ENV{CUDA_INC_PATH} $ENV{CUDA_PATH}/include) ENV "PROGRAMFILES(X86)"
ENV AMDAPPSDKROOT
else() ENV INTELOCLSDKROOT
# Unix style platforms ENV NVSDKCOMPUTE_ROOT
find_library(OPENCL_LIBRARIES OpenCL ENV CUDA_PATH
ENV LD_LIBRARY_PATH ENV ATISTREAMSDKROOT
ENV OCL_ROOT
/usr/local/cuda/include
PATH_SUFFIXES
include
OpenCL/common/inc
"AMD APP/include"
) )
get_filename_component(OPENCL_LIB_DIR ${OPENCL_LIBRARIES} PATH) find_path(_OPENCL_CPP_INCLUDE_DIRS
get_filename_component(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE) NAMES
CL/cl.hpp OpenCL/cl.hpp
# The AMD SDK currently does not place its headers PATHS
# in /usr/include, therefore also search relative ENV "PROGRAMFILES(X86)"
# to the library ENV AMDAPPSDKROOT
find_path(OPENCL_INCLUDE_DIRS CL/cl.h PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include") ENV INTELOCLSDKROOT
find_path(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include") ENV NVSDKCOMPUTE_ROOT
endif() ENV CUDA_PATH
endif() ENV ATISTREAMSDKROOT
ENV OCL_ROOT
find_package_handle_standard_args(OPENCL DEFAULT_MSG OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS) /usr/local/cuda/include
PATH_SUFFIXES
include
OpenCL/common/inc
"AMD APP/include"
)
set(OPENCL_INCLUDE_DIRS ${OPENCL_INCLUDE_DIR})
if(_OPENCL_CPP_INCLUDE_DIRS) if(_OPENCL_CPP_INCLUDE_DIRS)
set(OPENCL_HAS_CPP_BINDINGS TRUE) set(OPENCL_HAS_CPP_BINDINGS TRUE)
list(APPEND OPENCL_INCLUDE_DIRS ${_OPENCL_CPP_INCLUDE_DIRS}) list(APPEND OPENCL_INCLUDE_DIRS ${_OPENCL_CPP_INCLUDE_DIRS})
@ -97,14 +116,108 @@ if(_OPENCL_CPP_INCLUDE_DIRS)
list(REMOVE_DUPLICATES OPENCL_INCLUDE_DIRS) list(REMOVE_DUPLICATES OPENCL_INCLUDE_DIRS)
endif() endif()
_FIND_OPENCL_VERSION()
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
find_library(OPENCL_LIBRARY
NAMES OpenCL
PATHS
ENV "PROGRAMFILES(X86)"
ENV AMDAPPSDKROOT
ENV INTELOCLSDKROOT
ENV CUDA_PATH
ENV NVSDKCOMPUTE_ROOT
ENV ATISTREAMSDKROOT
ENV OCL_ROOT
PATH_SUFFIXES
"AMD APP/lib/x86"
lib/x86
lib/Win32
OpenCL/common/lib/Win32
)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
find_library(OPENCL_LIBRARY
NAMES OpenCL
PATHS
ENV "PROGRAMFILES(X86)"
ENV AMDAPPSDKROOT
ENV INTELOCLSDKROOT
ENV CUDA_PATH
ENV NVSDKCOMPUTE_ROOT
ENV ATISTREAMSDKROOT
ENV OCL_ROOT
PATH_SUFFIXES
"AMD APP/lib/x86_64"
lib/x86_64
lib/x64
OpenCL/common/lib/x64
)
endif()
else()
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
find_library(OPENCL_LIBRARY
NAMES OpenCL
PATHS
ENV AMDAPPSDKROOT
ENV CUDA_PATH
ENV LD_LIBRARY_PATH
PATH_SUFFIXES
lib/x86
lib
)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
find_library(OPENCL_LIBRARY
NAMES OpenCL
PATHS
ENV AMDAPPSDKROOT
ENV CUDA_PATH
ENV LD_LIBRARY_PATH
PATH_SUFFIXES
lib/x86_64
lib/x64
lib
lib64
)
endif()
endif()
set(OPENCL_LIBRARIES ${OPENCL_LIBRARY})
find_package_handle_standard_args(OPENCL DEFAULT_MSG OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS)
mark_as_advanced( mark_as_advanced(
OPENCL_INCLUDE_DIRS OPENCL_INCLUDE_DIRS
OPENCL_LIBRARIES
) )
if(OPENCL_INCLUDE_DIRS AND OPENCL_LIBRARIES) set_package_properties(OPENCL PROPERTIES
set( OPENCL_FOUND TRUE ) URL "https://www.khronos.org/opencl/"
add_definitions( -DOPENCL=1 ) )
if(OPENCL_FOUND AND OPENCL_VERSION_STRING)
set_package_properties(OPENCL PROPERTIES
DESCRIPTION "Library for parallel programming (found: v${OPENCL_VERSION_STRING})"
)
else() else()
set( OPENCL_FOUND FALSE ) set_package_properties(OPENCL PROPERTIES
add_definitions( -DOPENCL=0 ) DESCRIPTION "Library for parallel programming"
)
endif()
if(OPENCL_FOUND AND NOT TARGET OpenCL::OpenCL)
if(OPENCL_LIBRARY MATCHES "/([^/]+)\\.framework$")
add_library(OpenCL::OpenCL INTERFACE IMPORTED)
set_target_properties(OpenCL::OpenCL PROPERTIES
INTERFACE_LINK_LIBRARIES "${OPENCL_LIBRARY}"
)
else()
add_library(OpenCL::OpenCL UNKNOWN IMPORTED)
set_target_properties(OpenCL::OpenCL PROPERTIES
IMPORTED_LOCATION "${OPENCL_LIBRARY}"
)
endif()
set_target_properties(OpenCL::OpenCL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENCL_INCLUDE_DIRS}"
)
endif() endif()

View File

@ -15,7 +15,12 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. # along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
find_package(PkgConfig) if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig)
pkg_check_modules(PC_ORC "orc-0.4 > 0.4.22") pkg_check_modules(PC_ORC "orc-0.4 > 0.4.22")
find_program(ORCC_EXECUTABLE orcc find_program(ORCC_EXECUTABLE orcc
@ -63,6 +68,10 @@ find_library(ORC_LIB orc-0.4
${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
) )
if(PC_ORC_VERSION)
set(ORC_VERSION ${PC_ORC_VERSION})
endif()
list(APPEND ORC_LIBRARY ${ORC_LIB}) list(APPEND ORC_LIBRARY ${ORC_LIB})
set(ORC_INCLUDE_DIRS ${ORC_INCLUDE_DIR}) set(ORC_INCLUDE_DIRS ${ORC_INCLUDE_DIR})
@ -72,4 +81,18 @@ set(ORC_LIBRARY_DIRS ${ORC_LIBRARY_DIR})
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ORC "orc files" ORC_LIBRARY ORC_INCLUDE_DIR ORCC_EXECUTABLE) find_package_handle_standard_args(ORC "orc files" ORC_LIBRARY ORC_INCLUDE_DIR ORCC_EXECUTABLE)
set_package_properties(ORC PROPERTIES
URL "https://gstreamer.freedesktop.org/modules/orc.html"
)
if(ORC_FOUND AND ORC_VERSION)
set_package_properties(ORC PROPERTIES
DESCRIPTION "The Optimized Inner Loops Runtime Compiler (found: v${ORC_VERSION})"
)
else()
set_package_properties(ORC PROPERTIES
DESCRIPTION "The Optimized Inner Loops Runtime Compiler"
)
endif()
mark_as_advanced(ORC_INCLUDE_DIR ORC_LIBRARY ORCC_EXECUTABLE) mark_as_advanced(ORC_INCLUDE_DIR ORC_LIBRARY ORCC_EXECUTABLE)

View File

@ -48,6 +48,14 @@
# Pcap::pcap # Pcap::pcap
# #
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig)
pkg_check_modules(PC_PCAP libpcap QUIET)
if(EXISTS $ENV{PCAPDIR}) if(EXISTS $ENV{PCAPDIR})
find_path(PCAP_INCLUDE_DIR find_path(PCAP_INCLUDE_DIR
NAMES NAMES
@ -57,6 +65,7 @@ if(EXISTS $ENV{PCAPDIR})
$ENV{PCAPDIR} $ENV{PCAPDIR}
${PCAP_ROOT}/include ${PCAP_ROOT}/include
$ENV{PCAP_ROOT}/include $ENV{PCAP_ROOT}/include
${PC_PCAP_INCLUDEDIR}
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
find_library(PCAP_LIBRARY find_library(PCAP_LIBRARY
@ -66,6 +75,7 @@ if(EXISTS $ENV{PCAPDIR})
$ENV{PCAPDIR} $ENV{PCAPDIR}
${PCAP_ROOT}/lib ${PCAP_ROOT}/lib
$ENV{PCAP_ROOT}/lib $ENV{PCAP_ROOT}/lib
${PC_PCAP_LIBDIR}
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
else() else()
@ -76,6 +86,7 @@ else()
HINTS HINTS
${PCAP_ROOT}/include ${PCAP_ROOT}/include
$ENV{PCAP_ROOT}/include $ENV{PCAP_ROOT}/include
${PC_PCAP_INCLUDEDIR}
) )
find_library(PCAP_LIBRARY find_library(PCAP_LIBRARY
NAMES NAMES
@ -83,6 +94,7 @@ else()
HINTS HINTS
${PCAP_ROOT}/lib ${PCAP_ROOT}/lib
$ENV{PCAP_ROOT}/lib $ENV{PCAP_ROOT}/lib
${PC_PCAP_LIBDIR}
) )
endif() endif()
@ -92,17 +104,20 @@ set(PCAP_LIBRARIES ${PCAP_LIBRARY})
if(PCAP_INCLUDE_DIRS) if(PCAP_INCLUDE_DIRS)
message(STATUS "Pcap include dirs set to ${PCAP_INCLUDE_DIRS}") message(STATUS "Pcap include dirs set to ${PCAP_INCLUDE_DIRS}")
else() else()
message(FATAL " Pcap include dirs cannot be found") message(STATUS "Pcap include dirs cannot be found.")
endif() endif()
if(PCAP_LIBRARIES) if(PCAP_LIBRARIES)
message(STATUS "Pcap library set to ${PCAP_LIBRARIES}") message(STATUS "Pcap library set to ${PCAP_LIBRARIES}")
else() else()
message(FATAL "Pcap library cannot be found") message(STATUS "Pcap library cannot be found.")
endif() endif()
#Functions #Functions
include(CheckFunctionExists) include(CheckFunctionExists)
set(OLD_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS}) set(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARIES}) set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARIES})
check_function_exists("pcap_breakloop" HAVE_PCAP_BREAKLOOP) check_function_exists("pcap_breakloop" HAVE_PCAP_BREAKLOOP)
@ -115,10 +130,30 @@ check_function_exists("pcap_lib_version" HAVE_PCAP_LIB_VERSION)
check_function_exists("pcap_list_datalinks" HAVE_PCAP_LIST_DATALINKS) check_function_exists("pcap_list_datalinks" HAVE_PCAP_LIST_DATALINKS)
check_function_exists("pcap_open_dead" HAVE_PCAP_OPEN_DEAD) check_function_exists("pcap_open_dead" HAVE_PCAP_OPEN_DEAD)
check_function_exists("pcap_set_datalink" HAVE_PCAP_SET_DATALINK) check_function_exists("pcap_set_datalink" HAVE_PCAP_SET_DATALINK)
set(CMAKE_REQUIRED_INCLUDES ${OLD_CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PCAP DEFAULT_MSG PCAP_INCLUDE_DIRS PCAP_LIBRARIES) find_package_handle_standard_args(PCAP DEFAULT_MSG PCAP_INCLUDE_DIRS PCAP_LIBRARIES)
if(PCAP_FOUND AND PC_PCAP_VERSION)
set(PCAP_VERSION ${PC_PCAP_VERSION})
endif()
set_package_properties(PCAP PROPERTIES
URL "https://www.tcpdump.org"
)
if(PCAP_FOUND AND PCAP_VERSION)
set_package_properties(PCAP PROPERTIES
DESCRIPTION "A portable C/C++ library for network traffic capture (found: v${PCAP_VERSION})"
)
else()
set_package_properties(PCAP PROPERTIES
DESCRIPTION "A portable C/C++ library for network traffic capture"
)
endif()
if(PCAP_FOUND AND NOT TARGET Pcap::pcap) if(PCAP_FOUND AND NOT TARGET Pcap::pcap)
add_library(Pcap::pcap SHARED IMPORTED) add_library(Pcap::pcap SHARED IMPORTED)
set_target_properties(Pcap::pcap PROPERTIES set_target_properties(Pcap::pcap PROPERTIES

View File

@ -27,6 +27,11 @@
# Pugixml::pugixml # Pugixml::pugixml
# #
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(PC_PUGIXML pugixml QUIET) pkg_check_modules(PC_PUGIXML pugixml QUIET)
@ -36,11 +41,14 @@ find_path(PUGIXML_INCLUDE_DIR
/usr/include /usr/include
/usr/local/include /usr/local/include
/usr/local/include/pugixml-1.9 /usr/local/include/pugixml-1.9
/usr/local/include/pugixml-${PC_PUGIXML_VERSION}
/opt/local/include /opt/local/include
${PUGIXML_ROOT}/include ${PUGIXML_ROOT}/include
$ENV{PUGIXML_ROOT}/include $ENV{PUGIXML_ROOT}/include
${PUGIXML_ROOT}/include/pugixml-1.9 ${PUGIXML_ROOT}/include/pugixml-1.9
$ENV{PUGIXML_ROOT}/include/pugixml-1.9 $ENV{PUGIXML_ROOT}/include/pugixml-1.9
${PUGIXML_ROOT}/include/pugixml-${PC_PUGIXML_VERSION}
$ENV{PUGIXML_ROOT}/include/pugixml-${PC_PUGIXML_VERSION}
${PC_PUGIXML_INCLUDEDIR} ${PC_PUGIXML_INCLUDEDIR}
) )
@ -59,6 +67,7 @@ find_library(PUGIXML_LIBRARY
/usr/lib/s390x-linux-gnu /usr/lib/s390x-linux-gnu
/usr/local/lib /usr/local/lib
/usr/local/lib/pugixml-1.9 /usr/local/lib/pugixml-1.9
/usr/local/lib/pugixml-${PC_PUGIXML_VERSION}
/opt/local/lib /opt/local/lib
/usr/lib /usr/lib
/usr/lib64 /usr/lib64
@ -71,6 +80,10 @@ find_library(PUGIXML_LIBRARY
$ENV{PUGIXML_ROOT}/lib/pugixml-1.9 $ENV{PUGIXML_ROOT}/lib/pugixml-1.9
${PUGIXML_ROOT}/lib64/pugixml-1.9 ${PUGIXML_ROOT}/lib64/pugixml-1.9
$ENV{PUGIXML_ROOT}/lib64/pugixml-1.9 $ENV{PUGIXML_ROOT}/lib64/pugixml-1.9
${PUGIXML_ROOT}/lib/pugixml-${PC_PUGIXML_VERSION}
$ENV{PUGIXML_ROOT}/lib/pugixml-${PC_PUGIXML_VERSION}
${PUGIXML_ROOT}/lib64/pugixml-${PC_PUGIXML_VERSION}
$ENV{PUGIXML_ROOT}/lib64/pugixml-${PC_PUGIXML_VERSION}
${PC_PUGIXML_LIBDIR} ${PC_PUGIXML_LIBDIR}
) )
@ -92,6 +105,20 @@ else()
message(STATUS "PugiXML not found.") message(STATUS "PugiXML not found.")
endif() endif()
set_package_properties(PUGIXML PROPERTIES
URL "https://pugixml.org/"
)
if(PUGIXML_FOUND AND PUGIXML_VERSION)
set_package_properties(PUGIXML PROPERTIES
DESCRIPTION "Light-weight, simple and fast XML parser for C++ (found: v${PUGIXML_VERSION})"
)
else()
set_package_properties(PUGIXML PROPERTIES
DESCRIPTION "Light-weight, simple and fast XML parser for C++"
)
endif()
mark_as_advanced(PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR) mark_as_advanced(PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
if(PUGIXML_FOUND AND NOT TARGET Pugixml::pugixml) if(PUGIXML_FOUND AND NOT TARGET Pugixml::pugixml)

View File

@ -15,8 +15,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. # along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(PC_TELEORBIT teleorbit) pkg_check_modules(PC_TELEORBIT teleorbit QUIET)
find_path(TELEORBIT_INCLUDE_DIRS find_path(TELEORBIT_INCLUDE_DIRS
NAMES teleorbit/api.h NAMES teleorbit/api.h
@ -25,6 +30,7 @@ find_path(TELEORBIT_INCLUDE_DIRS
PATHS ${CMAKE_INSTALL_PREFIX}/include PATHS ${CMAKE_INSTALL_PREFIX}/include
/usr/local/include /usr/local/include
/usr/include /usr/include
/opt/local/include
${TELEORBIT_ROOT}/include ${TELEORBIT_ROOT}/include
$ENV{TELEORBIT_ROOT}/include $ENV{TELEORBIT_ROOT}/include
) )
@ -39,6 +45,7 @@ find_library(TELEORBIT_LIBRARIES
/usr/local/lib64 /usr/local/lib64
/usr/lib /usr/lib
/usr/lib64 /usr/lib64
/opt/local/lib
${TELEORBIT_ROOT}/lib ${TELEORBIT_ROOT}/lib
$ENV{TELEORBIT_ROOT}/lib $ENV{TELEORBIT_ROOT}/lib
${TELEORBIT_ROOT}/lib64 ${TELEORBIT_ROOT}/lib64
@ -48,6 +55,34 @@ find_library(TELEORBIT_LIBRARIES
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TELEORBIT DEFAULT_MSG TELEORBIT_LIBRARIES TELEORBIT_INCLUDE_DIRS) find_package_handle_standard_args(TELEORBIT DEFAULT_MSG TELEORBIT_LIBRARIES TELEORBIT_INCLUDE_DIRS)
if(PC_TELEORBIT_VERSION)
set(TELEORBIT_VERSION ${PC_TELEORBIT_VERSION})
endif()
if(NOT TELEORBIT_VERSION)
set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION})
unset(PACKAGE_VERSION)
list(GET TELEORBIT_LIBRARIES 0 FIRST_DIR)
get_filename_component(TELEORBIT_LIBRARIES_DIR ${FIRST_DIR} DIRECTORY)
if(EXISTS ${TELEORBIT_LIBRARIES_DIR}/cmake/teleorbit/TeleorbitConfigVersion.cmake)
include(${TELEORBIT_LIBRARIES_DIR}/cmake/teleorbit/TeleorbitConfigVersion.cmake)
endif()
if(PACKAGE_VERSION)
set(TELEORBIT_VERSION ${PACKAGE_VERSION})
endif()
set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION})
endif()
if(TELEORBIT_FOUND AND TELEORBIT_VERSION)
set_package_properties(TELEORBIT PROPERTIES
DESCRIPTION "The Teleorbit's Flexiband GNU Radio block (found: v${TELEORBIT_VERSION})"
)
else()
set_package_properties(TELEORBIT PROPERTIES
DESCRIPTION "The Teleorbit's Flexiband GNU Radio block."
)
endif()
if(TELEORBIT_FOUND AND NOT TARGET Gnuradio::teleorbit) if(TELEORBIT_FOUND AND NOT TARGET Gnuradio::teleorbit)
add_library(Gnuradio::teleorbit SHARED IMPORTED) add_library(Gnuradio::teleorbit SHARED IMPORTED)
set_target_properties(Gnuradio::teleorbit PROPERTIES set_target_properties(Gnuradio::teleorbit PROPERTIES

View File

@ -23,6 +23,11 @@
######################################################################## ########################################################################
# Find the library for the USRP Hardware Driver # Find the library for the USRP Hardware Driver
######################################################################## ########################################################################
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(PC_UHD uhd) pkg_check_modules(PC_UHD uhd)
@ -81,6 +86,8 @@ if(PC_UHD_VERSION)
set(UHD_VERSION ${PC_UHD_VERSION}) set(UHD_VERSION ${PC_UHD_VERSION})
endif() endif()
if(NOT PC_UHD_VERSION) if(NOT PC_UHD_VERSION)
set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION})
unset(PACKAGE_VERSION)
list(GET UHD_LIBRARIES 0 FIRST_DIR) list(GET UHD_LIBRARIES 0 FIRST_DIR)
get_filename_component(UHD_LIBRARIES_DIR ${FIRST_DIR} DIRECTORY) get_filename_component(UHD_LIBRARIES_DIR ${FIRST_DIR} DIRECTORY)
if(EXISTS ${UHD_LIBRARIES_DIR}/cmake/uhd/UHDConfigVersion.cmake) if(EXISTS ${UHD_LIBRARIES_DIR}/cmake/uhd/UHDConfigVersion.cmake)
@ -89,6 +96,21 @@ if(NOT PC_UHD_VERSION)
if(PACKAGE_VERSION) if(PACKAGE_VERSION)
set(UHD_VERSION ${PACKAGE_VERSION}) set(UHD_VERSION ${PACKAGE_VERSION})
endif() endif()
set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION})
endif()
set_package_properties(UHD PROPERTIES
URL "https://www.ettus.com/sdr-software/detail/usrp-hardware-driver"
)
if(UHD_FOUND AND UHD_VERSION)
set_package_properties(UHD PROPERTIES
DESCRIPTION "USRP Hardware Driver (found: v${UHD_VERSION})"
)
else()
set_package_properties(UHD PROPERTIES
DESCRIPTION "USRP Hardware Driver"
)
endif() endif()
if(UHD_FOUND AND NOT TARGET Uhd::uhd) if(UHD_FOUND AND NOT TARGET Uhd::uhd)

View File

@ -23,7 +23,11 @@
######################################################################## ########################################################################
# Find VOLK (Vector-Optimized Library of Kernels) # Find VOLK (Vector-Optimized Library of Kernels)
######################################################################## ########################################################################
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(PC_VOLK volk QUIET) pkg_check_modules(PC_VOLK volk QUIET)
@ -84,6 +88,8 @@ if(PC_VOLK_VERSION)
endif() endif()
if(NOT VOLK_VERSION) if(NOT VOLK_VERSION)
set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION})
unset(PACKAGE_VERSION)
list(GET VOLK_LIBRARIES 0 FIRST_DIR) list(GET VOLK_LIBRARIES 0 FIRST_DIR)
get_filename_component(VOLK_LIB_DIR ${FIRST_DIR} DIRECTORY) get_filename_component(VOLK_LIB_DIR ${FIRST_DIR} DIRECTORY)
if(EXISTS ${VOLK_LIB_DIR}/cmake/volk/VolkConfigVersion.cmake) if(EXISTS ${VOLK_LIB_DIR}/cmake/volk/VolkConfigVersion.cmake)
@ -92,6 +98,21 @@ if(NOT VOLK_VERSION)
if(PACKAGE_VERSION) if(PACKAGE_VERSION)
set(VOLK_VERSION ${PACKAGE_VERSION}) set(VOLK_VERSION ${PACKAGE_VERSION})
endif() endif()
set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION})
endif()
set_package_properties(VOLK PROPERTIES
URL "http://libvolk.org"
)
if(VOLK_FOUND AND VOLK_VERSION)
set_package_properties(VOLK PROPERTIES
DESCRIPTION "Vector-Optimized Library of Kernels (found: v${VOLK_VERSION})"
)
else()
set_package_properties(VOLK PROPERTIES
DESCRIPTION "Vector-Optimized Library of Kernels"
)
endif() endif()
mark_as_advanced(VOLK_LIBRARIES VOLK_INCLUDE_DIRS VOLK_VERSION) mark_as_advanced(VOLK_LIBRARIES VOLK_INCLUDE_DIRS VOLK_VERSION)

View File

@ -24,7 +24,11 @@
######################################################################## ########################################################################
# Find VOLK (Vector-Optimized Library of Kernels) GNSS-SDR library # Find VOLK (Vector-Optimized Library of Kernels) GNSS-SDR library
######################################################################## ########################################################################
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(PC_VOLK_GNSSSDR volk_gnsssdr) pkg_check_modules(PC_VOLK_GNSSSDR volk_gnsssdr)
@ -58,6 +62,19 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VOLKGNSSSDR DEFAULT_MSG VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS) find_package_handle_standard_args(VOLKGNSSSDR DEFAULT_MSG VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS)
mark_as_advanced(VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS) mark_as_advanced(VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS)
if(PC_VOLK_GNSSSDR_VERSION)
set(VOLKGNSSSDR_VERSION ${PC_VOLK_GNSSSDR_VERSION})
endif()
if(VOLKGNSSSDR_FOUND AND VOLKGNSSSDR_VERSION)
set_package_properties(VOLKGNSSSDR PROPERTIES
DESCRIPTION "Vector-Optimized Library of Kernels for GNSS-SDR (found: v${VOLKGNSSSDR_VERSION})."
)
else()
set_package_properties(VOLKGNSSSDR PROPERTIES
DESCRIPTION "Vector-Optimized Library of Kernels for GNSS-SDR."
)
endif()
if(VOLKGNSSSDR_FOUND AND NOT TARGET Volkgnsssdr::volkgnsssdr) if(VOLKGNSSSDR_FOUND AND NOT TARGET Volkgnsssdr::volkgnsssdr)
add_library(Volkgnsssdr::volkgnsssdr SHARED IMPORTED) add_library(Volkgnsssdr::volkgnsssdr SHARED IMPORTED)

View File

@ -1,55 +0,0 @@
# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors)
#
# 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/>.
###############################################################################
# Test for availability of SSE
#
# - Anthony Arnold
###############################################################################
function(test_for_sse h_file result_var name)
if(NOT DEFINED ${result_var})
execute_process(COMMAND echo "#include <${h_file}>"
COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -c -x c++ -
RESULT_VARIABLE COMPILE_RESULT
OUTPUT_QUIET ERROR_QUIET)
set(detected 0)
if(COMPILE_RESULT EQUAL 0)
message(STATUS "Detected ${name}")
set(detected 1)
endif()
set(${result_var} ${detected} CACHE INTERNAL "${name} Available")
endif()
endfunction()
message(STATUS "Testing for SIMD extensions")
enable_language(C)
test_for_sse("ammintrin.h" SSE4A_AVAILABLE "SSE4A")
test_for_sse("nmmintrin.h" SSE4_2_AVAILABLE "SSE4.2")
test_for_sse("smmintrin.h" SSE4_1_AVAILABLE "SSE4.1")
test_for_sse("tmmintrin.h" SSSE3_AVAILABLE "SSSE3")
test_for_sse("pmmintrin.h" SSE3_AVAILABLE "SSE3")
test_for_sse("emmintrin.h" SSE2_AVAILABLE "SSE2")
test_for_sse("xmmintrin.h" SSE_AVAILABLE "SSE1")
test_for_sse("mmintrin.h" MMX_AVAILABLE "MMX")
test_for_sse("wmmintrin.h" AES_AVAILABLE "AES")
test_for_sse("immintrin.h" AVX_AVAILABLE "AVX")
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/-.o")

View File

@ -56,6 +56,7 @@
### Improvements in Reliability ### Improvements in Reliability
- Included the Guidelines Support Library. General improvement of memory management, replacement of raw pointers by containers or smart pointers.
- Applied clang-tidy checks and fixes related to High Integrity C++: performance-move-const-arg, modernize-use-auto, modernize-use-equals-default, modernize-use-equals-delete, modernize-use-noexcept, modernize-use-nullptr, cert-dcl21-cpp, misc-new-delete-overloads, cert-dcl58-cpp, cert-err52-cpp, cert-err60-cpp. - Applied clang-tidy checks and fixes related to High Integrity C++: performance-move-const-arg, modernize-use-auto, modernize-use-equals-default, modernize-use-equals-delete, modernize-use-noexcept, modernize-use-nullptr, cert-dcl21-cpp, misc-new-delete-overloads, cert-dcl58-cpp, cert-err52-cpp, cert-err60-cpp.

View File

@ -77,6 +77,57 @@ rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
*/ */
class rtklib_pvt_gs : public gr::sync_block class rtklib_pvt_gs : public gr::sync_block
{ {
public:
~rtklib_pvt_gs(); //!< Default destructor
/*!
* \brief Get latest set of GPS ephemeris from PVT block
*/
std::map<int, Gps_Ephemeris> get_gps_ephemeris_map() const;
/*!
* \brief Get latest set of GPS almanac from PVT block
*/
std::map<int, Gps_Almanac> get_gps_almanac_map() const;
/*!
* \brief Get latest set of Galileo ephemeris from PVT block
*/
std::map<int, Galileo_Ephemeris> get_galileo_ephemeris_map() const;
/*!
* \brief Get latest set of Galileo almanac from PVT block
*/
std::map<int, Galileo_Almanac> get_galileo_almanac_map() const;
/*!
* \brief Get latest set of BeiDou DNAV ephemeris from PVT block
*/
std::map<int, Beidou_Dnav_Ephemeris> get_beidou_dnav_ephemeris_map() const;
/*!
* \brief Get latest set of BeiDou DNAV almanac from PVT block
*/
std::map<int, Beidou_Dnav_Almanac> get_beidou_dnav_almanac_map() const;
/*!
* \brief Clear all ephemeris information and the almanacs for GPS and Galileo
*/
void clear_ephemeris();
/*!
* \brief Get the latest Position WGS84 [deg], Ground Velocity, Course over Ground, and UTC Time, if available
*/
bool get_latest_PVT(double* longitude_deg,
double* latitude_deg,
double* height_m,
double* ground_speed_kmh,
double* course_over_ground_deg,
time_t* UTC_time) const;
int work(int noutput_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items); //!< PVT Signal Processing
private: private:
friend rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels, friend rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
const Pvt_Conf& conf_, const Pvt_Conf& conf_,
@ -169,57 +220,6 @@ private:
bool d_show_local_time_zone; bool d_show_local_time_zone;
std::string d_local_time_str; std::string d_local_time_str;
boost::posix_time::time_duration d_utc_diff_time; boost::posix_time::time_duration d_utc_diff_time;
public:
~rtklib_pvt_gs(); //!< Default destructor
/*!
* \brief Get latest set of GPS ephemeris from PVT block
*/
std::map<int, Gps_Ephemeris> get_gps_ephemeris_map() const;
/*!
* \brief Get latest set of GPS almanac from PVT block
*/
std::map<int, Gps_Almanac> get_gps_almanac_map() const;
/*!
* \brief Get latest set of Galileo ephemeris from PVT block
*/
std::map<int, Galileo_Ephemeris> get_galileo_ephemeris_map() const;
/*!
* \brief Get latest set of Galileo almanac from PVT block
*/
std::map<int, Galileo_Almanac> get_galileo_almanac_map() const;
/*!
* \brief Get latest set of BeiDou DNAV ephemeris from PVT block
*/
std::map<int, Beidou_Dnav_Ephemeris> get_beidou_dnav_ephemeris_map() const;
/*!
* \brief Get latest set of BeiDou DNAV almanac from PVT block
*/
std::map<int, Beidou_Dnav_Almanac> get_beidou_dnav_almanac_map() const;
/*!
* \brief Clear all ephemeris information and the almanacs for GPS and Galileo
*/
void clear_ephemeris();
/*!
* \brief Get the latest Position WGS84 [deg], Ground Velocity, Course over Ground, and UTC Time, if available
*/
bool get_latest_PVT(double* longitude_deg,
double* latitude_deg,
double* height_m,
double* ground_speed_kmh,
double* course_over_ground_deg,
time_t* UTC_time) const;
int work(int noutput_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items); //!< PVT Signal Processing
}; };
#endif #endif

View File

@ -47,18 +47,18 @@ class Pvt_Solution;
*/ */
class GeoJSON_Printer class GeoJSON_Printer
{ {
private:
std::ofstream geojson_file;
bool first_pos;
std::string filename_;
std::string geojson_base_path;
public: public:
GeoJSON_Printer(const std::string& base_path = "."); GeoJSON_Printer(const std::string& base_path = ".");
~GeoJSON_Printer(); ~GeoJSON_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true); bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Pvt_Solution>& position, bool print_average_values); bool print_position(const std::shared_ptr<Pvt_Solution>& position, bool print_average_values);
bool close_file(); bool close_file();
private:
std::ofstream geojson_file;
bool first_pos;
std::string filename_;
std::string geojson_base_path;
}; };
#endif #endif

View File

@ -47,19 +47,19 @@ class Rtklib_Solver;
*/ */
class Gpx_Printer class Gpx_Printer
{ {
private:
std::ofstream gpx_file;
bool positions_printed;
std::string gpx_filename;
std::string indent;
std::string gpx_base_path;
public: public:
Gpx_Printer(const std::string& base_path = "."); Gpx_Printer(const std::string& base_path = ".");
~Gpx_Printer(); ~Gpx_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true); bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values); bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values);
bool close_file(); bool close_file();
private:
std::ofstream gpx_file;
bool positions_printed;
std::string gpx_filename;
std::string indent;
std::string gpx_base_path;
}; };
#endif #endif

View File

@ -48,14 +48,6 @@
*/ */
class Hybrid_Ls_Pvt : public Ls_Pvt class Hybrid_Ls_Pvt : public Ls_Pvt
{ {
private:
int count_valid_position;
bool d_flag_dump_enabled;
std::string d_dump_filename;
std::ofstream d_dump_file;
int d_nchannels; // Number of available channels for positioning
double d_galileo_current_time;
public: public:
Hybrid_Ls_Pvt(int nchannels, std::string dump_filename, bool flag_dump_to_file); Hybrid_Ls_Pvt(int nchannels, std::string dump_filename, bool flag_dump_to_file);
~Hybrid_Ls_Pvt(); ~Hybrid_Ls_Pvt();
@ -75,6 +67,14 @@ public:
Gps_CNAV_Iono gps_cnav_iono; Gps_CNAV_Iono gps_cnav_iono;
Gps_CNAV_Utc_Model gps_cnav_utc_model; Gps_CNAV_Utc_Model gps_cnav_utc_model;
private:
int count_valid_position;
bool d_flag_dump_enabled;
std::string d_dump_filename;
std::ofstream d_dump_file;
int d_nchannels; // Number of available channels for positioning
double d_galileo_current_time;
}; };
#endif #endif

View File

@ -46,6 +46,13 @@ class Rtklib_Solver;
*/ */
class Kml_Printer class Kml_Printer
{ {
public:
Kml_Printer(const std::string& base_path = std::string("."));
~Kml_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values);
bool close_file();
private: private:
std::ofstream kml_file; std::ofstream kml_file;
std::ofstream tmp_file; std::ofstream tmp_file;
@ -55,13 +62,6 @@ private:
std::string tmp_file_str; std::string tmp_file_str;
unsigned int point_id; unsigned int point_id;
std::string indent; std::string indent;
public:
Kml_Printer(const std::string& base_path = std::string("."));
~Kml_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values);
bool close_file();
}; };
#endif #endif

View File

@ -41,12 +41,6 @@
*/ */
class Ls_Pvt : public Pvt_Solution class Ls_Pvt : public Pvt_Solution
{ {
private:
/*!
* \brief Computes the Lorentz inner product between two vectors
*/
double lorentz(const arma::vec& x, const arma::vec& y);
public: public:
Ls_Pvt(); Ls_Pvt();
@ -59,6 +53,12 @@ public:
* \brief Computes the Weighted Least Squares position solution * \brief Computes the Weighted Least Squares position solution
*/ */
arma::vec leastSquarePos(const arma::mat& satpos, const arma::vec& obs, const arma::vec& w_vec); arma::vec leastSquarePos(const arma::mat& satpos, const arma::vec& obs, const arma::vec& w_vec);
private:
/*!
* \brief Computes the Lorentz inner product between two vectors
*/
double lorentz(const arma::vec& x, const arma::vec& y);
}; };
#endif #endif

View File

@ -35,7 +35,7 @@
#include <sstream> #include <sstream>
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context} Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context}
{ {
for (const auto& address : addresses) for (const auto& address : addresses)
{ {

View File

@ -45,7 +45,7 @@ using b_io_context = boost::asio::io_service;
class Monitor_Pvt_Udp_Sink class Monitor_Pvt_Udp_Sink
{ {
public: public:
Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t &port, bool protobuf_enabled); Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t &port, bool protobuf_enabled);
bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt); bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt);
private: private:

View File

@ -283,7 +283,7 @@ bool Nmea_Printer::Print_Nmea_Line(const std::shared_ptr<Rtklib_Solver>& pvt_dat
} }
char Nmea_Printer::checkSum(std::string sentence) char Nmea_Printer::checkSum(const std::string& sentence)
{ {
char check = 0; char check = 0;
// iterate over the string, XOR each byte with the total sum: // iterate over the string, XOR each byte with the total sum:
@ -441,7 +441,7 @@ std::string Nmea_Printer::get_GPGSA()
// GSA-GNSS DOP and Active Satellites // GSA-GNSS DOP and Active Satellites
std::stringstream sentence_str; std::stringstream sentence_str;
unsigned char buff[1024] = {0}; unsigned char buff[1024] = {0};
outnmea_gsa(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat); outnmea_gsa(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat.data());
sentence_str << buff; sentence_str << buff;
return sentence_str.str(); return sentence_str.str();
} }
@ -454,7 +454,7 @@ std::string Nmea_Printer::get_GPGSV()
// Notice that NMEA 2.1 only supports 12 channels // Notice that NMEA 2.1 only supports 12 channels
std::stringstream sentence_str; std::stringstream sentence_str;
unsigned char buff[1024] = {0}; unsigned char buff[1024] = {0};
outnmea_gsv(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat); outnmea_gsv(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat.data());
sentence_str << buff; sentence_str << buff;
return sentence_str.str(); return sentence_str.str();
} }

View File

@ -83,7 +83,7 @@ private:
std::string get_UTC_NMEA_time(boost::posix_time::ptime d_position_UTC_time); std::string get_UTC_NMEA_time(boost::posix_time::ptime d_position_UTC_time);
std::string longitude_to_hm(double longitude); std::string longitude_to_hm(double longitude);
std::string latitude_to_hm(double lat); std::string latitude_to_hm(double lat);
char checkSum(std::string sentence); char checkSum(const std::string& sentence);
bool print_avg_pos; bool print_avg_pos;
bool d_flag_nmea_output_file; bool d_flag_nmea_output_file;
}; };

View File

@ -44,32 +44,6 @@
*/ */
class Pvt_Solution class Pvt_Solution
{ {
private:
double d_rx_dt_s; // RX time offset [s]
double d_latitude_d; // RX position Latitude WGS84 [deg]
double d_longitude_d; // RX position Longitude WGS84 [deg]
double d_height_m; // RX position height WGS84 [m]
double d_speed_over_ground_m_s; // RX speed over ground [m/s]
double d_course_over_ground_d; // RX course over ground [deg]
double d_avg_latitude_d; // Averaged latitude in degrees
double d_avg_longitude_d; // Averaged longitude in degrees
double d_avg_height_m; // Averaged height [m]
bool b_valid_position;
std::deque<double> d_hist_latitude_d;
std::deque<double> d_hist_longitude_d;
std::deque<double> d_hist_height_m;
bool d_flag_averaging;
int d_averaging_depth; // Length of averaging window
arma::vec d_rx_pos;
boost::posix_time::ptime d_position_UTC_time;
int d_valid_observations;
public: public:
Pvt_Solution(); Pvt_Solution();
@ -151,6 +125,33 @@ public:
* Translated to C++ by Carles Fernandez from a Matlab implementation by Kai Borre * Translated to C++ by Carles Fernandez from a Matlab implementation by Kai Borre
*/ */
int tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km); int tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km);
private:
double d_rx_dt_s; // RX time offset [s]
double d_latitude_d; // RX position Latitude WGS84 [deg]
double d_longitude_d; // RX position Longitude WGS84 [deg]
double d_height_m; // RX position height WGS84 [m]
double d_speed_over_ground_m_s; // RX speed over ground [m/s]
double d_course_over_ground_d; // RX course over ground [deg]
double d_avg_latitude_d; // Averaged latitude in degrees
double d_avg_longitude_d; // Averaged longitude in degrees
double d_avg_height_m; // Averaged height [m]
bool b_valid_position;
std::deque<double> d_hist_latitude_d;
std::deque<double> d_hist_longitude_d;
std::deque<double> d_hist_height_m;
bool d_flag_averaging;
int d_averaging_depth; // Length of averaging window
arma::vec d_rx_pos;
boost::posix_time::ptime d_position_UTC_time;
int d_valid_observations;
}; };
#endif #endif

View File

@ -140,7 +140,7 @@ bool Rtcm::is_server_running() const
std::string Rtcm::add_CRC(const std::string& message_without_crc) const std::string Rtcm::add_CRC(const std::string& message_without_crc) const
{ {
// ****** Computes Qualcomm CRC-24Q ****** // ****** Computes Qualcomm CRC-24Q ******
boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false> CRC_RTCM; boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false> CRC_RTCM;
// 1) Converts the string to a vector of uint8_t: // 1) Converts the string to a vector of uint8_t:
boost::dynamic_bitset<uint8_t> frame_bits(message_without_crc); boost::dynamic_bitset<uint8_t> frame_bits(message_without_crc);
std::vector<uint8_t> bytes; std::vector<uint8_t> bytes;
@ -159,7 +159,7 @@ std::string Rtcm::add_CRC(const std::string& message_without_crc) const
bool Rtcm::check_CRC(const std::string& message) const bool Rtcm::check_CRC(const std::string& message) const
{ {
boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false> CRC_RTCM_CHECK; boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false> CRC_RTCM_CHECK;
// Convert message to binary // Convert message to binary
std::string message_bin = Rtcm::binary_data_to_bin(message); std::string message_bin = Rtcm::binary_data_to_bin(message);
// Check CRC // Check CRC
@ -2419,7 +2419,7 @@ std::string Rtcm::get_MSM_1_content_sat_data(const std::map<int32_t, Gnss_Synchr
if (it == pos.end()) if (it == pos.end())
{ {
pos.push_back(65 - gnss_synchro_iter->second.PRN); pos.push_back(65 - gnss_synchro_iter->second.PRN);
observables_vector.push_back(*gnss_synchro_iter); observables_vector.emplace_back(*gnss_synchro_iter);
} }
} }
@ -2448,7 +2448,7 @@ std::string Rtcm::get_MSM_1_content_signal_data(const std::map<int32_t, Gnss_Syn
map_iter != observables.cend(); map_iter != observables.cend();
map_iter++) map_iter++)
{ {
observables_vector.push_back(*map_iter); observables_vector.emplace_back(*map_iter);
} }
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector); std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@ -2556,7 +2556,7 @@ std::string Rtcm::get_MSM_2_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend(); map_iter != observables.cend();
map_iter++) map_iter++)
{ {
observables_vector.push_back(*map_iter); observables_vector.emplace_back(*map_iter);
} }
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector); std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@ -2670,7 +2670,7 @@ std::string Rtcm::get_MSM_3_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend(); map_iter != observables.cend();
map_iter++) map_iter++)
{ {
observables_vector.push_back(*map_iter); observables_vector.emplace_back(*map_iter);
} }
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector); std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@ -2786,7 +2786,7 @@ std::string Rtcm::get_MSM_4_content_sat_data(const std::map<int32_t, Gnss_Synchr
if (it == pos.end()) if (it == pos.end())
{ {
pos.push_back(65 - gnss_synchro_iter->second.PRN); pos.push_back(65 - gnss_synchro_iter->second.PRN);
observables_vector.push_back(*gnss_synchro_iter); observables_vector.emplace_back(*gnss_synchro_iter);
} }
} }
@ -2827,7 +2827,7 @@ std::string Rtcm::get_MSM_4_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend(); map_iter != observables.cend();
map_iter++) map_iter++)
{ {
observables_vector.push_back(*map_iter); observables_vector.emplace_back(*map_iter);
} }
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector); std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@ -2947,7 +2947,7 @@ std::string Rtcm::get_MSM_5_content_sat_data(const std::map<int32_t, Gnss_Synchr
if (it == pos.end()) if (it == pos.end())
{ {
pos.push_back(65 - gnss_synchro_iter->second.PRN); pos.push_back(65 - gnss_synchro_iter->second.PRN);
observables_vector.push_back(*gnss_synchro_iter); observables_vector.emplace_back(*gnss_synchro_iter);
} }
} }
@ -2993,7 +2993,7 @@ std::string Rtcm::get_MSM_5_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend(); map_iter != observables.cend();
map_iter++) map_iter++)
{ {
observables_vector.push_back(*map_iter); observables_vector.emplace_back(*map_iter);
} }
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector); std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@ -3114,7 +3114,7 @@ std::string Rtcm::get_MSM_6_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend(); map_iter != observables.cend();
map_iter++) map_iter++)
{ {
observables_vector.push_back(*map_iter); observables_vector.emplace_back(*map_iter);
} }
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector); std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@ -3234,7 +3234,7 @@ std::string Rtcm::get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV,
map_iter != observables.cend(); map_iter != observables.cend();
map_iter++) map_iter++)
{ {
observables_vector.push_back(*map_iter); observables_vector.emplace_back(*map_iter);
} }
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector); std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
@ -5330,7 +5330,7 @@ int32_t Rtcm::set_DF398(const Gnss_Synchro& gnss_synchro)
} }
else else
{ {
rr_mod_ms = static_cast<uint32_t>(std::floor(rough_range_m / meters_to_miliseconds / TWO_N10) + 0.5) & 0x3FFu; rr_mod_ms = static_cast<uint32_t>(std::floor(rough_range_m / meters_to_miliseconds / TWO_N10) + 0.5) & 0x3FFU;
} }
DF398 = std::bitset<10>(rr_mod_ms); DF398 = std::bitset<10>(rr_mod_ms);
return 0; return 0;

View File

@ -64,6 +64,7 @@
#include <matio.h> #include <matio.h>
#include <exception> #include <exception>
#include <utility> #include <utility>
#include <vector>
Rtklib_Solver::Rtklib_Solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t &rtk) Rtklib_Solver::Rtklib_Solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t &rtk)
@ -172,34 +173,34 @@ bool Rtklib_Solver::save_matfile()
return false; return false;
} }
auto *TOW_at_current_symbol_ms = new uint32_t[num_epoch]; auto TOW_at_current_symbol_ms = std::vector<uint32_t>(num_epoch);
auto *week = new uint32_t[num_epoch]; auto week = std::vector<uint32_t>(num_epoch);
auto *RX_time = new double[num_epoch]; auto RX_time = std::vector<double>(num_epoch);
auto *user_clk_offset = new double[num_epoch]; auto user_clk_offset = std::vector<double>(num_epoch);
auto *pos_x = new double[num_epoch]; auto pos_x = std::vector<double>(num_epoch);
auto *pos_y = new double[num_epoch]; auto pos_y = std::vector<double>(num_epoch);
auto *pos_z = new double[num_epoch]; auto pos_z = std::vector<double>(num_epoch);
auto *vel_x = new double[num_epoch]; auto vel_x = std::vector<double>(num_epoch);
auto *vel_y = new double[num_epoch]; auto vel_y = std::vector<double>(num_epoch);
auto *vel_z = new double[num_epoch]; auto vel_z = std::vector<double>(num_epoch);
auto *cov_xx = new double[num_epoch]; auto cov_xx = std::vector<double>(num_epoch);
auto *cov_yy = new double[num_epoch]; auto cov_yy = std::vector<double>(num_epoch);
auto *cov_zz = new double[num_epoch]; auto cov_zz = std::vector<double>(num_epoch);
auto *cov_xy = new double[num_epoch]; auto cov_xy = std::vector<double>(num_epoch);
auto *cov_yz = new double[num_epoch]; auto cov_yz = std::vector<double>(num_epoch);
auto *cov_zx = new double[num_epoch]; auto cov_zx = std::vector<double>(num_epoch);
auto *latitude = new double[num_epoch]; auto latitude = std::vector<double>(num_epoch);
auto *longitude = new double[num_epoch]; auto longitude = std::vector<double>(num_epoch);
auto *height = new double[num_epoch]; auto height = std::vector<double>(num_epoch);
auto *valid_sats = new uint8_t[num_epoch]; auto valid_sats = std::vector<uint8_t>(num_epoch);
auto *solution_status = new uint8_t[num_epoch]; auto solution_status = std::vector<uint8_t>(num_epoch);
auto *solution_type = new uint8_t[num_epoch]; auto solution_type = std::vector<uint8_t>(num_epoch);
auto *AR_ratio_factor = new float[num_epoch]; auto AR_ratio_factor = std::vector<float>(num_epoch);
auto *AR_ratio_threshold = new float[num_epoch]; auto AR_ratio_threshold = std::vector<float>(num_epoch);
auto *gdop = new double[num_epoch]; auto gdop = std::vector<double>(num_epoch);
auto *pdop = new double[num_epoch]; auto pdop = std::vector<double>(num_epoch);
auto *hdop = new double[num_epoch]; auto hdop = std::vector<double>(num_epoch);
auto *vdop = new double[num_epoch]; auto vdop = std::vector<double>(num_epoch);
try try
{ {
@ -242,35 +243,6 @@ bool Rtklib_Solver::save_matfile()
catch (const std::ifstream::failure &e) catch (const std::ifstream::failure &e)
{ {
std::cerr << "Problem reading dump file:" << e.what() << std::endl; std::cerr << "Problem reading dump file:" << e.what() << std::endl;
delete[] TOW_at_current_symbol_ms;
delete[] week;
delete[] RX_time;
delete[] user_clk_offset;
delete[] pos_x;
delete[] pos_y;
delete[] pos_z;
delete[] vel_x;
delete[] vel_y;
delete[] vel_z;
delete[] cov_xx;
delete[] cov_yy;
delete[] cov_zz;
delete[] cov_xy;
delete[] cov_yz;
delete[] cov_zx;
delete[] latitude;
delete[] longitude;
delete[] height;
delete[] valid_sats;
delete[] solution_status;
delete[] solution_type;
delete[] AR_ratio_factor;
delete[] AR_ratio_threshold;
delete[] gdop;
delete[] pdop;
delete[] hdop;
delete[] vdop;
return false; return false;
} }
@ -284,149 +256,120 @@ bool Rtklib_Solver::save_matfile()
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_UINT32, MAT_T_UINT32, 2, dims, TOW_at_current_symbol_ms, 0); matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_UINT32, MAT_T_UINT32, 2, dims, TOW_at_current_symbol_ms.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("week", MAT_C_UINT32, MAT_T_UINT32, 2, dims, week, 0); matvar = Mat_VarCreate("week", MAT_C_UINT32, MAT_T_UINT32, 2, dims, week.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, RX_time, 0); matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, RX_time.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("user_clk_offset", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, user_clk_offset, 0); matvar = Mat_VarCreate("user_clk_offset", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, user_clk_offset.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("pos_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_x, 0); matvar = Mat_VarCreate("pos_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_x.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("pos_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_y, 0); matvar = Mat_VarCreate("pos_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_y.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("pos_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_z, 0); matvar = Mat_VarCreate("pos_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_z.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("vel_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_x, 0); matvar = Mat_VarCreate("vel_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_x.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("vel_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_y, 0); matvar = Mat_VarCreate("vel_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_y.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("vel_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_z, 0); matvar = Mat_VarCreate("vel_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_z.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_xx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_xx, 0); matvar = Mat_VarCreate("cov_xx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_xx.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_yy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_yy, 0); matvar = Mat_VarCreate("cov_yy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_yy.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_zz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_zz, 0); matvar = Mat_VarCreate("cov_zz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_zz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_xy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_xy, 0); matvar = Mat_VarCreate("cov_xy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_xy.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_yz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_yz, 0); matvar = Mat_VarCreate("cov_yz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_yz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_zx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_zx, 0); matvar = Mat_VarCreate("cov_zx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_zx.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("latitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, latitude, 0); matvar = Mat_VarCreate("latitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, latitude.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("longitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, longitude, 0); matvar = Mat_VarCreate("longitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, longitude.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("height", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, height, 0); matvar = Mat_VarCreate("height", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, height.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("valid_sats", MAT_C_UINT8, MAT_T_UINT8, 2, dims, valid_sats, 0); matvar = Mat_VarCreate("valid_sats", MAT_C_UINT8, MAT_T_UINT8, 2, dims, valid_sats.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("solution_status", MAT_C_UINT8, MAT_T_UINT8, 2, dims, solution_status, 0); matvar = Mat_VarCreate("solution_status", MAT_C_UINT8, MAT_T_UINT8, 2, dims, solution_status.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("solution_type", MAT_C_UINT8, MAT_T_UINT8, 2, dims, solution_type, 0); matvar = Mat_VarCreate("solution_type", MAT_C_UINT8, MAT_T_UINT8, 2, dims, solution_type.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("AR_ratio_factor", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, AR_ratio_factor, 0); matvar = Mat_VarCreate("AR_ratio_factor", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, AR_ratio_factor.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("AR_ratio_threshold", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, AR_ratio_threshold, 0); matvar = Mat_VarCreate("AR_ratio_threshold", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, AR_ratio_threshold.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("gdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, gdop, 0); matvar = Mat_VarCreate("gdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, gdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("pdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pdop, 0); matvar = Mat_VarCreate("pdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("hdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, hdop, 0); matvar = Mat_VarCreate("hdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, hdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("vdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vdop, 0); matvar = Mat_VarCreate("vdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }
Mat_Close(matfp); Mat_Close(matfp);
delete[] TOW_at_current_symbol_ms;
delete[] week;
delete[] RX_time;
delete[] user_clk_offset;
delete[] pos_x;
delete[] pos_y;
delete[] pos_z;
delete[] vel_x;
delete[] vel_y;
delete[] vel_z;
delete[] cov_xx;
delete[] cov_yy;
delete[] cov_zz;
delete[] cov_xy;
delete[] cov_yz;
delete[] cov_zx;
delete[] latitude;
delete[] longitude;
delete[] height;
delete[] valid_sats;
delete[] solution_status;
delete[] solution_type;
delete[] AR_ratio_factor;
delete[] AR_ratio_threshold;
delete[] gdop;
delete[] pdop;
delete[] hdop;
delete[] vdop;
return true; return true;
} }
@ -507,9 +450,9 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
int valid_obs = 0; // valid observations counter int valid_obs = 0; // valid observations counter
int glo_valid_obs = 0; // GLONASS L1/L2 valid observations counter int glo_valid_obs = 0; // GLONASS L1/L2 valid observations counter
obsd_t obs_data[MAXOBS]; std::array<obsd_t, MAXOBS> obs_data;
eph_t eph_data[MAXOBS]; std::array<eph_t, MAXOBS> eph_data;
geph_t geph_data[MAXOBS]; std::array<geph_t, MAXOBS> geph_data;
// Workaround for NAV/CNAV clash problem // Workaround for NAV/CNAV clash problem
bool gps_dual_band = false; bool gps_dual_band = false;
@ -894,8 +837,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
int result = 0; int result = 0;
int sat = 0; int sat = 0;
nav_t nav_data; nav_t nav_data;
nav_data.eph = eph_data; nav_data.eph = eph_data.data();
nav_data.geph = geph_data; nav_data.geph = geph_data.data();
nav_data.n = valid_obs; nav_data.n = valid_obs;
nav_data.ng = glo_valid_obs; nav_data.ng = glo_valid_obs;
@ -915,7 +858,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
} }
} }
result = rtkpos(&rtk_, obs_data, valid_obs + glo_valid_obs, &nav_data); result = rtkpos(&rtk_, obs_data.data(), valid_obs + glo_valid_obs, &nav_data);
if (result == 0) if (result == 0)
{ {
@ -1015,9 +958,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
<< " [deg], Height= " << this->get_height() << " [m]" << " [deg], Height= " << this->get_height() << " [m]"
<< " RX time offset= " << this->get_time_offset_s() << " [s]"; << " RX time offset= " << this->get_time_offset_s() << " [s]";
// ######## PVT MONITOR #########
// PVT MONITOR
// TOW // TOW
monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.begin()->second.TOW_at_current_symbol_ms; monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.begin()->second.TOW_at_current_symbol_ms;
// WEEK // WEEK
@ -1067,7 +1008,6 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
monitor_pvt.hdop = dop_[2]; monitor_pvt.hdop = dop_[2];
monitor_pvt.vdop = dop_[3]; monitor_pvt.vdop = dop_[3];
// ######## LOG FILE ######### // ######## LOG FILE #########
if (d_flag_dump_enabled == true) if (d_flag_dump_enabled == true)
{ {

View File

@ -84,22 +84,10 @@
/*! /*!
* \brief This class implements a simple PVT Least Squares solution * \brief This class implements a PVT solution based on RTKLIB
*/ */
class Rtklib_Solver : public Pvt_Solution class Rtklib_Solver : public Pvt_Solution
{ {
private:
rtk_t rtk_;
std::string d_dump_filename;
std::ofstream d_dump_file;
bool save_matfile();
bool d_flag_dump_enabled;
bool d_flag_dump_mat_enabled;
int d_nchannels; // Number of available channels for positioning
std::array<double, 4> dop_;
Monitor_Pvt monitor_pvt;
public: public:
Rtklib_Solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t& rtk); Rtklib_Solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t& rtk);
~Rtklib_Solver(); ~Rtklib_Solver();
@ -107,7 +95,7 @@ public:
bool get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_map, bool flag_averaging); bool get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_map, bool flag_averaging);
sol_t pvt_sol; sol_t pvt_sol;
ssat_t pvt_ssat[MAXSAT]; std::array<ssat_t, MAXSAT> pvt_ssat;
double get_hdop() const; double get_hdop() const;
double get_vdop() const; double get_vdop() const;
double get_pdop() const; double get_pdop() const;
@ -139,6 +127,17 @@ public:
std::map<int, Beidou_Dnav_Almanac> beidou_dnav_almanac_map; std::map<int, Beidou_Dnav_Almanac> beidou_dnav_almanac_map;
int count_valid_position; int count_valid_position;
private:
rtk_t rtk_;
std::string d_dump_filename;
std::ofstream d_dump_file;
bool save_matfile();
bool d_flag_dump_enabled;
bool d_flag_dump_mat_enabled;
int d_nchannels; // Number of available channels for positioning
std::array<double, 4> dop_;
Monitor_Pvt monitor_pvt;
}; };
#endif #endif

View File

@ -50,6 +50,7 @@ public:
GOOGLE_PROTOBUF_VERIFY_VERSION; GOOGLE_PROTOBUF_VERIFY_VERSION;
monitor_.New(); monitor_.New();
} }
~Serdes_Monitor_Pvt() ~Serdes_Monitor_Pvt()
{ {
// google::protobuf::ShutdownProtobufLibrary(); // google::protobuf::ShutdownProtobufLibrary();
@ -94,7 +95,6 @@ public:
return data; return data;
} }
inline Monitor_Pvt readProtobuffer(const gnss_sdr::MonitorPvt& mon) //!< Deserialization inline Monitor_Pvt readProtobuffer(const gnss_sdr::MonitorPvt& mon) //!< Deserialization
{ {
Monitor_Pvt monitor; Monitor_Pvt monitor;

View File

@ -39,6 +39,8 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
#include <memory>
BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition( BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
@ -90,7 +92,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
vector_length_ *= 2; vector_length_ *= 2;
} }
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "cshort") if (item_type_ == "cshort")
{ {
@ -135,10 +137,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
} }
BeidouB1iPcpsAcquisition::~BeidouB1iPcpsAcquisition() BeidouB1iPcpsAcquisition::~BeidouB1iPcpsAcquisition() = default;
{
delete[] code_;
}
void BeidouB1iPcpsAcquisition::stop_acquisition() void BeidouB1iPcpsAcquisition::stop_acquisition()
@ -204,18 +203,17 @@ void BeidouB1iPcpsAcquisition::init()
void BeidouB1iPcpsAcquisition::set_local_code() void BeidouB1iPcpsAcquisition::set_local_code()
{ {
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
beidou_b1i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); beidou_b1i_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
for (uint32_t i = 0; i < sampled_ms_; i++) gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
acquisition_->set_local_code(code_); acquisition_->set_local_code(code_.data());
delete[] code;
} }
@ -331,6 +329,7 @@ gr::basic_block_sptr BeidouB1iPcpsAcquisition::get_right_block()
return acquisition_; return acquisition_;
} }
void BeidouB1iPcpsAcquisition::set_resampler_latency(uint32_t latency_samples) void BeidouB1iPcpsAcquisition::set_resampler_latency(uint32_t latency_samples)
{ {
acquisition_->set_resampler_latency(latency_samples); acquisition_->set_resampler_latency(latency_samples);

View File

@ -42,7 +42,9 @@
#include <gnuradio/blocks/stream_to_vector.h> #include <gnuradio/blocks/stream_to_vector.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <cstdint> #include <cstdint>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -108,7 +110,6 @@ public:
acquisition_->set_channel_fsm(channel_fsm); acquisition_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -159,7 +160,6 @@ public:
*/ */
void set_resampler_latency(uint32_t latency_samples) override; void set_resampler_latency(uint32_t latency_samples) override;
private: private:
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_; pcps_acquisition_sptr acquisition_;
@ -183,12 +183,11 @@ private:
bool dump_; bool dump_;
bool blocking_; bool blocking_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
uint32_t in_streams_; uint32_t in_streams_;
uint32_t out_streams_; uint32_t out_streams_;
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };

View File

@ -37,7 +37,7 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
using google::LogMessage; using google::LogMessage;
@ -66,7 +66,10 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
blocking_ = configuration_->property(role + ".blocking", true); blocking_ = configuration_->property(role + ".blocking", true);
acq_parameters.blocking = blocking_; acq_parameters.blocking = blocking_;
doppler_max_ = configuration_->property(role + ".doppler_max", 5000); doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
}
acq_parameters.doppler_max = doppler_max_; acq_parameters.doppler_max = doppler_max_;
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1); sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
acq_parameters.sampled_ms = sampled_ms_; acq_parameters.sampled_ms = sampled_ms_;
@ -88,7 +91,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
vector_length_ *= 2; vector_length_ *= 2;
} }
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "cshort") if (item_type_ == "cshort")
{ {
@ -133,16 +136,14 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
} }
BeidouB3iPcpsAcquisition::~BeidouB3iPcpsAcquisition() BeidouB3iPcpsAcquisition::~BeidouB3iPcpsAcquisition() = default;
{
delete[] code_;
}
void BeidouB3iPcpsAcquisition::stop_acquisition() void BeidouB3iPcpsAcquisition::stop_acquisition()
{ {
} }
void BeidouB3iPcpsAcquisition::set_threshold(float threshold) void BeidouB3iPcpsAcquisition::set_threshold(float threshold)
{ {
float pfa = configuration_->property(role_ + ".pfa", 0.0); float pfa = configuration_->property(role_ + ".pfa", 0.0);
@ -201,18 +202,17 @@ void BeidouB3iPcpsAcquisition::init()
void BeidouB3iPcpsAcquisition::set_local_code() void BeidouB3iPcpsAcquisition::set_local_code()
{ {
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
beidou_b3i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); beidou_b3i_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
acquisition_->set_local_code(code_); acquisition_->set_local_code(code_.data());
delete[] code;
} }

View File

@ -41,7 +41,9 @@
#include <gnuradio/blocks/stream_to_vector.h> #include <gnuradio/blocks/stream_to_vector.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <cstdint> #include <cstdint>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -107,7 +109,6 @@ public:
acquisition_->set_channel_fsm(channel_fsm); acquisition_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -158,7 +159,6 @@ public:
*/ */
void set_resampler_latency(uint32_t latency_samples) override; void set_resampler_latency(uint32_t latency_samples) override;
private: private:
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_; pcps_acquisition_sptr acquisition_;
@ -182,12 +182,11 @@ private:
bool dump_; bool dump_;
bool blocking_; bool blocking_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };

View File

@ -36,6 +36,7 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
@ -86,7 +87,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
int samples_per_ms = code_length_ / 4; int samples_per_ms = code_length_ / 4;
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
@ -122,10 +123,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
} }
GalileoE1Pcps8msAmbiguousAcquisition::~GalileoE1Pcps8msAmbiguousAcquisition() GalileoE1Pcps8msAmbiguousAcquisition::~GalileoE1Pcps8msAmbiguousAcquisition() = default;
{
delete[] code_;
}
void GalileoE1Pcps8msAmbiguousAcquisition::stop_acquisition() void GalileoE1Pcps8msAmbiguousAcquisition::stop_acquisition()
@ -216,20 +214,20 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property( bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false); "Acquisition" + std::to_string(channel_) + ".cboc", false);
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
std::array<char, 3> Signal_;
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal, galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_ / 4; i++) for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
acquisition_cc_->set_local_code(code_); acquisition_cc_->set_local_code(code_.data());
delete[] code;
} }
} }
@ -242,6 +240,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::reset()
} }
} }
float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa) float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
{ {
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;

View File

@ -36,7 +36,9 @@
#include "galileo_pcps_8ms_acquisition_cc.h" #include "galileo_pcps_8ms_acquisition_cc.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include <gnuradio/blocks/stream_to_vector.h> #include <gnuradio/blocks/stream_to_vector.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -165,7 +167,7 @@ private:
int64_t fs_in_; int64_t fs_in_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;

View File

@ -37,6 +37,7 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
@ -126,7 +127,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
vector_length_ *= 2; vector_length_ *= 2;
} }
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "cshort") if (item_type_ == "cshort")
{ {
@ -166,16 +167,14 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
} }
GalileoE1PcpsAmbiguousAcquisition::~GalileoE1PcpsAmbiguousAcquisition() GalileoE1PcpsAmbiguousAcquisition::~GalileoE1PcpsAmbiguousAcquisition() = default;
{
delete[] code_;
}
void GalileoE1PcpsAmbiguousAcquisition::stop_acquisition() void GalileoE1PcpsAmbiguousAcquisition::stop_acquisition()
{ {
} }
void GalileoE1PcpsAmbiguousAcquisition::set_threshold(float threshold) void GalileoE1PcpsAmbiguousAcquisition::set_threshold(float threshold)
{ {
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0); float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
@ -242,45 +241,47 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property( bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false); "Acquisition" + std::to_string(channel_) + ".cboc", false);
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
gsl::span<std::complex<float>> code_span(code.get(), code_length_);
if (acquire_pilot_ == true) if (acquire_pilot_ == true)
{ {
//set local signal generator to Galileo E1 pilot component (1C) //set local signal generator to Galileo E1 pilot component (1C)
char pilot_signal[3] = "1C"; std::array<char, 3> pilot_signal = {{'1', 'C', '\0'}};
if (acq_parameters_.use_automatic_resampler) if (acq_parameters_.use_automatic_resampler)
{ {
galileo_e1_code_gen_complex_sampled(code, pilot_signal, galileo_e1_code_gen_complex_sampled(code_span, pilot_signal,
cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false); cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false);
} }
else else
{ {
galileo_e1_code_gen_complex_sampled(code, pilot_signal, galileo_e1_code_gen_complex_sampled(code_span, pilot_signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);
} }
} }
else else
{ {
std::array<char, 3> Signal_;
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
if (acq_parameters_.use_automatic_resampler) if (acq_parameters_.use_automatic_resampler)
{ {
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal, galileo_e1_code_gen_complex_sampled(code_span, Signal_,
cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false); cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false);
} }
else else
{ {
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal, galileo_e1_code_gen_complex_sampled(code_span, Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);
} }
} }
gsl::span<gr_complex> code__span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_ / 4; i++) for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
{ {
memcpy(&(code_[i * code_length_]), code, sizeof(gr_complex) * code_length_); std::copy_n(code.get(), code_length_, code__span.subspan(i * code_length_, code_length_).data());
} }
acquisition_->set_local_code(code_); acquisition_->set_local_code(code_.data());
delete[] code;
} }

View File

@ -39,7 +39,9 @@
#include "pcps_acquisition.h" #include "pcps_acquisition.h"
#include <gnuradio/blocks/float_to_complex.h> #include <gnuradio/blocks/float_to_complex.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -105,6 +107,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_->set_channel_fsm(channel_fsm); acquisition_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -153,10 +156,8 @@ public:
/*! /*!
* \brief Sets the resampler latency to account it in the acquisition code delay estimation * \brief Sets the resampler latency to account it in the acquisition code delay estimation
*/ */
void set_resampler_latency(uint32_t latency_samples) override; void set_resampler_latency(uint32_t latency_samples) override;
private: private:
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
Acq_Conf acq_parameters_; Acq_Conf acq_parameters_;
@ -181,7 +182,7 @@ private:
bool dump_; bool dump_;
bool blocking_; bool blocking_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;

View File

@ -40,9 +40,9 @@
#include <gnuradio/gr_complex.h> // for gr_complex #include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc #include <volk/volk.h> // for volk_32fc_conjugate_32fc
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm> // for copy_n
#include <cmath> // for abs, pow, floor #include <cmath> // for abs, pow, floor
#include <complex> // for complex #include <complex> // for complex
#include <cstring> // for memcpy
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
@ -108,10 +108,11 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
// compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time // compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned) // a channel is assigned)
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code std::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_all_fft_codes_ = new uint32_t[(nsamples_total * GALILEO_E1_NUMBER_OF_CODES)]; // memory containing all the possible fft codes for PRN 0 to 32 d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E1_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32
float max; // temporary maxima search float max; // temporary maxima search
int32_t tmp, tmp2, local_code, fft_data; int32_t tmp, tmp2, local_code, fft_data;
@ -122,14 +123,14 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
if (acquire_pilot_ == true) if (acquire_pilot_ == true)
{ {
//set local signal generator to Galileo E1 pilot component (1C) //set local signal generator to Galileo E1 pilot component (1C)
char pilot_signal[3] = "1C"; std::array<char, 3> pilot_signal = {{'1', 'C', '\0'}};
galileo_e1_code_gen_complex_sampled(code, pilot_signal, galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.data(), nsamples_total), pilot_signal,
cboc, PRN, fs_in, 0, false); cboc, PRN, fs_in, 0, false);
} }
else else
{ {
char data_signal[3] = "1B"; std::array<char, 3> data_signal = {{'1', 'B', '\0'}};
galileo_e1_code_gen_complex_sampled(code, data_signal, galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.data(), nsamples_total), data_signal,
cboc, PRN, fs_in, 0, false); cboc, PRN, fs_in, 0, false);
} }
@ -144,7 +145,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
code[s] = std::complex<float>(0.0, 0.0); code[s] = std::complex<float>(0.0, 0.0);
} }
memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code fft_if->execute(); // Run the FFT of local code
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
@ -173,7 +174,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
} }
} }
acq_parameters.all_fft_codes = d_all_fft_codes_; acq_parameters.all_fft_codes = d_all_fft_codes_.data();
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
@ -188,17 +189,12 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
doppler_step_ = 0; doppler_step_ = 0;
gnss_synchro_ = nullptr; gnss_synchro_ = nullptr;
// temporary buffers that we can delete // temporary buffers that we can release
delete[] code; volk_gnsssdr_free(fft_codes_padded);
delete fft_if;
delete[] fft_codes_padded;
} }
GalileoE1PcpsAmbiguousAcquisitionFpga::~GalileoE1PcpsAmbiguousAcquisitionFpga() GalileoE1PcpsAmbiguousAcquisitionFpga::~GalileoE1PcpsAmbiguousAcquisitionFpga() = default;
{
delete[] d_all_fft_codes_;
}
void GalileoE1PcpsAmbiguousAcquisitionFpga::stop_acquisition() void GalileoE1PcpsAmbiguousAcquisitionFpga::stop_acquisition()

View File

@ -37,7 +37,9 @@
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr #include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
#include <volk/volk_complex.h> // for lv_16sc_t #include <volk/volk_complex.h> // for lv_16sc_t
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <memory>
#include <string> #include <string>
#include <vector>
class Gnss_Synchro; class Gnss_Synchro;
class ConfigurationInterface; class ConfigurationInterface;
@ -165,8 +167,7 @@ private:
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
}; };
#endif /* GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H_ */ #endif /* GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H_ */

View File

@ -86,8 +86,8 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
int samples_per_ms = code_length_ / 4; int samples_per_ms = code_length_ / 4;
code_data_ = new gr_complex[vector_length_]; code_data_ = std::vector<std::complex<float>>(vector_length_);
code_pilot_ = new gr_complex[vector_length_]; code_pilot_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
@ -123,11 +123,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
} }
GalileoE1PcpsCccwsrAmbiguousAcquisition::~GalileoE1PcpsCccwsrAmbiguousAcquisition() GalileoE1PcpsCccwsrAmbiguousAcquisition::~GalileoE1PcpsCccwsrAmbiguousAcquisition() = default;
{
delete[] code_data_;
delete[] code_pilot_;
}
void GalileoE1PcpsCccwsrAmbiguousAcquisition::stop_acquisition() void GalileoE1PcpsCccwsrAmbiguousAcquisition::stop_acquisition()
@ -168,6 +164,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_doppler_step(unsigned int dopp
} }
} }
void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_gnss_synchro( void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_gnss_synchro(
Gnss_Synchro* gnss_synchro) Gnss_Synchro* gnss_synchro)
{ {
@ -203,19 +200,17 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property( bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false); "Acquisition" + std::to_string(channel_) + ".cboc", false);
char signal[3]; std::array<char, 3> signal = {{'1', 'B', '\0'}};
strcpy(signal, "1B"); galileo_e1_code_gen_complex_sampled(gsl::span<gr_complex>(code_data_.data(), vector_length_), signal,
galileo_e1_code_gen_complex_sampled(code_data_, signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);
strcpy(signal, "1C"); std::array<char, 3> signal_C = {{'1', 'C', '\0'}};
galileo_e1_code_gen_complex_sampled(code_pilot_, signal, galileo_e1_code_gen_complex_sampled(gsl::span<gr_complex>(code_pilot_.data(), vector_length_), signal_C,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);
acquisition_cc_->set_local_code(code_data_, code_pilot_); acquisition_cc_->set_local_code(code_data_.data(), code_pilot_.data());
} }
} }
@ -228,6 +223,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::reset()
} }
} }
void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_state(int state) void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_state(int state)
{ {
acquisition_cc_->set_state(state); acquisition_cc_->set_state(state);

View File

@ -36,7 +36,9 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_cccwsr_acquisition_cc.h" #include "pcps_cccwsr_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h> #include <gnuradio/blocks/stream_to_vector.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -101,6 +103,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_cc_->set_channel_fsm(channel_fsm); acquisition_cc_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of CCCWSR algorithm * \brief Set statistics threshold of CCCWSR algorithm
*/ */
@ -153,7 +156,6 @@ private:
std::string item_type_; std::string item_type_;
unsigned int vector_length_; unsigned int vector_length_;
unsigned int code_length_; unsigned int code_length_;
//unsigned int satellite_;
unsigned int channel_; unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_; std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_; float threshold_;
@ -164,8 +166,8 @@ private:
int64_t fs_in_; int64_t fs_in_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_data_; std::vector<std::complex<float>> code_data_;
std::complex<float>* code_pilot_; std::vector<std::complex<float>> code_pilot_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;

View File

@ -36,6 +36,7 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcquisition( GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcquisition(
@ -114,7 +115,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
dump_filename_ = configuration_->property(role + ".dump_filename", dump_filename_ = configuration_->property(role + ".dump_filename",
default_dump_filename); default_dump_filename);
code_ = new gr_complex[code_length_]; code_ = std::vector<std::complex<float>>(code_length_);
LOG(INFO) << "Vector Length: " << vector_length_ LOG(INFO) << "Vector Length: " << vector_length_
<< ", Samples per ms: " << samples_per_ms << ", Samples per ms: " << samples_per_ms
<< ", Folding factor: " << folding_factor_ << ", Folding factor: " << folding_factor_
@ -156,10 +157,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
} }
GalileoE1PcpsQuickSyncAmbiguousAcquisition::~GalileoE1PcpsQuickSyncAmbiguousAcquisition() GalileoE1PcpsQuickSyncAmbiguousAcquisition::~GalileoE1PcpsQuickSyncAmbiguousAcquisition() = default;
{
delete[] code_;
}
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::stop_acquisition() void GalileoE1PcpsQuickSyncAmbiguousAcquisition::stop_acquisition()
@ -250,23 +248,20 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property( bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false); "Acquisition" + std::to_string(channel_) + ".cboc", false);
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
std::array<char, 3> Signal_;
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal, galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < (sampled_ms_ / (folding_factor_ * 4)); i++) for (unsigned int i = 0; i < (sampled_ms_ / (folding_factor_ * 4)); i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
// memcpy(code_, code,sizeof(gr_complex)*code_length_); acquisition_cc_->set_local_code(code_.data());
acquisition_cc_->set_local_code(code_);
delete[] code;
code = nullptr;
} }
} }
@ -279,6 +274,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::reset()
} }
} }
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_state(int state) void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_state(int state)
{ {
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")

View File

@ -36,7 +36,9 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_quicksync_acquisition_cc.h" #include "pcps_quicksync_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h> #include <gnuradio/blocks/stream_to_vector.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -169,7 +171,7 @@ private:
int64_t fs_in_; int64_t fs_in_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;

View File

@ -36,6 +36,7 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
@ -89,7 +90,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
int samples_per_ms = code_length_ / 4; int samples_per_ms = code_length_ / 4;
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
@ -126,10 +127,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
} }
GalileoE1PcpsTongAmbiguousAcquisition::~GalileoE1PcpsTongAmbiguousAcquisition() GalileoE1PcpsTongAmbiguousAcquisition::~GalileoE1PcpsTongAmbiguousAcquisition() = default;
{
delete[] code_;
}
void GalileoE1PcpsTongAmbiguousAcquisition::stop_acquisition() void GalileoE1PcpsTongAmbiguousAcquisition::stop_acquisition()
@ -220,20 +218,19 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code()
bool cboc = configuration_->property( bool cboc = configuration_->property(
"Acquisition" + std::to_string(channel_) + ".cboc", false); "Acquisition" + std::to_string(channel_) + ".cboc", false);
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
std::array<char, 3> Signal_;
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal, std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_ / 4; i++) for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
acquisition_cc_->set_local_code(code_); acquisition_cc_->set_local_code(code_.data());
delete[] code;
} }
} }
@ -246,6 +243,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::reset()
} }
} }
void GalileoE1PcpsTongAmbiguousAcquisition::set_state(int state) void GalileoE1PcpsTongAmbiguousAcquisition::set_state(int state)
{ {
acquisition_cc_->set_state(state); acquisition_cc_->set_state(state);

View File

@ -36,7 +36,9 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_tong_acquisition_cc.h" #include "pcps_tong_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h> #include <gnuradio/blocks/stream_to_vector.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -168,7 +170,7 @@ private:
int64_t fs_in_; int64_t fs_in_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;

View File

@ -42,6 +42,7 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
@ -93,8 +94,8 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
vector_length_ = code_length_ * sampled_ms_; vector_length_ = code_length_ * sampled_ms_;
codeI_ = new gr_complex[vector_length_]; codeI_ = std::vector<std::complex<float>>(vector_length_);
codeQ_ = new gr_complex[vector_length_]; codeQ_ = std::vector<std::complex<float>>(vector_length_);
both_signal_components = false; both_signal_components = false;
std::string sig_ = configuration_->property("Channel.signal", std::string("5X")); std::string sig_ = configuration_->property("Channel.signal", std::string("5X"));
@ -131,11 +132,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
} }
GalileoE5aNoncoherentIQAcquisitionCaf::~GalileoE5aNoncoherentIQAcquisitionCaf() GalileoE5aNoncoherentIQAcquisitionCaf::~GalileoE5aNoncoherentIQAcquisitionCaf() = default;
{
delete[] codeI_;
delete[] codeQ_;
}
void GalileoE5aNoncoherentIQAcquisitionCaf::stop_acquisition() void GalileoE5aNoncoherentIQAcquisitionCaf::stop_acquisition()
@ -223,55 +220,51 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_local_code()
{ {
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
auto* codeI = new std::complex<float>[code_length_]; std::vector<std::complex<float>> codeI(code_length_);
auto* codeQ = new std::complex<float>[code_length_]; std::vector<std::complex<float>> codeQ(code_length_);
if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X') if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X')
{ {
char a[3]; std::array<char, 3> a = {{'5', 'I', '\0'}};
strcpy(a, "5I"); galileo_e5_a_code_gen_complex_sampled(gsl::span<std::complex<float>>(codeI.data(), code_length_), a,
galileo_e5_a_code_gen_complex_sampled(codeI, a,
gnss_synchro_->PRN, fs_in_, 0); gnss_synchro_->PRN, fs_in_, 0);
strcpy(a, "5Q"); std::array<char, 3> b = {{'5', 'Q', '\0'}};
galileo_e5_a_code_gen_complex_sampled(codeQ, a, galileo_e5_a_code_gen_complex_sampled(gsl::span<std::complex<float>>(codeQ.data(), code_length_), b,
gnss_synchro_->PRN, fs_in_, 0); gnss_synchro_->PRN, fs_in_, 0);
} }
else else
{ {
galileo_e5_a_code_gen_complex_sampled(codeI, gnss_synchro_->Signal, std::array<char, 3> signal_type_ = {{'5', 'X', '\0'}};
galileo_e5_a_code_gen_complex_sampled(gsl::span<std::complex<float>>(codeI.data(), code_length_), signal_type_,
gnss_synchro_->PRN, fs_in_, 0); gnss_synchro_->PRN, fs_in_, 0);
} }
// WARNING: 3ms are coherently integrated. Secondary sequence (1,1,1) // WARNING: 3ms are coherently integrated. Secondary sequence (1,1,1)
// is generated, and modulated in the 'block'. // is generated, and modulated in the 'block'.
gsl::span<gr_complex> codeQ_span(codeQ_.data(), vector_length_);
gsl::span<gr_complex> codeI_span(codeI_.data(), vector_length_);
if (Zero_padding == 0) // if no zero_padding if (Zero_padding == 0) // if no zero_padding
{ {
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
memcpy(&(codeI_[i * code_length_]), codeI, std::copy_n(codeI.data(), code_length_, codeI_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X') if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X')
{ {
memcpy(&(codeQ_[i * code_length_]), codeQ, std::copy_n(codeQ.data(), code_length_, codeQ_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
} }
} }
else else
{ {
// 1ms code + 1ms zero padding // 1ms code + 1ms zero padding
memcpy(&(codeI_[0]), codeI, std::copy_n(codeI.data(), code_length_, codeI_.data());
sizeof(gr_complex) * code_length_);
if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X') if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X')
{ {
memcpy(&(codeQ_[0]), codeQ, std::copy_n(codeQ.data(), code_length_, codeQ_.data());
sizeof(gr_complex) * code_length_);
} }
} }
acquisition_cc_->set_local_code(codeI_, codeQ_); acquisition_cc_->set_local_code(codeI_.data(), codeQ_.data());
delete[] codeI;
delete[] codeQ;
} }
} }

View File

@ -41,7 +41,9 @@
#include "channel_fsm.h" #include "channel_fsm.h"
#include "galileo_e5a_noncoherent_iq_acquisition_caf_cc.h" #include "galileo_e5a_noncoherent_iq_acquisition_caf_cc.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -102,6 +104,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_cc_->set_channel_fsm(channel_fsm); acquisition_cc_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -171,8 +174,8 @@ private:
std::string dump_filename_; std::string dump_filename_;
int Zero_padding; int Zero_padding;
int CAF_window_hz_; int CAF_window_hz_;
std::complex<float>* codeI_; std::vector<std::complex<float>> codeI_;
std::complex<float>* codeQ_; std::vector<std::complex<float>> codeQ_;
bool both_signal_components; bool both_signal_components;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;

View File

@ -37,6 +37,7 @@
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr_complex.h> #include <volk_gnsssdr/volk_gnsssdr_complex.h>
#include <algorithm>
GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration, GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration,
@ -123,7 +124,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / GALILEO_E5A_CODE_CHIP_RATE_HZ * static_cast<double>(GALILEO_E5A_CODE_LENGTH_CHIPS))); code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / GALILEO_E5A_CODE_CHIP_RATE_HZ * static_cast<double>(GALILEO_E5A_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * sampled_ms_; vector_length_ = code_length_ * sampled_ms_;
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
@ -164,10 +165,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
} }
GalileoE5aPcpsAcquisition::~GalileoE5aPcpsAcquisition() GalileoE5aPcpsAcquisition::~GalileoE5aPcpsAcquisition() = default;
{
delete[] code_;
}
void GalileoE5aPcpsAcquisition::stop_acquisition() void GalileoE5aPcpsAcquisition::stop_acquisition()
@ -235,38 +233,39 @@ void GalileoE5aPcpsAcquisition::init()
void GalileoE5aPcpsAcquisition::set_local_code() void GalileoE5aPcpsAcquisition::set_local_code()
{ {
auto* code = new gr_complex[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
char signal_[3]; std::array<char, 3> signal_;
signal_[0] = '5';
signal_[2] = '\0';
if (acq_iq_) if (acq_iq_)
{ {
strcpy(signal_, "5X"); signal_[1] = 'X';
} }
else if (acq_pilot_) else if (acq_pilot_)
{ {
strcpy(signal_, "5Q"); signal_[1] = 'Q';
} }
else else
{ {
strcpy(signal_, "5I"); signal_[1] = 'I';
} }
if (acq_parameters_.use_automatic_resampler) if (acq_parameters_.use_automatic_resampler)
{ {
galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0); galileo_e5_a_code_gen_complex_sampled(gsl::span<gr_complex>(code.get(), code_length_), signal_, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0);
} }
else else
{ {
galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, fs_in_, 0); galileo_e5_a_code_gen_complex_sampled(gsl::span<gr_complex>(code.get(), code_length_), signal_, gnss_synchro_->PRN, fs_in_, 0);
} }
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
memcpy(code_ + (i * code_length_), code, sizeof(gr_complex) * code_length_); std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
} }
acquisition_->set_local_code(code_); acquisition_->set_local_code(code_.data());
delete[] code;
} }

View File

@ -35,7 +35,9 @@
#include "channel_fsm.h" #include "channel_fsm.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_acquisition.h" #include "pcps_acquisition.h"
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -93,6 +95,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_->set_channel_fsm(channel_fsm); acquisition_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -143,29 +146,23 @@ public:
/*! /*!
* \brief Sets the resampler latency to account it in the acquisition code delay estimation * \brief Sets the resampler latency to account it in the acquisition code delay estimation
*/ */
void set_resampler_latency(uint32_t latency_samples) override; void set_resampler_latency(uint32_t latency_samples) override;
private: private:
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_; pcps_acquisition_sptr acquisition_;
Acq_Conf acq_parameters_; Acq_Conf acq_parameters_;
size_t item_size_; size_t item_size_;
std::string item_type_; std::string item_type_;
std::string dump_filename_; std::string dump_filename_;
std::string role_; std::string role_;
bool bit_transition_flag_; bool bit_transition_flag_;
bool dump_; bool dump_;
bool acq_pilot_; bool acq_pilot_;
bool use_CFAR_; bool use_CFAR_;
bool blocking_; bool blocking_;
bool acq_iq_; bool acq_iq_;
unsigned int vector_length_; unsigned int vector_length_;
unsigned int code_length_; unsigned int code_length_;
unsigned int channel_; unsigned int channel_;
@ -176,18 +173,10 @@ private:
unsigned int max_dwells_; unsigned int max_dwells_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
int64_t fs_in_; int64_t fs_in_;
float threshold_; float threshold_;
std::vector<std::complex<float>> code_;
/*
std::complex<float>* codeI_;
std::complex<float>* codeQ_;
*/
gr_complex* code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
}; };
#endif /* GALILEO_E5A_PCPS_ACQUISITION_H_ */ #endif /* GALILEO_E5A_PCPS_ACQUISITION_H_ */

View File

@ -40,9 +40,9 @@
#include <gnuradio/gr_complex.h> // for gr_complex #include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc #include <volk/volk.h> // for volk_32fc_conjugate_32fc
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm> // for copy_n
#include <cmath> // for abs, pow, floor #include <cmath> // for abs, pow, floor
#include <complex> // for complex #include <complex> // for complex
#include <cstring> // for strcpy, memcpy
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
@ -109,32 +109,34 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
// compute all the GALILEO E5 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time // compute all the GALILEO E5 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned) // a channel is assigned)
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code std::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_all_fft_codes_ = new uint32_t[(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES)]; // memory containing all the possible fft codes for PRN 0 to 32 d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32
float max; // temporary maxima search float max; // temporary maxima search
int32_t tmp, tmp2, local_code, fft_data; int32_t tmp, tmp2, local_code, fft_data;
for (uint32_t PRN = 1; PRN <= GALILEO_E5A_NUMBER_OF_CODES; PRN++) for (uint32_t PRN = 1; PRN <= GALILEO_E5A_NUMBER_OF_CODES; PRN++)
{ {
char signal_[3]; std::array<char, 3> signal_;
signal_[0] = '5';
signal_[2] = '\0';
if (acq_iq_) if (acq_iq_)
{ {
strcpy(signal_, "5X"); signal_[1] = 'X';
} }
else if (acq_pilot_) else if (acq_pilot_)
{ {
strcpy(signal_, "5Q"); signal_[1] = 'Q';
} }
else else
{ {
strcpy(signal_, "5I"); signal_[1] = 'I';
} }
galileo_e5_a_code_gen_complex_sampled(code, signal_, PRN, fs_in, 0); galileo_e5_a_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.data(), nsamples_total), signal_, PRN, fs_in, 0);
for (uint32_t s = code_length; s < 2 * code_length; s++) for (uint32_t s = code_length; s < 2 * code_length; s++)
{ {
@ -147,7 +149,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
code[s] = std::complex<float>(0.0, 0.0); code[s] = std::complex<float>(0.0, 0.0);
} }
memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code fft_if->execute(); // Run the FFT of local code
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
@ -175,7 +177,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
} }
} }
acq_parameters.all_fft_codes = d_all_fft_codes_; acq_parameters.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor // reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 13); acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 13);
@ -190,17 +192,12 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
doppler_step_ = 0; doppler_step_ = 0;
gnss_synchro_ = nullptr; gnss_synchro_ = nullptr;
// temporary buffers that we can delete // temporary buffers that we can release
delete[] code; volk_gnsssdr_free(fft_codes_padded);
delete fft_if;
delete[] fft_codes_padded;
} }
GalileoE5aPcpsAcquisitionFpga::~GalileoE5aPcpsAcquisitionFpga() GalileoE5aPcpsAcquisitionFpga::~GalileoE5aPcpsAcquisitionFpga() = default;
{
delete[] d_all_fft_codes_;
}
void GalileoE5aPcpsAcquisitionFpga::stop_acquisition() void GalileoE5aPcpsAcquisitionFpga::stop_acquisition()

View File

@ -39,7 +39,9 @@
#include <volk/volk_complex.h> // for lv_16sc_t #include <volk/volk_complex.h> // for lv_16sc_t
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <cstdint> #include <cstdint>
#include <memory>
#include <string> #include <string>
#include <vector>
class Gnss_Synchro; class Gnss_Synchro;
class ConfigurationInterface; class ConfigurationInterface;
@ -167,24 +169,19 @@ public:
private: private:
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
pcps_acquisition_fpga_sptr acquisition_fpga_; pcps_acquisition_fpga_sptr acquisition_fpga_;
std::string item_type_; std::string item_type_;
std::string dump_filename_; std::string dump_filename_;
std::string role_; std::string role_;
bool acq_pilot_; bool acq_pilot_;
bool acq_iq_; bool acq_iq_;
uint32_t channel_; uint32_t channel_;
std::weak_ptr<ChannelFsm> channel_fsm_; std::weak_ptr<ChannelFsm> channel_fsm_;
uint32_t doppler_max_; uint32_t doppler_max_;
uint32_t doppler_step_; uint32_t doppler_step_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
}; };
#endif /* GNSS_SDR_GALILEO_E5A_PCPS_ACQUISITION_FPGA_H_ */ #endif /* GNSS_SDR_GALILEO_E5A_PCPS_ACQUISITION_FPGA_H_ */

View File

@ -39,6 +39,7 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
@ -93,7 +94,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
vector_length_ *= 2; vector_length_ *= 2;
} }
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "cshort") if (item_type_ == "cshort")
{ {
@ -137,16 +138,14 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
} }
GlonassL1CaPcpsAcquisition::~GlonassL1CaPcpsAcquisition() GlonassL1CaPcpsAcquisition::~GlonassL1CaPcpsAcquisition() = default;
{
delete[] code_;
}
void GlonassL1CaPcpsAcquisition::stop_acquisition() void GlonassL1CaPcpsAcquisition::stop_acquisition()
{ {
} }
void GlonassL1CaPcpsAcquisition::set_threshold(float threshold) void GlonassL1CaPcpsAcquisition::set_threshold(float threshold)
{ {
float pfa = configuration_->property(role_ + ".pfa", 0.0); float pfa = configuration_->property(role_ + ".pfa", 0.0);
@ -206,18 +205,17 @@ void GlonassL1CaPcpsAcquisition::init()
void GlonassL1CaPcpsAcquisition::set_local_code() void GlonassL1CaPcpsAcquisition::set_local_code()
{ {
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
glonass_l1_ca_code_gen_complex_sampled(code, /* gnss_synchro_->PRN,*/ fs_in_, 0); glonass_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), /* gnss_synchro_->PRN,*/ fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
acquisition_->set_local_code(code_); acquisition_->set_local_code(code_.data());
delete[] code;
} }

View File

@ -39,7 +39,9 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_acquisition.h" #include "pcps_acquisition.h"
#include <gnuradio/blocks/float_to_complex.h> #include <gnuradio/blocks/float_to_complex.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -86,6 +88,7 @@ public:
* tracking blocks * tracking blocks
*/ */
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override; void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
/*! /*!
* \brief Set acquisition channel unique ID * \brief Set acquisition channel unique ID
*/ */
@ -103,6 +106,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_->set_channel_fsm(channel_fsm); acquisition_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -172,12 +176,11 @@ private:
bool dump_; bool dump_;
bool blocking_; bool blocking_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };

View File

@ -38,6 +38,7 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition( GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
@ -92,7 +93,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
vector_length_ *= 2; vector_length_ *= 2;
} }
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "cshort") if (item_type_ == "cshort")
{ {
@ -136,10 +137,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
} }
GlonassL2CaPcpsAcquisition::~GlonassL2CaPcpsAcquisition() GlonassL2CaPcpsAcquisition::~GlonassL2CaPcpsAcquisition() = default;
{
delete[] code_;
}
void GlonassL2CaPcpsAcquisition::stop_acquisition() void GlonassL2CaPcpsAcquisition::stop_acquisition()
@ -206,18 +204,17 @@ void GlonassL2CaPcpsAcquisition::init()
void GlonassL2CaPcpsAcquisition::set_local_code() void GlonassL2CaPcpsAcquisition::set_local_code()
{ {
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
glonass_l2_ca_code_gen_complex_sampled(code, /* gnss_synchro_->PRN,*/ fs_in_, 0); glonass_l2_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), /* gnss_synchro_->PRN,*/ fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
acquisition_->set_local_code(code_); acquisition_->set_local_code(code_.data());
delete[] code;
} }

View File

@ -38,7 +38,9 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_acquisition.h" #include "pcps_acquisition.h"
#include <gnuradio/blocks/float_to_complex.h> #include <gnuradio/blocks/float_to_complex.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -103,6 +105,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_->set_channel_fsm(channel_fsm); acquisition_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -172,12 +175,11 @@ private:
bool dump_; bool dump_;
bool blocking_; bool blocking_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };

View File

@ -41,6 +41,8 @@
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
#include <gsl/gsl>
GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
@ -121,7 +123,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L1_CA_CODE_PERIOD * 1000.0); acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L1_CA_CODE_PERIOD * 1000.0);
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1); vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "cshort") if (item_type_ == "cshort")
{ {
@ -159,16 +161,14 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
} }
GpsL1CaPcpsAcquisition::~GpsL1CaPcpsAcquisition() GpsL1CaPcpsAcquisition::~GpsL1CaPcpsAcquisition() = default;
{
delete[] code_;
}
void GpsL1CaPcpsAcquisition::stop_acquisition() void GpsL1CaPcpsAcquisition::stop_acquisition()
{ {
} }
void GpsL1CaPcpsAcquisition::set_threshold(float threshold) void GpsL1CaPcpsAcquisition::set_threshold(float threshold)
{ {
float pfa = configuration_->property(role_ + ".pfa", 0.0); float pfa = configuration_->property(role_ + ".pfa", 0.0);
@ -226,24 +226,23 @@ void GpsL1CaPcpsAcquisition::init()
void GpsL1CaPcpsAcquisition::set_local_code() void GpsL1CaPcpsAcquisition::set_local_code()
{ {
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
if (acq_parameters_.use_automatic_resampler) if (acq_parameters_.use_automatic_resampler)
{ {
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0); gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0);
} }
else else
{ {
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
} }
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
acquisition_->set_local_code(code_); acquisition_->set_local_code(code_.data());
delete[] code;
} }

View File

@ -43,7 +43,9 @@
#include "pcps_acquisition.h" #include "pcps_acquisition.h"
#include <gnuradio/blocks/float_to_complex.h> #include <gnuradio/blocks/float_to_complex.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -109,6 +111,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_->set_channel_fsm(channel_fsm); acquisition_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -157,10 +160,8 @@ public:
/*! /*!
* \brief Sets the resampler latency to account it in the acquisition code delay estimation * \brief Sets the resampler latency to account it in the acquisition code delay estimation
*/ */
void set_resampler_latency(uint32_t latency_samples) override; void set_resampler_latency(uint32_t latency_samples) override;
private: private:
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_; pcps_acquisition_sptr acquisition_;
@ -184,12 +185,11 @@ private:
bool dump_; bool dump_;
bool blocking_; bool blocking_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };

View File

@ -80,7 +80,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
//--- Find number of samples per spreading code ------------------------- //--- Find number of samples per spreading code -------------------------
vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
acq_parameters.samples_per_ms = vector_length_; acq_parameters.samples_per_ms = vector_length_;
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
@ -109,10 +109,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
} }
GpsL1CaPcpsAcquisitionFineDoppler::~GpsL1CaPcpsAcquisitionFineDoppler() GpsL1CaPcpsAcquisitionFineDoppler::~GpsL1CaPcpsAcquisitionFineDoppler() = default;
{
delete[] code_;
}
void GpsL1CaPcpsAcquisitionFineDoppler::stop_acquisition() void GpsL1CaPcpsAcquisitionFineDoppler::stop_acquisition()
@ -163,8 +160,8 @@ void GpsL1CaPcpsAcquisitionFineDoppler::init()
void GpsL1CaPcpsAcquisitionFineDoppler::set_local_code() void GpsL1CaPcpsAcquisitionFineDoppler::set_local_code()
{ {
gps_l1_ca_code_gen_complex_sampled(code_, gnss_synchro_->PRN, fs_in_, 0); gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code_.data(), vector_length_), gnss_synchro_->PRN, fs_in_, 0);
acquisition_cc_->set_local_code(code_); acquisition_cc_->set_local_code(code_.data());
} }

View File

@ -37,7 +37,9 @@
#include "channel_fsm.h" #include "channel_fsm.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_acquisition_fine_doppler_cc.h" #include "pcps_acquisition_fine_doppler_cc.h"
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -102,6 +104,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_cc_->set_channel_fsm(channel_fsm); acquisition_cc_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -161,7 +164,7 @@ private:
int64_t fs_in_; int64_t fs_in_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;

View File

@ -43,9 +43,9 @@
#include <gnuradio/gr_complex.h> // for gr_complex #include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc #include <volk/volk.h> // for volk_32fc_conjugate_32fc
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm> // for copy_n
#include <cmath> // for abs, pow, floor #include <cmath> // for abs, pow, floor
#include <complex> // for complex #include <complex> // for complex
#include <cstring> // for memcpy
#define NUM_PRNs 32 #define NUM_PRNs 32
@ -103,17 +103,17 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
// compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned) // a channel is assigned)
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true));
// allocate memory to compute all the PRNs and compute all the possible codes // allocate memory to compute all the PRNs and compute all the possible codes
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code std::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_all_fft_codes_ = new uint32_t[(nsamples_total * NUM_PRNs)]; // memory containing all the possible fft codes for PRN 0 to 32 d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
float max; float max;
int32_t tmp, tmp2, local_code, fft_data; int32_t tmp, tmp2, local_code, fft_data;
// temporary maxima search // temporary maxima search
for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++)
{ {
gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in, 0); // generate PRN code gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.data(), nsamples_total), PRN, fs_in, 0); // generate PRN code
for (uint32_t s = code_length; s < 2 * code_length; s++) for (uint32_t s = code_length; s < 2 * code_length; s++)
{ {
@ -126,7 +126,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
code[s] = std::complex<float>(0.0, 0.0); code[s] = std::complex<float>(0.0, 0.0);
} }
memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code fft_if->execute(); // Run the FFT of local code
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
@ -155,7 +155,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
} }
// acq_parameters // acq_parameters
acq_parameters.all_fft_codes = d_all_fft_codes_; acq_parameters.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor // reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 10); acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 10);
@ -170,17 +170,12 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
doppler_step_ = 0; doppler_step_ = 0;
gnss_synchro_ = nullptr; gnss_synchro_ = nullptr;
// temporary buffers that we can delete // temporary buffers that we can release
delete[] code; volk_gnsssdr_free(fft_codes_padded);
delete fft_if;
delete[] fft_codes_padded;
} }
GpsL1CaPcpsAcquisitionFpga::~GpsL1CaPcpsAcquisitionFpga() GpsL1CaPcpsAcquisitionFpga::~GpsL1CaPcpsAcquisitionFpga() = default;
{
delete[] d_all_fft_codes_;
}
void GpsL1CaPcpsAcquisitionFpga::stop_acquisition() void GpsL1CaPcpsAcquisitionFpga::stop_acquisition()

View File

@ -41,7 +41,9 @@
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr #include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
#include <volk/volk_complex.h> // for lv_16sc_t #include <volk/volk_complex.h> // for lv_16sc_t
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <string> // for string #include <memory>
#include <string>
#include <vector>
class Gnss_Synchro; class Gnss_Synchro;
class ConfigurationInterface; class ConfigurationInterface;
@ -167,7 +169,7 @@ private:
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
}; };
#endif /* GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_ */ #endif /* GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_ */

View File

@ -70,7 +70,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
//--- Find number of samples per spreading code ------------------------- //--- Find number of samples per spreading code -------------------------
vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
code_ = new gr_complex[vector_length_]; code_ = std::make_shared<std::complex<float>>(vector_length_);
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
@ -101,10 +101,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
} }
GpsL1CaPcpsAssistedAcquisition::~GpsL1CaPcpsAssistedAcquisition() GpsL1CaPcpsAssistedAcquisition::~GpsL1CaPcpsAssistedAcquisition() = default;
{
delete[] code_;
}
void GpsL1CaPcpsAssistedAcquisition::stop_acquisition() void GpsL1CaPcpsAssistedAcquisition::stop_acquisition()
@ -154,8 +151,8 @@ void GpsL1CaPcpsAssistedAcquisition::init()
void GpsL1CaPcpsAssistedAcquisition::set_local_code() void GpsL1CaPcpsAssistedAcquisition::set_local_code()
{ {
gps_l1_ca_code_gen_complex_sampled(code_, gnss_synchro_->PRN, fs_in_, 0); gps_l1_ca_code_gen_complex_sampled(gsl::span<gr_complex>(code_.get(), vector_length_), gnss_synchro_->PRN, fs_in_, 0);
acquisition_cc_->set_local_code(code_); acquisition_cc_->set_local_code(code_.get());
} }
void GpsL1CaPcpsAssistedAcquisition::reset() void GpsL1CaPcpsAssistedAcquisition::reset()

View File

@ -37,7 +37,9 @@
#include "channel_fsm.h" #include "channel_fsm.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_assisted_acquisition_cc.h" #include "pcps_assisted_acquisition_cc.h"
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -102,6 +104,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_cc_->set_channel_fsm(channel_fsm); acquisition_cc_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -147,7 +150,6 @@ private:
size_t item_size_; size_t item_size_;
std::string item_type_; std::string item_type_;
unsigned int vector_length_; unsigned int vector_length_;
//unsigned int satellite_;
unsigned int channel_; unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_; std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_; float threshold_;
@ -159,7 +161,7 @@ private:
int64_t fs_in_; int64_t fs_in_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::shared_ptr<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;

View File

@ -36,6 +36,7 @@
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition( GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
@ -59,7 +60,10 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
dump_ = configuration_->property(role + ".dump", false); dump_ = configuration_->property(role + ".dump", false);
doppler_max_ = configuration->property(role + ".doppler_max", 5000); doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
}
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1); sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
bit_transition_flag_ = configuration_->property("Acquisition.bit_transition_flag", false); bit_transition_flag_ = configuration_->property("Acquisition.bit_transition_flag", false);
@ -81,7 +85,7 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
vector_length_ = code_length_ * sampled_ms_; vector_length_ = code_length_ * sampled_ms_;
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
@ -117,16 +121,14 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
} }
GpsL1CaPcpsOpenClAcquisition::~GpsL1CaPcpsOpenClAcquisition() GpsL1CaPcpsOpenClAcquisition::~GpsL1CaPcpsOpenClAcquisition() = default;
{
delete[] code_;
}
void GpsL1CaPcpsOpenClAcquisition::stop_acquisition() void GpsL1CaPcpsOpenClAcquisition::stop_acquisition()
{ {
} }
void GpsL1CaPcpsOpenClAcquisition::set_threshold(float threshold) void GpsL1CaPcpsOpenClAcquisition::set_threshold(float threshold)
{ {
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0); float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
@ -207,19 +209,17 @@ void GpsL1CaPcpsOpenClAcquisition::set_local_code()
{ {
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
acquisition_cc_->set_local_code(code_); acquisition_cc_->set_local_code(code_.data());
delete[] code;
} }
} }

View File

@ -36,7 +36,9 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_opencl_acquisition_cc.h" #include "pcps_opencl_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h> #include <gnuradio/blocks/stream_to_vector.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -101,6 +103,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_cc_->set_channel_fsm(channel_fsm); acquisition_cc_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -144,6 +147,12 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
inline bool opencl_ready() const
{
bool ready = this->acquisition_cc_->opencl_ready();
return ready;
}
private: private:
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
pcps_opencl_acquisition_cc_sptr acquisition_cc_; pcps_opencl_acquisition_cc_sptr acquisition_cc_;
@ -163,12 +172,11 @@ private:
int64_t fs_in_; int64_t fs_in_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };

View File

@ -37,6 +37,7 @@
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
@ -104,7 +105,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
int samples_per_ms = round(code_length_); int samples_per_ms = round(code_length_);
code_ = new gr_complex[code_length_](); code_ = std::vector<std::complex<float>>(code_length_);
/*Object relevant information for debugging*/ /*Object relevant information for debugging*/
LOG(INFO) << "Implementation: " << this->implementation() LOG(INFO) << "Implementation: " << this->implementation()
<< ", Vector Length: " << vector_length_ << ", Vector Length: " << vector_length_
@ -149,16 +150,14 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
} }
GpsL1CaPcpsQuickSyncAcquisition::~GpsL1CaPcpsQuickSyncAcquisition() GpsL1CaPcpsQuickSyncAcquisition::~GpsL1CaPcpsQuickSyncAcquisition() = default;
{
delete[] code_;
}
void GpsL1CaPcpsQuickSyncAcquisition::stop_acquisition() void GpsL1CaPcpsQuickSyncAcquisition::stop_acquisition()
{ {
} }
void GpsL1CaPcpsQuickSyncAcquisition::set_threshold(float threshold) void GpsL1CaPcpsQuickSyncAcquisition::set_threshold(float threshold)
{ {
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0); float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
@ -236,20 +235,17 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_local_code()
{ {
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
auto* code = new std::complex<float>[code_length_](); std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < (sampled_ms_ / folding_factor_); i++) for (unsigned int i = 0; i < (sampled_ms_ / folding_factor_); i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
//memcpy(code_, code,sizeof(gr_complex)*code_length_); acquisition_cc_->set_local_code(code_.data());
acquisition_cc_->set_local_code(code_);
delete[] code;
} }
} }

View File

@ -38,7 +38,9 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_quicksync_acquisition_cc.h" #include "pcps_quicksync_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h> #include <gnuradio/blocks/stream_to_vector.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -103,6 +105,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_cc_->set_channel_fsm(channel_fsm); acquisition_cc_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -170,12 +173,11 @@ private:
int64_t fs_in_; int64_t fs_in_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };

View File

@ -36,6 +36,7 @@
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
@ -75,7 +76,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
vector_length_ = code_length_ * sampled_ms_; vector_length_ = code_length_ * sampled_ms_;
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
@ -111,16 +112,14 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
} }
GpsL1CaPcpsTongAcquisition::~GpsL1CaPcpsTongAcquisition() GpsL1CaPcpsTongAcquisition::~GpsL1CaPcpsTongAcquisition() = default;
{
delete[] code_;
}
void GpsL1CaPcpsTongAcquisition::stop_acquisition() void GpsL1CaPcpsTongAcquisition::stop_acquisition()
{ {
} }
void GpsL1CaPcpsTongAcquisition::set_threshold(float threshold) void GpsL1CaPcpsTongAcquisition::set_threshold(float threshold)
{ {
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0); float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
@ -193,23 +192,22 @@ void GpsL1CaPcpsTongAcquisition::init()
//set_local_code(); //set_local_code();
} }
void GpsL1CaPcpsTongAcquisition::set_local_code() void GpsL1CaPcpsTongAcquisition::set_local_code()
{ {
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < sampled_ms_; i++) for (unsigned int i = 0; i < sampled_ms_; i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
acquisition_cc_->set_local_code(code_); acquisition_cc_->set_local_code(code_.data());
delete[] code;
} }
} }

View File

@ -37,7 +37,9 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pcps_tong_acquisition_cc.h" #include "pcps_tong_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h> #include <gnuradio/blocks/stream_to_vector.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -102,6 +104,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_cc_->set_channel_fsm(channel_fsm); acquisition_cc_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of TONG algorithm * \brief Set statistics threshold of TONG algorithm
*/ */
@ -169,12 +172,11 @@ private:
int64_t fs_in_; int64_t fs_in_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };

View File

@ -39,6 +39,7 @@
#include "gps_l2c_signal.h" #include "gps_l2c_signal.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
@ -126,7 +127,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L2_M_PERIOD * 1000.0); acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L2_M_PERIOD * 1000.0);
vector_length_ = acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms * (acq_parameters_.bit_transition_flag ? 2 : 1); vector_length_ = acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms * (acq_parameters_.bit_transition_flag ? 2 : 1);
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "cshort") if (item_type_ == "cshort")
{ {
@ -164,10 +165,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
} }
GpsL2MPcpsAcquisition::~GpsL2MPcpsAcquisition() GpsL2MPcpsAcquisition::~GpsL2MPcpsAcquisition() = default;
{
delete[] code_;
}
void GpsL2MPcpsAcquisition::stop_acquisition() void GpsL2MPcpsAcquisition::stop_acquisition()
@ -239,27 +237,24 @@ void GpsL2MPcpsAcquisition::init()
void GpsL2MPcpsAcquisition::set_local_code() void GpsL2MPcpsAcquisition::set_local_code()
{ {
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
if (acq_parameters_.use_automatic_resampler) if (acq_parameters_.use_automatic_resampler)
{ {
gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs); gps_l2c_m_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), gnss_synchro_->PRN, acq_parameters_.resampled_fs);
} }
else else
{ {
gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); gps_l2c_m_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), gnss_synchro_->PRN, fs_in_);
} }
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < num_codes_; i++) for (unsigned int i = 0; i < num_codes_; i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
acquisition_->set_local_code(code_); acquisition_->set_local_code(code_.data());
delete[] code;
} }
@ -268,6 +263,7 @@ void GpsL2MPcpsAcquisition::reset()
acquisition_->set_active(true); acquisition_->set_active(true);
} }
void GpsL2MPcpsAcquisition::set_state(int state) void GpsL2MPcpsAcquisition::set_state(int state)
{ {
acquisition_->set_state(state); acquisition_->set_state(state);

View File

@ -40,7 +40,9 @@
#include "pcps_acquisition.h" #include "pcps_acquisition.h"
#include <gnuradio/blocks/float_to_complex.h> #include <gnuradio/blocks/float_to_complex.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -106,6 +108,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_->set_channel_fsm(channel_fsm); acquisition_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -154,10 +157,8 @@ public:
/*! /*!
* \brief Sets the resampler latency to account it in the acquisition code delay estimation * \brief Sets the resampler latency to account it in the acquisition code delay estimation
*/ */
void set_resampler_latency(uint32_t latency_samples) override; void set_resampler_latency(uint32_t latency_samples) override;
private: private:
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_; pcps_acquisition_sptr acquisition_;
@ -180,13 +181,12 @@ private:
bool dump_; bool dump_;
bool blocking_; bool blocking_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
unsigned int num_codes_; unsigned int num_codes_;
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };

View File

@ -42,9 +42,9 @@
#include <gnuradio/gr_complex.h> // for gr_complex #include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc #include <volk/volk.h> // for volk_32fc_conjugate_32fc
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm> // for copy_n
#include <cmath> // for abs, pow, floor #include <cmath> // for abs, pow, floor
#include <complex> // for complex #include <complex> // for complex
#include <cstring> // for memcpy
#define NUM_PRNs 32 #define NUM_PRNs 32
#define QUANT_BITS_LOCAL_CODE 16 #define QUANT_BITS_LOCAL_CODE 16
@ -102,24 +102,24 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
// compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned) // a channel is assigned)
auto* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
// allocate memory to compute all the PRNs and compute all the possible codes // allocate memory to compute all the PRNs and compute all the possible codes
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code std::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
//d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32 d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
d_all_fft_codes_ = new uint32_t[(nsamples_total * NUM_PRNs)]; // memory containing all the possible fft codes for PRN 0 to 32
float max; // temporary maxima search float max; // temporary maxima search
int32_t tmp, tmp2, local_code, fft_data; int32_t tmp, tmp2, local_code, fft_data;
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++) for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
{ {
gps_l2c_m_code_gen_complex_sampled(code, PRN, fs_in_); gps_l2c_m_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.data(), nsamples_total), PRN, fs_in_);
// fill in zero padding // fill in zero padding
for (unsigned int s = code_length; s < nsamples_total; s++) for (unsigned int s = code_length; s < nsamples_total; s++)
{ {
code[s] = std::complex<float>(0.0, 0.0); code[s] = std::complex<float>(0.0, 0.0);
} }
memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code fft_if->execute(); // Run the FFT of local code
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
max = 0; // initialize maximum value max = 0; // initialize maximum value
@ -149,12 +149,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
} }
} }
acq_parameters.all_fft_codes = d_all_fft_codes_; acq_parameters.all_fft_codes = d_all_fft_codes_.data();
// temporary buffers that we can delete
delete[] code;
delete fft_if;
delete[] fft_codes_padded;
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
@ -162,15 +157,14 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
doppler_step_ = 0; doppler_step_ = 0;
gnss_synchro_ = nullptr; gnss_synchro_ = nullptr;
threshold_ = 0.0; threshold_ = 0.0;
// temporary buffers that we can release
volk_gnsssdr_free(fft_codes_padded);
} }
GpsL2MPcpsAcquisitionFpga::~GpsL2MPcpsAcquisitionFpga() GpsL2MPcpsAcquisitionFpga::~GpsL2MPcpsAcquisitionFpga() = default;
{
delete[] d_all_fft_codes_;
}
void GpsL2MPcpsAcquisitionFpga::stop_acquisition() void GpsL2MPcpsAcquisitionFpga::stop_acquisition()

View File

@ -39,7 +39,9 @@
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr #include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
#include <volk/volk_complex.h> // for lv_16sc_t #include <volk/volk_complex.h> // for lv_16sc_t
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <memory> // for weak_ptr
#include <string> // for string #include <string> // for string
#include <vector>
class Gnss_Synchro; class Gnss_Synchro;
class ConfigurationInterface; class ConfigurationInterface;
@ -168,10 +170,7 @@ private:
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
//float calculate_threshold(float pfa);
}; };
#endif /* GNSS_SDR_GPS_L2_M_PCPS_ACQUISITION_FPGA_H_ */ #endif /* GNSS_SDR_GPS_L2_M_PCPS_ACQUISITION_FPGA_H_ */

View File

@ -39,6 +39,7 @@
#include "gps_l5_signal.h" #include "gps_l5_signal.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm>
GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
@ -133,7 +134,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L5I_PERIOD * 1000.0); acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L5I_PERIOD * 1000.0);
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1); vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
code_ = new gr_complex[vector_length_]; code_ = std::vector<std::complex<float>>(vector_length_);
acquisition_ = pcps_make_acquisition(acq_parameters_); acquisition_ = pcps_make_acquisition(acq_parameters_);
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
@ -159,10 +160,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
} }
GpsL5iPcpsAcquisition::~GpsL5iPcpsAcquisition() GpsL5iPcpsAcquisition::~GpsL5iPcpsAcquisition() = default;
{
delete[] code_;
}
void GpsL5iPcpsAcquisition::stop_acquisition() void GpsL5iPcpsAcquisition::stop_acquisition()
@ -230,28 +228,27 @@ void GpsL5iPcpsAcquisition::init()
acquisition_->init(); acquisition_->init();
} }
void GpsL5iPcpsAcquisition::set_local_code() void GpsL5iPcpsAcquisition::set_local_code()
{ {
auto* code = new std::complex<float>[code_length_]; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
if (acq_parameters_.use_automatic_resampler) if (acq_parameters_.use_automatic_resampler)
{ {
gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs); gps_l5i_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), gnss_synchro_->PRN, acq_parameters_.resampled_fs);
} }
else else
{ {
gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); gps_l5i_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), gnss_synchro_->PRN, fs_in_);
} }
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
for (unsigned int i = 0; i < num_codes_; i++) for (unsigned int i = 0; i < num_codes_; i++)
{ {
memcpy(&(code_[i * code_length_]), code, std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
sizeof(gr_complex) * code_length_);
} }
acquisition_->set_local_code(code_); acquisition_->set_local_code(code_.data());
delete[] code;
} }
@ -260,6 +257,7 @@ void GpsL5iPcpsAcquisition::reset()
acquisition_->set_active(true); acquisition_->set_active(true);
} }
void GpsL5iPcpsAcquisition::set_state(int state) void GpsL5iPcpsAcquisition::set_state(int state)
{ {
acquisition_->set_state(state); acquisition_->set_state(state);
@ -359,6 +357,7 @@ gr::basic_block_sptr GpsL5iPcpsAcquisition::get_right_block()
return acquisition_; return acquisition_;
} }
void GpsL5iPcpsAcquisition::set_resampler_latency(uint32_t latency_samples) void GpsL5iPcpsAcquisition::set_resampler_latency(uint32_t latency_samples)
{ {
acquisition_->set_resampler_latency(latency_samples); acquisition_->set_resampler_latency(latency_samples);

View File

@ -31,8 +31,8 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#ifndef GNSS_SDR_GPS_L5i_PCPS_ACQUISITION_H_ #ifndef GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_H_
#define GNSS_SDR_GPS_L5i_PCPS_ACQUISITION_H_ #define GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_H_
#include "channel_fsm.h" #include "channel_fsm.h"
#include "complex_byte_to_float_x2.h" #include "complex_byte_to_float_x2.h"
@ -40,7 +40,9 @@
#include "pcps_acquisition.h" #include "pcps_acquisition.h"
#include <gnuradio/blocks/float_to_complex.h> #include <gnuradio/blocks/float_to_complex.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <memory>
#include <string> #include <string>
#include <vector>
class ConfigurationInterface; class ConfigurationInterface;
@ -106,6 +108,7 @@ public:
channel_fsm_ = channel_fsm; channel_fsm_ = channel_fsm;
acquisition_->set_channel_fsm(channel_fsm); acquisition_->set_channel_fsm(channel_fsm);
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
@ -154,7 +157,6 @@ public:
/*! /*!
* \brief Sets the resampler latency to account it in the acquisition code delay estimation * \brief Sets the resampler latency to account it in the acquisition code delay estimation
*/ */
void set_resampler_latency(uint32_t latency_samples) override; void set_resampler_latency(uint32_t latency_samples) override;
private: private:
@ -179,14 +181,13 @@ private:
bool dump_; bool dump_;
bool blocking_; bool blocking_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int num_codes_; unsigned int num_codes_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };
#endif /* GNSS_SDR_GPS_L5i_PCPS_ACQUISITION_H_ */ #endif /* GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_H_ */

View File

@ -43,9 +43,9 @@
#include <gnuradio/gr_complex.h> // for gr_complex #include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc #include <volk/volk.h> // for volk_32fc_conjugate_32fc
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm> // for copy_n
#include <cmath> // for abs, pow, floor #include <cmath> // for abs, pow, floor
#include <complex> // for complex #include <complex> // for complex
#include <cstring> // for memcpy
#define NUM_PRNs 32 #define NUM_PRNs 32
@ -108,17 +108,17 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
// compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned) // a channel is assigned)
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
auto* code = new gr_complex[nsamples_total]; std::vector<std::complex<float>> code(nsamples_total);
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_all_fft_codes_ = new uint32_t[(nsamples_total * NUM_PRNs)]; // memory containing all the possible fft codes for PRN 0 to 32 d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
float max; // temporary maxima search float max; // temporary maxima search
int32_t tmp, tmp2, local_code, fft_data; int32_t tmp, tmp2, local_code, fft_data;
for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++)
{ {
gps_l5i_code_gen_complex_sampled(code, PRN, fs_in); gps_l5i_code_gen_complex_sampled(gsl::span<gr_complex>(code.data(), nsamples_total), PRN, fs_in);
for (uint32_t s = code_length; s < 2 * code_length; s++) for (uint32_t s = code_length; s < 2 * code_length; s++)
{ {
@ -130,7 +130,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
// fill in zero padding // fill in zero padding
code[s] = std::complex<float>(0.0, 0.0); code[s] = std::complex<float>(0.0, 0.0);
} }
memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
fft_if->execute(); // Run the FFT of local code fft_if->execute(); // Run the FFT of local code
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
@ -158,7 +158,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
} }
} }
acq_parameters.all_fft_codes = d_all_fft_codes_; acq_parameters.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor // reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 13); acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 13);
@ -173,18 +173,12 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
doppler_step_ = 0; doppler_step_ = 0;
gnss_synchro_ = nullptr; gnss_synchro_ = nullptr;
// temporary buffers that we can delete // temporary buffers that we can release
delete[] code; volk_gnsssdr_free(fft_codes_padded);
delete fft_if;
delete[] fft_codes_padded;
} }
GpsL5iPcpsAcquisitionFpga::~GpsL5iPcpsAcquisitionFpga() GpsL5iPcpsAcquisitionFpga::~GpsL5iPcpsAcquisitionFpga() = default;
{
//delete[] code_;
delete[] d_all_fft_codes_;
}
void GpsL5iPcpsAcquisitionFpga::stop_acquisition() void GpsL5iPcpsAcquisitionFpga::stop_acquisition()

View File

@ -40,7 +40,9 @@
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr #include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
#include <volk/volk_complex.h> // for lv_16sc_t #include <volk/volk_complex.h> // for lv_16sc_t
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <memory>
#include <string> #include <string>
#include <vector>
class Gnss_Synchro; class Gnss_Synchro;
class ConfigurationInterface; class ConfigurationInterface;
@ -167,9 +169,7 @@ private:
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };

View File

@ -49,16 +49,6 @@ if(OPENCL_FOUND)
set(ACQ_GR_BLOCKS_HEADERS ${ACQ_GR_BLOCKS_HEADERS} pcps_opencl_acquisition_cc.h) set(ACQ_GR_BLOCKS_HEADERS ${ACQ_GR_BLOCKS_HEADERS} pcps_opencl_acquisition_cc.h)
endif() endif()
if(OPENCL_FOUND)
include_directories(${OPENCL_INCLUDE_DIRS})
if(OS_IS_MACOSX)
set(OPT_LIBRARIES ${OPT_LIBRARIES} "-framework OpenCL")
else()
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${OPENCL_LIBRARIES})
endif()
endif()
list(SORT ACQ_GR_BLOCKS_HEADERS) list(SORT ACQ_GR_BLOCKS_HEADERS)
list(SORT ACQ_GR_BLOCKS_SOURCES) list(SORT ACQ_GR_BLOCKS_SOURCES)
@ -78,19 +68,19 @@ endif()
target_link_libraries(acquisition_gr_blocks target_link_libraries(acquisition_gr_blocks
PUBLIC PUBLIC
algorithms_libs
Gnuradio::runtime Gnuradio::runtime
Gnuradio::fft Gnuradio::fft
Volk::volk Volk::volk
channel_libs channel_libs
acquisition_libs acquisition_libs
core_system_parameters core_system_parameters
${OPT_LIBRARIES}
PRIVATE PRIVATE
Gflags::gflags Gflags::gflags
Glog::glog Glog::glog
Matio::matio Matio::matio
Volkgnsssdr::volkgnsssdr Volkgnsssdr::volkgnsssdr
algorithms_libs
) )
target_include_directories(acquisition_gr_blocks target_include_directories(acquisition_gr_blocks
@ -101,7 +91,11 @@ target_include_directories(acquisition_gr_blocks
) )
if(OPENCL_FOUND) if(OPENCL_FOUND)
target_include_directories(acquisition_gr_blocks PUBLIC ${OPENCL_INCLUDE_DIRS}) target_link_libraries(acquisition_gr_blocks PUBLIC OpenCL::OpenCL)
target_include_directories(acquisition_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/algorithms/libs/opencl
)
endif() endif()
if(ENABLE_CLANG_TIDY) if(ENABLE_CLANG_TIDY)
@ -116,4 +110,5 @@ endif()
set_property(TARGET acquisition_gr_blocks set_property(TARGET acquisition_gr_blocks
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/algorithms/libs/opencl>
) )

View File

@ -145,10 +145,10 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
} }
// Direct FFT // Direct FFT
d_fft_if = new gr::fft::fft_complex(d_fft_size, true); d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT // Inverse FFT
d_ifft = new gr::fft::fft_complex(d_fft_size, false); d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
// For dumping samples into a file // For dumping samples into a file
d_dump = dump; d_dump = dump;
@ -210,9 +210,6 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::~galileo_e5a_noncoherentIQ_acquisi
} }
} }
delete d_fft_if;
delete d_ifft;
try try
{ {
if (d_dump) if (d_dump)

View File

@ -44,6 +44,7 @@
#include <gnuradio/fft/fft.h> #include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h> #include <gnuradio/gr_complex.h>
#include <fstream> #include <fstream>
#include <memory>
#include <string> #include <string>
#include <utility> #include <utility>
@ -51,8 +52,8 @@ class galileo_e5a_noncoherentIQ_acquisition_caf_cc;
using galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr = boost::shared_ptr<galileo_e5a_noncoherentIQ_acquisition_caf_cc>; using galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr = boost::shared_ptr<galileo_e5a_noncoherentIQ_acquisition_caf_cc>;
galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(
galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(unsigned int sampled_ms, unsigned int sampled_ms,
unsigned int max_dwells, unsigned int max_dwells,
unsigned int doppler_max, int64_t fs_in, unsigned int doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code, int samples_per_ms, int samples_per_code,
@ -71,88 +72,6 @@ galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(unsigned int sampled_ms,
*/ */
class galileo_e5a_noncoherentIQ_acquisition_caf_cc : public gr::block class galileo_e5a_noncoherentIQ_acquisition_caf_cc : public gr::block
{ {
private:
friend galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr
galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(
unsigned int sampled_ms,
unsigned int max_dwells,
unsigned int doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_,
int Zero_padding_);
galileo_e5a_noncoherentIQ_acquisition_caf_cc(
unsigned int sampled_ms,
unsigned int max_dwells,
unsigned int doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_,
int Zero_padding_);
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
int doppler_offset);
float estimate_input_power(gr_complex* in);
std::weak_ptr<ChannelFsm> d_channel_fsm;
int64_t d_fs_in;
int d_samples_per_ms;
int d_sampled_ms;
int d_samples_per_code;
unsigned int d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
unsigned int d_doppler_max;
unsigned int d_doppler_step;
unsigned int d_max_dwells;
unsigned int d_well_count;
unsigned int d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
unsigned int d_num_doppler_bins;
gr_complex* d_fft_code_I_A;
gr_complex* d_fft_code_I_B;
gr_complex* d_fft_code_Q_A;
gr_complex* d_fft_code_Q_B;
gr_complex* d_inbuffer;
gr::fft::fft_complex* d_fft_if;
gr::fft::fft_complex* d_ifft;
Gnss_Synchro* d_gnss_synchro;
unsigned int d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitudeIA;
float* d_magnitudeIB;
float* d_magnitudeQA;
float* d_magnitudeQB;
float d_input_power;
float d_test_statistics;
bool d_bit_transition_flag;
std::ofstream d_dump_file;
bool d_active;
int d_state;
bool d_dump;
bool d_both_signal_components;
// bool d_CAF_filter;
int d_CAF_window_hz;
float* d_CAF_vector;
float* d_CAF_vector_I;
float* d_CAF_vector_Q;
// double* d_CAF_vector;
// double* d_CAF_vector_I;
// double* d_CAF_vector_Q;
unsigned int d_channel;
std::string d_dump_filename;
unsigned int d_buffer_count;
unsigned int d_gr_stream_buffer;
public: public:
/*! /*!
* \brief Default destructor. * \brief Default destructor.
@ -256,5 +175,85 @@ public:
int general_work(int noutput_items, gr_vector_int& ninput_items, int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items); gr_vector_void_star& output_items);
private:
friend galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr
galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(
unsigned int sampled_ms,
unsigned int max_dwells,
unsigned int doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_,
int Zero_padding_);
galileo_e5a_noncoherentIQ_acquisition_caf_cc(
unsigned int sampled_ms,
unsigned int max_dwells,
unsigned int doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_,
int Zero_padding_);
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
int doppler_offset);
float estimate_input_power(gr_complex* in);
std::weak_ptr<ChannelFsm> d_channel_fsm;
int64_t d_fs_in;
int d_samples_per_ms;
int d_sampled_ms;
int d_samples_per_code;
unsigned int d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
unsigned int d_doppler_max;
unsigned int d_doppler_step;
unsigned int d_max_dwells;
unsigned int d_well_count;
unsigned int d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
unsigned int d_num_doppler_bins;
gr_complex* d_fft_code_I_A;
gr_complex* d_fft_code_I_B;
gr_complex* d_fft_code_Q_A;
gr_complex* d_fft_code_Q_B;
gr_complex* d_inbuffer;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
unsigned int d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitudeIA;
float* d_magnitudeIB;
float* d_magnitudeQA;
float* d_magnitudeQB;
float d_input_power;
float d_test_statistics;
bool d_bit_transition_flag;
std::ofstream d_dump_file;
bool d_active;
int d_state;
bool d_dump;
bool d_both_signal_components;
int d_CAF_window_hz;
float* d_CAF_vector;
float* d_CAF_vector_I;
float* d_CAF_vector_Q;
unsigned int d_channel;
std::string d_dump_filename;
unsigned int d_buffer_count;
unsigned int d_gr_stream_buffer;
}; };
#endif /* GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H_ */ #endif /* GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H_ */

View File

@ -87,10 +87,10 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
d_magnitude = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); d_magnitude = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
// Direct FFT // Direct FFT
d_fft_if = new gr::fft::fft_complex(d_fft_size, true); d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT // Inverse FFT
d_ifft = new gr::fft::fft_complex(d_fft_size, false); d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
// For dumping samples into a file // For dumping samples into a file
d_dump = dump; d_dump = dump;
@ -123,9 +123,6 @@ galileo_pcps_8ms_acquisition_cc::~galileo_pcps_8ms_acquisition_cc()
volk_gnsssdr_free(d_fft_code_B); volk_gnsssdr_free(d_fft_code_B);
volk_gnsssdr_free(d_magnitude); volk_gnsssdr_free(d_magnitude);
delete d_ifft;
delete d_fft_if;
try try
{ {
if (d_dump) if (d_dump)

View File

@ -38,6 +38,7 @@
#include <gnuradio/fft/fft.h> #include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h> #include <gnuradio/gr_complex.h>
#include <fstream> #include <fstream>
#include <memory>
#include <string> #include <string>
#include <utility> #include <utility>
@ -61,67 +62,6 @@ galileo_pcps_8ms_make_acquisition_cc(uint32_t sampled_ms,
*/ */
class galileo_pcps_8ms_acquisition_cc : public gr::block class galileo_pcps_8ms_acquisition_cc : public gr::block
{ {
private:
friend galileo_pcps_8ms_acquisition_cc_sptr
galileo_pcps_8ms_make_acquisition_cc(
uint32_t sampled_ms,
uint32_t max_dwells,
uint32_t doppler_max,
int64_t fs_in,
int32_t samples_per_ms,
int32_t samples_per_code,
bool dump,
std::string dump_filename);
galileo_pcps_8ms_acquisition_cc(
uint32_t sampled_ms,
uint32_t max_dwells,
uint32_t doppler_max,
int64_t fs_in,
int32_t samples_per_ms,
int32_t samples_per_code,
bool dump,
std::string dump_filename);
void calculate_magnitudes(
gr_complex* fft_begin,
int32_t doppler_shift,
int32_t doppler_offset);
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_code_A;
gr_complex* d_fft_code_B;
gr::fft::fft_complex* d_fft_if;
gr::fft::fft_complex* d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
bool d_active;
int32_t d_state;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
public: public:
/*! /*!
* \brief Default destructor. * \brief Default destructor.
@ -225,6 +165,67 @@ public:
int general_work(int noutput_items, gr_vector_int& ninput_items, int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items); gr_vector_void_star& output_items);
private:
friend galileo_pcps_8ms_acquisition_cc_sptr
galileo_pcps_8ms_make_acquisition_cc(
uint32_t sampled_ms,
uint32_t max_dwells,
uint32_t doppler_max,
int64_t fs_in,
int32_t samples_per_ms,
int32_t samples_per_code,
bool dump,
std::string dump_filename);
galileo_pcps_8ms_acquisition_cc(
uint32_t sampled_ms,
uint32_t max_dwells,
uint32_t doppler_max,
int64_t fs_in,
int32_t samples_per_ms,
int32_t samples_per_code,
bool dump,
std::string dump_filename);
void calculate_magnitudes(
gr_complex* fft_begin,
int32_t doppler_shift,
int32_t doppler_offset);
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_code_A;
gr_complex* d_fft_code_B;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
bool d_active;
int32_t d_state;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
}; };
#endif /* GNSS_SDR_PCPS_8MS_ACQUISITION_CC_H_*/ #endif /* GNSS_SDR_PCPS_8MS_ACQUISITION_CC_H_*/

View File

@ -134,30 +134,22 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
acq_parameters.max_dwells = 1; // Activation of acq_parameters.bit_transition_flag invalidates the value of acq_parameters.max_dwells acq_parameters.max_dwells = 1; // Activation of acq_parameters.bit_transition_flag invalidates the value of acq_parameters.max_dwells
} }
d_tmp_buffer = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); d_tmp_buffer = std::vector<float>(d_fft_size);
d_fft_codes = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_fft_codes = std::vector<std::complex<float>>(d_fft_size);
d_magnitude = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); d_input_signal = std::vector<std::complex<float>>(d_fft_size);
d_input_signal = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
// Direct FFT // Direct FFT
d_fft_if = new gr::fft::fft_complex(d_fft_size, true); d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT // Inverse FFT
d_ifft = new gr::fft::fft_complex(d_fft_size, false); d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
d_gnss_synchro = nullptr; d_gnss_synchro = nullptr;
d_grid_doppler_wipeoffs = nullptr;
d_grid_doppler_wipeoffs_step_two = nullptr;
d_magnitude_grid = nullptr;
d_worker_active = false; d_worker_active = false;
d_data_buffer = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_consumed_samples * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_data_buffer = std::vector<std::complex<float>>(d_consumed_samples);
if (d_cshort) if (d_cshort)
{ {
d_data_buffer_sc = static_cast<lv_16sc_t*>(volk_gnsssdr_malloc(d_consumed_samples * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment())); d_data_buffer_sc = std::vector<lv_16sc_t>(d_consumed_samples);
}
else
{
d_data_buffer_sc = nullptr;
} }
grid_ = arma::fmat(); grid_ = arma::fmat();
narrow_grid_ = arma::fmat(); narrow_grid_ = arma::fmat();
@ -213,38 +205,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
} }
pcps_acquisition::~pcps_acquisition() pcps_acquisition::~pcps_acquisition() = default;
{
if (d_num_doppler_bins > 0)
{
for (uint32_t i = 0; i < d_num_doppler_bins; i++)
{
volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]);
volk_gnsssdr_free(d_magnitude_grid[i]);
}
delete[] d_grid_doppler_wipeoffs;
delete[] d_magnitude_grid;
}
if (acq_parameters.make_2_steps)
{
for (uint32_t i = 0; i < d_num_doppler_bins_step2; i++)
{
volk_gnsssdr_free(d_grid_doppler_wipeoffs_step_two[i]);
}
delete[] d_grid_doppler_wipeoffs_step_two;
}
volk_gnsssdr_free(d_fft_codes);
volk_gnsssdr_free(d_magnitude);
volk_gnsssdr_free(d_tmp_buffer);
volk_gnsssdr_free(d_input_signal);
delete d_ifft;
delete d_fft_if;
volk_gnsssdr_free(d_data_buffer);
if (d_cshort)
{
volk_gnsssdr_free(d_data_buffer_sc);
}
}
void pcps_acquisition::set_resampler_latency(uint32_t latency_samples) void pcps_acquisition::set_resampler_latency(uint32_t latency_samples)
@ -288,7 +249,7 @@ void pcps_acquisition::set_local_code(std::complex<float>* code)
} }
d_fft_if->execute(); // We need the FFT of local code d_fft_if->execute(); // We need the FFT of local code
volk_32fc_conjugate_32fc(d_fft_codes, d_fft_if->get_outbuf(), d_fft_size); volk_32fc_conjugate_32fc(d_fft_codes.data(), d_fft_if->get_outbuf(), d_fft_size);
} }
@ -311,7 +272,7 @@ bool pcps_acquisition::is_fdma()
} }
void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t correlator_length_samples, float freq) void pcps_acquisition::update_local_carrier(gsl::span<gr_complex> carrier_vector, float freq)
{ {
float phase_step_rad; float phase_step_rad;
if (acq_parameters.use_automatic_resampler) if (acq_parameters.use_automatic_resampler)
@ -324,7 +285,7 @@ void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t
} }
float _phase[1]; float _phase[1];
_phase[0] = 0.0; _phase[0] = 0.0;
volk_gnsssdr_s32f_sincos_32fc(carrier_vector, -phase_step_rad, _phase, correlator_length_samples); volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase, carrier_vector.length());
} }
@ -344,27 +305,18 @@ void pcps_acquisition::init()
d_num_doppler_bins = static_cast<uint32_t>(std::ceil(static_cast<double>(static_cast<int32_t>(acq_parameters.doppler_max) - static_cast<int32_t>(-acq_parameters.doppler_max)) / static_cast<double>(d_doppler_step))); d_num_doppler_bins = static_cast<uint32_t>(std::ceil(static_cast<double>(static_cast<int32_t>(acq_parameters.doppler_max) - static_cast<int32_t>(-acq_parameters.doppler_max)) / static_cast<double>(d_doppler_step)));
// Create the carrier Doppler wipeoff signals // Create the carrier Doppler wipeoff signals
if (d_grid_doppler_wipeoffs == nullptr) if (d_grid_doppler_wipeoffs.empty())
{ {
d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins]; d_grid_doppler_wipeoffs = std::vector<std::vector<std::complex<float>>>(d_num_doppler_bins, std::vector<std::complex<float>>(d_fft_size));
} }
if (acq_parameters.make_2_steps && (d_grid_doppler_wipeoffs_step_two == nullptr)) if (acq_parameters.make_2_steps && (d_grid_doppler_wipeoffs_step_two.empty()))
{ {
d_grid_doppler_wipeoffs_step_two = new gr_complex*[d_num_doppler_bins_step2]; d_grid_doppler_wipeoffs_step_two = std::vector<std::vector<std::complex<float>>>(d_num_doppler_bins_step2, std::vector<std::complex<float>>(d_fft_size));
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++)
{
d_grid_doppler_wipeoffs_step_two[doppler_index] = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
}
} }
if (d_magnitude_grid == nullptr) if (d_magnitude_grid.empty())
{ {
d_magnitude_grid = new float*[d_num_doppler_bins]; d_magnitude_grid = std::vector<std::vector<float>>(d_num_doppler_bins, std::vector<float>(d_fft_size));
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_magnitude_grid[doppler_index] = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
}
} }
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
@ -374,7 +326,7 @@ void pcps_acquisition::init()
d_magnitude_grid[doppler_index][k] = 0.0; d_magnitude_grid[doppler_index][k] = 0.0;
} }
int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * doppler_index; int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * doppler_index;
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, d_old_freq + doppler); update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size), d_old_freq + doppler);
} }
d_worker_active = false; d_worker_active = false;
@ -393,7 +345,7 @@ void pcps_acquisition::update_grid_doppler_wipeoffs()
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{ {
int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * doppler_index; int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * doppler_index;
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, d_old_freq + doppler); update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size), d_old_freq + doppler);
} }
} }
@ -403,7 +355,7 @@ void pcps_acquisition::update_grid_doppler_wipeoffs_step2()
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++) for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++)
{ {
float doppler = (static_cast<float>(doppler_index) - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0))) * acq_parameters.doppler_step2; float doppler = (static_cast<float>(doppler_index) - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0))) * acq_parameters.doppler_step2;
update_local_carrier(d_grid_doppler_wipeoffs_step_two[doppler_index], d_fft_size, d_doppler_center_step_two + doppler); update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs_step_two[doppler_index].data(), d_fft_size), d_doppler_center_step_two + doppler);
} }
} }
@ -510,11 +462,11 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
dims[0] = static_cast<size_t>(1); dims[0] = static_cast<size_t>(1);
dims[1] = static_cast<size_t>(1); dims[1] = static_cast<size_t>(1);
matvar = Mat_VarCreate("doppler_max", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &acq_parameters.doppler_max, 0); matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims, &acq_parameters.doppler_max, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("doppler_step", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_doppler_step, 0); matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_doppler_step, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
@ -552,7 +504,7 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("num_dwells", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_num_noncoherent_integrations_counter, 0); matvar = Mat_VarCreate("num_dwells", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_num_noncoherent_integrations_counter, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
@ -592,7 +544,7 @@ float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int32_t&
// Find the correlation peak and the carrier frequency // Find the correlation peak and the carrier frequency
for (uint32_t i = 0; i < num_doppler_bins; i++) for (uint32_t i = 0; i < num_doppler_bins; i++)
{ {
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i], d_fft_size); volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i].data(), d_fft_size);
if (d_magnitude_grid[i][tmp_intex_t] > grid_maximum) if (d_magnitude_grid[i][tmp_intex_t] > grid_maximum)
{ {
grid_maximum = d_magnitude_grid[i][tmp_intex_t]; grid_maximum = d_magnitude_grid[i][tmp_intex_t];
@ -629,7 +581,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
// Find the correlation peak and the carrier frequency // Find the correlation peak and the carrier frequency
for (uint32_t i = 0; i < num_doppler_bins; i++) for (uint32_t i = 0; i < num_doppler_bins; i++)
{ {
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i], d_fft_size); volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i].data(), d_fft_size);
if (d_magnitude_grid[i][tmp_intex_t] > firstPeak) if (d_magnitude_grid[i][tmp_intex_t] > firstPeak)
{ {
firstPeak = d_magnitude_grid[i][tmp_intex_t]; firstPeak = d_magnitude_grid[i][tmp_intex_t];
@ -663,7 +615,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
} }
int32_t idx = excludeRangeIndex1; int32_t idx = excludeRangeIndex1;
memcpy(d_tmp_buffer, d_magnitude_grid[index_doppler], d_fft_size); memcpy(d_tmp_buffer.data(), d_magnitude_grid[index_doppler].data(), d_fft_size);
do do
{ {
d_tmp_buffer[idx] = 0.0; d_tmp_buffer[idx] = 0.0;
@ -676,7 +628,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
while (idx != excludeRangeIndex2); while (idx != excludeRangeIndex2);
// Find the second highest correlation peak in the same freq. bin --- // Find the second highest correlation peak in the same freq. bin ---
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_tmp_buffer, d_fft_size); volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_tmp_buffer.data(), d_fft_size);
float secondPeak = d_tmp_buffer[tmp_intex_t]; float secondPeak = d_tmp_buffer[tmp_intex_t];
// Compute the test statistics and compare to the threshold // Compute the test statistics and compare to the threshold
@ -694,9 +646,9 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
int32_t effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size); int32_t effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size);
if (d_cshort) if (d_cshort)
{ {
volk_gnsssdr_16ic_convert_32fc(d_data_buffer, d_data_buffer_sc, d_consumed_samples); volk_gnsssdr_16ic_convert_32fc(d_data_buffer.data(), d_data_buffer_sc.data(), d_consumed_samples);
} }
memcpy(d_input_signal, d_data_buffer, d_consumed_samples * sizeof(gr_complex)); memcpy(d_input_signal.data(), d_data_buffer.data(), d_consumed_samples * sizeof(gr_complex));
if (d_fft_size > d_consumed_samples) if (d_fft_size > d_consumed_samples)
{ {
for (uint32_t i = d_consumed_samples; i < d_fft_size; i++) for (uint32_t i = d_consumed_samples; i < d_fft_size; i++)
@ -704,7 +656,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
d_input_signal[i] = gr_complex(0.0, 0.0); d_input_signal[i] = gr_complex(0.0, 0.0);
} }
} }
const gr_complex* in = d_input_signal; // Get the input samples pointer const gr_complex* in = d_input_signal.data(); // Get the input samples pointer
d_input_power = 0.0; d_input_power = 0.0;
d_mag = 0.0; d_mag = 0.0;
@ -722,8 +674,8 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
if (d_use_CFAR_algorithm_flag or acq_parameters.bit_transition_flag) if (d_use_CFAR_algorithm_flag or acq_parameters.bit_transition_flag)
{ {
// Compute the input signal power estimation // Compute the input signal power estimation
volk_32fc_magnitude_squared_32f(d_tmp_buffer, in, d_fft_size); volk_32fc_magnitude_squared_32f(d_tmp_buffer.data(), in, d_fft_size);
volk_32f_accumulator_s32f(&d_input_power, d_tmp_buffer, d_fft_size); volk_32f_accumulator_s32f(&d_input_power, d_tmp_buffer.data(), d_fft_size);
d_input_power /= static_cast<float>(d_fft_size); d_input_power /= static_cast<float>(d_fft_size);
} }
@ -733,14 +685,14 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{ {
// Remove Doppler // Remove Doppler
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size); volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size);
// Perform the FFT-based convolution (parallel time search) // Perform the FFT-based convolution (parallel time search)
// Compute the FFT of the carrier wiped--off incoming signal // Compute the FFT of the carrier wiped--off incoming signal
d_fft_if->execute(); d_fft_if->execute();
// Multiply carrier wiped--off, Fourier transformed incoming signal with the local FFT'd code reference // Multiply carrier wiped--off, Fourier transformed incoming signal with the local FFT'd code reference
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size); volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes.data(), d_fft_size);
// Compute the inverse FFT // Compute the inverse FFT
d_ifft->execute(); d_ifft->execute();
@ -749,17 +701,17 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0); size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0);
if (d_num_noncoherent_integrations_counter == 1) if (d_num_noncoherent_integrations_counter == 1)
{ {
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index], d_ifft->get_outbuf() + offset, effective_fft_size); volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index].data(), d_ifft->get_outbuf() + offset, effective_fft_size);
} }
else else
{ {
volk_32fc_magnitude_squared_32f(d_tmp_buffer, d_ifft->get_outbuf() + offset, effective_fft_size); volk_32fc_magnitude_squared_32f(d_tmp_buffer.data(), d_ifft->get_outbuf() + offset, effective_fft_size);
volk_32f_x2_add_32f(d_magnitude_grid[doppler_index], d_magnitude_grid[doppler_index], d_tmp_buffer, effective_fft_size); volk_32f_x2_add_32f(d_magnitude_grid[doppler_index].data(), d_magnitude_grid[doppler_index].data(), d_tmp_buffer.data(), effective_fft_size);
} }
// Record results to file if required // Record results to file if required
if (d_dump and d_channel == d_dump_channel) if (d_dump and d_channel == d_dump_channel)
{ {
memcpy(grid_.colptr(doppler_index), d_magnitude_grid[doppler_index], sizeof(float) * effective_fft_size); memcpy(grid_.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size);
} }
} }
@ -791,7 +743,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
{ {
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++) for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++)
{ {
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs_step_two[doppler_index], d_fft_size); volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs_step_two[doppler_index].data(), d_fft_size);
// Perform the FFT-based convolution (parallel time search) // Perform the FFT-based convolution (parallel time search)
// Compute the FFT of the carrier wiped--off incoming signal // Compute the FFT of the carrier wiped--off incoming signal
@ -799,7 +751,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
// Multiply carrier wiped--off, Fourier transformed incoming signal // Multiply carrier wiped--off, Fourier transformed incoming signal
// with the local FFT'd code reference using SIMD operations with VOLK library // with the local FFT'd code reference using SIMD operations with VOLK library
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size); volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes.data(), d_fft_size);
// compute the inverse FFT // compute the inverse FFT
d_ifft->execute(); d_ifft->execute();
@ -807,17 +759,17 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0); size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0);
if (d_num_noncoherent_integrations_counter == 1) if (d_num_noncoherent_integrations_counter == 1)
{ {
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index], d_ifft->get_outbuf() + offset, effective_fft_size); volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index].data(), d_ifft->get_outbuf() + offset, effective_fft_size);
} }
else else
{ {
volk_32fc_magnitude_squared_32f(d_tmp_buffer, d_ifft->get_outbuf() + offset, effective_fft_size); volk_32fc_magnitude_squared_32f(d_tmp_buffer.data(), d_ifft->get_outbuf() + offset, effective_fft_size);
volk_32f_x2_add_32f(d_magnitude_grid[doppler_index], d_magnitude_grid[doppler_index], d_tmp_buffer, effective_fft_size); volk_32f_x2_add_32f(d_magnitude_grid[doppler_index].data(), d_magnitude_grid[doppler_index].data(), d_tmp_buffer.data(), effective_fft_size);
} }
// Record results to file if required // Record results to file if required
if (d_dump and d_channel == d_dump_channel) if (d_dump and d_channel == d_dump_channel)
{ {
memcpy(narrow_grid_.colptr(doppler_index), d_magnitude_grid[doppler_index], sizeof(float) * effective_fft_size); memcpy(narrow_grid_.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size);
} }
} }
// Compute the test statistic // Compute the test statistic

View File

@ -61,17 +61,25 @@
#include <gnuradio/thread/thread.h> // for scoped_lock #include <gnuradio/thread/thread.h> // for scoped_lock
#include <gnuradio/types.h> // for gr_vector_const_void_star #include <gnuradio/types.h> // for gr_vector_const_void_star
#include <volk/volk_complex.h> // for lv_16sc_t #include <volk/volk_complex.h> // for lv_16sc_t
#include <complex>
#include <cstdint> #include <cstdint>
#include <memory>
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector>
#if HAS_SPAN
#include <span>
namespace gsl = std;
#else
#include <gsl/gsl>
#endif
class Gnss_Synchro; class Gnss_Synchro;
class pcps_acquisition; class pcps_acquisition;
using pcps_acquisition_sptr = boost::shared_ptr<pcps_acquisition>; using pcps_acquisition_sptr = boost::shared_ptr<pcps_acquisition>;
pcps_acquisition_sptr pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_);
pcps_make_acquisition(const Acq_Conf& conf_);
/*! /*!
* \brief This class implements a Parallel Code Phase Search Acquisition. * \brief This class implements a Parallel Code Phase Search Acquisition.
@ -81,75 +89,6 @@ pcps_make_acquisition(const Acq_Conf& conf_);
*/ */
class pcps_acquisition : public gr::block class pcps_acquisition : public gr::block
{ {
private:
friend pcps_acquisition_sptr
pcps_make_acquisition(const Acq_Conf& conf_);
pcps_acquisition(const Acq_Conf& conf_);
void update_local_carrier(gr_complex* carrier_vector, int32_t correlator_length_samples, float freq);
void update_grid_doppler_wipeoffs();
void update_grid_doppler_wipeoffs_step2();
bool is_fdma();
void acquisition_core(uint64_t samp_count);
void send_negative_acquisition();
void send_positive_acquisition();
void dump_results(int32_t effective_fft_size);
float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
float max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, float input_power, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
bool start();
Acq_Conf acq_parameters;
bool d_active;
bool d_worker_active;
bool d_cshort;
bool d_step_two;
bool d_use_CFAR_algorithm_flag;
int32_t d_positive_acq;
float d_threshold;
float d_mag;
float d_input_power;
float d_test_statistics;
float* d_magnitude;
float** d_magnitude_grid;
float* d_tmp_buffer;
gr_complex* d_input_signal;
uint32_t d_samplesPerChip;
int64_t d_old_freq;
int32_t d_state;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
uint32_t d_doppler_step;
float d_doppler_center_step_two;
uint32_t d_num_noncoherent_integrations_counter;
uint32_t d_fft_size;
uint32_t d_consumed_samples;
uint32_t d_num_doppler_bins;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
gr_complex** d_grid_doppler_wipeoffs_step_two;
gr_complex* d_fft_codes;
gr_complex* d_data_buffer;
lv_16sc_t* d_data_buffer_sc;
gr::fft::fft_complex* d_fft_if;
gr::fft::fft_complex* d_ifft;
Gnss_Synchro* d_gnss_synchro;
arma::fmat grid_;
arma::fmat narrow_grid_;
uint32_t d_num_doppler_bins_step2;
int64_t d_dump_number;
uint32_t d_dump_channel;
uint32_t d_buffer_count;
bool d_dump;
std::string d_dump_filename;
public: public:
~pcps_acquisition(); ~pcps_acquisition();
@ -249,7 +188,6 @@ public:
d_doppler_step = doppler_step; d_doppler_step = doppler_step;
} }
void set_resampler_latency(uint32_t latency_samples); void set_resampler_latency(uint32_t latency_samples);
/*! /*!
@ -258,6 +196,63 @@ public:
int general_work(int noutput_items, gr_vector_int& ninput_items, int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items); gr_vector_void_star& output_items);
private:
friend pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_);
pcps_acquisition(const Acq_Conf& conf_);
bool d_active;
bool d_worker_active;
bool d_cshort;
bool d_step_two;
bool d_use_CFAR_algorithm_flag;
bool d_dump;
int32_t d_state;
int32_t d_positive_acq;
uint32_t d_channel;
uint32_t d_samplesPerChip;
uint32_t d_doppler_step;
uint32_t d_num_noncoherent_integrations_counter;
uint32_t d_fft_size;
uint32_t d_consumed_samples;
uint32_t d_num_doppler_bins;
uint32_t d_num_doppler_bins_step2;
uint32_t d_dump_channel;
uint32_t d_buffer_count;
uint64_t d_sample_counter;
int64_t d_dump_number;
int64_t d_old_freq;
float d_threshold;
float d_mag;
float d_input_power;
float d_test_statistics;
float d_doppler_center_step_two;
std::string d_dump_filename;
std::vector<std::vector<float>> d_magnitude_grid;
std::vector<float> d_tmp_buffer;
std::vector<std::complex<float>> d_input_signal;
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs_step_two;
std::vector<std::complex<float>> d_fft_codes;
std::vector<std::complex<float>> d_data_buffer;
std::vector<lv_16sc_t> d_data_buffer_sc;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
std::weak_ptr<ChannelFsm> d_channel_fsm;
Acq_Conf acq_parameters;
Gnss_Synchro* d_gnss_synchro;
arma::fmat grid_;
arma::fmat narrow_grid_;
void update_local_carrier(gsl::span<gr_complex> carrier_vector, float freq);
void update_grid_doppler_wipeoffs();
void update_grid_doppler_wipeoffs_step2();
void acquisition_core(uint64_t samp_count);
void send_negative_acquisition();
void send_positive_acquisition();
void dump_results(int32_t effective_fft_size);
bool is_fdma();
bool start();
float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
float max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, float input_power, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
}; };
#endif /* GNSS_SDR_PCPS_ACQUISITION_H_*/ #endif /* GNSS_SDR_PCPS_ACQUISITION_H_*/

View File

@ -93,10 +93,10 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
d_10_ms_buffer = static_cast<gr_complex *>(volk_gnsssdr_malloc(50 * d_samples_per_ms * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_10_ms_buffer = static_cast<gr_complex *>(volk_gnsssdr_malloc(50 * d_samples_per_ms * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
// Direct FFT // Direct FFT
d_fft_if = new gr::fft::fft_complex(d_fft_size, true); d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT // Inverse FFT
d_ifft = new gr::fft::fft_complex(d_fft_size, false); d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
// For dumping samples into a file // For dumping samples into a file
d_dump = conf_.dump; d_dump = conf_.dump;
@ -138,8 +138,6 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
d_threshold = 0; d_threshold = 0;
d_num_doppler_points = 0; d_num_doppler_points = 0;
d_doppler_step = 0; d_doppler_step = 0;
d_grid_data = nullptr;
d_grid_doppler_wipeoffs = nullptr;
d_gnss_synchro = nullptr; d_gnss_synchro = nullptr;
d_code_phase = 0; d_code_phase = 0;
d_doppler_freq = 0; d_doppler_freq = 0;
@ -168,6 +166,7 @@ unsigned int pcps_acquisition_fine_doppler_cc::nextPowerOf2(unsigned int n)
return n; return n;
} }
void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_step) void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_step)
{ {
d_doppler_step = doppler_step; d_doppler_step = doppler_step;
@ -175,11 +174,7 @@ void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_ste
d_num_doppler_points = floor(std::abs(2 * d_config_doppler_max) / d_doppler_step); d_num_doppler_points = floor(std::abs(2 * d_config_doppler_max) / d_doppler_step);
d_grid_data = new float *[d_num_doppler_points]; d_grid_data = std::vector<std::vector<float>>(d_num_doppler_points, std::vector<float>(d_fft_size));
for (int i = 0; i < d_num_doppler_points; i++)
{
d_grid_data[i] = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
}
if (d_dump) if (d_dump)
{ {
@ -190,27 +185,12 @@ void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_ste
} }
void pcps_acquisition_fine_doppler_cc::free_grid_memory()
{
for (int i = 0; i < d_num_doppler_points; i++)
{
volk_gnsssdr_free(d_grid_data[i]);
delete[] d_grid_doppler_wipeoffs[i];
}
delete d_grid_data;
delete d_grid_doppler_wipeoffs;
}
pcps_acquisition_fine_doppler_cc::~pcps_acquisition_fine_doppler_cc() pcps_acquisition_fine_doppler_cc::~pcps_acquisition_fine_doppler_cc()
{ {
volk_gnsssdr_free(d_carrier); volk_gnsssdr_free(d_carrier);
volk_gnsssdr_free(d_fft_codes); volk_gnsssdr_free(d_fft_codes);
volk_gnsssdr_free(d_magnitude); volk_gnsssdr_free(d_magnitude);
volk_gnsssdr_free(d_10_ms_buffer); volk_gnsssdr_free(d_10_ms_buffer);
delete d_ifft;
delete d_fft_if;
free_grid_memory();
} }
@ -266,17 +246,16 @@ void pcps_acquisition_fine_doppler_cc::update_carrier_wipeoff()
// create the carrier Doppler wipeoff signals // create the carrier Doppler wipeoff signals
int doppler_hz; int doppler_hz;
float phase_step_rad; float phase_step_rad;
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_points]; d_grid_doppler_wipeoffs = std::vector<std::vector<std::complex<float>>>(d_num_doppler_points, std::vector<std::complex<float>>(d_fft_size));
for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++) for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
{ {
doppler_hz = d_doppler_step * doppler_index - d_config_doppler_max; doppler_hz = d_doppler_step * doppler_index - d_config_doppler_max;
// doppler search steps // doppler search steps
// compute the carrier doppler wipe-off signal and store it // compute the carrier doppler wipe-off signal and store it
phase_step_rad = static_cast<float>(GPS_TWO_PI) * doppler_hz / static_cast<float>(d_fs_in); phase_step_rad = static_cast<float>(GPS_TWO_PI) * doppler_hz / static_cast<float>(d_fs_in);
d_grid_doppler_wipeoffs[doppler_index] = new gr_complex[d_fft_size];
float _phase[1]; float _phase[1];
_phase[0] = 0; _phase[0] = 0;
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size); volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase, d_fft_size);
} }
} }
@ -294,7 +273,7 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF()
//--- Find the correlation peak and the carrier frequency -------------- //--- Find the correlation peak and the carrier frequency --------------
for (int i = 0; i < d_num_doppler_points; i++) for (int i = 0; i < d_num_doppler_points; i++)
{ {
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i], d_fft_size); volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i].data(), d_fft_size);
if (d_grid_data[i][tmp_intex_t] > firstPeak) if (d_grid_data[i][tmp_intex_t] > firstPeak)
{ {
firstPeak = d_grid_data[i][tmp_intex_t]; firstPeak = d_grid_data[i][tmp_intex_t];
@ -305,7 +284,7 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF()
// Record results to file if required // Record results to file if required
if (d_dump and d_channel == d_dump_channel) if (d_dump and d_channel == d_dump_channel)
{ {
memcpy(grid_.colptr(i), d_grid_data[i], sizeof(float) * d_fft_size); memcpy(grid_.colptr(i), d_grid_data[i].data(), sizeof(float) * d_fft_size);
} }
} }
@ -337,7 +316,7 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF()
while (idx != excludeRangeIndex2); while (idx != excludeRangeIndex2);
//--- Find the second highest correlation peak in the same freq. bin --- //--- Find the second highest correlation peak in the same freq. bin ---
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[index_doppler], d_fft_size); volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[index_doppler].data(), d_fft_size);
float secondPeak = d_grid_data[index_doppler][tmp_intex_t]; float secondPeak = d_grid_data[index_doppler][tmp_intex_t];
// 5- Compute the test statistics and compare to the threshold // 5- Compute the test statistics and compare to the threshold
@ -383,7 +362,7 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons
{ {
// doppler search steps // doppler search steps
// Perform the carrier wipe-off // Perform the carrier wipe-off
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size); volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size);
// 3- Perform the FFT-based convolution (parallel time search) // 3- Perform the FFT-based convolution (parallel time search)
// Compute the FFT of the carrier wiped--off incoming signal // Compute the FFT of the carrier wiped--off incoming signal
@ -399,7 +378,7 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons
// save the grid matrix delay file // save the grid matrix delay file
volk_32fc_magnitude_squared_32f(p_tmp_vector, d_ifft->get_outbuf(), d_fft_size); volk_32fc_magnitude_squared_32f(p_tmp_vector, d_ifft->get_outbuf(), d_fft_size);
//accumulate grid values //accumulate grid values
volk_32f_x2_add_32f(d_grid_data[doppler_index], d_grid_data[doppler_index], p_tmp_vector, d_fft_size); volk_32f_x2_add_32f(d_grid_data[doppler_index].data(), d_grid_data[doppler_index].data(), p_tmp_vector, d_fft_size);
} }
volk_gnsssdr_free(p_tmp_vector); volk_gnsssdr_free(p_tmp_vector);
@ -423,14 +402,14 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
int signal_samples = prn_replicas * d_fft_size; int signal_samples = prn_replicas * d_fft_size;
//int fft_size_extended = nextPowerOf2(signal_samples * zero_padding_factor); //int fft_size_extended = nextPowerOf2(signal_samples * zero_padding_factor);
int fft_size_extended = signal_samples * zero_padding_factor; int fft_size_extended = signal_samples * zero_padding_factor;
auto *fft_operator = new gr::fft::fft_complex(fft_size_extended, true); auto fft_operator = std::make_shared<gr::fft::fft_complex>(fft_size_extended, true);
//zero padding the entire vector //zero padding the entire vector
std::fill_n(fft_operator->get_inbuf(), fft_size_extended, gr_complex(0.0, 0.0)); std::fill_n(fft_operator->get_inbuf(), fft_size_extended, gr_complex(0.0, 0.0));
//1. generate local code aligned with the acquisition code phase estimation //1. generate local code aligned with the acquisition code phase estimation
auto *code_replica = static_cast<gr_complex *>(volk_gnsssdr_malloc(signal_samples * sizeof(gr_complex), volk_gnsssdr_get_alignment())); auto *code_replica = static_cast<gr_complex *>(volk_gnsssdr_malloc(signal_samples * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
gps_l1_ca_code_gen_complex_sampled(code_replica, d_gnss_synchro->PRN, d_fs_in, 0); gps_l1_ca_code_gen_complex_sampled(gsl::span<gr_complex>(code_replica, signal_samples * sizeof(gr_complex)), d_gnss_synchro->PRN, d_fs_in, 0);
int shift_index = static_cast<int>(d_gnss_synchro->Acq_delay_samples); int shift_index = static_cast<int>(d_gnss_synchro->Acq_delay_samples);
@ -460,9 +439,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
//case even //case even
int counter = 0; int counter = 0;
auto *fftFreqBins = new float[fft_size_extended]; auto fftFreqBins = std::vector<float>(fft_size_extended);
std::fill_n(fftFreqBins, fft_size_extended, 0.0);
for (int k = 0; k < (fft_size_extended / 2); k++) for (int k = 0; k < (fft_size_extended / 2); k++)
{ {
@ -489,10 +466,8 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
} }
// free memory!! // free memory!!
delete fft_operator;
volk_gnsssdr_free(code_replica); volk_gnsssdr_free(code_replica);
volk_gnsssdr_free(p_tmp_vector); volk_gnsssdr_free(p_tmp_vector);
delete[] fftFreqBins;
return d_fft_size; return d_fft_size;
} }
@ -705,11 +680,11 @@ void pcps_acquisition_fine_doppler_cc::dump_results(int effective_fft_size)
dims[0] = static_cast<size_t>(1); dims[0] = static_cast<size_t>(1);
dims[1] = static_cast<size_t>(1); dims[1] = static_cast<size_t>(1);
matvar = Mat_VarCreate("doppler_max", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_config_doppler_max, 0); matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_config_doppler_max, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("doppler_step", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_doppler_step, 0); matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_doppler_step, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);

View File

@ -58,15 +58,16 @@
#include <gnuradio/gr_complex.h> #include <gnuradio/gr_complex.h>
#include <cstdint> #include <cstdint>
#include <fstream> #include <fstream>
#include <memory>
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector>
class pcps_acquisition_fine_doppler_cc; class pcps_acquisition_fine_doppler_cc;
using pcps_acquisition_fine_doppler_cc_sptr = boost::shared_ptr<pcps_acquisition_fine_doppler_cc>; using pcps_acquisition_fine_doppler_cc_sptr = boost::shared_ptr<pcps_acquisition_fine_doppler_cc>;
pcps_acquisition_fine_doppler_cc_sptr pcps_acquisition_fine_doppler_cc_sptr pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
/*! /*!
* \brief This class implements a Parallel Code Phase Search Acquisition. * \brief This class implements a Parallel Code Phase Search Acquisition.
@ -74,63 +75,6 @@ pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
*/ */
class pcps_acquisition_fine_doppler_cc : public gr::block class pcps_acquisition_fine_doppler_cc : public gr::block
{ {
private:
friend pcps_acquisition_fine_doppler_cc_sptr
pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
pcps_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
int compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
int estimate_Doppler();
float estimate_input_power(gr_vector_const_void_star& input_items);
double compute_CAF();
void reset_grid();
void update_carrier_wipeoff();
void free_grid_memory();
bool start();
Acq_Conf acq_parameters;
int64_t d_fs_in;
int d_samples_per_ms;
int d_max_dwells;
int d_gnuradio_forecast_samples;
float d_threshold;
std::string d_satellite_str;
int d_config_doppler_max;
int d_num_doppler_points;
int d_doppler_step;
unsigned int d_fft_size;
uint64_t d_sample_counter;
gr_complex* d_carrier;
gr_complex* d_fft_codes;
gr_complex* d_10_ms_buffer;
float* d_magnitude;
float** d_grid_data;
gr_complex** d_grid_doppler_wipeoffs;
gr::fft::fft_complex* d_fft_if;
gr::fft::fft_complex* d_ifft;
Gnss_Synchro* d_gnss_synchro;
unsigned int d_code_phase;
float d_doppler_freq;
float d_test_statistics;
int d_positive_acq;
int d_state;
bool d_active;
int d_well_count;
int d_n_samples_in_buffer;
bool d_dump;
unsigned int d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
arma::fmat grid_;
int64_t d_dump_number;
unsigned int d_dump_channel;
public: public:
/*! /*!
* \brief Default destructor. * \brief Default destructor.
@ -226,15 +170,6 @@ public:
*/ */
void set_state(int state); void set_state(int state);
/*!
* \brief Parallel Code Phase Search Acquisition signal processing.
*/
int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
/*! /*!
* \brief Obtains the next power of 2 greater or equal to the input parameter * \brief Obtains the next power of 2 greater or equal to the input parameter
* \param n - Integer value to obtain the next power of 2. * \param n - Integer value to obtain the next power of 2.
@ -242,6 +177,64 @@ public:
unsigned int nextPowerOf2(unsigned int n); unsigned int nextPowerOf2(unsigned int n);
void dump_results(int effective_fft_size); void dump_results(int effective_fft_size);
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
/*!
* \brief Parallel Code Phase Search Acquisition signal processing.
*/
int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
private:
friend pcps_acquisition_fine_doppler_cc_sptr
pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
pcps_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
int compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
int estimate_Doppler();
float estimate_input_power(gr_vector_const_void_star& input_items);
double compute_CAF();
void reset_grid();
void update_carrier_wipeoff();
bool start();
Acq_Conf acq_parameters;
int64_t d_fs_in;
int d_samples_per_ms;
int d_max_dwells;
int d_gnuradio_forecast_samples;
float d_threshold;
std::string d_satellite_str;
int d_config_doppler_max;
int d_num_doppler_points;
int d_doppler_step;
unsigned int d_fft_size;
uint64_t d_sample_counter;
gr_complex* d_carrier;
gr_complex* d_fft_codes;
gr_complex* d_10_ms_buffer;
float* d_magnitude;
std::vector<std::vector<float>> d_grid_data;
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
unsigned int d_code_phase;
float d_doppler_freq;
float d_test_statistics;
int d_positive_acq;
int d_state;
bool d_active;
int d_well_count;
int d_n_samples_in_buffer;
bool d_dump;
unsigned int d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
arma::fmat grid_;
int64_t d_dump_number;
unsigned int d_dump_channel;
}; };
#endif /* pcps_acquisition_fine_doppler_cc*/ #endif /* pcps_acquisition_fine_doppler_cc*/

View File

@ -34,7 +34,6 @@
#include "pcps_acquisition_fpga.h" #include "pcps_acquisition_fpga.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
//#include <boost/chrono.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <cmath> // for ceil #include <cmath> // for ceil
#include <iostream> // for operator<< #include <iostream> // for operator<<
@ -87,6 +86,7 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_)
pcps_acquisition_fpga::~pcps_acquisition_fpga() = default; pcps_acquisition_fpga::~pcps_acquisition_fpga() = default;
void pcps_acquisition_fpga::set_local_code() void pcps_acquisition_fpga::set_local_code()
{ {
acquisition_fpga->set_local_code(d_gnss_synchro->PRN); acquisition_fpga->set_local_code(d_gnss_synchro->PRN);
@ -243,6 +243,7 @@ void pcps_acquisition_fpga::send_negative_acquisition()
} }
} }
void pcps_acquisition_fpga::acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_min) void pcps_acquisition_fpga::acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_min)
{ {
uint32_t indext = 0U; uint32_t indext = 0U;

Some files were not shown because too many files have changed in this diff Show More