diff --git a/CMakeLists.txt b/CMakeLists.txt index 03a38d3cb..fba8bdefe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,8 +39,8 @@ list(APPEND CMAKE_MODULE_PATH ${gnss-sdr_project_SOURCE_DIR}/cmake/Modules) # Set the version information here set(VERSION_INFO_MAJOR_VERSION 0) -set(VERSION_INFO_API_COMPAT 0) -set(VERSION_INFO_MINOR_VERSION 1) +set(VERSION_INFO_API_COMPAT 2) +set(VERSION_INFO_MINOR_VERSION 0.svn) set(VERSION ${VERSION_INFO_MAJOR_VERSION}.${VERSION_INFO_API_COMPAT}.${VERSION_INFO_MINOR_VERSION}) # Append -O2 optimization flag for Debug builds @@ -50,6 +50,7 @@ option(INSTALL_GNURADIO "Install GNU Radio and all its dependencies" OFF) file(RELATIVE_PATH RELATIVE_CMAKE_CALL ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + ######################################################################## # Environment setup ######################################################################## @@ -65,7 +66,7 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(OperatingSystem "Mac OS X") set(OS_IS_MACOSX TRUE) - set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") @@ -86,108 +87,6 @@ else() endif(GTEST_DIR) -################################################################################ -# GNU Radio - http://gnuradio.org/redmine/projects/gnuradio/wiki -################################################################################ - -if(INSTALL_GNURADIO) - if(OperatingSystem MATCHES "Linux") - message("Trying to install GNU Radio and all its dependencies.") - message("This process can take a long time.") - set(GNURADIO_RELEASE "3.6.3") - set(UHD_RELEASE "003_005_000") - set(INSTALL_GNURADIO CACHE BOOL OFF FORCE) - file(DOWNLOAD http://www.sbrac.org/files/build-gnuradio - ${CMAKE_CURRENT_BINARY_DIR}/download/build-gnuradio - ) - file(COPY ${CMAKE_CURRENT_BINARY_DIR}/download/build-gnuradio - DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - ) - execute_process( - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/build-gnuradio -l ${CMAKE_CURRENT_BINARY_DIR}/build-gnuradio.log - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty - ) - # The flags -gt v${GNURADIO_RELEASE} -ut release_${UHD_RELEASE} do not work :-( - else(OperatingSystem MATCHES "Linux") - message( "The script http://www.sbrac.org/files/build-gnuradio does not work in your operating system.") - message( "Please visit http://gnuradio.org and find out how to install GNU Radio.") - message( "Once installed, run 'cmake ${RELATIVE_CMAKE_CALL}' again.") - endif(OperatingSystem MATCHES "Linux") -endif(INSTALL_GNURADIO) - -find_package(GnuradioCore) -if(NOT GNURADIO_CORE_FOUND) - if(OperatingSystem MATCHES "Linux") - message( "If you are using Ubuntu, Fedora, RedHat, Debian or Mint") - message( "use 'cmake ${RELATIVE_CMAKE_CALL} -DINSTALL_GNURADIO=ON' to install GNU Radio and all its dependencies." ) - endif(OperatingSystem MATCHES "Linux") - message(FATAL_ERROR "Please install GNU Radio and all its dependencies. Visit http://gnuradio.org") -endif(NOT GNURADIO_CORE_FOUND) - -find_library( - GNURADIO_CORE_LIBRARIES - NAMES gnuradio-core - PATHS usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -find_library( - GR_FILTER_LIBRARIES - NAMES gnuradio-filter - PATHS usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) -find_library( - GR_FFT_LIBRARIES - NAMES gnuradio-fft - PATHS usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) -find_library( - GR_BLOCKS_LIBRARIES - NAMES gnuradio-blocks - PATHS usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -find_package(Gruel) -if(NOT GRUEL_FOUND) - message(FATAL_ERROR "Gruel required to build gnss-sdr") -endif() -link_libraries(${GRUEL_LIBRARIES}) -include_directories(${GRUEL_INCLUDE_DIRS}) - -find_package(UHD) -if(NOT UHD_FOUND) - message(FATAL_ERROR "UHD required to build gnss-sdr") -endif() - -find_package(GnuradioUHD) -if(NOT GNURADIO_UHD_FOUND) - message(FATAL_ERROR "Gnuradio UHD required to build gnss-sdr") -endif() - -find_package(Volk) -if(NOT VOLK_FOUND) - message(FATAL_ERROR "Volk required to build gnss-sdr") -endif() -find_library( - VOLK_LIBRARIES - NAMES volk - PATHS usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) ################################################################################ # Boost - http://www.boost.org @@ -210,24 +109,67 @@ find_package(Boost COMPONENTS date_time system filesystem thread serialization R if(NOT Boost_FOUND) message(FATAL_ERROR "Fatal error: Boost (version >=1.42.0) required.") endif(NOT Boost_FOUND) -include_directories(${Boost_INCLUDE_DIRS}) +################################################################################ +# GNU Radio - http://gnuradio.org/redmine/projects/gnuradio/wiki +################################################################################ + +if(INSTALL_GNURADIO) + if(OperatingSystem MATCHES "Linux") + message("Trying to install GNU Radio and all its dependencies.") + message("This process can take a long time.") + #set(GNURADIO_RELEASE "3.6.3") + #set(UHD_RELEASE "003_005_000") + set(INSTALL_GNURADIO CACHE BOOL OFF FORCE) + file(DOWNLOAD http://www.sbrac.org/files/build-gnuradio + ${CMAKE_CURRENT_BINARY_DIR}/download/build-gnuradio + ) + file(COPY ${CMAKE_CURRENT_BINARY_DIR}/download/build-gnuradio + DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + execute_process( + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/build-gnuradio -l ${CMAKE_CURRENT_BINARY_DIR}/build-gnuradio.log + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty + ) + # The flags -gt v${GNURADIO_RELEASE} -ut release_${UHD_RELEASE} do not work :-( + else(OperatingSystem MATCHES "Linux") + message( "The script http://www.sbrac.org/files/build-gnuradio does not work in your operating system.") + message( "Please visit http://gnuradio.org and find out how to install GNU Radio.") + message( "Once installed, run 'cmake ${RELATIVE_CMAKE_CALL}' again.") + endif(OperatingSystem MATCHES "Linux") +endif(INSTALL_GNURADIO) + + +find_package(GnuradioRuntime) +find_package(GnuradioBlocks) +find_package(UHD) +find_package(GnuradioUHD) +#find_library(GnuradioAnalog) +find_package(GnuradioFilter) +find_package(GnuradioFft) +find_package(Volk) +if(NOT GNURADIO_RUNTIME_FOUND) + message(FATAL_ERROR "gnuradio-runtime 3.7 or later is required to build gnss-sdr") +endif() + ################################################################################ # gflags - http://code.google.com/p/gflags/ ################################################################################ - +set(LOCAL_GFLAGS false CACHE STRING "GFlags installed on the system") find_package(GFlags) -if (NOT GFlags_FOUND OR LOCAL_GFLAGS) +if (NOT GFlags_FOUND) message (" gflags library has not been found.") message (" gflags will be downloaded and built automatically ") message (" when doing 'make'. ") set(gflags_RELEASE 2.0 CACHE STRING "Local gflags release") set(gflags_MD5 "5fd4554d2ba84bf222a2fec0870d28df") + ExternalProject_Add( gflags-${gflags_RELEASE} PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE} @@ -256,10 +198,8 @@ if (NOT GFlags_FOUND OR LOCAL_GFLAGS) link_directories(${GFlags_LIBRARY_PATH}) set(GFlags_lib ${GFlags_LIBS} CACHE FILEPATH "Local Gflags library") set(GFlags_LIBRARY_PATH ${GFlags_LIBS}) - set(LOCAL_GFLAGS true CACHE STRING "GFlags downloaded and build automatically") -endif(NOT GFlags_FOUND OR LOCAL_GFLAGS) - -include_directories(${GFlags_INCLUDE_DIRS}) + set(LOCAL_GFLAGS true CACHE STRING "GFlags downloaded and build automatically" FORCE) +endif(NOT GFlags_FOUND) @@ -270,14 +210,14 @@ include_directories(${GFlags_INCLUDE_DIRS}) find_package(GLOG) if (NOT GLOG_FOUND OR LOCAL_GFLAGS) message (" glog library has not been found") - if(LOCAL_GFLAGS) + if(NOT GFlags_FOUND) message(" or it is likely not linked to gflags.") - endif(LOCAL_GFLAGS) + endif(NOT GFlags_FOUND) message (" glog will be downloaded and built automatically ") message (" when doing 'make'. ") set(glog_RELEASE 0.3.3) set(glog_MD5 "a6fd2c22f8996846e34c763422717c18") - if(LOCAL_GFLAGS) + if(LOCAL_GFLAGS) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE}/tmp/configure_with_gflags "#!/bin/sh export CPPFLAGS=-I${GFlags_INCLUDE_DIRS} @@ -288,11 +228,20 @@ export LIBS=${GFlags_SHARED_LIBS} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE} FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - set(GLOG_CONFIGURE ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE}/configure_with_gflags) else(LOCAL_GFLAGS) - set(GLOG_CONFIGURE ../../thirdparty/glog/glog-${glog_RELEASE}/configure) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE}/tmp/configure_with_gflags + "#!/bin/sh + export CPPFLAGS=-I${GFlags_INCLUDE_DIRS} + export LDFLAGS=-L${GFlags_LIBRARY_DIRS} + export LIBS=${GFlags_LIBS} + ../../thirdparty/glog/glog-${glog_RELEASE}/configure") + file(COPY ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE}/tmp/configure_with_gflags + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ + GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endif(LOCAL_GFLAGS) - + + set(GLOG_CONFIGURE ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE}/configure_with_gflags) ExternalProject_Add( glog-${glog_RELEASE} PREFIX ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE} @@ -301,7 +250,7 @@ export LIBS=${GFlags_SHARED_LIBS} URL_MD5 ${glog_MD5} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glog/glog-${glog_RELEASE} BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE} - CONFIGURE_COMMAND ${GLOG_CONFIGURE} --prefix= + CONFIGURE_COMMAND ${GLOG_CONFIGURE} --prefix= BUILD_COMMAND make UPDATE_COMMAND "" PATCH_COMMAND "" @@ -315,8 +264,8 @@ export LIBS=${GFlags_SHARED_LIBS} set(GLOG_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE}/.libs/${CMAKE_FIND_LIBRARY_PREFIXES}glog.a ) + set(LOCAL_GLOG true) endif(NOT GLOG_FOUND OR LOCAL_GFLAGS) -include_directories(${GLOG_INCLUDE_DIRS}) @@ -328,7 +277,7 @@ set(GCC_GPERFTOOLS_FLAGS "") find_package(Gperftools) if ( NOT GPERFTOOLS_FOUND ) message("The optional library GPerftools has not been found.") -else() +else( NOT GPERFTOOLS_FOUND ) message ( "GPerftools library found." ) link_libraries(profiler tcmalloc) endif( NOT GPERFTOOLS_FOUND ) @@ -401,23 +350,23 @@ if(NOT ARMADILLO_FOUND) message (" Armadillo has not been found.") message (" Armadillo will be downloaded and built automatically ") message (" when doing 'make'. ") - set(armadillo_RELEASE 3.6.2) - set(armadillo_MD5 "0ccb90f5f40d936a59785eff10c362ad") + set(armadillo_RELEASE 3.810.2) + set(armadillo_MD5 "f91e3aff360d6a21fa7db36bb3dfe35f") if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/download/armadillo-${armadillo_RELEASE}/armadillo-${armadillo_RELEASE}.tar.gz) set(ARMADILLO_PATCH_FILE ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE}/armadillo_no.patch) file(WRITE ${ARMADILLO_PATCH_FILE} "") else(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/download/armadillo-${armadillo_RELEASE}/armadillo-${armadillo_RELEASE}.tar.gz) set(ARMADILLO_PATCH_FILE ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE}/armadillo_staticlib.patch) file(WRITE ${ARMADILLO_PATCH_FILE} -"43c43 -< set(ARMA_USE_WRAPPER true ) # set this to false if you prefer to directly link with LAPACK and/or BLAS (eg. -llapack -lblas) instead of -larmadillo +"35c35 +< set(ARMA_USE_WRAPPER true ) --- -> set(ARMA_USE_WRAPPER false) # set this to false if you prefer to directly link with LAPACK and/or BLAS (eg. -llapack -lblas) instead of -larmadillo -274c274 +> set(ARMA_USE_WRAPPER false) +292c292 < add_library( armadillo SHARED src/wrap_libs ) --- > add_library( armadillo STATIC src/wrap_libs ) -") +") endif(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/download/armadillo-${armadillo_RELEASE}/armadillo-${armadillo_RELEASE}.tar.gz) ExternalProject_Add( armadillo-${armadillo_RELEASE} @@ -460,8 +409,8 @@ endif($ENV{GN3S_DRIVER} ) if( $ENV{RTLSDR_DRIVER} ) message( "RTLSDR_DRIVER variable found." ) - # find libosmosdr - # find gr-osmosdr + # find libosmosdr (done in src/algorithms/signal_sources/adapters) + # find gr-osmosdr (done in src/algorithms/signal_sources/adapters) endif($ENV{RTLSDR_DRIVER} ) @@ -469,13 +418,19 @@ endif($ENV{RTLSDR_DRIVER} ) # Setup the include paths ######################################################################## -include_directories( - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GLOG_INCLUDE_DIRS} - ${GFlags_INCLUDE_DIRS} - ${UHD_INCLUDE_DIRS} - ${GPERFTOOLS_INCLUDE_DIRS} -) +#include_directories( +# ${Boost_INCLUDE_DIRS} +# ${GNURADIO_RUNTIME_INCLUDE_DIRS} +# ${GNURADIO_BLOCKS_INCLUDE_DIRS} +# ${UHD_INCLUDE_DIRS} +# ${GNURADIO_UHD_INCLUDE_DIRS} +# ${GNURADIO_FILTER_INCLUDE_DIRS} +# ${GNURADIO_FFT_INCLUDE_DIRS} +# ${ARMADILLO_INCLUDE_DIRS} +# ${GLOG_INCLUDE_DIRS} +# ${GFlags_INCLUDE_DIRS} +# ${GPERFTOOLS_INCLUDE_DIRS} +#) ######################################################################## @@ -487,6 +442,9 @@ include_directories( if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++0x") endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11 -stdlib=libc++ -Wno-c++11-narrowing") +endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # Add warning flags # For "-Wall" see http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html @@ -514,18 +472,18 @@ endif(GPERFTOOLS_FOUND) # Detect 64-bits machine if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) + # message("64-bits architecture detected.") #set(MY_CXX_FLAGS "${MY_CXX_FLAGS} ...") # link_libraries(pthread) # Needed by Fedora 18 - message("64-bits architecture detected.") endif( CMAKE_SIZEOF_VOID_P EQUAL 8 ) list(APPEND CMAKE_CXX_FLAGS ${MY_CXX_FLAGS}) -#add_definitions( -DGNSS_SDR_VERSION="${VERSION}" ) + + ######################################################################## # Add subdirectories (in order of deps) ######################################################################## add_subdirectory(src) - diff --git a/cmake/Modules/FindGnuradioAnalog.cmake b/cmake/Modules/FindGnuradioAnalog.cmake new file mode 100644 index 000000000..75f0856a8 --- /dev/null +++ b/cmake/Modules/FindGnuradioAnalog.cmake @@ -0,0 +1,6 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(GNURADIO_ANALOG gnuradio-analog>=3.7) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_ANALOG DEFAULT_MSG GNURADIO_ANALOG_LIBRARIES GNURADIO_ANALOG_INCLUDE_DIRS) +MARK_AS_ADVANCED(GNURADIO_ANALOG_LIBRARIES GNURADIO_ANALOG_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGnuradioBlocks.cmake b/cmake/Modules/FindGnuradioBlocks.cmake new file mode 100644 index 000000000..85582e284 --- /dev/null +++ b/cmake/Modules/FindGnuradioBlocks.cmake @@ -0,0 +1,6 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(GNURADIO_BLOCKS gnuradio-blocks>=3.7) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_BLOCKS DEFAULT_MSG GNURADIO_BLOCKS_LIBRARIES GNURADIO_BLOCKS_INCLUDE_DIRS) +MARK_AS_ADVANCED(GNURADIO_BLOCKS_LIBRARIES GNURADIO_BLOCKS_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGnuradioCore.cmake b/cmake/Modules/FindGnuradioCore.cmake deleted file mode 100644 index 3773588a7..000000000 --- a/cmake/Modules/FindGnuradioCore.cmake +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GNURADIO_CORE gnuradio-core) - -FIND_PATH( - GNURADIO_CORE_INCLUDE_DIRS - NAMES gr_random.h - HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio - ${PC_GNURADIO_CORE_INCLUDEDIR} - PATHS /usr/local/include/gnuradio - /usr/include/gnuradio -) - -FIND_LIBRARY( - GNURADIO_CORE_LIBRARIES - NAMES gnuradio-core - HINTS $ENV{GNURADIO_CORE_DIR}/lib - ${PC_GNURADIO_CORE_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) -MARK_AS_ADVANCED(GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGnuradioFft.cmake b/cmake/Modules/FindGnuradioFft.cmake new file mode 100644 index 000000000..31a187d56 --- /dev/null +++ b/cmake/Modules/FindGnuradioFft.cmake @@ -0,0 +1,6 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(GNURADIO_FFT gnuradio-fft>=3.7) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_FFT DEFAULT_MSG GNURADIO_FFT_LIBRARIES GNURADIO_FFT_INCLUDE_DIRS) +MARK_AS_ADVANCED(GNURADIO_FFT_LIBRARIES GNURADIO_FFT_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGnuradioFilter.cmake b/cmake/Modules/FindGnuradioFilter.cmake new file mode 100644 index 000000000..830004027 --- /dev/null +++ b/cmake/Modules/FindGnuradioFilter.cmake @@ -0,0 +1,6 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(GNURADIO_FILTER gnuradio-filter>=3.7) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_FILTER DEFAULT_MSG GNURADIO_FILTER_LIBRARIES GNURADIO_FILTER_INCLUDE_DIRS) +MARK_AS_ADVANCED(GNURADIO_FILTER_LIBRARIES GNURADIO_FILTER_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGnuradioRuntime.cmake b/cmake/Modules/FindGnuradioRuntime.cmake new file mode 100644 index 000000000..04031d360 --- /dev/null +++ b/cmake/Modules/FindGnuradioRuntime.cmake @@ -0,0 +1,7 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(GNURADIO_RUNTIME gnuradio-runtime>=3.7) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) +MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) + diff --git a/cmake/Modules/FindGnuradioUHD.cmake b/cmake/Modules/FindGnuradioUHD.cmake index 33c437d54..c0e93ef79 100644 --- a/cmake/Modules/FindGnuradioUHD.cmake +++ b/cmake/Modules/FindGnuradioUHD.cmake @@ -1,25 +1,5 @@ INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GNURADIO_UHD gnuradio-uhd) - -FIND_PATH( - GNURADIO_UHD_INCLUDE_DIRS - NAMES gnuradio/gr_uhd_api.h - HINTS $ENV{GNURADIO_UHD_DIR}/include - ${PC_GNURADIO_UHD_INCLUDEDIR} - PATHS /usr/local/include - /usr/include -) - -FIND_LIBRARY( - GNURADIO_UHD_LIBRARIES - NAMES gnuradio-uhd - HINTS $ENV{GNURADIO_UHD_DIR}/lib - ${PC_GNURADIO_UHD_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) +PKG_CHECK_MODULES(GNURADIO_UHD gnuradio-uhd>=3.7) if(GNURADIO_UHD_INCLUDE_DIRS AND GNURADIO_UHD_LIBRARIES) set(GNURADIO_UHD_FOUND TRUE CACHE INTERNAL "gnuradio-uhd found") diff --git a/cmake/Modules/FindGrOsmoSDR.cmake b/cmake/Modules/FindGrOsmoSDR.cmake index 119cbdef4..260a47e06 100644 --- a/cmake/Modules/FindGrOsmoSDR.cmake +++ b/cmake/Modules/FindGrOsmoSDR.cmake @@ -20,8 +20,8 @@ FIND_PATH(GROSMOSDR_INCLUDE_DIR - NAMES osmosdr/osmosdr_source_c.h - osmosdr/osmosdr_api.h + NAMES osmosdr/source_c.h + osmosdr/api.h HINTS ${GrOsmoSDR_ROOT_DIR}/include PATHS /usr/local/include /usr/include diff --git a/cmake/Modules/FindGruel.cmake b/cmake/Modules/FindGruel.cmake deleted file mode 100644 index 58dff7044..000000000 --- a/cmake/Modules/FindGruel.cmake +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GRUEL gruel) - -FIND_PATH( - GRUEL_INCLUDE_DIRS - NAMES gruel/attributes.h - HINTS $ENV{GRUEL_DIR}/include - ${PC_GRUEL_INCLUDEDIR} - PATHS /usr/local/include - /usr/include -) - -FIND_LIBRARY( - GRUEL_LIBRARIES - NAMES gruel - HINTS $ENV{GRUEL_DIR}/lib - ${PC_GRUEL_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GRUEL DEFAULT_MSG GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS) -MARK_AS_ADVANCED(GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS) diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake deleted file mode 100644 index 9331d5deb..000000000 --- a/cmake/Modules/GrMiscUtils.cmake +++ /dev/null @@ -1,210 +0,0 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -if(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE) - return() -endif() -set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE) - -######################################################################## -# Set global variable macro. -# Used for subdirectories to export settings. -# Example: include and library paths. -######################################################################## -function(GR_SET_GLOBAL var) - set(${var} ${ARGN} CACHE INTERNAL "" FORCE) -endfunction(GR_SET_GLOBAL) - -######################################################################## -# Set the pre-processor definition if the condition is true. -# - def the pre-processor definition to set and condition name -######################################################################## -function(GR_ADD_COND_DEF def) - if(${def}) - add_definitions(-D${def}) - endif(${def}) -endfunction(GR_ADD_COND_DEF) - -######################################################################## -# Check for a header and conditionally set a compile define. -# - hdr the relative path to the header file -# - def the pre-processor definition to set -######################################################################## -function(GR_CHECK_HDR_N_DEF hdr def) - include(CheckIncludeFileCXX) - CHECK_INCLUDE_FILE_CXX(${hdr} ${def}) - GR_ADD_COND_DEF(${def}) -endfunction(GR_CHECK_HDR_N_DEF) - -######################################################################## -# Include subdirectory macro. -# Sets the CMake directory variables, -# includes the subdirectory CMakeLists.txt, -# resets the CMake directory variables. -# -# This macro includes subdirectories rather than adding them -# so that the subdirectory can affect variables in the level above. -# This provides a work-around for the lack of convenience libraries. -# This way a subdirectory can append to the list of library sources. -######################################################################## -macro(GR_INCLUDE_SUBDIRECTORY subdir) - #insert the current directories on the front of the list - list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR}) - list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR}) - - #set the current directories to the names of the subdirs - set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}) - set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir}) - - #include the subdirectory CMakeLists to run it - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt) - - #reset the value of the current directories - list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR) - list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR) - - #pop the subdir names of the front of the list - list(REMOVE_AT _cmake_source_dirs 0) - list(REMOVE_AT _cmake_binary_dirs 0) -endmacro(GR_INCLUDE_SUBDIRECTORY) - -######################################################################## -# Check if a compiler flag works and conditionally set a compile define. -# - flag the compiler flag to check for -# - have the variable to set with result -######################################################################## -macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have) - include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG(${flag} ${have}) - if(${have}) - add_definitions(${flag}) - endif(${have}) -endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE) - -######################################################################## -# Generates the .la libtool file -# This appears to generate libtool files that cannot be used by auto*. -# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest]) -# Notice: there is not COMPONENT option, these will not get distributed. -######################################################################## -function(GR_LIBTOOL) - if(NOT DEFINED GENERATE_LIBTOOL) - set(GENERATE_LIBTOOL OFF) #disabled by default - endif() - - if(GENERATE_LIBTOOL) - include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN}) - - find_program(LIBTOOL libtool) - if(LIBTOOL) - include(CMakeMacroLibtoolFile) - CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION}) - endif(LIBTOOL) - endif(GENERATE_LIBTOOL) - -endfunction(GR_LIBTOOL) - -######################################################################## -# Do standard things to the library target -# - set target properties -# - make install rules -# Also handle gnuradio custom naming conventions w/ extras mode. -######################################################################## -function(GR_LIBRARY_FOO target) - #parse the arguments for component names - include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN}) - - #set additional target properties - set_target_properties(${target} PROPERTIES SOVERSION ${LIBVER}) - - #install the generated files like so... - install(TARGETS ${target} - LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .so/.dylib file - ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_DEVEL_COMPONENT} # .lib file - RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .dll file - ) - - #extras mode enabled automatically on linux - if(NOT DEFINED LIBRARY_EXTRAS) - set(LIBRARY_EXTRAS ${LINUX}) - endif() - - #special extras mode to enable alternative naming conventions - if(LIBRARY_EXTRAS) - - #create .la file before changing props - GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR}) - - #give the library a special name with ultra-zero soversion - set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0") - set(target_name lib${target}-${LIBVER}.so.0.0.0) - - #custom command to generate symlinks - add_custom_command( - TARGET ${target} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so - COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0 - COMMAND ${CMAKE_COMMAND} -E touch ${target_name} #so the symlinks point to something valid so cmake 2.6 will install - ) - - #and install the extra symlinks - install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so - ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0 - DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} - ) - - endif(LIBRARY_EXTRAS) -endfunction(GR_LIBRARY_FOO) - -######################################################################## -# Create a dummy custom command that depends on other targets. -# Usage: -# GR_GEN_TARGET_DEPS(unique_name target_deps ...) -# ADD_CUSTOM_COMMAND( ${target_deps}) -# -# Custom command cant depend on targets, but can depend on executables, -# and executables can depend on targets. So this is the process: -######################################################################## -function(GR_GEN_TARGET_DEPS name var) - file( - WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in - "int main(void){return 0;}\n" - ) - execute_process( - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in - ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp - ) - add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp) - if(ARGN) - add_dependencies(${name} ${ARGN}) - endif(ARGN) - - if(CMAKE_CROSSCOMPILING) - set(${var} "DEPENDS;${name}" PARENT_SCOPE) #cant call command when cross - else() - set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE) - endif() -endfunction(GR_GEN_TARGET_DEPS) diff --git a/cmake/Modules/GrPlatform.cmake b/cmake/Modules/GrPlatform.cmake deleted file mode 100644 index a2e4f3b34..000000000 --- a/cmake/Modules/GrPlatform.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE) - return() -endif() -set(__INCLUDED_GR_PLATFORM_CMAKE TRUE) - -######################################################################## -# Setup additional defines for OS types -######################################################################## -if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(LINUX TRUE) -endif() - -if(LINUX AND EXISTS "/etc/debian_version") - set(DEBIAN TRUE) -endif() - -if(LINUX AND EXISTS "/etc/redhat-release") - set(REDHAT TRUE) -endif() - -######################################################################## -# when the library suffix should be 64 (applies to redhat linux family) -######################################################################## -if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") - set(LIB_SUFFIX 64) -endif() -set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake deleted file mode 100644 index efdddf371..000000000 --- a/cmake/Modules/GrPython.cmake +++ /dev/null @@ -1,227 +0,0 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -if(DEFINED __INCLUDED_GR_PYTHON_CMAKE) - return() -endif() -set(__INCLUDED_GR_PYTHON_CMAKE TRUE) - -######################################################################## -# Setup the python interpreter: -# This allows the user to specify a specific interpreter, -# or finds the interpreter via the built-in cmake module. -######################################################################## -#this allows the user to override PYTHON_EXECUTABLE -if(PYTHON_EXECUTABLE) - - set(PYTHONINTERP_FOUND TRUE) - -#otherwise if not set, try to automatically find it -else(PYTHON_EXECUTABLE) - - #use the built-in find script - find_package(PythonInterp) - - #and if that fails use the find program routine - if(NOT PYTHONINTERP_FOUND) - find_program(PYTHON_EXECUTABLE NAMES python python2.7 python2.6 python2.5) - if(PYTHON_EXECUTABLE) - set(PYTHONINTERP_FOUND TRUE) - endif(PYTHON_EXECUTABLE) - endif(NOT PYTHONINTERP_FOUND) - -endif(PYTHON_EXECUTABLE) - -#make the path to the executable appear in the cmake gui -set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter") - -#make sure we can use -B with python (introduced in 2.6) -if(PYTHON_EXECUTABLE) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -B -c "" - OUTPUT_QUIET ERROR_QUIET - RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT - ) - if(PYTHON_HAS_DASH_B_RESULT EQUAL 0) - set(PYTHON_DASH_B "-B") - endif() -endif(PYTHON_EXECUTABLE) - -######################################################################## -# Check for the existence of a python module: -# - desc a string description of the check -# - mod the name of the module to import -# - cmd an additional command to run -# - have the result variable to set -######################################################################## -macro(GR_PYTHON_CHECK_MODULE desc mod cmd have) - message(STATUS "") - message(STATUS "Python checking for ${desc}") - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c " -######################################### -try: import ${mod} -except: exit(-1) -try: assert ${cmd} -except: exit(-1) -#########################################" - RESULT_VARIABLE ${have} - ) - if(${have} EQUAL 0) - message(STATUS "Python checking for ${desc} - found") - set(${have} TRUE) - else(${have} EQUAL 0) - message(STATUS "Python checking for ${desc} - not found") - set(${have} FALSE) - endif(${have} EQUAL 0) -endmacro(GR_PYTHON_CHECK_MODULE) - -######################################################################## -# Sets the python installation directory GR_PYTHON_DIR -######################################################################## -execute_process(COMMAND ${PYTHON_EXECUTABLE} -c " -from distutils import sysconfig -print sysconfig.get_python_lib(plat_specific=True, prefix='') -" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE -) -file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR) - -######################################################################## -# Create an always-built target with a unique name -# Usage: GR_UNIQUE_TARGET( ) -######################################################################## -function(GR_UNIQUE_TARGET desc) - file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib -unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5] -print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))" - OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE) - add_custom_target(${_target} ALL DEPENDS ${ARGN}) -endfunction(GR_UNIQUE_TARGET) - -######################################################################## -# Install python sources (also builds and installs byte-compiled python) -######################################################################## -function(GR_PYTHON_INSTALL) - include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN}) - - #################################################################### - if(GR_PYTHON_INSTALL_FILES) - #################################################################### - install(${ARGN}) #installs regular python files - - #create a list of all generated files - unset(pysrcfiles) - unset(pycfiles) - unset(pyofiles) - foreach(pyfile ${GR_PYTHON_INSTALL_FILES}) - get_filename_component(pyfile ${pyfile} ABSOLUTE) - list(APPEND pysrcfiles ${pyfile}) - - #determine if this file is in the source or binary directory - file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile}) - string(LENGTH "${source_rel_path}" source_rel_path_len) - file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile}) - string(LENGTH "${binary_rel_path}" binary_rel_path_len) - - #and set the generated path appropriately - if(${source_rel_path_len} GREATER ${binary_rel_path_len}) - set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path}) - else() - set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path}) - endif() - list(APPEND pycfiles ${pygenfile}c) - list(APPEND pyofiles ${pygenfile}o) - - #ensure generation path exists - get_filename_component(pygen_path ${pygenfile} PATH) - file(MAKE_DIRECTORY ${pygen_path}) - - endforeach(pyfile) - - #the command to generate the pyc files - add_custom_command( - DEPENDS ${pysrcfiles} OUTPUT ${pycfiles} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles} - ) - - #the command to generate the pyo files - add_custom_command( - DEPENDS ${pysrcfiles} OUTPUT ${pyofiles} - COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles} - ) - - #create install rule and add generated files to target list - set(python_install_gen_targets ${pycfiles} ${pyofiles}) - install(FILES ${python_install_gen_targets} - DESTINATION ${GR_PYTHON_INSTALL_DESTINATION} - COMPONENT ${GR_PYTHON_INSTALL_COMPONENT} - ) - - - #################################################################### - elseif(GR_PYTHON_INSTALL_PROGRAMS) - #################################################################### - file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native) - - foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS}) - get_filename_component(pyfile_name ${pyfile} NAME) - get_filename_component(pyfile ${pyfile} ABSOLUTE) - string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe") - list(APPEND python_install_gen_targets ${pyexefile}) - - get_filename_component(pyexefile_path ${pyexefile} PATH) - file(MAKE_DIRECTORY ${pyexefile_path}) - - add_custom_command( - OUTPUT ${pyexefile} DEPENDS ${pyfile} - COMMAND ${PYTHON_EXECUTABLE} -c - \"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\" - COMMENT "Shebangin ${pyfile_name}" - ) - - #on windows, python files need an extension to execute - get_filename_component(pyfile_ext ${pyfile} EXT) - if(WIN32 AND NOT pyfile_ext) - set(pyfile_name "${pyfile_name}.py") - endif() - - install(PROGRAMS ${pyexefile} RENAME ${pyfile_name} - DESTINATION ${GR_PYTHON_INSTALL_DESTINATION} - COMPONENT ${GR_PYTHON_INSTALL_COMPONENT} - ) - endforeach(pyfile) - - endif() - - GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets}) - -endfunction(GR_PYTHON_INSTALL) - -######################################################################## -# Write the python helper script that generates byte code files -######################################################################## -file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py " -import sys, py_compile -files = sys.argv[1:] -srcs, gens = files[:len(files)/2], files[len(files)/2:] -for src, gen in zip(srcs, gens): - py_compile.compile(file=src, cfile=gen, doraise=True) -") diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake deleted file mode 100644 index 6ba5ee3a5..000000000 --- a/cmake/Modules/GrSwig.cmake +++ /dev/null @@ -1,229 +0,0 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -if(DEFINED __INCLUDED_GR_SWIG_CMAKE) - return() -endif() -set(__INCLUDED_GR_SWIG_CMAKE TRUE) - -include(GrPython) - -######################################################################## -# Builds a swig documentation file to be generated into python docstrings -# Usage: GR_SWIG_MAKE_DOCS(output_file input_path input_path....) -# -# Set the following variable to specify extra dependent targets: -# - GR_SWIG_DOCS_SOURCE_DEPS -# - GR_SWIG_DOCS_TARGET_DEPS -######################################################################## -function(GR_SWIG_MAKE_DOCS output_file) - find_package(Doxygen) - if(DOXYGEN_FOUND) - - #setup the input files variable list, quote formated - set(input_files) - unset(INPUT_PATHS) - foreach(input_path ${ARGN}) - if (IS_DIRECTORY ${input_path}) #when input path is a directory - file(GLOB input_path_h_files ${input_path}/*.h) - else() #otherwise its just a file, no glob - set(input_path_h_files ${input_path}) - endif() - list(APPEND input_files ${input_path_h_files}) - set(INPUT_PATHS "${INPUT_PATHS} \"${input_path}\"") - endforeach(input_path) - - #determine the output directory - get_filename_component(name ${output_file} NAME_WE) - get_filename_component(OUTPUT_DIRECTORY ${output_file} PATH) - set(OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/${name}_swig_docs) - make_directory(${OUTPUT_DIRECTORY}) - - #generate the Doxyfile used by doxygen - configure_file( - ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.swig_doc.in - ${OUTPUT_DIRECTORY}/Doxyfile - @ONLY) - - #Create a dummy custom command that depends on other targets - include(GrMiscUtils) - GR_GEN_TARGET_DEPS(_${name}_tag tag_deps ${GR_SWIG_DOCS_TARGET_DEPS}) - - #call doxygen on the Doxyfile + input headers - add_custom_command( - OUTPUT ${OUTPUT_DIRECTORY}/xml/index.xml - DEPENDS ${input_files} ${GR_SWIG_DOCS_SOURCE_DEPS} ${tag_deps} - COMMAND ${DOXYGEN_EXECUTABLE} ${OUTPUT_DIRECTORY}/Doxyfile - COMMENT "Generating doxygen xml for ${name} docs" - ) - - #call the swig_doc script on the xml files - add_custom_command( - OUTPUT ${output_file} - DEPENDS ${input_files} ${OUTPUT_DIRECTORY}/xml/index.xml - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} - ${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py - ${OUTPUT_DIRECTORY}/xml - ${output_file} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen - ) - - else(DOXYGEN_FOUND) - file(WRITE ${output_file} "\n") #no doxygen -> empty file - endif(DOXYGEN_FOUND) -endfunction(GR_SWIG_MAKE_DOCS) - -######################################################################## -# Build a swig target for the common gnuradio use case. Usage: -# GR_SWIG_MAKE(target ifile ifile ifile...) -# -# Set the following variables before calling: -# - GR_SWIG_FLAGS -# - GR_SWIG_INCLUDE_DIRS -# - GR_SWIG_LIBRARIES -# - GR_SWIG_SOURCE_DEPS -# - GR_SWIG_TARGET_DEPS -# - GR_SWIG_DOC_FILE -# - GR_SWIG_DOC_DIRS -######################################################################## -macro(GR_SWIG_MAKE name) - set(ifiles ${ARGN}) - - #do swig doc generation if specified - if (GR_SWIG_DOC_FILE) - set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS}) - set(GR_SWIG_DOCS_TAREGT_DEPS ${GR_SWIG_TARGET_DEPS}) - GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS}) - list(APPEND GR_SWIG_SOURCE_DEPS ${GR_SWIG_DOC_FILE}) - endif() - - #append additional include directories - find_package(PythonLibs) - list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs) - list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) - list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) - list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}) - - #determine include dependencies for swig file - execute_process( - COMMAND ${PYTHON_EXECUTABLE} - ${CMAKE_BINARY_DIR}/get_swig_deps.py - "${ifiles}" "${GR_SWIG_INCLUDE_DIRS}" - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE SWIG_MODULE_${name}_EXTRA_DEPS - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - ) - - #Create a dummy custom command that depends on other targets - include(GrMiscUtils) - GR_GEN_TARGET_DEPS(_${name}_swig_tag tag_deps ${GR_SWIG_TARGET_DEPS}) - set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag) - add_custom_command( - OUTPUT ${tag_file} - DEPENDS ${GR_SWIG_SOURCE_DEPS} ${tag_deps} - COMMAND ${CMAKE_COMMAND} -E touch ${tag_file} - ) - - #append the specified include directories - include_directories(${GR_SWIG_INCLUDE_DIRS}) - list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${tag_file}) - - #setup the swig flags with flags and include directories - set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS}) - foreach(dir ${GR_SWIG_INCLUDE_DIRS}) - list(APPEND CMAKE_SWIG_FLAGS "-I${dir}") - endforeach(dir) - - #set the C++ property on the swig .i file so it builds - set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON) - - #setup the actual swig library target to be built - include(UseSWIG) - SWIG_ADD_MODULE(${name} python ${ifiles}) - SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES}) - -endmacro(GR_SWIG_MAKE) - -######################################################################## -# Install swig targets generated by GR_SWIG_MAKE. Usage: -# GR_SWIG_INSTALL( -# TARGETS target target target... -# [DESTINATION destination] -# [COMPONENT component] -# ) -######################################################################## -macro(GR_SWIG_INSTALL) - - include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN}) - - foreach(name ${GR_SWIG_INSTALL_TARGETS}) - install(TARGETS ${SWIG_MODULE_${name}_REAL_NAME} - DESTINATION ${GR_SWIG_INSTALL_DESTINATION} - COMPONENT ${GR_SWIG_INSTALL_COMPONENT} - ) - - include(GrPython) - GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py - DESTINATION ${GR_SWIG_INSTALL_DESTINATION} - COMPONENT ${GR_SWIG_INSTALL_COMPONENT} - ) - - GR_LIBTOOL( - TARGET ${SWIG_MODULE_${name}_REAL_NAME} - DESTINATION ${GR_SWIG_INSTALL_DESTINATION} - ) - - endforeach(name) - -endmacro(GR_SWIG_INSTALL) - -######################################################################## -# Generate a python file that can determine swig dependencies. -# Used by the make macro above to determine extra dependencies. -# When you build C++, CMake figures out the header dependencies. -# This code essentially performs that logic for swig includes. -######################################################################## -file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py " - -import os, sys, re - -include_matcher = re.compile('[#|%]include\\s*[<|\"](.*)[>|\"]') -include_dirs = sys.argv[2].split(';') - -def get_swig_incs(file_path): - file_contents = open(file_path, 'r').read() - return include_matcher.findall(file_contents, re.MULTILINE) - -def get_swig_deps(file_path, level): - deps = [file_path] - if level == 0: return deps - for inc_file in get_swig_incs(file_path): - for inc_dir in include_dirs: - inc_path = os.path.join(inc_dir, inc_file) - if not os.path.exists(inc_path): continue - deps.extend(get_swig_deps(inc_path, level-1)) - return deps - -if __name__ == '__main__': - ifiles = sys.argv[1].split(';') - deps = sum([get_swig_deps(ifile, 3) for ifile in ifiles], []) - #sys.stderr.write(';'.join(set(deps)) + '\\n\\n') - print(';'.join(set(deps))) -") diff --git a/conf/gnss-sdr_gn3s_realtime.conf b/conf/gnss-sdr_gn3s_realtime.conf index 607f87763..07cfa8fe6 100644 --- a/conf/gnss-sdr_gn3s_realtime.conf +++ b/conf/gnss-sdr_gn3s_realtime.conf @@ -7,13 +7,7 @@ ;######### GLOBAL OPTIONS ################## ;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz]. -; The sampling frequency of GN3S is 8183800 Hz, you can downsample by a natural number using te Signal Conditioner -; 8183800/5 = 1636760 -; 8183800/4 = 2045950 -; 8183800/3 = 2727933.33333333 -; 8183800/2 = 4091900 - -GNSS-SDR.internal_fs_hz=2045950 +GNSS-SDR.internal_fs_hz=2727933.33 ;######### CONTROL_THREAD CONFIG ############ ControlThread.wait_for_flowgraph=false @@ -144,14 +138,12 @@ InputFilter.grid_density=16 ;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz ; 8183800/5 = 1636760 -; 8183800/4 = 2045950 +; 8183800/4 = 2727933.33 ; 8183800/3 = 2727933.33333333 -; 8183800/2 = 4091900 - InputFilter.sampling_frequency=8183800 -InputFilter.IF=-38400 +InputFilter.IF=38400 -InputFilter.decimation_factor=4 +InputFilter.decimation_factor=3 @@ -181,12 +173,14 @@ Resampler.sample_freq_out=2727933.33 ;######### CHANNELS GLOBAL CONFIG ############ ;#count: Number of available satellite channels. -Channels.count=4 +Channels.count=1 ;#in_acquisition: Number of channels simultaneously acquiring Channels.in_acquisition=1 -;#system: GPS, GLONASS, Galileo, SBAS or Compass + +;######### CHANNEL 0 CONFIG ############ +;#system: GPS, GLONASS, GALILEO, SBAS or COMPASS ;#if the option is disabled by default is assigned GPS -Channel.system=GPS +Channel0.system=GPS ;#signal: ;# "1C" GPS L1 C/A @@ -245,24 +239,46 @@ Channel.system=GPS ;# "6Q" COMPASS E6 Q ;# "6X" COMPASS E6 IQ ;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel.signal=1C - -;######### SPECIFIC CHANNELS CONFIG ###### -;#The following options are specific to each channel and overwrite the generic options - -;######### CHANNEL 0 CONFIG ############ - -Channel0.system=GPS Channel0.signal=1C ;#satellite: Satellite PRN ID for this channel. Disable this option to random search -Channel0.satellite=11 +Channel0.satellite=15 +Channel0.repeat_satellite=false ;######### CHANNEL 1 CONFIG ############ Channel1.system=GPS Channel1.signal=1C Channel1.satellite=18 +Channel1.repeat_satellite=false + +;######### CHANNEL 2 CONFIG ############ + +Channel2.system=GPS +Channel2.signal=1C +Channel2.satellite=16 +Channel2.repeat_satellite=false + +;######### CHANNEL 3 CONFIG ############ + +Channel3.system=GPS +Channel3.signal=1C +Channel3.satellite=21 +Channel3.repeat_satellite=false + +;######### CHANNEL 4 CONFIG ############ + +Channel4.system=GPS +Channel4.signal=1C +Channel4.satellite=3 +Channel4.repeat_satellite=false + +;######### CHANNEL 5 CONFIG ############ + +Channel5.system=GPS +Channel5.signal=1C +;Channel5.satellite=21 +;Channel5.repeat_satellite=false ;######### ACQUISITION GLOBAL CONFIG ############ @@ -277,38 +293,76 @@ Acquisition.item_type=gr_complex Acquisition.if=0 ;#sampled_ms: Signal block duration for the acquisition signal detection [ms] Acquisition.sampled_ms=1 -;#implementation: Acquisition algorithm selection for this channel: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition] -Acquisition.implementation=GPS_L1_CA_PCPS_Acquisition -;#threshold: Acquisition threshold -Acquisition.threshold=0.005 -;#pfa: Acquisition false alarm probability. This option overrides the threshold option. Only use with implementations: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition] -Acquisition.pfa=0.0001 -;#doppler_max: Maximum expected Doppler shift [Hz] -Acquisition.doppler_max=10000 -;#doppler_max: Doppler step in the grid search [Hz] -Acquisition.doppler_step=500 ;######### ACQUISITION CHANNELS CONFIG ###### -;#The following options are specific to each channel and overwrite the generic options - ;######### ACQUISITION CH 0 CONFIG ############ -;Acquisition0.implementation=GPS_L1_CA_PCPS_Acquisition -;Acquisition0.threshold=0.005 -;Acquisition0.pfa=0.001 -;Acquisition0.doppler_max=10000 -;Acquisition0.doppler_step=250 +;#implementation: Acquisition algorithm selection for this channel: [GPS_L1_CA_PCPS_Acquisition] +Acquisition0.implementation=GPS_L1_CA_PCPS_Acquisition +;#threshold: Acquisition threshold +Acquisition0.threshold=50 +;#doppler_max: Maximum expected Doppler shift [Hz] +Acquisition0.doppler_max=10000 +;#doppler_max: Doppler step in the grid search [Hz] +Acquisition0.doppler_step=250 +;#repeat_satellite: Use only jointly with the satellte PRN ID option. -;#repeat_satellite: Use only jointly with the satellite PRN ID option. The default value is false -;Acquisition0.repeat_satellite = false ;######### ACQUISITION CH 1 CONFIG ############ -;Acquisition1.implementation=GPS_L1_CA_PCPS_Acquisition -;Acquisition1.threshold=0.005 -;Acquisition1.pfa=0.001 -;Acquisition1.doppler_max=10000 -;Acquisition1.doppler_step=250 -;Acquisition1.repeat_satellite = false +Acquisition1.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition1.threshold=30 +Acquisition1.doppler_max=10000 +Acquisition1.doppler_step=250 + + +;######### ACQUISITION CH 2 CONFIG ############ +Acquisition2.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition2.threshold=30 +Acquisition2.doppler_max=10000 +Acquisition2.doppler_step=250 + + +;######### ACQUISITION CH 3 CONFIG ############ +Acquisition3.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition3.threshold=30 +Acquisition3.doppler_max=10000 +Acquisition3.doppler_step=250 + + +;######### ACQUISITION CH 4 CONFIG ############ +Acquisition4.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition4.threshold=70 +Acquisition4.doppler_max=10000 +Acquisition4.doppler_step=250 + + +;######### ACQUISITION CH 5 CONFIG ############ +Acquisition5.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition5.threshold=70 +Acquisition5.doppler_max=10000 +Acquisition5.doppler_step=250 + + +;######### ACQUISITION CH 6 CONFIG ############ +Acquisition6.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition6.threshold=70 +Acquisition6.doppler_max=10000 +Acquisition6.doppler_step=250 + + +;######### ACQUISITION CH 7 CONFIG ############ +Acquisition7.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition7.threshold=70 +Acquisition7.doppler_max=10000 +Acquisition7.doppler_step=250 + + +;######### ACQUISITION CH 8 CONFIG ############ +Acquisition8.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition8.threshold=70 +Acquisition8.doppler_max=10000 +Acquisition8.doppler_step=250 + ;######### TRACKING GLOBAL CONFIG ############ @@ -331,7 +385,7 @@ Tracking.dump_filename=./tracking_ch_ Tracking.pll_bw_hz=50.0; ;#dll_bw_hz: DLL loop filter bandwidth [Hz] -Tracking.dll_bw_hz=2.0; +Tracking.dll_bw_hz=4.0; ;#fll_bw_hz: FLL loop filter bandwidth [Hz] Tracking.fll_bw_hz=10.0; diff --git a/drivers/gr-gn3s/CMakeLists.txt b/drivers/gr-gn3s/CMakeLists.txt index 6ca4f5eec..348e491a8 100644 --- a/drivers/gr-gn3s/CMakeLists.txt +++ b/drivers/gr-gn3s/CMakeLists.txt @@ -62,6 +62,19 @@ if(NOT Boost_FOUND) message(FATAL_ERROR "Boost required to compile gn3s") endif() +######################################################################## +# Find libUSB +######################################################################## +find_package(USB) +if(NOT LIBUSB_FOUND) + message(FATAL_ERROR "libusb required to compile gn3s") +endif(NOT LIBUSB_FOUND) +include_directories(${LIBUSB_INCLUDE_DIR}) +#message (" kjhkhkjh ${LIBUSB_INCLUDE_DIR}") +if(APPLE) + include_directories(/usr/include/pcap) +endif(APPLE) + ######################################################################## # Install directories ######################################################################## @@ -82,15 +95,11 @@ set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks) ######################################################################## # Find gnuradio build dependencies ######################################################################## -find_package(Gruel) -find_package(GnuradioCore) +find_package(GnuradioRuntime) -if(NOT GRUEL_FOUND) - message(FATAL_ERROR "Gruel required to compile gn3s") -endif() -if(NOT GNURADIO_CORE_FOUND) - message(FATAL_ERROR "GnuRadio Core required to compile gn3s") +if(NOT GNURADIO_RUNTIME_FOUND) + message(FATAL_ERROR "gnuradio-runtime 3.7 or later is required to compile gr-gn3s") endif() @@ -100,14 +109,13 @@ endif() include_directories( ${CMAKE_SOURCE_DIR}/include ${Boost_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} + ${LIBUSB_INCLUDE_DIR} ) link_directories( ${Boost_LIBRARY_DIRS} - ${GRUEL_LIBRARY_DIRS} - ${GNURADIO_CORE_LIBRARY_DIRS} + ${GNURADIO_RUNTIME_LIBRARY_DIRS} ) # Set component parameters diff --git a/drivers/gr-gn3s/cmake/Modules/FindGnuradioCore.cmake b/drivers/gr-gn3s/cmake/Modules/FindGnuradioCore.cmake deleted file mode 100644 index 3773588a7..000000000 --- a/drivers/gr-gn3s/cmake/Modules/FindGnuradioCore.cmake +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GNURADIO_CORE gnuradio-core) - -FIND_PATH( - GNURADIO_CORE_INCLUDE_DIRS - NAMES gr_random.h - HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio - ${PC_GNURADIO_CORE_INCLUDEDIR} - PATHS /usr/local/include/gnuradio - /usr/include/gnuradio -) - -FIND_LIBRARY( - GNURADIO_CORE_LIBRARIES - NAMES gnuradio-core - HINTS $ENV{GNURADIO_CORE_DIR}/lib - ${PC_GNURADIO_CORE_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) -MARK_AS_ADVANCED(GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) diff --git a/drivers/gr-gn3s/cmake/Modules/FindGruel.cmake b/drivers/gr-gn3s/cmake/Modules/FindGruel.cmake deleted file mode 100644 index 58dff7044..000000000 --- a/drivers/gr-gn3s/cmake/Modules/FindGruel.cmake +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GRUEL gruel) - -FIND_PATH( - GRUEL_INCLUDE_DIRS - NAMES gruel/attributes.h - HINTS $ENV{GRUEL_DIR}/include - ${PC_GRUEL_INCLUDEDIR} - PATHS /usr/local/include - /usr/include -) - -FIND_LIBRARY( - GRUEL_LIBRARIES - NAMES gruel - HINTS $ENV{GRUEL_DIR}/lib - ${PC_GRUEL_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GRUEL DEFAULT_MSG GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS) -MARK_AS_ADVANCED(GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS) diff --git a/drivers/gr-gn3s/cmake/Modules/FindUSB.cmake b/drivers/gr-gn3s/cmake/Modules/FindUSB.cmake new file mode 100644 index 000000000..0cfefba45 --- /dev/null +++ b/drivers/gr-gn3s/cmake/Modules/FindUSB.cmake @@ -0,0 +1,29 @@ +INCLUDE(FindPkgConfig) +if(NOT LIBUSB_FOUND) + pkg_check_modules (LIBUSB_PKG libusb-1.0) + find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h + PATHS + ${LIBUSB_PKG_INCLUDE_DIRS} + /usr/include/libusb-1.0 + /usr/include + /usr/local/include + ) + + find_library(LIBUSB_LIBRARIES NAMES usb-1.0 + PATHS + ${LIBUSB_PKG_LIBRARY_DIRS} + /usr/lib + /usr/local/lib + ) + +if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) + set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found") + message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}") +else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) + set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found") + message(STATUS "libusb-1.0 not found.") +endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) + +mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) + +endif(NOT LIBUSB_FOUND) diff --git a/drivers/gr-gn3s/cmake/Modules/GrMiscUtils.cmake b/drivers/gr-gn3s/cmake/Modules/GrMiscUtils.cmake index 9331d5deb..883ca5104 100644 --- a/drivers/gr-gn3s/cmake/Modules/GrMiscUtils.cmake +++ b/drivers/gr-gn3s/cmake/Modules/GrMiscUtils.cmake @@ -155,7 +155,7 @@ function(GR_LIBRARY_FOO target) GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR}) #give the library a special name with ultra-zero soversion - set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0") + set_target_properties(${target} PROPERTIES OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0") set(target_name lib${target}-${LIBVER}.so.0.0.0) #custom command to generate symlinks @@ -208,3 +208,140 @@ function(GR_GEN_TARGET_DEPS name var) set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE) endif() endfunction(GR_GEN_TARGET_DEPS) + +######################################################################## +# Control use of gr_logger +# Usage: +# GR_LOGGING() +# +# Will set ENABLE_GR_LOG to 1 by default. +# Can manually set with -DENABLE_GR_LOG=0|1 +######################################################################## +function(GR_LOGGING) + find_package(Log4cpp) + + OPTION(ENABLE_GR_LOG "Use gr_logger" ON) + if(ENABLE_GR_LOG) + # If gr_logger is enabled, make it usable + add_definitions( -DENABLE_GR_LOG ) + + # also test LOG4CPP; if we have it, use this version of the logger + # otherwise, default to the stdout/stderr model. + if(LOG4CPP_FOUND) + SET(HAVE_LOG4CPP True CACHE INTERNAL "" FORCE) + add_definitions( -DHAVE_LOG4CPP ) + else(not LOG4CPP_FOUND) + SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE) + SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) + SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) + SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE) + endif(LOG4CPP_FOUND) + + SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE) + + else(ENABLE_GR_LOG) + SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE) + SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) + SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) + SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE) + endif(ENABLE_GR_LOG) + + message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.") + message(STATUS "HAVE_LOG4CPP set to ${HAVE_LOG4CPP}.") + message(STATUS "LOG4CPP_LIBRARIES set to ${LOG4CPP_LIBRARIES}.") + +endfunction(GR_LOGGING) + +######################################################################## +# Run GRCC to compile .grc files into .py files. +# +# Usage: GRCC(filename, directory) +# - filenames: List of file name of .grc file +# - directory: directory of built .py file - usually in +# ${CMAKE_CURRENT_BINARY_DIR} +# - Sets PYFILES: output converted GRC file names to Python files. +######################################################################## +function(GRCC) + # Extract directory from list of args, remove it for the list of filenames. + list(GET ARGV -1 directory) + list(REMOVE_AT ARGV -1) + set(filenames ${ARGV}) + file(MAKE_DIRECTORY ${directory}) + + SET(GRCC_COMMAND ${CMAKE_SOURCE_DIR}/gr-utils/python/grcc) + + # GRCC uses some stuff in grc and gnuradio-runtime, so we force + # the known paths here + list(APPEND PYTHONPATHS + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/gnuradio-runtime/python + ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/swig + ${CMAKE_BINARY_DIR}/gnuradio-runtime/lib/swig + ) + + if(WIN32) + #SWIG generates the python library files into a subdirectory. + #Therefore, we must append this subdirectory into PYTHONPATH. + #Only do this for the python directories matching the following: + foreach(pydir ${PYTHONPATHS}) + get_filename_component(name ${pydir} NAME) + if(name MATCHES "^(swig|lib|src)$") + list(APPEND PYTHONPATHS ${pydir}/${CMAKE_BUILD_TYPE}) + endif() + endforeach(pydir) + endif(WIN32) + + file(TO_NATIVE_PATH "${PYTHONPATHS}" pypath) + + if(UNIX) + list(APPEND pypath "$PYTHONPATH") + string(REPLACE ";" ":" pypath "${pypath}") + set(ENV{PYTHONPATH} ${pypath}) + endif(UNIX) + + if(WIN32) + list(APPEND pypath "%PYTHONPATH%") + string(REPLACE ";" "\\;" pypath "${pypath}") + #list(APPEND environs "PYTHONPATH=${pypath}") + set(ENV{PYTHONPATH} ${pypath}) + endif(WIN32) + + foreach(f ${filenames}) + execute_process( + COMMAND ${GRCC_COMMAND} -d ${directory} ${f} + ) + string(REPLACE ".grc" ".py" pyfile "${f}") + string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" pyfile "${pyfile}") + list(APPEND pyfiles ${pyfile}) + endforeach(f) + + set(PYFILES ${pyfiles} PARENT_SCOPE) +endfunction(GRCC) + +######################################################################## +# Check if HAVE_PTHREAD_SETSCHEDPARAM and HAVE_SCHED_SETSCHEDULER +# should be defined +######################################################################## +macro(GR_CHECK_LINUX_SCHED_AVAIL) +set(CMAKE_REQUIRED_LIBRARIES -lpthread) + CHECK_CXX_SOURCE_COMPILES(" + #include + int main(){ + pthread_t pthread; + pthread_setschedparam(pthread, 0, 0); + return 0; + } " HAVE_PTHREAD_SETSCHEDPARAM + ) + GR_ADD_COND_DEF(HAVE_PTHREAD_SETSCHEDPARAM) + + CHECK_CXX_SOURCE_COMPILES(" + #include + int main(){ + pid_t pid; + sched_setscheduler(pid, 0, 0); + return 0; + } " HAVE_SCHED_SETSCHEDULER + ) + GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER) +endmacro(GR_CHECK_LINUX_SCHED_AVAIL) + diff --git a/drivers/gr-gn3s/cmake/Modules/GrPlatform.cmake b/drivers/gr-gn3s/cmake/Modules/GrPlatform.cmake index a2e4f3b34..5b7e886f8 100644 --- a/drivers/gr-gn3s/cmake/Modules/GrPlatform.cmake +++ b/drivers/gr-gn3s/cmake/Modules/GrPlatform.cmake @@ -37,10 +37,18 @@ if(LINUX AND EXISTS "/etc/redhat-release") set(REDHAT TRUE) endif() +if(LINUX AND EXISTS "/etc/slackware-version") + set(SLACKWARE TRUE) +endif() + ######################################################################## # when the library suffix should be 64 (applies to redhat linux family) ######################################################################## -if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") +if (REDHAT OR SLACKWARE) + set(LIB64_CONVENTION TRUE) +endif() + +if(NOT DEFINED LIB_SUFFIX AND LIB64_CONVENTION AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") set(LIB_SUFFIX 64) endif() set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") diff --git a/drivers/gr-gn3s/cmake/Modules/GrPython.cmake b/drivers/gr-gn3s/cmake/Modules/GrPython.cmake index efdddf371..791114e05 100644 --- a/drivers/gr-gn3s/cmake/Modules/GrPython.cmake +++ b/drivers/gr-gn3s/cmake/Modules/GrPython.cmake @@ -76,10 +76,11 @@ macro(GR_PYTHON_CHECK_MODULE desc mod cmd have) execute_process( COMMAND ${PYTHON_EXECUTABLE} -c " ######################################### -try: import ${mod} -except: exit(-1) -try: assert ${cmd} -except: exit(-1) +try: + import ${mod} + assert ${cmd} +except ImportError, AssertionError: exit(-1) +except: pass #########################################" RESULT_VARIABLE ${have} ) @@ -95,11 +96,13 @@ endmacro(GR_PYTHON_CHECK_MODULE) ######################################################################## # Sets the python installation directory GR_PYTHON_DIR ######################################################################## +if(NOT DEFINED GR_PYTHON_DIR) execute_process(COMMAND ${PYTHON_EXECUTABLE} -c " from distutils import sysconfig print sysconfig.get_python_lib(plat_specific=True, prefix='') " OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE ) +endif() file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR) ######################################################################## @@ -181,6 +184,10 @@ function(GR_PYTHON_INSTALL) #################################################################### file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native) + if (CMAKE_CROSSCOMPILING) + set(pyexe_native /usr/bin/env python) + endif() + foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS}) get_filename_component(pyfile_name ${pyfile} NAME) get_filename_component(pyfile ${pyfile} ABSOLUTE) diff --git a/drivers/gr-gn3s/cmake/Modules/GrSwig.cmake b/drivers/gr-gn3s/cmake/Modules/GrSwig.cmake index 6ba5ee3a5..8cf126541 100644 --- a/drivers/gr-gn3s/cmake/Modules/GrSwig.cmake +++ b/drivers/gr-gn3s/cmake/Modules/GrSwig.cmake @@ -33,8 +33,7 @@ include(GrPython) # - GR_SWIG_DOCS_TARGET_DEPS ######################################################################## function(GR_SWIG_MAKE_DOCS output_file) - find_package(Doxygen) - if(DOXYGEN_FOUND) + if(ENABLE_DOXYGEN) #setup the input files variable list, quote formated set(input_files) @@ -76,17 +75,18 @@ function(GR_SWIG_MAKE_DOCS output_file) #call the swig_doc script on the xml files add_custom_command( OUTPUT ${output_file} - DEPENDS ${input_files} ${OUTPUT_DIRECTORY}/xml/index.xml + DEPENDS ${input_files} ${stamp-file} ${OUTPUT_DIRECTORY}/xml/index.xml COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py ${OUTPUT_DIRECTORY}/xml ${output_file} + COMMENT "Generating python docstrings for ${name}" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen ) - else(DOXYGEN_FOUND) + else(ENABLE_DOXYGEN) file(WRITE ${output_file} "\n") #no doxygen -> empty file - endif(DOXYGEN_FOUND) + endif(ENABLE_DOXYGEN) endfunction(GR_SWIG_MAKE_DOCS) ######################################################################## @@ -105,20 +105,35 @@ endfunction(GR_SWIG_MAKE_DOCS) macro(GR_SWIG_MAKE name) set(ifiles ${ARGN}) + # Shimming this in here to take care of a SWIG bug with handling + # vector and vector (on 32-bit machines) and + # vector (on 64-bit machines). Use this to test + # the size of size_t, then set SIZE_T_32 if it's a 32-bit machine + # or not if it's 64-bit. The logic in gr_type.i handles the rest. + INCLUDE (CheckTypeSize) + CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T) + CHECK_TYPE_SIZE("unsigned int" SIZEOF_UINT) + if(${SIZEOF_SIZE_T} EQUAL ${SIZEOF_UINT}) + list(APPEND GR_SWIG_FLAGS -DSIZE_T_32) + endif(${SIZEOF_SIZE_T} EQUAL ${SIZEOF_UINT}) + #do swig doc generation if specified if (GR_SWIG_DOC_FILE) set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS}) - set(GR_SWIG_DOCS_TAREGT_DEPS ${GR_SWIG_TARGET_DEPS}) + list(APPEND GR_SWIG_DOCS_TARGET_DEPS ${GR_SWIG_TARGET_DEPS}) GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS}) - list(APPEND GR_SWIG_SOURCE_DEPS ${GR_SWIG_DOC_FILE}) + add_custom_target(${name}_swig_doc DEPENDS ${GR_SWIG_DOC_FILE}) + list(APPEND GR_SWIG_TARGET_DEPS ${name}_swig_doc ${GR_RUNTIME_SWIG_DOC_FILE}) endif() #append additional include directories find_package(PythonLibs) list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs) list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) - list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) - list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}) + + #prepend local swig directories + list(INSERT GR_SWIG_INCLUDE_DIRS 0 ${CMAKE_CURRENT_SOURCE_DIR}) + list(INSERT GR_SWIG_INCLUDE_DIRS 0 ${CMAKE_CURRENT_BINARY_DIR}) #determine include dependencies for swig file execute_process( @@ -204,21 +219,25 @@ file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py " import os, sys, re -include_matcher = re.compile('[#|%]include\\s*[<|\"](.*)[>|\"]') +i_include_matcher = re.compile('%(include|import)\\s*[<|\"](.*)[>|\"]') +h_include_matcher = re.compile('#(include)\\s*[<|\"](.*)[>|\"]') include_dirs = sys.argv[2].split(';') def get_swig_incs(file_path): + if file_path.endswith('.i'): matcher = i_include_matcher + else: matcher = h_include_matcher file_contents = open(file_path, 'r').read() - return include_matcher.findall(file_contents, re.MULTILINE) + return matcher.findall(file_contents, re.MULTILINE) def get_swig_deps(file_path, level): deps = [file_path] if level == 0: return deps - for inc_file in get_swig_incs(file_path): + for keyword, inc_file in get_swig_incs(file_path): for inc_dir in include_dirs: inc_path = os.path.join(inc_dir, inc_file) if not os.path.exists(inc_path): continue deps.extend(get_swig_deps(inc_path, level-1)) + break #found, we dont search in lower prio inc dirs return deps if __name__ == '__main__': diff --git a/drivers/gr-gn3s/cmake/Modules/GrTest.cmake b/drivers/gr-gn3s/cmake/Modules/GrTest.cmake index 6174c034e..bb045dcbb 100644 --- a/drivers/gr-gn3s/cmake/Modules/GrTest.cmake +++ b/drivers/gr-gn3s/cmake/Modules/GrTest.cmake @@ -30,10 +30,10 @@ set(__INCLUDED_GR_TEST_CMAKE TRUE) # GR_TEST_TARGET_DEPS - built targets for the library path # GR_TEST_LIBRARY_DIRS - directories for the library path # GR_TEST_PYTHON_DIRS - directories for the python path +# GR_TEST_ENVIRONS - other environment key/value pairs ######################################################################## function(GR_ADD_TEST test_name) - if(WIN32) #Ensure that the build exe also appears in the PATH. list(APPEND GR_TEST_TARGET_DEPS ${ARGN}) @@ -50,6 +50,7 @@ function(GR_ADD_TEST test_name) endif(location) endforeach(target) + if(WIN32) #SWIG generates the python library files into a subdirectory. #Therefore, we must append this subdirectory into PYTHONPATH. #Only do this for the python directories matching the following: @@ -66,6 +67,7 @@ function(GR_ADD_TEST test_name) file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list? set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}") + list(APPEND environs ${GR_TEST_ENVIRONS}) #http://www.cmake.org/pipermail/cmake/2009-May/029464.html #Replaced this add test + set environs code with the shell script generation. @@ -74,15 +76,19 @@ function(GR_ADD_TEST test_name) #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}") if(UNIX) + set(LD_PATH_VAR "LD_LIBRARY_PATH") + if(APPLE) + set(LD_PATH_VAR "DYLD_LIBRARY_PATH") + endif() + set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH") - #set both LD and DYLD paths to cover multiple UNIX OS library paths - list(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH") + list(APPEND libpath "$${LD_PATH_VAR}") list(APPEND pypath "$PYTHONPATH") #replace list separator with the path separator string(REPLACE ";" ":" libpath "${libpath}") string(REPLACE ";" ":" pypath "${pypath}") - list(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}") + list(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${libpath}" "PYTHONPATH=${pypath}") #generate a bat file that sets the environment and runs the test find_program(SHELL sh) diff --git a/drivers/gr-gn3s/include/gn3s_api.h b/drivers/gr-gn3s/include/gn3s_api.h index c5538cc20..26032a71b 100644 --- a/drivers/gr-gn3s/include/gn3s_api.h +++ b/drivers/gr-gn3s/include/gn3s_api.h @@ -31,7 +31,7 @@ #ifndef INCLUDED_GN3S_API_H #define INCLUDED_GN3S_API_H -#include +#include #ifdef gr_gn3s_EXPORTS # define GN3S_API __GR_ATTR_EXPORT diff --git a/drivers/gr-gn3s/include/gn3s_source_cc.h b/drivers/gr-gn3s/include/gn3s_source_cc.h index ef5a16b4d..2dbc7e2c5 100644 --- a/drivers/gr-gn3s/include/gn3s_source_cc.h +++ b/drivers/gr-gn3s/include/gn3s_source_cc.h @@ -31,7 +31,7 @@ #define INCLUDED_GN3S_SOURCE_CC_H #include "gn3s_api.h" -#include +#include #include "gn3s_source.h" #include "gn3s_defines.h" @@ -65,7 +65,7 @@ GN3S_API gn3s_source_cc_sptr gn3s_make_source_cc (); * * \sa gn3s_source for a version that subclasses gr_block. */ -class GN3S_API gn3s_source_cc : public gr_block +class GN3S_API gn3s_source_cc : public gr::block { private: // The friend declaration allows gn3s_source to diff --git a/drivers/gr-gn3s/lib/CMakeLists.txt b/drivers/gr-gn3s/lib/CMakeLists.txt index 3d825d798..065736099 100644 --- a/drivers/gr-gn3s/lib/CMakeLists.txt +++ b/drivers/gr-gn3s/lib/CMakeLists.txt @@ -23,7 +23,7 @@ include(GrPlatform) #define LIB_SUFFIX add_library(gr-gn3s SHARED gn3s_source_cc.cc gn3s_source.cc gn3s.cc fusb.cc fusb_linux.cc) -target_link_libraries(gr-gn3s ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES} "usb") +target_link_libraries(gr-gn3s ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} "usb" ${LIBUSB_LIBRARIES}) set_target_properties(gr-gn3s PROPERTIES DEFINE_SYMBOL "gr_gn3s_EXPORTS") ######################################################################## @@ -46,6 +46,6 @@ set(GR_TEST_TARGET_DEPS gr-gn3s) add_definitions(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN) add_executable(qa_gn3s_source_cc qa_gn3s_source_cc.cc) -target_link_libraries(qa_gn3s_source_cc gr-gn3s ${Boost_LIBRARIES} "usb") +target_link_libraries(qa_gn3s_source_cc gr-gn3s ${Boost_LIBRARIES} "usb" ${LIBUSB_LIBRARIES}) GR_ADD_TEST(qa_gn3s_source_cc qa_gn3s_source_cc) diff --git a/drivers/gr-gn3s/lib/gn3s_source_cc.cc b/drivers/gr-gn3s/lib/gn3s_source_cc.cc index c91b6df96..60df6d276 100644 --- a/drivers/gr-gn3s/lib/gn3s_source_cc.cc +++ b/drivers/gr-gn3s/lib/gn3s_source_cc.cc @@ -33,7 +33,7 @@ #include #include -#include +#include /* @@ -49,7 +49,7 @@ gn3s_make_source_cc () /* * Specify constraints on number of input and output streams. * This info is used to construct the input and output signatures - * (2nd & 3rd args to gr_block's constructor). The input and + * (2nd & 3rd args to gr::block's constructor). The input and * output signatures are used by the runtime system to * check that a valid number and type of inputs and outputs * are connected to this block. In this case, we accept @@ -64,9 +64,9 @@ static const int MAX_OUT = 1; // maximum number of output streams * The private constructor */ gn3s_source_cc::gn3s_source_cc () - : gr_block ("gn3s_cc", - gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)), - gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (gr_complex))) + : gr::block ("gn3s_cc", + gr::io_signature::make(MIN_IN, MAX_IN, sizeof (gr_complex)), + gr::io_signature::make(MIN_OUT, MAX_OUT, sizeof (gr_complex))) { // constructor code here gn3s_drv = new gn3s_Source(); @@ -99,13 +99,16 @@ int n_samples_rx; if (noutput_items<=GN3S_SAMPS_5MS) { gn3s_drv->Read(&packet,noutput_items); - n_samples_rx=noutput_items; -}else{ - gn3s_drv->Read(&packet,GN3S_SAMPS_5MS); - n_samples_rx=GN3S_SAMPS_5MS; + n_samples_rx = noutput_items; } - for (int i = 0; i < n_samples_rx; i++){ - out[i]=gr_complex(packet.data[i].i,packet.data[i].q); +else +{ + gn3s_drv->Read(&packet,GN3S_SAMPS_5MS); + n_samples_rx = GN3S_SAMPS_5MS; +} + for (int i = 0; i < n_samples_rx; i++) + { + out[i] = gr_complex(packet.data[i].i, packet.data[i].q); } // Tell runtime system how many output items we produced. diff --git a/drivers/gr-gn3s/swig/CMakeLists.txt b/drivers/gr-gn3s/swig/CMakeLists.txt index 7faef8a7e..5fe2117fa 100644 --- a/drivers/gr-gn3s/swig/CMakeLists.txt +++ b/drivers/gr-gn3s/swig/CMakeLists.txt @@ -31,15 +31,15 @@ include(GrPython) ######################################################################## # Setup swig generation ######################################################################## -foreach(incdir ${GNURADIO_CORE_INCLUDE_DIRS}) - list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig) -endforeach(incdir) +set(GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS ${GNURADIO_RUNTIME_INCLUDE_DIRS}/gnuradio/swig) -foreach(incdir ${GRUEL_INCLUDE_DIRS}) - list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gruel/swig) -endforeach(incdir) +set(GR_SWIG_INCLUDE_DIRS + ${GR_GN3S_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} +) -set(GR_SWIG_LIBRARIES gr-gn3s) +set(GR_SWIG_LIBRARIES gr-gn3s gnuradio-runtime) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/gn3s_swig_doc.i) set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include) @@ -57,5 +57,5 @@ install( FILES gn3s_swig.i ${CMAKE_CURRENT_BINARY_DIR}/gn3s_swig_doc.i - DESTINATION ${GR_INCLUDE_DIR}/gn3s/swig + DESTINATION ${GNURADIO_RUNTIME_INCLUDE_DIR}/gn3s/swig ) diff --git a/src/algorithms/PVT/adapters/CMakeLists.txt b/src/algorithms/PVT/adapters/CMakeLists.txt index 2d233639b..8469cfba1 100644 --- a/src/algorithms/PVT/adapters/CMakeLists.txt +++ b/src/algorithms/PVT/adapters/CMakeLists.txt @@ -25,9 +25,10 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/PVT/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs - ${GNURADIO_CORE_INCLUDE_DIRS} ${ARMADILLO_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(pvt_adapters ${PVT_ADAPTER_SOURCES}) -target_link_libraries(pvt_adapters pvt_gr_blocks ${ARMADILLO_LIBRARIES}) \ No newline at end of file +target_link_libraries(pvt_adapters pvt_gr_blocks ${ARMADILLO_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES}) diff --git a/src/algorithms/PVT/adapters/gps_l1_ca_pvt.cc b/src/algorithms/PVT/adapters/gps_l1_ca_pvt.cc index 4f28bf4ad..cd9adfa22 100644 --- a/src/algorithms/PVT/adapters/gps_l1_ca_pvt.cc +++ b/src/algorithms/PVT/adapters/gps_l1_ca_pvt.cc @@ -34,7 +34,6 @@ #include "gps_l1_ca_pvt.h" #include "configuration_interface.h" #include "gps_l1_ca_pvt_cc.h" -#include #include #include @@ -44,11 +43,11 @@ GpsL1CaPvt::GpsL1CaPvt(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : - role_(role), - in_streams_(in_streams), - out_streams_(out_streams), - queue_(queue) + boost::shared_ptr queue) : + role_(role), + in_streams_(in_streams), + out_streams_(out_streams), + queue_(queue) { // dump parameters std::string default_dump_filename = "./pvt.dat"; @@ -76,7 +75,7 @@ GpsL1CaPvt::GpsL1CaPvt(ConfigurationInterface* configuration, std::string nmea_dump_devname; nmea_dump_devname = configuration->property(role + ".nmea_dump_devname", default_nmea_dump_devname); // make PVT object - pvt_ = gps_l1_ca_make_pvt_cc(in_streams_, queue_, dump_, dump_filename_, averaging_depth, flag_averaging, output_rate_ms, display_rate_ms,flag_nmea_tty_port,nmea_dump_filename,nmea_dump_devname); + pvt_ = gps_l1_ca_make_pvt_cc(in_streams_, queue_, dump_, dump_filename_, averaging_depth, flag_averaging, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname); DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")"; } @@ -85,25 +84,25 @@ GpsL1CaPvt::~GpsL1CaPvt() {} -void GpsL1CaPvt::connect(gr_top_block_sptr top_block) +void GpsL1CaPvt::connect(gr::top_block_sptr top_block) { // Nothing to connect internally DLOG(INFO) << "nothing to connect internally"; } -void GpsL1CaPvt::disconnect(gr_top_block_sptr top_block) +void GpsL1CaPvt::disconnect(gr::top_block_sptr top_block) { // Nothing to disconnect } -gr_basic_block_sptr GpsL1CaPvt::get_left_block() +gr::basic_block_sptr GpsL1CaPvt::get_left_block() { return pvt_; } -gr_basic_block_sptr GpsL1CaPvt::get_right_block() +gr::basic_block_sptr GpsL1CaPvt::get_right_block() { return pvt_; } diff --git a/src/algorithms/PVT/adapters/gps_l1_ca_pvt.h b/src/algorithms/PVT/adapters/gps_l1_ca_pvt.h index 0c7ad15d4..8a5c19f64 100644 --- a/src/algorithms/PVT/adapters/gps_l1_ca_pvt.h +++ b/src/algorithms/PVT/adapters/gps_l1_ca_pvt.h @@ -38,7 +38,7 @@ #include "pvt_interface.h" #include "gps_l1_ca_pvt_cc.h" -#include +#include class ConfigurationInterface; @@ -52,7 +52,7 @@ public: std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); virtual ~GpsL1CaPvt(); @@ -61,23 +61,23 @@ public: return role_; } - //! return "GPS_L1_CA_PVT" + //! Returns "GPS_L1_CA_PVT" std::string implementation() { return "GPS_L1_CA_PVT"; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); void reset() { return; } - //! All blocks must have an item_size() function implementation + //! All blocks must have an item_size() function implementation. Returns sizeof(gr_complex) size_t item_size() { return sizeof(gr_complex); @@ -91,7 +91,7 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; }; #endif diff --git a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt index 5578567eb..95ef63c5e 100644 --- a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt @@ -24,9 +24,10 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs - ${GNURADIO_CORE_INCLUDE_DIRS} ${ARMADILLO_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(pvt_gr_blocks ${PVT_GR_BLOCKS_SOURCES}) -target_link_libraries(pvt_gr_blocks pvt_lib ${ARMADILLO_LIBRARIES}) \ No newline at end of file +target_link_libraries(pvt_gr_blocks pvt_lib ${ARMADILLO_LIBRARIES}) diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc index f0780ed2f..2556aa800 100644 --- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc @@ -34,9 +34,8 @@ #include #include #include -#include -#include "math.h" -#include +#include +#include #include #include #include "control_message_factory.h" @@ -51,15 +50,15 @@ extern concurrent_map global_gps_iono_map; extern concurrent_map global_gps_utc_model_map; gps_l1_ca_pvt_cc_sptr -gps_l1_ca_make_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname) +gps_l1_ca_make_pvt_cc(unsigned int nchannels, boost::shared_ptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname) { return gps_l1_ca_pvt_cc_sptr(new gps_l1_ca_pvt_cc(nchannels, queue, dump, dump_filename, averaging_depth, flag_averaging, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname)); } -gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname) : - gr_block ("gps_l1_ca_pvt_cc", gr_make_io_signature (nchannels, nchannels, sizeof(Gnss_Synchro)), - gr_make_io_signature(1, 1, sizeof(gr_complex))) +gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, boost::shared_ptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname) : + gr::block("gps_l1_ca_pvt_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)), + gr::io_signature::make(1, 1, sizeof(gr_complex))) { d_output_rate_ms = output_rate_ms; @@ -88,8 +87,8 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr que d_ls_pvt->set_averaging_depth(d_averaging_depth); d_sample_counter = 0; - d_last_sample_nav_output=0; - d_rx_time=0.0; + d_last_sample_nav_output = 0; + d_rx_time = 0.0; b_rinex_header_writen = false; rp = new Rinex_Printer(); @@ -111,7 +110,6 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr que } } } - } @@ -153,102 +151,95 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite // ############ 1. READ EPHEMERIS/UTC_MODE/IONO FROM GLOBAL MAPS #### - d_ls_pvt->gps_ephemeris_map=global_gps_ephemeris_map.get_map_copy(); + d_ls_pvt->gps_ephemeris_map = global_gps_ephemeris_map.get_map_copy(); if (global_gps_utc_model_map.size()>0) - { - // UTC MODEL data is shared for all the GPS satellites. Read always at ID=0 - global_gps_utc_model_map.read(0,d_ls_pvt->gps_utc_model); - } + { + // UTC MODEL data is shared for all the GPS satellites. Read always at ID=0 + global_gps_utc_model_map.read(0,d_ls_pvt->gps_utc_model); + } if (global_gps_iono_map.size()>0) - { - // IONO data is shared for all the GPS satellites. Read always at ID=0 - global_gps_iono_map.read(0,d_ls_pvt->gps_iono); - } + { + // IONO data is shared for all the GPS satellites. Read always at ID=0 + global_gps_iono_map.read(0,d_ls_pvt->gps_iono); + } // ############ 2 COMPUTE THE PVT ################################ if (gnss_pseudoranges_map.size() > 0 and d_ls_pvt->gps_ephemeris_map.size() >0) - { - // The GPS TX time is directly the Time of Week (TOW) associated to the current symbol of the reference channel - // It is used to compute the SV positions at the TX instant + { + // compute on the fly PVT solution + //mod 8/4/2012 Set the PVT computation rate in this block + if ((d_sample_counter % d_output_rate_ms) == 0) + { + bool pvt_result; + pvt_result = d_ls_pvt->get_PVT(gnss_pseudoranges_map, d_rx_time, d_flag_averaging); + if (pvt_result==true) + { + d_kml_dump.print_position(d_ls_pvt, d_flag_averaging); + d_nmea_printer->Print_Nmea_Line(d_ls_pvt, d_flag_averaging); - // compute on the fly PVT solution - //mod 8/4/2012 Set the PVT computation rate in this block - if ((d_sample_counter % d_output_rate_ms) == 0) - { - bool pvt_result; - pvt_result=d_ls_pvt->get_PVT(gnss_pseudoranges_map,d_rx_time,d_flag_averaging); - if (pvt_result==true) - { - d_kml_dump.print_position(d_ls_pvt, d_flag_averaging); - d_nmea_printer->Print_Nmea_Line(d_ls_pvt, d_flag_averaging); + if (!b_rinex_header_writen) // & we have utc data in nav message! + { + std::map::iterator gps_ephemeris_iter; + gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin(); + if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) + { + rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second,d_rx_time); + rp->rinex_nav_header(rp->navFile,d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model); + b_rinex_header_writen = true; // do not write header anymore + } + } + if(b_rinex_header_writen) // Put here another condition to separate annotations (e.g 30 s) + { + // Limit the RINEX navigation output rate to 1/6 seg + // Notice that d_sample_counter period is 1ms (for GPS correlators) + if ((d_sample_counter-d_last_sample_nav_output)>=6000) + { + rp->log_rinex_nav(rp->navFile, d_ls_pvt->gps_ephemeris_map); + d_last_sample_nav_output=d_sample_counter; + } + std::map::iterator gps_ephemeris_iter; + gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin(); + if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) + { + rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, d_rx_time, gnss_pseudoranges_map); + } + } + } + } - if (!b_rinex_header_writen) // & we have utc data in nav message! - { - std::map::iterator gps_ephemeris_iter; - gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin(); - if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) - { - rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second,d_rx_time); - rp->rinex_nav_header(rp->navFile,d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model); - b_rinex_header_writen = true; // do not write header anymore - } - } - if(b_rinex_header_writen) // Put here another condition to separate annotations (e.g 30 s) - { - // Limit the RINEX navigation output rate to 1/6 seg - // Notice that d_sample_counter period is 1ms (for GPS correlators) + // DEBUG MESSAGE: Display position in console output + if (((d_sample_counter % d_display_rate_ms) == 0) and d_ls_pvt->b_valid_position == true) + { + std::cout << "Position at " << boost::posix_time::to_simple_string(d_ls_pvt->d_position_UTC_time) + << " is Lat = " << d_ls_pvt->d_latitude_d << " [deg], Long = " << d_ls_pvt->d_longitude_d + << " [deg], Height= " << d_ls_pvt->d_height_m << " [m]" << std::endl; - if ((d_sample_counter-d_last_sample_nav_output)>=6000) - { - rp->log_rinex_nav(rp->navFile, d_ls_pvt->gps_ephemeris_map); - d_last_sample_nav_output=d_sample_counter; - } - std::map::iterator gps_ephemeris_iter; - gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin(); - if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) - { - rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, d_rx_time, gnss_pseudoranges_map); - } - } - } - - - } - - // DEBUG MESSAGE: Display position in console output - if (((d_sample_counter % d_display_rate_ms) == 0) and d_ls_pvt->b_valid_position == true) - { - std::cout << "Position at " << boost::posix_time::to_simple_string(d_ls_pvt->d_position_UTC_time) - << " is Lat = " << d_ls_pvt->d_latitude_d << " [deg], Long = " << d_ls_pvt->d_longitude_d - << " [deg], Height= " << d_ls_pvt->d_height_m << " [m]" << std::endl; - - std::cout << "Dilution of Precision at " << boost::posix_time::to_simple_string(d_ls_pvt->d_position_UTC_time) - << " is HDOP = " << d_ls_pvt->d_HDOP << " and VDOP = " << d_ls_pvt->d_VDOP << std::endl; - } - // MULTIPLEXED FILE RECORDING - Record results to file - if(d_dump == true) - { - try - { - double tmp_double; - for (unsigned int i=0; id_position_UTC_time) + << " is HDOP = " << d_ls_pvt->d_HDOP << " and VDOP = " << d_ls_pvt->d_VDOP << std::endl; + } + // MULTIPLEXED FILE RECORDING - Record results to file + if(d_dump == true) + { + try + { + double tmp_double; + for (unsigned int i=0; i -#include -#include +#include +#include #include #include #include @@ -51,18 +51,18 @@ class gps_l1_ca_pvt_cc; typedef boost::shared_ptr gps_l1_ca_pvt_cc_sptr; gps_l1_ca_pvt_cc_sptr -gps_l1_ca_make_pvt_cc(unsigned int n_channels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname); +gps_l1_ca_make_pvt_cc(unsigned int n_channels, boost::shared_ptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname); /*! * \brief This class implements a block that computes the PVT solution */ -class gps_l1_ca_pvt_cc : public gr_block +class gps_l1_ca_pvt_cc : public gr::block { private: friend gps_l1_ca_pvt_cc_sptr - gps_l1_ca_make_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname); - gps_l1_ca_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname); - gr_msg_queue_sptr d_queue; + gps_l1_ca_make_pvt_cc(unsigned int nchannels, boost::shared_ptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname); + gps_l1_ca_pvt_cc(unsigned int nchannels, boost::shared_ptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname); + boost::shared_ptr d_queue; bool d_dump; bool b_rinex_header_writen; Rinex_Printer *rp; diff --git a/src/algorithms/PVT/libs/CMakeLists.txt b/src/algorithms/PVT/libs/CMakeLists.txt index 8fa00ec9a..6ca2b89df 100644 --- a/src/algorithms/PVT/libs/CMakeLists.txt +++ b/src/algorithms/PVT/libs/CMakeLists.txt @@ -29,11 +29,11 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/PVT/adapters - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${ARMADILLO_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GFlags_INCLUDE_DIRS} ) add_library(pvt_lib ${PVT_LIB_SOURCES}) -target_link_libraries(pvt_lib ${Boost_LIBRARIES} ${GFlags_LIBS} ${ARMADILLO_LIBRARIES} ) \ No newline at end of file +target_link_libraries(pvt_lib ${Boost_LIBRARIES} ${GFlags_LIBS} ${GLOG_LIBRARIES} ${ARMADILLO_LIBRARIES} ) diff --git a/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc b/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc index 5750c6d88..4ae26a22a 100644 --- a/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc +++ b/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc @@ -28,13 +28,12 @@ * ------------------------------------------------------------------------- */ -#include "armadillo" +#include #include "gps_l1_ca_ls_pvt.h" #include "GPS_L1_CA.h" #include #include #include "boost/date_time/posix_time/posix_time.hpp" - #include "gnss_synchro.h" using google::LogMessage; @@ -141,10 +140,10 @@ arma::vec gps_l1_ca_ls_pvt::leastSquarePos(arma::mat satpos, arma::vec obs, arma arma::mat omc; arma::mat az; arma::mat el; - A=arma::zeros(nmbOfSatellites, 4); - omc=arma::zeros(nmbOfSatellites, 1); - az=arma::zeros(1, nmbOfSatellites); - el=arma::zeros(1, nmbOfSatellites); + A = arma::zeros(nmbOfSatellites, 4); + omc = arma::zeros(nmbOfSatellites, 1); + az = arma::zeros(1, nmbOfSatellites); + el = arma::zeros(1, nmbOfSatellites); for (int i = 0; i < nmbOfSatellites; i++) { for (int j = 0; j < 4; j++) @@ -202,7 +201,7 @@ arma::vec gps_l1_ca_ls_pvt::leastSquarePos(arma::mat satpos, arma::vec obs, arma A(i,2) = (-(Rot_X(2) - pos(2))) / obs(i); A(i,3) = 1.0; } - + //--- Find position update --------------------------------------------- x = arma::solve(w*A, w*omc); // Armadillo @@ -214,7 +213,8 @@ arma::vec gps_l1_ca_ls_pvt::leastSquarePos(arma::mat satpos, arma::vec obs, arma } } - try{ + try + { //-- compute the Dilution Of Precision values arma::mat Q; Q = arma::inv(arma::htrans(A)*A); @@ -230,7 +230,7 @@ arma::vec gps_l1_ca_ls_pvt::leastSquarePos(arma::mat satpos, arma::vec obs, arma d_PDOP = -1; d_HDOP = -1; d_VDOP = -1; - d_TDOP = -1; + d_TDOP = -1; } return pos; } @@ -238,211 +238,209 @@ arma::vec gps_l1_ca_ls_pvt::leastSquarePos(arma::mat satpos, arma::vec obs, arma bool gps_l1_ca_ls_pvt::get_PVT(std::map gnss_pseudoranges_map, double GPS_current_time, bool flag_averaging) { - std::map::iterator gnss_pseudoranges_iter; - std::map::iterator gps_ephemeris_iter; - int valid_pseudoranges=gnss_pseudoranges_map.size(); + std::map::iterator gnss_pseudoranges_iter; + std::map::iterator gps_ephemeris_iter; + int valid_pseudoranges = gnss_pseudoranges_map.size(); - arma::mat W = arma::eye(valid_pseudoranges,valid_pseudoranges); //channels weights matrix - arma::vec obs = arma::zeros(valid_pseudoranges); // pseudoranges observation vector - arma::mat satpos = arma::zeros(3,valid_pseudoranges); //satellite positions matrix + arma::mat W = arma::eye(valid_pseudoranges,valid_pseudoranges); //channels weights matrix + arma::vec obs = arma::zeros(valid_pseudoranges); // pseudoranges observation vector + arma::mat satpos = arma::zeros(3,valid_pseudoranges); //satellite positions matrix - int GPS_week = 0; - //double GPS_corrected_time = 0; - double utc = 0; - double SV_clock_drift_s = 0; - double SV_relativistic_clock_corr_s=0; - double TX_time_corrected_s; - double SV_clock_bias_s=0; + int GPS_week = 0; + double utc = 0; + double SV_clock_drift_s = 0; + double SV_relativistic_clock_corr_s = 0; + double TX_time_corrected_s; + double SV_clock_bias_s = 0; - d_flag_averaging = flag_averaging; + d_flag_averaging = flag_averaging; - // ******************************************************************************** - // ****** PREPARE THE LEAST SQUARES DATA (SV POSITIONS MATRIX AND OBS VECTORS) **** - // ******************************************************************************** - int valid_obs = 0; //valid observations counter - int obs_counter=0; - for(gnss_pseudoranges_iter = gnss_pseudoranges_map.begin(); - gnss_pseudoranges_iter != gnss_pseudoranges_map.end(); - gnss_pseudoranges_iter++) - { - // 1- find the ephemeris for the current SV observation. The SV PRN ID is the map key - gps_ephemeris_iter = gps_ephemeris_map.find(gnss_pseudoranges_iter->first); - if (gps_ephemeris_iter != gps_ephemeris_map.end()) - { + // ******************************************************************************** + // ****** PREPARE THE LEAST SQUARES DATA (SV POSITIONS MATRIX AND OBS VECTORS) **** + // ******************************************************************************** + int valid_obs = 0; //valid observations counter + int obs_counter = 0; + for(gnss_pseudoranges_iter = gnss_pseudoranges_map.begin(); + gnss_pseudoranges_iter != gnss_pseudoranges_map.end(); + gnss_pseudoranges_iter++) + { + // 1- find the ephemeris for the current SV observation. The SV PRN ID is the map key + gps_ephemeris_iter = gps_ephemeris_map.find(gnss_pseudoranges_iter->first); + if (gps_ephemeris_iter != gps_ephemeris_map.end()) + { + /*! + * \todo Place here the satellite CN0 (power level, or weight factor) + */ + W(obs_counter, obs_counter) = 1; - /*! - * \todo Place here the satellite CN0 (power level, or weight factor) - */ - W(obs_counter,obs_counter) = 1; + // COMMON RX TIME PVT ALGORITHM MODIFICATION (Like RINEX files) + // first estimate of transmit time + double Rx_time = GPS_current_time; + double Tx_time = Rx_time - gnss_pseudoranges_iter->second.Pseudorange_m/GPS_C_m_s; - // COMMON RX TIME PVT ALGORITHM MODIFICATION (Like RINEX files) - // first estimate of transmit time - double Rx_time=GPS_current_time; - double Tx_time=Rx_time-gnss_pseudoranges_iter->second.Pseudorange_m/GPS_C_m_s; + // 2- compute the clock drift using the clock model (broadcast) for this SV + SV_clock_drift_s = gps_ephemeris_iter->second.sv_clock_drift(Tx_time); - // 2- compute the clock drift using the clock model (broadcast) for this SV - SV_clock_drift_s = gps_ephemeris_iter->second.sv_clock_drift(Tx_time); + // 3- compute the relativistic clock drift using the clock model (broadcast) for this SV + SV_relativistic_clock_corr_s = gps_ephemeris_iter->second.sv_clock_relativistic_term(Tx_time); - // 3- compute the relativistic clock drift using the clock model (broadcast) for this SV + // 4- compute the current ECEF position for this SV using corrected TX time + SV_clock_bias_s = SV_clock_drift_s + SV_relativistic_clock_corr_s - gps_ephemeris_iter->second.d_TGD; + TX_time_corrected_s = Tx_time - SV_clock_bias_s; + gps_ephemeris_iter->second.satellitePosition(TX_time_corrected_s); - SV_relativistic_clock_corr_s = gps_ephemeris_iter->second.sv_clock_relativistic_term(Tx_time); + satpos(0,obs_counter) = gps_ephemeris_iter->second.d_satpos_X; + satpos(1,obs_counter) = gps_ephemeris_iter->second.d_satpos_Y; + satpos(2,obs_counter) = gps_ephemeris_iter->second.d_satpos_Z; + // 5- fill the observations vector with the corrected pseudorranges + obs(obs_counter) = gnss_pseudoranges_iter->second.Pseudorange_m + SV_clock_bias_s*GPS_C_m_s; + d_visible_satellites_IDs[valid_obs] = gps_ephemeris_iter->second.i_satellite_PRN; + d_visible_satellites_CN0_dB[valid_obs] = gnss_pseudoranges_iter->second.CN0_dB_hz; + valid_obs++; - // 4- compute the current ECEF position for this SV using corrected TX time + // SV ECEF DEBUG OUTPUT + DLOG(INFO) << "(new)ECEF satellite SV ID=" << gps_ephemeris_iter->second.i_satellite_PRN + << " X=" << gps_ephemeris_iter->second.d_satpos_X + << " [m] Y=" << gps_ephemeris_iter->second.d_satpos_Y + << " [m] Z=" << gps_ephemeris_iter->second.d_satpos_Z + << " [m] PR_obs=" << obs(obs_counter) << " [m]" << std::endl; - SV_clock_bias_s=SV_clock_drift_s+SV_relativistic_clock_corr_s-gps_ephemeris_iter->second.d_TGD; - TX_time_corrected_s=Tx_time-SV_clock_bias_s; + // compute the UTC time for this SV (just to print the asociated UTC timestamp) + GPS_week = gps_ephemeris_iter->second.i_GPS_week; + utc = gps_utc_model.utc_time(TX_time_corrected_s, GPS_week); - gps_ephemeris_iter->second.satellitePosition(TX_time_corrected_s); + } + else // the ephemeris are not available for this SV + { + // no valid pseudorange for the current SV + W(obs_counter, obs_counter) = 0; // SV de-activated + obs(obs_counter) = 1; // to avoid algorithm problems (divide by zero) + DLOG(INFO) << "No ephemeris data for SV "<< gnss_pseudoranges_iter->first << std::endl; + } + obs_counter++; + } - satpos(0,obs_counter) = gps_ephemeris_iter->second.d_satpos_X; - satpos(1,obs_counter) = gps_ephemeris_iter->second.d_satpos_Y; - satpos(2,obs_counter) = gps_ephemeris_iter->second.d_satpos_Z; - // 5- fill the observations vector with the corrected pseudorranges - obs(obs_counter) = gnss_pseudoranges_iter->second.Pseudorange_m + SV_clock_bias_s*GPS_C_m_s; - d_visible_satellites_IDs[valid_obs] = gps_ephemeris_iter->second.i_satellite_PRN; - d_visible_satellites_CN0_dB[valid_obs] =gnss_pseudoranges_iter->second.CN0_dB_hz; - valid_obs++; - // SV ECEF DEBUG OUTPUT - DLOG(INFO) << "(new)ECEF satellite SV ID=" << gps_ephemeris_iter->second.i_satellite_PRN - << " X=" << gps_ephemeris_iter->second.d_satpos_X - << " [m] Y=" << gps_ephemeris_iter->second.d_satpos_Y - << " [m] Z=" << gps_ephemeris_iter->second.d_satpos_Z - << " [m] PR_obs="<first<= 4) - { - arma::vec mypos; - DLOG(INFO)<<"satpos="< #include #include -#include +//#include +#include #include #include #include "gps_navigation_message.h" diff --git a/src/algorithms/PVT/libs/kml_printer.cc b/src/algorithms/PVT/libs/kml_printer.cc index 514d4b57a..b753dadcf 100644 --- a/src/algorithms/PVT/libs/kml_printer.cc +++ b/src/algorithms/PVT/libs/kml_printer.cc @@ -45,7 +45,7 @@ bool Kml_Printer::set_headers(std::string filename) { DLOG(INFO) << "KML printer writing on " << filename.c_str(); // Set iostream numeric format and precision - kml_file.setf(kml_file.fixed,kml_file.floatfield); + kml_file.setf(kml_file.fixed, kml_file.floatfield); kml_file << std::setprecision(14); kml_file << "" << std::endl << "" << std::endl diff --git a/src/algorithms/PVT/libs/nmea_printer.cc b/src/algorithms/PVT/libs/nmea_printer.cc index 4d089a432..ce0d80b14 100644 --- a/src/algorithms/PVT/libs/nmea_printer.cc +++ b/src/algorithms/PVT/libs/nmea_printer.cc @@ -510,7 +510,7 @@ std::string Nmea_Printer::get_GPGSA() sentence_str << std::hex << (int)checksum; // end NMEA sentence - sentence_str<<"\r\n"; + sentence_str << "\r\n"; return sentence_str.str(); } @@ -521,7 +521,7 @@ std::string Nmea_Printer::get_GPGSV() { // GSV-GNSS Satellites in View // Notice that NMEA 2.1 only supports 12 channels - int n_sats_used=d_PVT_data->d_valid_observations; + int n_sats_used = d_PVT_data->d_valid_observations; std::stringstream sentence_str; std::stringstream frame_str; std::string sentence_header; @@ -618,11 +618,11 @@ std::string Nmea_Printer::get_GPGGA() if (d_PVT_data->d_flag_averaging == true) { - MSL_altitude=d_PVT_data->d_avg_height_m; + MSL_altitude = d_PVT_data->d_avg_height_m; } else { - MSL_altitude=d_PVT_data->d_height_m; + MSL_altitude = d_PVT_data->d_height_m; } std::stringstream sentence_str; diff --git a/src/algorithms/PVT/libs/nmea_printer.h b/src/algorithms/PVT/libs/nmea_printer.h index ba6a4c613..6d06e54bd 100644 --- a/src/algorithms/PVT/libs/nmea_printer.h +++ b/src/algorithms/PVT/libs/nmea_printer.h @@ -60,10 +60,10 @@ public: ~Nmea_Printer(); private: - std::string nmea_filename ; // #include #include // for getenv() #include #include -#include // for floor +#include // for floor #include // for min and max #include "boost/date_time/time_zone_base.hpp" #include "boost/date_time/gregorian/gregorian.hpp" @@ -948,79 +947,79 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Gps_Ephemeris eph, doub out << line << std::endl; if (version==2) - { - // --------- WAVELENGHT FACTOR - // put here real data! - line.clear(); - line +=Rinex_Printer::rightJustify("1",6); - line +=Rinex_Printer::rightJustify("1",6); - line += std::string(48, ' '); - line += Rinex_Printer::leftJustify("WAVELENGTH FACT L1/2", 20); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; - } + { + // --------- WAVELENGHT FACTOR + // put here real data! + line.clear(); + line +=Rinex_Printer::rightJustify("1",6); + line +=Rinex_Printer::rightJustify("1",6); + line += std::string(48, ' '); + line += Rinex_Printer::leftJustify("WAVELENGTH FACT L1/2", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } if (version==3) - { - // -------- SYS / OBS TYPES - // one line per available system - line.clear(); - line += satelliteSystem["GPS"]; - line += std::string(2, ' '); - //int numberTypesObservations=2; // Count the number of available types of observable in the system - std::stringstream strm; - strm << numberTypesObservations; - line += Rinex_Printer::rightJustify(strm.str(), 3); - // per type of observation - line += std::string(1, ' '); - line += observationType["PSEUDORANGE"]; - line += observationCode["GPS_L1_CA"]; - line += std::string(1, ' '); - line += observationType["SIGNAL_STRENGTH"]; - line += observationCode["GPS_L1_CA"]; + { + // -------- SYS / OBS TYPES + // one line per available system + line.clear(); + line += satelliteSystem["GPS"]; + line += std::string(2, ' '); + //int numberTypesObservations=2; // Count the number of available types of observable in the system + std::stringstream strm; + strm << numberTypesObservations; + line += Rinex_Printer::rightJustify(strm.str(), 3); + // per type of observation + line += std::string(1, ' '); + line += observationType["PSEUDORANGE"]; + line += observationCode["GPS_L1_CA"]; + line += std::string(1, ' '); + line += observationType["SIGNAL_STRENGTH"]; + line += observationCode["GPS_L1_CA"]; - line += std::string(60-line.size(), ' '); - line += Rinex_Printer::leftJustify("SYS / # / OBS TYPES", 20); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; - } + line += std::string(60-line.size(), ' '); + line += Rinex_Printer::leftJustify("SYS / # / OBS TYPES", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } if (version==2) - { - // -------- SYS / OBS TYPES - line.clear(); - std::stringstream strm; - strm << numberTypesObservations; - line += Rinex_Printer::rightJustify(strm.str(), 6); - // per type of observation - // GPS L1 PSEUDORANGE - line += Rinex_Printer::rightJustify(observationType["PSEUDORANGE_CA_v2"], 5); - line += observationCode["GPS_L1_CA_v2"]; - // GPS L1 PHASE - line += Rinex_Printer::rightJustify(observationType["CARRIER_PHASE_CA_v2"], 5); - line += observationCode["GPS_L1_CA_v2"]; - // GPS DOPPLER L1 - line += Rinex_Printer::rightJustify(observationType["DOPPLER_v2"], 5); - line += observationCode["GPS_L1_CA_v2"]; - // GPS L1 SIGNAL STRENGTH - line += Rinex_Printer::rightJustify(observationType["SIGNAL_STRENGTH_v2"], 5); - line += observationCode["GPS_L1_CA_v2"]; - line += std::string(60-line.size(), ' '); - line += Rinex_Printer::leftJustify("# / TYPES OF OBSERV", 20); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; - } + { + // -------- SYS / OBS TYPES + line.clear(); + std::stringstream strm; + strm << numberTypesObservations; + line += Rinex_Printer::rightJustify(strm.str(), 6); + // per type of observation + // GPS L1 PSEUDORANGE + line += Rinex_Printer::rightJustify(observationType["PSEUDORANGE_CA_v2"], 5); + line += observationCode["GPS_L1_CA_v2"]; + // GPS L1 PHASE + line += Rinex_Printer::rightJustify(observationType["CARRIER_PHASE_CA_v2"], 5); + line += observationCode["GPS_L1_CA_v2"]; + // GPS DOPPLER L1 + line += Rinex_Printer::rightJustify(observationType["DOPPLER_v2"], 5); + line += observationCode["GPS_L1_CA_v2"]; + // GPS L1 SIGNAL STRENGTH + line += Rinex_Printer::rightJustify(observationType["SIGNAL_STRENGTH_v2"], 5); + line += observationCode["GPS_L1_CA_v2"]; + line += std::string(60-line.size(), ' '); + line += Rinex_Printer::leftJustify("# / TYPES OF OBSERV", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } if (version==3) - { - // -------- Signal Strength units - line.clear(); - line += Rinex_Printer::leftJustify("DBHZ", 20); - line += std::string(40, ' '); - line += Rinex_Printer::leftJustify("SIGNAL STRENGTH UNIT", 20); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; - } + { + // -------- Signal Strength units + line.clear(); + line += Rinex_Printer::leftJustify("DBHZ", 20); + line += std::string(40, ' '); + line += Rinex_Printer::leftJustify("SIGNAL STRENGTH UNIT", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } // -------- TIME OF FIRST OBS line.clear(); @@ -1031,7 +1030,7 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Gps_Ephemeris eph, doub std::string day (timestring, 6, 2); std::string hour (timestring, 9, 2); std::string minutes (timestring, 11, 2); - double gps_t =d_TOW_first_observation; + double gps_t = d_TOW_first_observation; double seconds = fmod(gps_t, 60); line += Rinex_Printer::rightJustify(year, 6); line += Rinex_Printer::rightJustify(month, 6); @@ -1064,10 +1063,11 @@ void Rinex_Printer::log_rinex_obs(std::ofstream& out, Gps_Ephemeris eph, double std::string line; - boost::posix_time::ptime p_gps_time= Rinex_Printer::compute_GPS_time(eph,obs_time); - std::string timestring=boost::posix_time::to_iso_string(p_gps_time); + boost::posix_time::ptime p_gps_time = Rinex_Printer::compute_GPS_time(eph,obs_time); + std::string timestring = boost::posix_time::to_iso_string(p_gps_time); //double utc_t = nav_msg.utc_time(nav_msg.sv_clock_correction(obs_time)); - double gps_t=obs_time; + //double gps_t = eph.sv_clock_correction(obs_time); + double gps_t = obs_time; std::string month (timestring, 4, 2); std::string day (timestring, 6, 2); @@ -1273,13 +1273,12 @@ boost::posix_time::ptime Rinex_Printer::compute_UTC_time(Gps_Navigation_Message boost::posix_time::ptime Rinex_Printer::compute_GPS_time(Gps_Ephemeris eph, double obs_time) { - // The RINEX v2.11 v3.00 format uses GPS time for the observations epoch, not UTC time, thus, no leap seconds needed here. - // (see Section 3 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex211.txt) - // (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf) - // --??? No time correction here, since it will be done in the RINEX processor + // The RINEX v2.11 v3.00 format uses GPS time for the observations epoch, not UTC time, thus, no leap seconds needed here. + // (see Section 3 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex211.txt) + // (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf) + // --??? No time correction here, since it will be done in the RINEX processor double gps_t = obs_time; - //double gps_t=obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800*(double)(eph.i_GPS_week%1024))*1000); + boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800*(double)(eph.i_GPS_week%1024))*1000); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } diff --git a/src/algorithms/acquisition/adapters/CMakeLists.txt b/src/algorithms/acquisition/adapters/CMakeLists.txt index 4e9048b4d..c9ce71aae 100644 --- a/src/algorithms/acquisition/adapters/CMakeLists.txt +++ b/src/algorithms/acquisition/adapters/CMakeLists.txt @@ -29,9 +29,10 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/libs - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GFlags_INCLUDE_DIRS} ) add_library(acq_adapters ${ACQ_ADAPTER_SOURCES}) -target_link_libraries(acq_adapters gnss_sp_libs acq_gr_blocks ${GR_BLOCKS_LIBRARIES}) \ No newline at end of file +target_link_libraries(acq_adapters gnss_sp_libs acq_gr_blocks ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES}) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index acc0285a0..7944bca7b 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -36,20 +36,17 @@ #include #include #include -#include #include #include #include - using google::LogMessage; GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : - role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_( - queue) + boost::shared_ptr queue) : + role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { configuration_ = configuration; std::string default_item_type = "gr_complex"; @@ -72,8 +69,8 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( vector_length_ = round( fs_in_ - / (Galileo_E1_CODE_CHIP_RATE_HZ - / Galileo_E1_B_CODE_LENGTH_CHIPS)); + / (Galileo_E1_CODE_CHIP_RATE_HZ + / Galileo_E1_B_CODE_LENGTH_CHIPS)); int samples_per_ms = vector_length_ / 4; code_ = new gr_complex[vector_length_]; @@ -84,8 +81,6 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, shift_resolution_, if_, fs_in_, samples_per_ms, queue_, dump_, dump_filename_); - //stream_to_vector_ = gr_make_stream_to_vector(item_size_, - // vector_length_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")"; @@ -254,7 +249,7 @@ float GalileoE1PcpsAmbiguousAcquisition::calculate_threshold(float pfa) void -GalileoE1PcpsAmbiguousAcquisition::connect(gr_top_block_sptr top_block) +GalileoE1PcpsAmbiguousAcquisition::connect(gr::top_block_sptr top_block) { if (item_type_.compare("gr_complex") == 0) { @@ -266,7 +261,7 @@ GalileoE1PcpsAmbiguousAcquisition::connect(gr_top_block_sptr top_block) void -GalileoE1PcpsAmbiguousAcquisition::disconnect(gr_top_block_sptr top_block) +GalileoE1PcpsAmbiguousAcquisition::disconnect(gr::top_block_sptr top_block) { if (item_type_.compare("gr_complex") == 0) { @@ -276,16 +271,14 @@ GalileoE1PcpsAmbiguousAcquisition::disconnect(gr_top_block_sptr top_block) -gr_basic_block_sptr -GalileoE1PcpsAmbiguousAcquisition::get_left_block() +gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_left_block() { return stream_to_vector_; } -gr_basic_block_sptr -GalileoE1PcpsAmbiguousAcquisition::get_right_block() +gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_right_block() { return acquisition_cc_; } diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h index 754682c13..3c26a3324 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h @@ -36,7 +36,7 @@ #include "gnss_synchro.h" #include "acquisition_interface.h" #include "pcps_acquisition_cc.h" -#include +#include #include class ConfigurationInterface; @@ -50,7 +50,7 @@ class GalileoE1PcpsAmbiguousAcquisition: public AcquisitionInterface public: GalileoE1PcpsAmbiguousAcquisition(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, - unsigned int out_streams, gr_msg_queue_sptr queue); + unsigned int out_streams, boost::shared_ptr queue); virtual ~GalileoE1PcpsAmbiguousAcquisition(); @@ -71,10 +71,10 @@ public: return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); /*! * \brief Set acquisition/tracking common Gnss_Synchro object pointer @@ -146,9 +146,8 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; concurrent_queue *channel_internal_queue_; - float calculate_threshold(float pfa); }; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 23c3286a4..e31e51534 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -37,22 +37,21 @@ #include "GPS_L1_CA.h" #include "configuration_interface.h" #include -#include #include #include +#include #include +#include using google::LogMessage; GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : - role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_( - queue) + gr::msg_queue::sptr queue) : + role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { - - configuration_=configuration; + configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./data/acquisition.dat"; @@ -71,7 +70,6 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); - //--- Find number of samples per spreading code ------------------------- vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); @@ -118,10 +116,12 @@ void GpsL1CaPcpsAcquisition::set_channel(unsigned int channel) void GpsL1CaPcpsAcquisition::set_threshold(float threshold) { - float pfa = configuration_->property(role_+ boost::lexical_cast(channel_) + ".pfa", 0.0); - - if(pfa==0.0) pfa = configuration_->property(role_+".pfa", 0.0); + float pfa = configuration_->property(role_ + boost::lexical_cast(channel_) + ".pfa", 0.0); + if(pfa==0.0) + { + pfa = configuration_->property(role_+".pfa", 0.0); + } if(pfa==0.0) { threshold_ = threshold; @@ -235,9 +235,8 @@ float GpsL1CaPcpsAcquisition::calculate_threshold(float pfa) return threshold; } -void GpsL1CaPcpsAcquisition::connect(gr_top_block_sptr top_block) +void GpsL1CaPcpsAcquisition::connect(gr::top_block_sptr top_block) { - if (item_type_.compare("gr_complex") == 0) { top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0); @@ -246,7 +245,7 @@ void GpsL1CaPcpsAcquisition::connect(gr_top_block_sptr top_block) } -void GpsL1CaPcpsAcquisition::disconnect(gr_top_block_sptr top_block) +void GpsL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block) { if (item_type_.compare("gr_complex") == 0) { @@ -255,13 +254,13 @@ void GpsL1CaPcpsAcquisition::disconnect(gr_top_block_sptr top_block) } -gr_basic_block_sptr GpsL1CaPcpsAcquisition::get_left_block() +gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_left_block() { return stream_to_vector_; } -gr_basic_block_sptr GpsL1CaPcpsAcquisition::get_right_block() +gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_right_block() { return acquisition_cc_; } diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h index 8697ad82e..0df019145 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h @@ -38,7 +38,7 @@ #include "gnss_synchro.h" #include "acquisition_interface.h" #include "pcps_acquisition_cc.h" -#include +#include #include @@ -53,7 +53,7 @@ class GpsL1CaPcpsAcquisition: public AcquisitionInterface public: GpsL1CaPcpsAcquisition(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, - unsigned int out_streams, gr_msg_queue_sptr queue); + unsigned int out_streams, boost::shared_ptr queue); virtual ~GpsL1CaPcpsAcquisition(); @@ -74,10 +74,10 @@ public: return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); /*! * \brief Set acquisition/tracking common Gnss_Synchro object pointer @@ -149,7 +149,7 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; concurrent_queue *channel_internal_queue_; float calculate_threshold(float pfa); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc index a798fe983..41d054c2a 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc @@ -37,7 +37,6 @@ #include "GPS_L1_CA.h" #include "configuration_interface.h" #include -#include #include #include @@ -46,9 +45,9 @@ using google::LogMessage; GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : - role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_( - queue) + boost::shared_ptr queue) : + role_(role), in_streams_(in_streams), out_streams_(out_streams), + queue_(queue) { std::string default_item_type = "gr_complex"; @@ -57,7 +56,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( DLOG(INFO) << "role " << role; item_type_ = configuration->property(role + ".item_type", - default_item_type); + default_item_type); fs_in_ = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); if_ = configuration->property(role + ".ifreq", 0); @@ -67,7 +66,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( sampled_ms_ = configuration->property(role + ".sampled_ms", 1); max_dwells_= configuration->property(role + ".max_dwells", 1); dump_filename_ = configuration->property(role + ".dump_filename", - default_dump_filename); + default_dump_filename); //--- Find number of samples per spreading code ------------------------- vector_length_ = round(fs_in_ @@ -80,7 +79,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_make_assisted_acquisition_cc(max_dwells_,sampled_ms_, doppler_max_, doppler_min_, if_, fs_in_, vector_length_, queue_, - dump_, dump_filename_); + dump_, dump_filename_); } else @@ -159,7 +158,7 @@ void GpsL1CaPcpsAssistedAcquisition::reset() } -void GpsL1CaPcpsAssistedAcquisition::connect(gr_top_block_sptr top_block) +void GpsL1CaPcpsAssistedAcquisition::connect(gr::top_block_sptr top_block) { //nothing to disconnect, now the tracking uses gr_sync_decimator @@ -167,19 +166,19 @@ void GpsL1CaPcpsAssistedAcquisition::connect(gr_top_block_sptr top_block) } -void GpsL1CaPcpsAssistedAcquisition::disconnect(gr_top_block_sptr top_block) +void GpsL1CaPcpsAssistedAcquisition::disconnect(gr::top_block_sptr top_block) { //nothing to disconnect, now the tracking uses gr_sync_decimator } -gr_basic_block_sptr GpsL1CaPcpsAssistedAcquisition::get_left_block() +gr::basic_block_sptr GpsL1CaPcpsAssistedAcquisition::get_left_block() { return acquisition_cc_; } -gr_basic_block_sptr GpsL1CaPcpsAssistedAcquisition::get_right_block() +gr::basic_block_sptr GpsL1CaPcpsAssistedAcquisition::get_right_block() { return acquisition_cc_; } diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h index 552019812..a7808ada8 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h @@ -37,7 +37,7 @@ #include "gnss_synchro.h" #include "acquisition_interface.h" #include "pcps_assisted_acquisition_cc.h" -#include +#include #include @@ -52,7 +52,7 @@ class GpsL1CaPcpsAssistedAcquisition: public AcquisitionInterface public: GpsL1CaPcpsAssistedAcquisition(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, - unsigned int out_streams, gr_msg_queue_sptr queue); + unsigned int out_streams, boost::shared_ptr queue); virtual ~GpsL1CaPcpsAssistedAcquisition(); @@ -73,10 +73,10 @@ public: return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); /*! * \brief Set acquisition/tracking common Gnss_Synchro object pointer @@ -147,7 +147,7 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; concurrent_queue *channel_internal_queue_; }; diff --git a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt index ede620503..adabeda2d 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt @@ -27,12 +27,11 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/libs - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} - ${GR_FFT_INCLUDE_DIRS} - ${VOLK_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GFlags_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(acq_gr_blocks ${ACQ_GR_BLOCKS_SOURCES}) -target_link_libraries(acq_gr_blocks gnss_system_parameters ${GR_FFT_LIBRARIES} ${VOLK_LIBRARIES}) +target_link_libraries(acq_gr_blocks gnss_system_parameters ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${VOLK_LIBRARIES}) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc index 355375ff3..2bed6d37d 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc @@ -34,7 +34,7 @@ #include "pcps_acquisition_cc.h" #include "gnss_signal_processing.h" #include "control_message_factory.h" -#include +#include #include #include #include @@ -44,7 +44,7 @@ using google::LogMessage; pcps_acquisition_cc_sptr pcps_make_acquisition_cc( unsigned int sampled_ms, unsigned int doppler_max, long freq, - long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump, + long fs_in, int samples_per_ms, gr::msg_queue::sptr queue, bool dump, std::string dump_filename) { @@ -57,11 +57,11 @@ pcps_acquisition_cc_sptr pcps_make_acquisition_cc( pcps_acquisition_cc::pcps_acquisition_cc( unsigned int sampled_ms, unsigned int doppler_max, long freq, - long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump, + long fs_in, int samples_per_ms, gr::msg_queue::sptr queue, bool dump, std::string dump_filename) : - gr_block("pcps_acquisition_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms), - gr_make_io_signature(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms)) + gr::block("pcps_acquisition_cc", + gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms), + gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms)) { d_sample_counter = 0; // SAMPLE COUNTER d_active = false; @@ -108,7 +108,7 @@ pcps_acquisition_cc::~pcps_acquisition_cc() void pcps_acquisition_cc::set_local_code(std::complex * code) { - memcpy(d_fft_if->get_inbuf(),code,sizeof(gr_complex)*d_fft_size); + memcpy(d_fft_if->get_inbuf(),code, sizeof(gr_complex)*d_fft_size); } @@ -175,10 +175,11 @@ int pcps_acquisition_cc::general_work(int noutput_items, d_input_power = 0.0; DLOG(INFO) << "Channel: " << d_channel - << " , doing acquisition of satellite: " << d_gnss_synchro->System << " "<< d_gnss_synchro->PRN - << " ,sample stamp: " << d_sample_counter << ", threshold: " - << d_threshold << ", doppler_max: " << d_doppler_max - << ", doppler_step: " << d_doppler_step; + << " , doing acquisition of satellite: " << d_gnss_synchro->System + << " "<< d_gnss_synchro->PRN + << " ,sample stamp: " << d_sample_counter << ", threshold: " + << d_threshold << ", doppler_max: " << d_doppler_max + << ", doppler_step: " << d_doppler_step; // 1- Compute the input signal power estimation for (i = 0; i < d_fft_size; i++) @@ -247,10 +248,9 @@ int pcps_acquisition_cc::general_work(int noutput_items, std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write filename.str(""); filename << "../data/test_statistics_" << d_gnss_synchro->System - <<"_" << d_gnss_synchro->Signal << "_sat_" - << d_gnss_synchro->PRN << "_doppler_" << doppler << ".dat"; - d_dump_file.open(filename.str().c_str(), std::ios::out - | std::ios::binary); + <<"_" << d_gnss_synchro->Signal << "_sat_" + << d_gnss_synchro->PRN << "_doppler_" << doppler << ".dat"; + d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary); d_dump_file.write((char*)d_ifft->get_outbuf(), n); //write directly |abs(x)|^2 in this Doppler bin? d_dump_file.close(); } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h index 6944fc8f5..8a35dcf8f 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h @@ -50,8 +50,8 @@ #define GNSS_SDR_PCPS_ACQUISITION_CC_H_ #include -#include -#include +#include +#include #include #include #include @@ -61,12 +61,13 @@ #include "gnss_synchro.h" class pcps_acquisition_cc; -typedef boost::shared_ptr -pcps_acquisition_cc_sptr; + +typedef boost::shared_ptr pcps_acquisition_cc_sptr; + pcps_acquisition_cc_sptr pcps_make_acquisition_cc(unsigned int sampled_ms, unsigned int doppler_max, long freq, long fs_in, int samples_per_ms, - gr_msg_queue_sptr queue, bool dump, std::string dump_filename); + gr::msg_queue::sptr queue, bool dump, std::string dump_filename); /*! * \brief This class implements a Parallel Code Phase Search Acquisition. @@ -74,151 +75,150 @@ pcps_make_acquisition_cc(unsigned int sampled_ms, * Check \ref Navitec2012 "An Open Source Galileo E1 Software Receiver", * Algorithm 1, for a pseudocode description of this implementation. */ - -class pcps_acquisition_cc: public gr_block +class pcps_acquisition_cc: public gr::block { private: - friend pcps_acquisition_cc_sptr - pcps_make_acquisition_cc(unsigned int sampled_ms, - unsigned int doppler_max, long freq, long fs_in, - int samples_per_ms, gr_msg_queue_sptr queue, bool dump, - std::string dump_filename); + friend pcps_acquisition_cc_sptr + pcps_make_acquisition_cc(unsigned int sampled_ms, + unsigned int doppler_max, long freq, long fs_in, + int samples_per_ms, gr::msg_queue::sptr queue, bool dump, + std::string dump_filename); - pcps_acquisition_cc(unsigned int sampled_ms, - unsigned int doppler_max, long freq, long fs_in, - int samples_per_ms, gr_msg_queue_sptr queue, bool dump, - std::string dump_filename); + pcps_acquisition_cc(unsigned int sampled_ms, + unsigned int doppler_max, long freq, long fs_in, + int samples_per_ms, gr::msg_queue::sptr d_queue, bool dump, + std::string dump_filename); - void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift, - int doppler_offset); + void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift, + int doppler_offset); - long d_fs_in; - long d_freq; - int d_samples_per_ms; - 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_sampled_ms; - unsigned int d_fft_size; - unsigned long int d_sample_counter; - gr_complex* d_carrier; - gr_complex* d_fft_codes; - 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_input_power; - float d_test_statistics; - gr_msg_queue_sptr d_queue; - concurrent_queue *d_channel_internal_queue; - std::ofstream d_dump_file; - bool d_active; - bool d_dump; - unsigned int d_channel; - std::string d_dump_filename; + long d_fs_in; + long d_freq; + int d_samples_per_ms; + 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_sampled_ms; + unsigned int d_fft_size; + unsigned long int d_sample_counter; + gr_complex* d_carrier; + gr_complex* d_fft_codes; + 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_input_power; + float d_test_statistics; + gr::msg_queue::sptr d_queue; + concurrent_queue *d_channel_internal_queue; + std::ofstream d_dump_file; + bool d_active; + bool d_dump; + unsigned int d_channel; + std::string d_dump_filename; public: - /*! - * \brief Default destructor. - */ - ~pcps_acquisition_cc(); + /*! + * \brief Default destructor. + */ + ~pcps_acquisition_cc(); - /*! - * \brief Set acquisition/tracking common Gnss_Synchro object pointer - * to exchange synchronization data between acquisition and tracking blocks. - * \param p_gnss_synchro Satellite information shared by the processing blocks. - */ - void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) - { - d_gnss_synchro = p_gnss_synchro; - } + /*! + * \brief Set acquisition/tracking common Gnss_Synchro object pointer + * to exchange synchronization data between acquisition and tracking blocks. + * \param p_gnss_synchro Satellite information shared by the processing blocks. + */ + void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) + { + d_gnss_synchro = p_gnss_synchro; + } - /*! - * \brief Returns the maximum peak of grid search. - */ - unsigned int mag() - { - return d_mag; - } + /*! + * \brief Returns the maximum peak of grid search. + */ + unsigned int mag() + { + return d_mag; + } - /*! - * \brief Initializes acquisition algorithm. - */ - void init(); + /*! + * \brief Initializes acquisition algorithm. + */ + void init(); - /*! - * \brief Sets local code for PCPS acquisition algorithm. - * \param code - Pointer to the PRN code. - */ - void set_local_code(std::complex * code); + /*! + * \brief Sets local code for PCPS acquisition algorithm. + * \param code - Pointer to the PRN code. + */ + void set_local_code(std::complex * code); - /*! - * \brief Starts acquisition algorithm, turning from standby mode to - * active mode - * \param active - bool that activates/deactivates the block. - */ - void set_active(bool active) - { - d_active = active; - } + /*! + * \brief Starts acquisition algorithm, turning from standby mode to + * active mode + * \param active - bool that activates/deactivates the block. + */ + void set_active(bool active) + { + d_active = active; + } - /*! - * \brief Set acquisition channel unique ID - * \param channel - receiver channel. - */ - void set_channel(unsigned int channel) - { - d_channel = channel; - } + /*! + * \brief Set acquisition channel unique ID + * \param channel - receiver channel. + */ + void set_channel(unsigned int channel) + { + d_channel = channel; + } - /*! - * \brief Set statistics threshold of PCPS algorithm. - * \param threshold - Threshold for signal detection (check \ref Navitec2012, - * Algorithm 1, for a definition of this threshold). - */ - void set_threshold(float threshold) - { - d_threshold = threshold; - } + /*! + * \brief Set statistics threshold of PCPS algorithm. + * \param threshold - Threshold for signal detection (check \ref Navitec2012, + * Algorithm 1, for a definition of this threshold). + */ + void set_threshold(float threshold) + { + d_threshold = threshold; + } - /*! - * \brief Set maximum Doppler grid search - * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. - */ - void set_doppler_max(unsigned int doppler_max) - { - d_doppler_max = doppler_max; - } + /*! + * \brief Set maximum Doppler grid search + * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. + */ + void set_doppler_max(unsigned int doppler_max) + { + d_doppler_max = doppler_max; + } - /*! - * \brief Set Doppler steps for the grid search - * \param doppler_step - Frequency bin of the search grid [Hz]. - */ - void set_doppler_step(unsigned int doppler_step) - { - d_doppler_step = doppler_step; - } + /*! + * \brief Set Doppler steps for the grid search + * \param doppler_step - Frequency bin of the search grid [Hz]. + */ + void set_doppler_step(unsigned int doppler_step) + { + d_doppler_step = doppler_step; + } - /*! - * \brief Set tracking channel internal queue. - * \param channel_internal_queue - Channel's internal blocks information queue. - */ - void set_channel_queue(concurrent_queue *channel_internal_queue) - { - d_channel_internal_queue = channel_internal_queue; - } + /*! + * \brief Set tracking channel internal queue. + * \param channel_internal_queue - Channel's internal blocks information queue. + */ + void set_channel_queue(concurrent_queue *channel_internal_queue) + { + d_channel_internal_queue = channel_internal_queue; + } - /*! - * \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); + /*! + * \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); }; #endif /* GNSS_SDR_PCPS_ACQUISITION_CC_H_*/ diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc index 7ed499ce0..8b8b9266d 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc @@ -34,7 +34,7 @@ #include "gnss_signal_processing.h" #include "control_message_factory.h" #include "gps_acq_assist.h" -#include +#include #include #include #include @@ -47,403 +47,410 @@ extern concurrent_map global_gps_acq_assist_map; using google::LogMessage; pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc( - int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long freq, - long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump, - std::string dump_filename) + int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long freq, + long fs_in, int samples_per_ms, boost::shared_ptr queue, bool dump, + std::string dump_filename) { - return pcps_assisted_acquisition_cc_sptr( - new pcps_assisted_acquisition_cc(max_dwells, sampled_ms, doppler_max, doppler_min, freq, - fs_in, samples_per_ms, queue, dump, dump_filename)); + return pcps_assisted_acquisition_cc_sptr( + new pcps_assisted_acquisition_cc(max_dwells, sampled_ms, doppler_max, doppler_min, freq, + fs_in, samples_per_ms, queue, dump, dump_filename)); } pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc( - int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long freq, - long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump, - std::string dump_filename) : - gr_block("pcps_assisted_acquisition_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, sizeof(gr_complex))) + int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long freq, + long fs_in, int samples_per_ms, boost::shared_ptr queue, bool dump, + std::string dump_filename) : + gr::block("pcps_assisted_acquisition_cc", + gr::io_signature::make(1, 1, sizeof(gr_complex)), + gr::io_signature::make(0, 0, sizeof(gr_complex))) { - d_sample_counter = 0; // SAMPLE COUNTER - d_active = false; - d_queue = queue; - d_freq = freq; - d_fs_in = fs_in; - d_samples_per_ms = samples_per_ms; - d_sampled_ms = sampled_ms; - d_config_doppler_max = doppler_max; - d_config_doppler_min=doppler_min; - d_fft_size = d_sampled_ms * d_samples_per_ms; - // HS Acquisition - d_max_dwells= max_dwells; - d_gnuradio_forecast_samples=d_fft_size*4; - d_input_power = 0.0; - d_state=0; - d_disable_assist=false; - //todo: do something if posix_memalign fails - if (posix_memalign((void**)&d_carrier, 16, d_fft_size * sizeof(gr_complex)) == 0){}; - if (posix_memalign((void**)&d_fft_codes, 16, d_fft_size * sizeof(gr_complex)) == 0){}; + d_sample_counter = 0; // SAMPLE COUNTER + d_active = false; + d_queue = queue; + d_freq = freq; + d_fs_in = fs_in; + d_samples_per_ms = samples_per_ms; + d_sampled_ms = sampled_ms; + d_config_doppler_max = doppler_max; + d_config_doppler_min=doppler_min; + d_fft_size = d_sampled_ms * d_samples_per_ms; + // HS Acquisition + d_max_dwells = max_dwells; + d_gnuradio_forecast_samples = d_fft_size*4; + d_input_power = 0.0; + d_state = 0; + d_disable_assist = false; + //todo: do something if posix_memalign fails + if (posix_memalign((void**)&d_carrier, 16, d_fft_size * sizeof(gr_complex)) == 0){}; + if (posix_memalign((void**)&d_fft_codes, 16, d_fft_size * sizeof(gr_complex)) == 0){}; - // Direct FFT - d_fft_if = new gr::fft::fft_complex(d_fft_size, true); + // Direct FFT + d_fft_if = new gr::fft::fft_complex(d_fft_size, true); - // Inverse FFT - d_ifft = new gr::fft::fft_complex(d_fft_size, false); + // Inverse FFT + d_ifft = new gr::fft::fft_complex(d_fft_size, false); - // For dumping samples into a file - d_dump = dump; - d_dump_filename = dump_filename; + // For dumping samples into a file + d_dump = dump; + d_dump_filename = dump_filename; } void pcps_assisted_acquisition_cc::set_doppler_step(unsigned int doppler_step) { - d_doppler_step = doppler_step; + d_doppler_step = doppler_step; } void pcps_assisted_acquisition_cc::free_grid_memory() { - for (int i=0;i * code) { - memcpy(d_fft_if->get_inbuf(),code,sizeof(gr_complex)*d_fft_size); + memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex)*d_fft_size); } void pcps_assisted_acquisition_cc::init() { - d_gnss_synchro->Acq_delay_samples = 0.0; - d_gnss_synchro->Acq_doppler_hz = 0.0; - d_gnss_synchro->Acq_samplestamp_samples = 0; - d_input_power = 0.0; + d_gnss_synchro->Acq_delay_samples = 0.0; + d_gnss_synchro->Acq_doppler_hz = 0.0; + d_gnss_synchro->Acq_samplestamp_samples = 0; + d_input_power = 0.0; - d_state=0; + d_state = 0; - d_fft_if->execute(); // We need the FFT of local code + d_fft_if->execute(); // We need the FFT of local code - //Conjugate the local code - volk_32fc_conjugate_32fc_a(d_fft_codes,d_fft_if->get_outbuf(),d_fft_size); + //Conjugate the local code + volk_32fc_conjugate_32fc_a(d_fft_codes, d_fft_if->get_outbuf(), d_fft_size); } void pcps_assisted_acquisition_cc::forecast (int noutput_items, - gr_vector_int &ninput_items_required) + gr_vector_int &ninput_items_required) { - ninput_items_required[0] = d_gnuradio_forecast_samples ; //set the required available samples in each call + ninput_items_required[0] = d_gnuradio_forecast_samples ; //set the required available samples in each call } void pcps_assisted_acquisition_cc::get_assistance() { - Gps_Acq_Assist gps_acq_assisistance; - if (global_gps_acq_assist_map.read(this->d_gnss_synchro->PRN,gps_acq_assisistance)==true) - { - //TODO: use the LO tolerance here - if (gps_acq_assisistance.dopplerUncertainty>=1000) - { - d_doppler_max=gps_acq_assisistance.d_Doppler0+gps_acq_assisistance.dopplerUncertainty*2; - d_doppler_min=gps_acq_assisistance.d_Doppler0-gps_acq_assisistance.dopplerUncertainty*2; - }else{ - d_doppler_max=gps_acq_assisistance.d_Doppler0+1000; - d_doppler_min=gps_acq_assisistance.d_Doppler0-1000; - } - this->d_disable_assist=false; - std::cout<<"Acq assist ENABLED for GPS SV "<d_gnss_synchro->PRN<<" (Doppler max,Doppler min)=(" - <d_disable_assist=true; - std::cout<<"Acq assist DISABLED for GPS SV "<d_gnss_synchro->PRN<d_gnss_synchro->PRN, gps_acq_assisistance)==true) + { + //TODO: use the LO tolerance here + if (gps_acq_assisistance.dopplerUncertainty >= 1000) + { + d_doppler_max = gps_acq_assisistance.d_Doppler0 + gps_acq_assisistance.dopplerUncertainty*2; + d_doppler_min = gps_acq_assisistance.d_Doppler0 - gps_acq_assisistance.dopplerUncertainty*2; + } + else + { + d_doppler_max = gps_acq_assisistance.d_Doppler0 + 1000; + d_doppler_min = gps_acq_assisistance.d_Doppler0 - 1000; + } + this->d_disable_assist = false; + std::cout << "Acq assist ENABLED for GPS SV "<< this->d_gnss_synchro->PRN <<" (Doppler max,Doppler min)=(" + << d_doppler_max << "," << d_doppler_min << ")" << std::endl; + } + else + { + this->d_disable_assist = true; + std::cout << "Acq assist DISABLED for GPS SV "<< this->d_gnss_synchro->PRN << std::endl; + } } void pcps_assisted_acquisition_cc::reset_grid() { - d_well_count=0; - for (int i=0;id_disable_assist==true) - { - d_doppler_max=d_config_doppler_max; - d_doppler_min=d_config_doppler_min; - } - // Create the search grid array - d_num_doppler_points=floor(std::abs(d_doppler_max-d_doppler_min)/d_doppler_step); + if (this->d_disable_assist==true) + { + d_doppler_max = d_config_doppler_max; + d_doppler_min = d_config_doppler_min; + } + // Create the search grid array + d_num_doppler_points = floor(std::abs(d_doppler_max-d_doppler_min)/d_doppler_step); - d_grid_data=new float*[d_num_doppler_points]; - for (int i=0;i magt) - { - magt = d_grid_data[i][index_time]; - index_doppler = i; - index_time = tmp_intex_t; - } - } + for (int i=0;i magt) + { + magt = d_grid_data[i][index_time]; + index_doppler = i; + index_time = tmp_intex_t; + } + } - // Normalize the maximum value to correct the scale factor introduced by FFTW - fft_normalization_factor = (float)d_fft_size * (float)d_fft_size; - magt = magt / (fft_normalization_factor * fft_normalization_factor); + // Normalize the maximum value to correct the scale factor introduced by FFTW + fft_normalization_factor = (float)d_fft_size * (float)d_fft_size; + magt = magt / (fft_normalization_factor * fft_normalization_factor); - // 5- Compute the test statistics and compare to the threshold - d_test_statistics = 2 * d_fft_size * magt /(d_input_power*d_well_count); + // 5- Compute the test statistics and compare to the threshold + d_test_statistics = 2 * d_fft_size * magt /(d_input_power*d_well_count); - // 4- record the maximum peak and the associated synchronization parameters - d_gnss_synchro->Acq_delay_samples = (double)index_time; - d_gnss_synchro->Acq_doppler_hz = (double)(index_doppler*d_doppler_step+d_doppler_min); - d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; + // 4- record the maximum peak and the associated synchronization parameters + d_gnss_synchro->Acq_delay_samples = (double)index_time; + d_gnss_synchro->Acq_doppler_hz = (double)(index_doppler*d_doppler_step + d_doppler_min); + d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; - // Record results to file if required - if (d_dump) - { - std::stringstream filename; - std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write - filename.str(""); - filename << "../data/test_statistics_" << d_gnss_synchro->System - <<"_" << d_gnss_synchro->Signal << "_sat_" - << d_gnss_synchro->PRN << "_doppler_" << d_gnss_synchro->Acq_doppler_hz << ".dat"; - d_dump_file.open(filename.str().c_str(), std::ios::out - | std::ios::binary); - d_dump_file.write((char*)d_grid_data[index_doppler], n); //write directly |abs(x)|^2 in this Doppler bin? - d_dump_file.close(); - } + // Record results to file if required + if (d_dump) + { + std::stringstream filename; + std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write + filename.str(""); + filename << "../data/test_statistics_" << d_gnss_synchro->System + << "_" << d_gnss_synchro->Signal << "_sat_" + << d_gnss_synchro->PRN << "_doppler_" << d_gnss_synchro->Acq_doppler_hz << ".dat"; + d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary); + d_dump_file.write((char*)d_grid_data[index_doppler], n); //write directly |abs(x)|^2 in this Doppler bin? + d_dump_file.close(); + } - return d_test_statistics; + return d_test_statistics; } float pcps_assisted_acquisition_cc::estimate_input_power(gr_vector_const_void_star &input_items) { - const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer - // 1- Compute the input signal power estimation - float* p_tmp_vector; - if (posix_memalign((void**)&p_tmp_vector, 16, d_fft_size * sizeof(float)) == 0){}; - volk_32fc_magnitude_squared_32f_u(p_tmp_vector, in, d_fft_size); + const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer + // 1- Compute the input signal power estimation + float* p_tmp_vector; + if (posix_memalign((void**)&p_tmp_vector, 16, d_fft_size * sizeof(float)) == 0){}; + volk_32fc_magnitude_squared_32f_u(p_tmp_vector, in, d_fft_size); - const float* p_const_tmp_vector=p_tmp_vector; - float power; - volk_32f_accumulator_s32f_a(&power, p_const_tmp_vector, d_fft_size); - free(p_tmp_vector); - return ( power / (float)d_fft_size); + const float* p_const_tmp_vector = p_tmp_vector; + float power; + volk_32f_accumulator_s32f_a(&power, p_const_tmp_vector, d_fft_size); + free(p_tmp_vector); + return ( power / (float)d_fft_size); } int pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_const_void_star &input_items) { - // initialize acquisition algorithm - const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer + // initialize acquisition algorithm + const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer - DLOG(INFO) << "Channel: " << d_channel - << " , doing acquisition of satellite: " << d_gnss_synchro->System << " "<< d_gnss_synchro->PRN - << " ,sample stamp: " << d_sample_counter << ", threshold: " - << d_threshold << ", doppler_max: " << d_doppler_max - << ", doppler_step: " << d_doppler_step; + DLOG(INFO) << "Channel: " << d_channel + << " , doing acquisition of satellite: " << d_gnss_synchro->System << " " + << d_gnss_synchro->PRN + << " ,sample stamp: " << d_sample_counter << ", threshold: " + << d_threshold << ", doppler_max: " << d_doppler_max + << ", doppler_step: " << d_doppler_step; - // 2- Doppler frequency search loop - float* p_tmp_vector; - if (posix_memalign((void**)&p_tmp_vector, 16, d_fft_size * sizeof(float)) == 0){}; + // 2- Doppler frequency search loop + float* p_tmp_vector; + if (posix_memalign((void**)&p_tmp_vector, 16, d_fft_size * sizeof(float)) == 0){}; - for (int doppler_index=0;doppler_indexget_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size); - // 3- Perform the FFT-based convolution (parallel time search) - // Compute the FFT of the carrier wiped--off incoming signal - d_fft_if->execute(); + for (int doppler_index=0; doppler_indexget_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size); + // 3- Perform the FFT-based convolution (parallel time search) + // Compute the FFT of the carrier wiped--off incoming signal + d_fft_if->execute(); - // Multiply carrier wiped--off, Fourier transformed incoming signal - // with the local FFT'd code reference using SIMD operations with VOLK library - volk_32fc_x2_multiply_32fc_a(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size); + // Multiply carrier wiped--off, Fourier transformed incoming signal + // with the local FFT'd code reference using SIMD operations with VOLK library + volk_32fc_x2_multiply_32fc_a(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size); - // compute the inverse FFT - d_ifft->execute(); + // compute the inverse FFT + d_ifft->execute(); - // save the grid matrix delay file - volk_32fc_magnitude_squared_32f_a(p_tmp_vector, d_ifft->get_outbuf(), d_fft_size); - const float* old_vector=d_grid_data[doppler_index]; - volk_32f_x2_add_32f_a(d_grid_data[doppler_index],old_vector,p_tmp_vector,d_fft_size); + // save the grid matrix delay file + volk_32fc_magnitude_squared_32f_a(p_tmp_vector, d_ifft->get_outbuf(), d_fft_size); + const float* old_vector = d_grid_data[doppler_index]; + volk_32f_x2_add_32f_a(d_grid_data[doppler_index], old_vector, p_tmp_vector, d_fft_size); - } - free(p_tmp_vector); - return d_fft_size; + } + free(p_tmp_vector); + return d_fft_size; } int pcps_assisted_acquisition_cc::general_work(int noutput_items, - gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { - /*! - * TODO: High sensitivity acquisition algorithm: - * State Mechine: - * S0. StandBy. If d_active==1 -> S1 - * S1. GetAssist. Define search grid with assistance information. Reset grid matrix -> S2 - * S2. ComputeGrid. Perform the FFT acqusition doppler and delay grid. - * Accumulate the search grid matrix (#doppler_bins x #fft_size) - * Compare maximum to threshold and decide positive or negative - * If T>=gamma -> S4 else - * If d_well_count S2 - * else if !disable_assist -> S3 - * else -> S5. - * S3. RedefineGrid. Open the grid search to unasisted acquisition. Reset counters and grid. -> S2 - * S4. Positive_Acq: Send message and stop acq -> S0 - * S5. Negative_Acq: Send message and stop acq -> S0 - */ + /*! + * TODO: High sensitivity acquisition algorithm: + * State Mechine: + * S0. StandBy. If d_active==1 -> S1 + * S1. GetAssist. Define search grid with assistance information. Reset grid matrix -> S2 + * S2. ComputeGrid. Perform the FFT acqusition doppler and delay grid. + * Accumulate the search grid matrix (#doppler_bins x #fft_size) + * Compare maximum to threshold and decide positive or negative + * If T>=gamma -> S4 else + * If d_well_count S2 + * else if !disable_assist -> S3 + * else -> S5. + * S3. RedefineGrid. Open the grid search to unasisted acquisition. Reset counters and grid. -> S2 + * S4. Positive_Acq: Send message and stop acq -> S0 + * S5. Negative_Acq: Send message and stop acq -> S0 + */ - switch (d_state) - { - case 0: // S0. StandBy - if (d_active==true) d_state=1; - d_sample_counter += ninput_items[0]; // sample counter - consume_each(ninput_items[0]); - break; - case 1: // S1. GetAssist - get_assistance(); - redefine_grid(); - reset_grid(); - d_sample_counter += ninput_items[0]; // sample counter - consume_each(ninput_items[0]); - d_state=2; - break; - case 2: // S2. ComputeGrid - int consumed_samples; - consumed_samples=compute_and_accumulate_grid(input_items); - d_well_count++; - if (d_well_count>=d_max_dwells) - { - d_state=3; - } - d_sample_counter+=consumed_samples; - consume_each(consumed_samples); - break; - case 3: // Compute test statistics and decide - d_input_power=estimate_input_power(input_items); - d_test_statistics=search_maximum(); - if (d_test_statistics > d_threshold) - { - d_state=5; - }else{ - if (d_disable_assist==false) - { - d_disable_assist=true; - std::cout<<"Acq assist DISABLED for GPS SV "<d_gnss_synchro->PRN<System << " " << d_gnss_synchro->PRN; - DLOG(INFO) << "sample_stamp " << d_sample_counter; - DLOG(INFO) << "test statistics value " << d_test_statistics; - DLOG(INFO) << "test statistics threshold " << d_threshold; - DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples; - DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; - DLOG(INFO) << "input signal power " << d_input_power; + switch (d_state) + { + case 0: // S0. StandBy + if (d_active==true) d_state = 1; + d_sample_counter += ninput_items[0]; // sample counter + consume_each(ninput_items[0]); + break; + case 1: // S1. GetAssist + get_assistance(); + redefine_grid(); + reset_grid(); + d_sample_counter += ninput_items[0]; // sample counter + consume_each(ninput_items[0]); + d_state = 2; + break; + case 2: // S2. ComputeGrid + int consumed_samples; + consumed_samples = compute_and_accumulate_grid(input_items); + d_well_count++; + if (d_well_count>=d_max_dwells) + { + d_state=3; + } + d_sample_counter += consumed_samples; + consume_each(consumed_samples); + break; + case 3: // Compute test statistics and decide + d_input_power = estimate_input_power(input_items); + d_test_statistics = search_maximum(); + if (d_test_statistics > d_threshold) + { + d_state = 5; + } + else + { + if (d_disable_assist == false) + { + d_disable_assist = true; + std::cout << "Acq assist DISABLED for GPS SV "<< this->d_gnss_synchro->PRN << std::endl; + d_state = 4; + } + else + { + d_state = 6; + } + } + d_sample_counter += ninput_items[0]; // sample counter + consume_each(ninput_items[0]); + break; + case 4: // RedefineGrid + free_grid_memory(); + redefine_grid(); + reset_grid(); + d_sample_counter += ninput_items[0]; // sample counter + consume_each(ninput_items[0]); + d_state = 2; + break; + case 5: // Positive_Acq + DLOG(INFO) << "positive acquisition"; + DLOG(INFO) << "satellite " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN; + DLOG(INFO) << "sample_stamp " << d_sample_counter; + DLOG(INFO) << "test statistics value " << d_test_statistics; + DLOG(INFO) << "test statistics threshold " << d_threshold; + DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples; + DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; + DLOG(INFO) << "input signal power " << d_input_power; - d_active = false; - // Send message to channel queue //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL - d_channel_internal_queue->push(1); // 1-> positive acquisition - free_grid_memory(); - // consume samples to not block the GNU Radio flowgraph - d_sample_counter += ninput_items[0]; // sample counter - consume_each(ninput_items[0]); - d_state=0; - break; - case 6: // Negative_Acq - DLOG(INFO) << "negative acquisition"; - DLOG(INFO) << "satellite " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN; - DLOG(INFO) << "sample_stamp " << d_sample_counter; - DLOG(INFO) << "test statistics value " << d_test_statistics; - DLOG(INFO) << "test statistics threshold " << d_threshold; - DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples; - DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; - DLOG(INFO) << "input signal power " << d_input_power; + d_active = false; + // Send message to channel queue //0=STOP_CHANNEL 1=ACQ_SUCCESS 2=ACQ_FAIL + d_channel_internal_queue->push(1); // 1-> positive acquisition + free_grid_memory(); + // consume samples to not block the GNU Radio flowgraph + d_sample_counter += ninput_items[0]; // sample counter + consume_each(ninput_items[0]); + d_state = 0; + break; + case 6: // Negative_Acq + DLOG(INFO) << "negative acquisition"; + DLOG(INFO) << "satellite " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN; + DLOG(INFO) << "sample_stamp " << d_sample_counter; + DLOG(INFO) << "test statistics value " << d_test_statistics; + DLOG(INFO) << "test statistics threshold " << d_threshold; + DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples; + DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; + DLOG(INFO) << "input signal power " << d_input_power; - d_active = false; - // Send message to channel queue //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL - d_channel_internal_queue->push(2); // 2-> negative acquisition - free_grid_memory(); - // consume samples to not block the GNU Radio flowgraph - d_sample_counter += ninput_items[0]; // sample counter - consume_each(ninput_items[0]); - d_state=0; - break; - default: - d_state=0; - break; - } + d_active = false; + // Send message to channel queue //0=STOP_CHANNEL 1=ACQ_SUCCESS 2=ACQ_FAIL + d_channel_internal_queue->push(2); // 2-> negative acquisition + free_grid_memory(); + // consume samples to not block the GNU Radio flowgraph + d_sample_counter += ninput_items[0]; // sample counter + consume_each(ninput_items[0]); + d_state = 0; + break; + default: + d_state = 0; + break; + } - return 0; + return 0; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h index dc7266cb1..7d875aeb2 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h @@ -49,8 +49,8 @@ #define GNSS_SDR_PCPS_assisted_acquisition_cc_H_ #include -#include -#include +#include +#include #include #include #include @@ -60,12 +60,14 @@ #include "gnss_synchro.h" class pcps_assisted_acquisition_cc; + typedef boost::shared_ptr pcps_assisted_acquisition_cc_sptr; + pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long freq, long fs_in, int samples_per_ms, - gr_msg_queue_sptr queue, bool dump, std::string dump_filename); + boost::shared_ptr queue, bool dump, std::string dump_filename); /*! * \brief This class implements a Parallel Code Phase Search Acquisition. @@ -74,171 +76,171 @@ pcps_make_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms, * Algorithm 1, for a pseudocode description of this implementation. */ -class pcps_assisted_acquisition_cc: public gr_block +class pcps_assisted_acquisition_cc: public gr::block { private: - friend pcps_assisted_acquisition_cc_sptr - pcps_make_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms, - int doppler_max, int doppler_min, long freq, long fs_in, - int samples_per_ms, gr_msg_queue_sptr queue, bool dump, - std::string dump_filename); + friend pcps_assisted_acquisition_cc_sptr + pcps_make_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms, + int doppler_max, int doppler_min, long freq, long fs_in, + int samples_per_ms, boost::shared_ptr queue, bool dump, + std::string dump_filename); - pcps_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms, - int doppler_max, int doppler_min, long freq, long fs_in, - int samples_per_ms, gr_msg_queue_sptr queue, bool dump, - std::string dump_filename); + pcps_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms, + int doppler_max, int doppler_min, long freq, long fs_in, + int samples_per_ms, boost::shared_ptr queue, bool dump, + std::string dump_filename); - void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift, - int doppler_offset); + void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift, + int doppler_offset); - int compute_and_accumulate_grid(gr_vector_const_void_star &input_items); - float estimate_input_power(gr_vector_const_void_star &input_items); - double search_maximum(); - void get_assistance(); - void reset_grid(); - void redefine_grid(); - void free_grid_memory(); + int compute_and_accumulate_grid(gr_vector_const_void_star &input_items); + float estimate_input_power(gr_vector_const_void_star &input_items); + double search_maximum(); + void get_assistance(); + void reset_grid(); + void redefine_grid(); + void free_grid_memory(); - long d_fs_in; - long d_freq; - int d_samples_per_ms; - int d_max_dwells; - unsigned int d_doppler_resolution; - int d_gnuradio_forecast_samples; - float d_threshold; - std::string d_satellite_str; - int d_doppler_max; - int d_doppler_min; - int d_config_doppler_max; - int d_config_doppler_min; + long d_fs_in; + long d_freq; + int d_samples_per_ms; + int d_max_dwells; + unsigned int d_doppler_resolution; + int d_gnuradio_forecast_samples; + float d_threshold; + std::string d_satellite_str; + int d_doppler_max; + int d_doppler_min; + int d_config_doppler_max; + int d_config_doppler_min; - int d_num_doppler_points; + int d_num_doppler_points; int d_doppler_step; - unsigned int d_sampled_ms; - unsigned int d_fft_size; - unsigned long int d_sample_counter; - gr_complex* d_carrier; - gr_complex* d_fft_codes; + unsigned int d_sampled_ms; + unsigned int d_fft_size; + unsigned long int d_sample_counter; + gr_complex* d_carrier; + gr_complex* d_fft_codes; - float** d_grid_data; - gr_complex** d_grid_doppler_wipeoffs; + 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_input_power; - float d_test_statistics; - gr_msg_queue_sptr d_queue; - concurrent_queue *d_channel_internal_queue; - std::ofstream d_dump_file; - int d_state; - bool d_active; - bool d_disable_assist; - int d_well_count; - bool d_dump; - unsigned int d_channel; + 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_input_power; + float d_test_statistics; + boost::shared_ptr d_queue; + concurrent_queue *d_channel_internal_queue; + std::ofstream d_dump_file; + int d_state; + bool d_active; + bool d_disable_assist; + int d_well_count; + bool d_dump; + unsigned int d_channel; - std::string d_dump_filename; + std::string d_dump_filename; public: - /*! - * \brief Default destructor. - */ - ~pcps_assisted_acquisition_cc(); + /*! + * \brief Default destructor. + */ + ~pcps_assisted_acquisition_cc(); - /*! - * \brief Set acquisition/tracking common Gnss_Synchro object pointer - * to exchange synchronization data between acquisition and tracking blocks. - * \param p_gnss_synchro Satellite information shared by the processing blocks. - */ - void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) - { - d_gnss_synchro = p_gnss_synchro; - } + /*! + * \brief Set acquisition/tracking common Gnss_Synchro object pointer + * to exchange synchronization data between acquisition and tracking blocks. + * \param p_gnss_synchro Satellite information shared by the processing blocks. + */ + void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) + { + d_gnss_synchro = p_gnss_synchro; + } - /*! - * \brief Returns the maximum peak of grid search. - */ - unsigned int mag() - { - return d_test_statistics; - } + /*! + * \brief Returns the maximum peak of grid search. + */ + unsigned int mag() + { + return d_test_statistics; + } - /*! - * \brief Initializes acquisition algorithm. - */ - void init(); + /*! + * \brief Initializes acquisition algorithm. + */ + void init(); - /*! - * \brief Sets local code for PCPS acquisition algorithm. - * \param code - Pointer to the PRN code. - */ - void set_local_code(std::complex * code); + /*! + * \brief Sets local code for PCPS acquisition algorithm. + * \param code - Pointer to the PRN code. + */ + void set_local_code(std::complex * code); - /*! - * \brief Starts acquisition algorithm, turning from standby mode to - * active mode - * \param active - bool that activates/deactivates the block. - */ - void set_active(bool active) - { - d_active = active; - } + /*! + * \brief Starts acquisition algorithm, turning from standby mode to + * active mode + * \param active - bool that activates/deactivates the block. + */ + void set_active(bool active) + { + d_active = active; + } - /*! - * \brief Set acquisition channel unique ID - * \param channel - receiver channel. - */ - void set_channel(unsigned int channel) - { - d_channel = channel; - } + /*! + * \brief Set acquisition channel unique ID + * \param channel - receiver channel. + */ + void set_channel(unsigned int channel) + { + d_channel = channel; + } - /*! - * \brief Set statistics threshold of PCPS algorithm. - * \param threshold - Threshold for signal detection (check \ref Navitec2012, - * Algorithm 1, for a definition of this threshold). - */ - void set_threshold(float threshold) - { - d_threshold = threshold; - } + /*! + * \brief Set statistics threshold of PCPS algorithm. + * \param threshold - Threshold for signal detection (check \ref Navitec2012, + * Algorithm 1, for a definition of this threshold). + */ + void set_threshold(float threshold) + { + d_threshold = threshold; + } - /*! - * \brief Set maximum Doppler grid search - * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. - */ - void set_doppler_max(unsigned int doppler_max) - { - d_doppler_max = doppler_max; - } + /*! + * \brief Set maximum Doppler grid search + * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. + */ + void set_doppler_max(unsigned int doppler_max) + { + d_doppler_max = doppler_max; + } - /*! - * \brief Set Doppler steps for the grid search - * \param doppler_step - Frequency bin of the search grid [Hz]. - */ - void set_doppler_step(unsigned int doppler_step); + /*! + * \brief Set Doppler steps for the grid search + * \param doppler_step - Frequency bin of the search grid [Hz]. + */ + void set_doppler_step(unsigned int doppler_step); - /*! - * \brief Set tracking channel internal queue. - * \param channel_internal_queue - Channel's internal blocks information queue. - */ - void set_channel_queue(concurrent_queue *channel_internal_queue) - { - d_channel_internal_queue = channel_internal_queue; - } + /*! + * \brief Set tracking channel internal queue. + * \param channel_internal_queue - Channel's internal blocks information queue. + */ + void set_channel_queue(concurrent_queue *channel_internal_queue) + { + d_channel_internal_queue = channel_internal_queue; + } - /*! - * \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); + /*! + * \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); + void forecast (int noutput_items, gr_vector_int &ninput_items_required); }; diff --git a/src/algorithms/channel/adapters/CMakeLists.txt b/src/algorithms/channel/adapters/CMakeLists.txt index 623c94016..89af68755 100644 --- a/src/algorithms/channel/adapters/CMakeLists.txt +++ b/src/algorithms/channel/adapters/CMakeLists.txt @@ -24,9 +24,10 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/channel/libs - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GFlags_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(channel_adapters ${CHANNEL_ADAPTER_SOURCES}) -target_link_libraries(channel_adapters channel_fsm) \ No newline at end of file +target_link_libraries(channel_adapters channel_fsm ${GNURADIO_RUNTIME_LIBRARIES}) diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index d24d42fd8..0ca7b38c4 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -39,8 +39,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -50,7 +50,7 @@ using google::LogMessage; Channel::Channel(ConfigurationInterface *configuration, unsigned int channel, GNSSBlockInterface *pass_through, AcquisitionInterface *acq, TrackingInterface *trk, TelemetryDecoderInterface *nav, - std::string role, std::string implementation, gr_msg_queue_sptr queue) : + std::string role, std::string implementation, boost::shared_ptr queue) : pass_through_(pass_through), acq_(acq), trk_(trk), nav_(nav), role_(role), implementation_(implementation), channel_(channel), queue_(queue) @@ -84,10 +84,11 @@ Channel::Channel(ConfigurationInterface *configuration, unsigned int channel, float threshold = configuration->property("Acquisition" + boost::lexical_cast(channel_) + ".threshold",0.0); - if(threshold==0.0) threshold = configuration->property("Acquisition.threshold",0.0); + if(threshold==0.0) threshold = configuration->property("Acquisition.threshold",0); acq_->set_threshold(threshold); + repeat_ = configuration->property("Acquisition" + boost::lexical_cast< std::string>(channel_) + ".repeat_satellite", false); @@ -119,7 +120,7 @@ Channel::~Channel() -void Channel::connect(gr_top_block_sptr top_block) +void Channel::connect(gr::top_block_sptr top_block) { if (connected_) { @@ -142,7 +143,7 @@ void Channel::connect(gr_top_block_sptr top_block) -void Channel::disconnect(gr_top_block_sptr top_block) +void Channel::disconnect(gr::top_block_sptr top_block) { if (!connected_) { @@ -161,14 +162,14 @@ void Channel::disconnect(gr_top_block_sptr top_block) -gr_basic_block_sptr Channel::get_left_block() +gr::basic_block_sptr Channel::get_left_block() { return pass_through_->get_left_block(); } -gr_basic_block_sptr Channel::get_right_block() +gr::basic_block_sptr Channel::get_right_block() { return nav_->get_right_block(); } diff --git a/src/algorithms/channel/adapters/channel.h b/src/algorithms/channel/adapters/channel.h index 6637268d6..8758ece46 100644 --- a/src/algorithms/channel/adapters/channel.h +++ b/src/algorithms/channel/adapters/channel.h @@ -35,8 +35,8 @@ #ifndef GNSS_SDR_CHANNEL_H_ #define GNSS_SDR_CHANNEL_H_ -#include -#include +//#include +#include #include "channel_interface.h" #include "gps_l1_ca_channel_fsm.h" #include "control_message_factory.h" @@ -62,13 +62,13 @@ public: GNSSBlockInterface *pass_through, AcquisitionInterface *acq, TrackingInterface *trk, TelemetryDecoderInterface *nav, std::string role, std::string implementation, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); //! Virtual destructor virtual ~Channel(); - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); std::string role(){ return role_; } //! Returns "Channel" @@ -103,7 +103,7 @@ private: int message_; bool repeat_; GpsL1CaChannelFsm channel_fsm_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; concurrent_queue channel_internal_queue_; boost::thread ch_thread_; void run(); diff --git a/src/algorithms/channel/libs/CMakeLists.txt b/src/algorithms/channel/libs/CMakeLists.txt index b9bc8b3d0..4061a6f15 100644 --- a/src/algorithms/channel/libs/CMakeLists.txt +++ b/src/algorithms/channel/libs/CMakeLists.txt @@ -24,8 +24,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/channel/adapters - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GFlags_INCLUDE_DIRS} ) -add_library(channel_fsm ${CHANNEL_FSM_SOURCES}) \ No newline at end of file +add_library(channel_fsm ${CHANNEL_FSM_SOURCES}) diff --git a/src/algorithms/channel/libs/gps_l1_ca_channel_fsm.cc b/src/algorithms/channel/libs/gps_l1_ca_channel_fsm.cc index 7e0959ad7..b8d6d6f3a 100644 --- a/src/algorithms/channel/libs/gps_l1_ca_channel_fsm.cc +++ b/src/algorithms/channel/libs/gps_l1_ca_channel_fsm.cc @@ -156,7 +156,7 @@ void GpsL1CaChannelFsm::set_tracking(TrackingInterface *tracking) { trk_ = tracking; } -void GpsL1CaChannelFsm::set_queue(gr_msg_queue_sptr queue) { +void GpsL1CaChannelFsm::set_queue(boost::shared_ptr queue) { queue_ = queue; } @@ -181,7 +181,7 @@ void GpsL1CaChannelFsm::start_tracking() { //trk_->set_acq_sample_stamp(acq_->get_sample_stamp()); trk_->start_tracking(); ControlMessageFactory* cmf = new ControlMessageFactory(); - if (queue_ != gr_msg_queue_sptr()) { + if (queue_ != gr::msg_queue::make()) { queue_->handle(cmf->GetQueueMessage(channel_, 1)); } delete cmf; @@ -189,7 +189,7 @@ void GpsL1CaChannelFsm::start_tracking() { void GpsL1CaChannelFsm::request_satellite() { ControlMessageFactory* cmf = new ControlMessageFactory(); - if (queue_ != gr_msg_queue_sptr()) { + if (queue_ != gr::msg_queue::make()) { queue_->handle(cmf->GetQueueMessage(channel_, 0)); } delete cmf; diff --git a/src/algorithms/channel/libs/gps_l1_ca_channel_fsm.h b/src/algorithms/channel/libs/gps_l1_ca_channel_fsm.h index 0cee07d67..4e826f69f 100644 --- a/src/algorithms/channel/libs/gps_l1_ca_channel_fsm.h +++ b/src/algorithms/channel/libs/gps_l1_ca_channel_fsm.h @@ -44,7 +44,7 @@ #include "acquisition_interface.h" #include "tracking_interface.h" #include "telemetry_decoder_interface.h" -#include +#include #include #include @@ -69,7 +69,7 @@ public: void set_acquisition(AcquisitionInterface *acquisition); void set_tracking(TrackingInterface *tracking); - void set_queue(gr_msg_queue_sptr queue); + void set_queue(boost::shared_ptr queue); void set_channel(unsigned int channel); void start_acquisition(); void start_tracking(); @@ -87,7 +87,7 @@ private: AcquisitionInterface *acq_; TrackingInterface *trk_; TelemetryDecoderInterface *nav_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; unsigned int channel_; }; diff --git a/src/algorithms/conditioner/adapters/CMakeLists.txt b/src/algorithms/conditioner/adapters/CMakeLists.txt index c7b5b7512..f544da301 100644 --- a/src/algorithms/conditioner/adapters/CMakeLists.txt +++ b/src/algorithms/conditioner/adapters/CMakeLists.txt @@ -26,8 +26,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/libs - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GFlags_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) -add_library(conditioner_adapters ${COND_ADAPTER_SOURCES}) \ No newline at end of file +add_library(conditioner_adapters ${COND_ADAPTER_SOURCES}) diff --git a/src/algorithms/conditioner/adapters/signal_conditioner.cc b/src/algorithms/conditioner/adapters/signal_conditioner.cc index 612c2ae10..89dd9ccb2 100644 --- a/src/algorithms/conditioner/adapters/signal_conditioner.cc +++ b/src/algorithms/conditioner/adapters/signal_conditioner.cc @@ -35,8 +35,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -46,7 +46,7 @@ using google::LogMessage; SignalConditioner::SignalConditioner(ConfigurationInterface *configuration, GNSSBlockInterface *data_type_adapt, GNSSBlockInterface *in_filt, GNSSBlockInterface *res, std::string role, std::string implementation, - gr_msg_queue_sptr queue) : data_type_adapt_(data_type_adapt), + boost::shared_ptr queue) : data_type_adapt_(data_type_adapt), in_filt_(in_filt), res_(res), role_(role), implementation_(implementation), queue_(queue) { @@ -64,7 +64,7 @@ SignalConditioner::~SignalConditioner() -void SignalConditioner::connect(gr_top_block_sptr top_block) +void SignalConditioner::connect(gr::top_block_sptr top_block) { if (connected_) { @@ -76,11 +76,13 @@ void SignalConditioner::connect(gr_top_block_sptr top_block) res_->connect(top_block); top_block->connect(data_type_adapt_->get_right_block(), 0, - in_filt_->get_left_block(), 0); + in_filt_->get_left_block(), 0); + DLOG(INFO) << "data_type_adapter -> input_filter"; top_block->connect(in_filt_->get_right_block(), 0, - res_->get_left_block(), 0); + res_->get_left_block(), 0); + DLOG(INFO) << "input_filter -> resampler"; connected_ = true; @@ -88,7 +90,7 @@ void SignalConditioner::connect(gr_top_block_sptr top_block) -void SignalConditioner::disconnect(gr_top_block_sptr top_block) +void SignalConditioner::disconnect(gr::top_block_sptr top_block) { if (!connected_) { @@ -97,9 +99,9 @@ void SignalConditioner::disconnect(gr_top_block_sptr top_block) } top_block->disconnect(data_type_adapt_->get_right_block(), 0, - in_filt_->get_left_block(), 0); + in_filt_->get_left_block(), 0); top_block->disconnect(in_filt_->get_right_block(), 0, - res_->get_left_block(), 0); + res_->get_left_block(), 0); data_type_adapt_->disconnect(top_block); in_filt_->disconnect(top_block); @@ -109,14 +111,14 @@ void SignalConditioner::disconnect(gr_top_block_sptr top_block) } -gr_basic_block_sptr SignalConditioner::get_left_block() +gr::basic_block_sptr SignalConditioner::get_left_block() { return data_type_adapt_->get_left_block(); } -gr_basic_block_sptr SignalConditioner::get_right_block() +gr::basic_block_sptr SignalConditioner::get_right_block() { return res_->get_right_block(); } diff --git a/src/algorithms/conditioner/adapters/signal_conditioner.h b/src/algorithms/conditioner/adapters/signal_conditioner.h index 6b1198285..aac2d719f 100644 --- a/src/algorithms/conditioner/adapters/signal_conditioner.h +++ b/src/algorithms/conditioner/adapters/signal_conditioner.h @@ -32,8 +32,7 @@ #ifndef GNSS_SDR_SIGNAL_CONDITIONER_H_ #define GNSS_SDR_SIGNAL_CONDITIONER_H_ -#include -#include +#include #include "gnss_block_interface.h" #include "control_message_factory.h" @@ -54,15 +53,15 @@ public: SignalConditioner(ConfigurationInterface *configuration, GNSSBlockInterface *data_type_adapt, GNSSBlockInterface *in_filt, GNSSBlockInterface *res, std::string role, std::string implementation, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); //! Virtual destructor virtual ~SignalConditioner(); - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); std::string role(){ return role_; } //! Returns "Signal_Conditioner" @@ -81,7 +80,7 @@ private: std::string implementation_; bool connected_; //bool stop_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; }; #endif /*GNSS_SDR_SIGNAL_CONDITIONER_H_*/ diff --git a/src/algorithms/data_type_adapter/adapters/CMakeLists.txt b/src/algorithms/data_type_adapter/adapters/CMakeLists.txt index 154bfbeb9..ecf5f0b6d 100644 --- a/src/algorithms/data_type_adapter/adapters/CMakeLists.txt +++ b/src/algorithms/data_type_adapter/adapters/CMakeLists.txt @@ -23,10 +23,9 @@ include_directories( $(CMAKE_CURRENT_SOURCE_DIR) ${CMAKE_SOURCE_DIR}/src/core/system_parameters ${CMAKE_SOURCE_DIR}/src/core/interfaces - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} - ${GR_BLOCKS_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(datatype_adapters ${DATATYPE_ADAPTER_SOURCES}) -target_link_libraries(datatype_adapters ${GR_FILTER_LIBRARIES} ${GR_BLOCKS_LIBRARIES}) \ No newline at end of file +target_link_libraries(datatype_adapters ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES}) diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc index a406320b7..7728b37de 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc @@ -30,8 +30,6 @@ #include "ishort_to_complex.h" #include "configuration_interface.h" -#include -#include #include #include @@ -39,7 +37,7 @@ using google::LogMessage; IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { @@ -51,13 +49,13 @@ IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::str DLOG(INFO) << "role " << role_; input_item_type_ = config_->property(role_ + ".input_item_type", - default_input_item_type); + default_input_item_type); dump_ = config_->property(role_ + ".dump", false); dump_filename_ = config_->property(role_ + ".dump_filename", - default_dump_filename); + default_dump_filename); - size_t item_size=sizeof(gr_complex); + size_t item_size = sizeof(gr_complex); gr_interleaved_short_to_complex_ = gr::blocks::interleaved_short_to_complex::make(); @@ -66,7 +64,7 @@ IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::str if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; - file_sink_ = gr_make_file_sink(item_size, dump_filename_.c_str()); + file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } } @@ -76,7 +74,7 @@ IshortToComplex::~IshortToComplex() {} -void IshortToComplex::connect(gr_top_block_sptr top_block) +void IshortToComplex::connect(gr::top_block_sptr top_block) { if (dump_) { @@ -89,7 +87,7 @@ void IshortToComplex::connect(gr_top_block_sptr top_block) } -void IshortToComplex::disconnect(gr_top_block_sptr top_block) +void IshortToComplex::disconnect(gr::top_block_sptr top_block) { if (dump_) { @@ -99,14 +97,14 @@ void IshortToComplex::disconnect(gr_top_block_sptr top_block) -gr_basic_block_sptr IshortToComplex::get_left_block() +gr::basic_block_sptr IshortToComplex::get_left_block() { return gr_interleaved_short_to_complex_; } -gr_basic_block_sptr IshortToComplex::get_right_block() +gr::basic_block_sptr IshortToComplex::get_right_block() { return gr_interleaved_short_to_complex_; } diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.h b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.h index 651da3820..562ae8c43 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.h +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.h @@ -34,7 +34,8 @@ #include "gnss_synchro.h" #include "gnss_block_interface.h" #include -#include +#include +#include class ConfigurationInterface; @@ -47,7 +48,7 @@ class IshortToComplex: public GNSSBlockInterface public: IshortToComplex(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, - unsigned int out_streams, gr_msg_queue_sptr queue); + unsigned int out_streams, boost::shared_ptr queue); virtual ~IshortToComplex(); @@ -65,10 +66,10 @@ public: return 0; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); private: gr::blocks::interleaved_short_to_complex::sptr gr_interleaved_short_to_complex_; @@ -80,8 +81,8 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; - gr_block_sptr file_sink_; + boost::shared_ptr queue_; + gr::blocks::file_sink::sptr file_sink_; }; #endif diff --git a/src/algorithms/input_filter/adapters/CMakeLists.txt b/src/algorithms/input_filter/adapters/CMakeLists.txt index 0616a2405..37ae1f9b2 100644 --- a/src/algorithms/input_filter/adapters/CMakeLists.txt +++ b/src/algorithms/input_filter/adapters/CMakeLists.txt @@ -25,10 +25,9 @@ include_directories( $(CMAKE_CURRENT_SOURCE_DIR) ${CMAKE_SOURCE_DIR}/src/core/system_parameters ${CMAKE_SOURCE_DIR}/src/core/interfaces - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} - ${GR_FILTER_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(input_filter_adapters ${INPUT_FILTER_ADAPTER_SOURCES}) -target_link_libraries(input_filter_adapters ${GR_FILTER_LIBRARIES}) \ No newline at end of file +target_link_libraries(input_filter_adapters ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES}) diff --git a/src/algorithms/input_filter/adapters/fir_filter.cc b/src/algorithms/input_filter/adapters/fir_filter.cc index b9dff6675..b44773772 100644 --- a/src/algorithms/input_filter/adapters/fir_filter.cc +++ b/src/algorithms/input_filter/adapters/fir_filter.cc @@ -32,8 +32,6 @@ #include "configuration_interface.h" #include #include -#include -#include #include #include #include @@ -42,7 +40,7 @@ using google::LogMessage; FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { @@ -62,7 +60,7 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role, if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; - file_sink_ = gr_make_file_sink(item_size, dump_filename_.c_str()); + file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } } @@ -73,7 +71,7 @@ FirFilter::~FirFilter() -void FirFilter::connect(gr_top_block_sptr top_block) +void FirFilter::connect(gr::top_block_sptr top_block) { if (dump_) { @@ -87,7 +85,7 @@ void FirFilter::connect(gr_top_block_sptr top_block) -void FirFilter::disconnect(gr_top_block_sptr top_block) +void FirFilter::disconnect(gr::top_block_sptr top_block) { if (dump_) { @@ -97,14 +95,14 @@ void FirFilter::disconnect(gr_top_block_sptr top_block) -gr_basic_block_sptr FirFilter::get_left_block() +gr::basic_block_sptr FirFilter::get_left_block() { return fir_filter_ccf_; } -gr_basic_block_sptr FirFilter::get_right_block() +gr::basic_block_sptr FirFilter::get_right_block() { return fir_filter_ccf_; } @@ -165,6 +163,7 @@ void FirFilter::init() std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type); int grid_density = config_->property(role_ + ".grid_density", default_grid_density); + // pm_remez implements the Parks-McClellan FIR filter design. // It calculates the optimal (in the Chebyshev/minimax sense) FIR filter // impulse response given a set of band edges, the desired response on diff --git a/src/algorithms/input_filter/adapters/fir_filter.h b/src/algorithms/input_filter/adapters/fir_filter.h index 04efd51f9..0962027c5 100644 --- a/src/algorithms/input_filter/adapters/fir_filter.h +++ b/src/algorithms/input_filter/adapters/fir_filter.h @@ -33,10 +33,14 @@ #ifndef GNSS_SDR_FIR_FILTER_H_ #define GNSS_SDR_FIR_FILTER_H_ +#include +#include +#include +#include +#include #include "gnss_synchro.h" #include "gnss_block_interface.h" -#include -#include + class ConfigurationInterface; @@ -51,10 +55,14 @@ class ConfigurationInterface; class FirFilter: public GNSSBlockInterface { public: + //! Constructor FirFilter(ConfigurationInterface* configuration, - std::string role, unsigned int in_streams, - unsigned int out_streams, gr_msg_queue_sptr queue); + std::string role, + unsigned int in_streams, + unsigned int out_streams, + boost::shared_ptr queue); + //! Destructor virtual ~FirFilter(); std::string role() { @@ -70,10 +78,10 @@ public: { return 0; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); private: gr::filter::fir_filter_ccf::sptr fir_filter_ccf_; @@ -87,8 +95,8 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; - gr_block_sptr file_sink_; + boost::shared_ptr queue_; + gr::blocks::file_sink::sptr file_sink_; void init(); }; diff --git a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc index e16772765..64ea99fbc 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -32,8 +32,8 @@ #include "configuration_interface.h" #include #include -#include -#include +//#include +#include #include #include #include @@ -42,7 +42,7 @@ using google::LogMessage; FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : config_(configuration), role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { @@ -67,7 +67,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration { DLOG(INFO) << "Dumping output into file " << dump_filename_; std::cout<<"Dumping output into file " << dump_filename_< -#include +#include +#include class ConfigurationInterface; @@ -57,7 +58,7 @@ class FreqXlatingFirFilter: public GNSSBlockInterface public: FreqXlatingFirFilter(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, - unsigned int out_streams, gr_msg_queue_sptr queue); + unsigned int out_streams, boost::shared_ptr queue); virtual ~FreqXlatingFirFilter(); std::string role() @@ -74,10 +75,10 @@ public: { return 0; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); private: gr::filter::freq_xlating_fir_filter_ccf::sptr freq_xlating_fir_filter_ccf_; @@ -93,8 +94,8 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; - gr_block_sptr file_sink_; + boost::shared_ptr queue_; + gr::blocks::file_sink::sptr file_sink_; void init(); }; diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index 9d7c6a104..729398b21 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -16,6 +16,15 @@ # along with GNSS-SDR. If not, see . # +#if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +#set(GNSS_SPLIBS_SOURCES +# galileo_e1_signal_processing.cc +# gnss_sdr_valve.cc +# gnss_signal_processing.cc +# gps_sdr_signal_processing.cc +# pass_through.cc +#) +#else(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(GNSS_SPLIBS_SOURCES galileo_e1_signal_processing.cc gnss_sdr_valve.cc @@ -24,12 +33,17 @@ set(GNSS_SPLIBS_SOURCES nco_lib.cc pass_through.cc ) +#endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") include_directories( $(CMAKE_CURRENT_SOURCE_DIR) ${CMAKE_SOURCE_DIR}/src/core/system_parameters ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${Boost_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GFlags_INCLUDE_DIRS} ) -add_library(gnss_sp_libs ${GNSS_SPLIBS_SOURCES}) \ No newline at end of file +add_library(gnss_sp_libs ${GNSS_SPLIBS_SOURCES}) +target_link_libraries(gnss_sp_libs ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES}) diff --git a/src/algorithms/libs/galileo_e1_signal_processing.h b/src/algorithms/libs/galileo_e1_signal_processing.h index ebb6da682..fe6dd4f33 100644 --- a/src/algorithms/libs/galileo_e1_signal_processing.h +++ b/src/algorithms/libs/galileo_e1_signal_processing.h @@ -34,6 +34,7 @@ #include #include +#include #include "Galileo_E1.h" #include "gnss_signal_processing.h" diff --git a/src/algorithms/libs/gnss_sdr_valve.cc b/src/algorithms/libs/gnss_sdr_valve.cc index 20fb6fc05..2108909d1 100644 --- a/src/algorithms/libs/gnss_sdr_valve.cc +++ b/src/algorithms/libs/gnss_sdr_valve.cc @@ -31,28 +31,28 @@ */ #include "gnss_sdr_valve.h" -#include -#include "control_message_factory.h" +#include #include #include +#include "control_message_factory.h" using google::LogMessage; gnss_sdr_valve::gnss_sdr_valve (size_t sizeof_stream_item, int nitems, - gr_msg_queue_sptr queue) : gr_sync_block ("valve", - gr_make_io_signature (1, 1, sizeof_stream_item), - gr_make_io_signature (1, 1, sizeof_stream_item)), - d_nitems (nitems), d_ncopied_items (0), d_queue(queue) + gr::msg_queue::sptr queue) : gr::sync_block("valve", + gr::io_signature::make(1, 1, sizeof_stream_item), + gr::io_signature::make(1, 1, sizeof_stream_item) ), + d_nitems(nitems), d_ncopied_items(0), d_queue(queue) {} -gr_block_sptr gnss_sdr_make_valve (size_t sizeof_stream_item, +boost::shared_ptr gnss_sdr_make_valve (size_t sizeof_stream_item, int nitems, - gr_msg_queue_sptr queue) + gr::msg_queue::sptr queue) { - return gr_block_sptr (new gnss_sdr_valve (sizeof_stream_item, nitems, queue)); + return boost::shared_ptr (new gnss_sdr_valve (sizeof_stream_item, nitems, queue)); } @@ -72,7 +72,7 @@ int gnss_sdr_valve::work (int noutput_items, unsigned n = std::min(d_nitems - d_ncopied_items, noutput_items); if (n == 0) return 0; - memcpy (output_items[0], input_items[0], n * input_signature()->sizeof_stream_item (0)); + memcpy (output_items[0], input_items[0], n * input_signature()->sizeof_stream_item(0)); d_ncopied_items += n; return n; } diff --git a/src/algorithms/libs/gnss_sdr_valve.h b/src/algorithms/libs/gnss_sdr_valve.h index acc81cedc..9594933dd 100644 --- a/src/algorithms/libs/gnss_sdr_valve.h +++ b/src/algorithms/libs/gnss_sdr_valve.h @@ -34,30 +34,32 @@ #define GNSS_SDR_GNSS_SDR_VALVE_H_ #include -#include -#include +#include +#include +#include -gr_block_sptr gnss_sdr_make_valve (size_t sizeof_stream_item, + +boost::shared_ptr gnss_sdr_make_valve (size_t sizeof_stream_item, int nitems, - gr_msg_queue_sptr queue); + gr::msg_queue::sptr queue); /*! * \brief Implementation of a GNU Radio block that sends a STOP message to the * control queue right after a specific number of samples have passed through it. */ -class gnss_sdr_valve : public gr_sync_block +class gnss_sdr_valve : public gr::sync_block { - friend gr_block_sptr gnss_sdr_make_valve(size_t sizeof_stream_item, - int nitems, - gr_msg_queue_sptr queue); + friend boost::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, + int nitems, + gr::msg_queue::sptr queue); gnss_sdr_valve (size_t sizeof_stream_item, - int nitems, - gr_msg_queue_sptr queue); + int nitems, + gr::msg_queue::sptr queue); int d_nitems; int d_ncopied_items; - gr_msg_queue_sptr d_queue; + gr::msg_queue::sptr d_queue; public: - int work (int noutput_items, + int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; diff --git a/src/algorithms/libs/gnss_signal_processing.cc b/src/algorithms/libs/gnss_signal_processing.cc index fe8572b4e..f5e9537f4 100644 --- a/src/algorithms/libs/gnss_signal_processing.cc +++ b/src/algorithms/libs/gnss_signal_processing.cc @@ -32,7 +32,7 @@ */ #include "gnss_signal_processing.h" -#include // fixed point sine and cosine +#include // fixed point sine and cosine void complex_exp_gen(std::complex* _dest, double _f, double _fs, unsigned int _samps) @@ -44,7 +44,7 @@ void complex_exp_gen(std::complex* _dest, double _f, double _fs, unsigned int phase_i = 0; int phase_step_i; float phase_step_f = (float)((GPS_TWO_PI * _f) / _fs); - phase_step_i = gr_fxpt::float_to_fixed(phase_step_f); + phase_step_i = gr::fxpt::float_to_fixed(phase_step_f); float sin_f,cos_f; for(unsigned int i = 0; i < _samps; i++) @@ -53,7 +53,7 @@ void complex_exp_gen(std::complex* _dest, double _f, double _fs, unsigned //_dest[i] = std::complex(cos(phase), sin(phase)); //phase += phase_step; //new Fixed Point NCO (faster) - gr_fxpt::sincos(phase_i,&sin_f,&cos_f); + gr::fxpt::sincos(phase_i,&sin_f,&cos_f); _dest[i] = std::complex(cos_f, sin_f); phase_i += phase_step_i; } @@ -69,7 +69,7 @@ void complex_exp_gen_conj(std::complex* _dest, double _f, double _fs, uns int phase_i = 0; int phase_step_i; float phase_step_f = (float)((GPS_TWO_PI * _f) / _fs); - phase_step_i = gr_fxpt::float_to_fixed(phase_step_f); + phase_step_i = gr::fxpt::float_to_fixed(phase_step_f); float sin_f,cos_f; for(unsigned int i = 0; i < _samps; i++) @@ -78,7 +78,7 @@ void complex_exp_gen_conj(std::complex* _dest, double _f, double _fs, uns //_dest[i] = std::complex(cos(phase), sin(phase)); //phase += phase_step; //new Fixed Point NCO (faster) - gr_fxpt::sincos(phase_i,&sin_f,&cos_f); + gr::fxpt::sincos(phase_i,&sin_f,&cos_f); _dest[i] = std::complex(cos_f, -sin_f); phase_i += phase_step_i; } diff --git a/src/algorithms/libs/gps_sdr_signal_processing.cc b/src/algorithms/libs/gps_sdr_signal_processing.cc index d3d470f18..f792d1c9a 100644 --- a/src/algorithms/libs/gps_sdr_signal_processing.cc +++ b/src/algorithms/libs/gps_sdr_signal_processing.cc @@ -31,7 +31,6 @@ */ #include "gps_sdr_signal_processing.h" -#include #include #include diff --git a/src/algorithms/libs/nco_lib.cc b/src/algorithms/libs/nco_lib.cc index aa6faa703..9a7d71022 100644 --- a/src/algorithms/libs/nco_lib.cc +++ b/src/algorithms/libs/nco_lib.cc @@ -36,123 +36,121 @@ typedef ALIGN16_BEG union { - float f[4]; - int i[4]; - v4sf v; + float f[4]; + int i[4]; + v4sf v; } ALIGN16_END V4SF; -void sse_nco(std::complex *dest, int n_samples,float start_phase_rad, float phase_step_rad) +void sse_nco(std::complex *dest, int n_samples, float start_phase_rad, float phase_step_rad) { //SSE NCO int sse_loops_four_op; int remnant_ops; - sse_loops_four_op=(int)n_samples/4; - remnant_ops=n_samples%4; + sse_loops_four_op = (int)n_samples/4; + remnant_ops = n_samples%4; V4SF vx, sin4, cos4; float phase_rad; - phase_rad=start_phase_rad; + phase_rad = start_phase_rad; - int index=0; - for(int i=0;i(cos4.f[0], -sin4.f[0]); - index++; - dest[index] = std::complex(cos4.f[1], -sin4.f[1]); - index++; - dest[index] = std::complex(cos4.f[2], -sin4.f[2]); - index++; - dest[index] = std::complex(cos4.f[3], -sin4.f[3]); - index++; - } - for(int i=0;i(cos4.f[0], -sin4.f[0]); + index++; + dest[index] = std::complex(cos4.f[1], -sin4.f[1]); + index++; + dest[index] = std::complex(cos4.f[2], -sin4.f[2]); + index++; + dest[index] = std::complex(cos4.f[3], -sin4.f[3]); + index++; + } + for(int i = 0;i(cos4.f[i], -sin4.f[i]); - index++; - } + for(int i = 0;i(cos4.f[i], -sin4.f[i]); + index++; + } } -void fxp_nco(std::complex *dest, int n_samples,float start_phase_rad, float phase_step_rad) +void fxp_nco(std::complex *dest, int n_samples, float start_phase_rad, float phase_step_rad) { - int phase_rad_i; - phase_rad_i=gr_fxpt::float_to_fixed(start_phase_rad); - int phase_step_rad_i; - phase_step_rad_i=gr_fxpt::float_to_fixed(phase_step_rad); + int phase_rad_i; + phase_rad_i = gr::fxpt::float_to_fixed(start_phase_rad); + int phase_step_rad_i; + phase_step_rad_i = gr::fxpt::float_to_fixed(phase_step_rad); + float sin_f,cos_f; - float sin_f,cos_f; - - for(int i = 0; i < n_samples; i++) - { - //using temp variables - gr_fxpt::sincos(-phase_rad_i,&sin_f,&cos_f); - dest[i] = gr_complex(cos_f, sin_f); - phase_rad_i += phase_step_rad_i; - - } + for(int i = 0; i < n_samples; i++) + { + //using temp variables + gr::fxpt::sincos(-phase_rad_i,&sin_f,&cos_f); + dest[i] = gr_complex(cos_f, sin_f); + phase_rad_i += phase_step_rad_i; + } } -void fxp_nco_cpyref(std::complex *dest, int n_samples,float start_phase_rad, float phase_step_rad) +void fxp_nco_cpyref(std::complex *dest, int n_samples, float start_phase_rad, float phase_step_rad) { - int phase_rad_i; - phase_rad_i=gr_fxpt::float_to_fixed(start_phase_rad); - int phase_step_rad_i; - phase_step_rad_i=gr_fxpt::float_to_fixed(phase_step_rad); + int phase_rad_i; + phase_rad_i = gr::fxpt::float_to_fixed(start_phase_rad); + int phase_step_rad_i; + phase_step_rad_i = gr::fxpt::float_to_fixed(phase_step_rad); - float* vector_cpx; - vector_cpx=(float*)dest; - for(int i = 0; i < n_samples; i++) - { - //using references (may be it can be a problem for c++11 standard - //gr_fxpt::sincos(phase_rad_i,&d_carr_sign[i].imag(),&d_carr_sign[i].real()); - gr_fxpt::sincos(-phase_rad_i,&vector_cpx[i*2+1],&vector_cpx[i*2]); - phase_rad_i += phase_step_rad_i; + float* vector_cpx; + vector_cpx = (float*)dest; + for(int i = 0; i < n_samples; i++) + { + //using references (maybe it can be a problem for c++11 ?) + //gr_fxpt::sincos(phase_rad_i,&d_carr_sign[i].imag(),&d_carr_sign[i].real()); + gr::fxpt::sincos(-phase_rad_i, &vector_cpx[i*2+1], &vector_cpx[i*2]); + phase_rad_i += phase_step_rad_i; - } + } } void fxp_nco_IQ_split(float* I, float* Q , int n_samples,float start_phase_rad, float phase_step_rad) { - int phase_rad_i; - phase_rad_i=gr_fxpt::float_to_fixed(start_phase_rad); - int phase_step_rad_i; - phase_step_rad_i=gr_fxpt::float_to_fixed(phase_step_rad); + int phase_rad_i; + phase_rad_i = gr::fxpt::float_to_fixed(start_phase_rad); + int phase_step_rad_i; + phase_step_rad_i = gr::fxpt::float_to_fixed(phase_step_rad); - float sin_f,cos_f; - for(int i = 0; i < n_samples; i++) - { - gr_fxpt::sincos(-phase_rad_i,&sin_f,&cos_f); - I[i]=cos_f; - Q[i]=sin_f; - phase_rad_i += phase_step_rad_i; + float sin_f,cos_f; + for(int i = 0; i < n_samples; i++) + { + gr::fxpt::sincos(-phase_rad_i,&sin_f,&cos_f); + I[i] = cos_f; + Q[i] = sin_f; + phase_rad_i += phase_step_rad_i; - } + } } -void std_nco(std::complex *dest, int n_samples,float start_phase_rad, float phase_step_rad) +void std_nco(std::complex *dest, int n_samples, float start_phase_rad, float phase_step_rad) { - float phase_rad; - phase_rad=start_phase_rad; + float phase_rad; + phase_rad = start_phase_rad; - for(int i = 0; i < n_samples; i++) - { - // Using std::cos and std::sin - dest[i] = gr_complex(std::cos(phase_rad), -std::sin(phase_rad)); - phase_rad=phase_rad+phase_step_rad; - } + for(int i = 0; i < n_samples; i++) + { + // Using std::cos and std::sin + dest[i] = gr_complex(std::cos(phase_rad), -std::sin(phase_rad)); + phase_rad = phase_rad+phase_step_rad; + } } diff --git a/src/algorithms/libs/nco_lib.h b/src/algorithms/libs/nco_lib.h index 0deb4f996..95d088c87 100644 --- a/src/algorithms/libs/nco_lib.h +++ b/src/algorithms/libs/nco_lib.h @@ -37,7 +37,7 @@ #ifndef GNSS_SDR_NCO_LIB_CC_H_ #define GNSS_SDR_NCO_LIB_CC_H_ -#include +#include #include #include #include diff --git a/src/algorithms/libs/pass_through.cc b/src/algorithms/libs/pass_through.cc index 65fd0850e..c1f848afe 100644 --- a/src/algorithms/libs/pass_through.cc +++ b/src/algorithms/libs/pass_through.cc @@ -33,7 +33,7 @@ #include "pass_through.h" #include -#include +//#include #include #include #include "configuration_interface.h" @@ -67,7 +67,7 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro LOG_AT_LEVEL(WARNING) << item_type_ << " unrecognized item type. Using float"; item_size_ = sizeof(float); } - kludge_copy_ = gr_make_kludge_copy(item_size_); + kludge_copy_ = gr::blocks::copy::make(item_size_); DLOG(INFO) << "kludge_copy(" << kludge_copy_->unique_id() << ")"; } @@ -78,28 +78,28 @@ Pass_Through::~Pass_Through() -void Pass_Through::connect(gr_top_block_sptr top_block) +void Pass_Through::connect(gr::top_block_sptr top_block) { DLOG(INFO) << "nothing to connect internally"; } -void Pass_Through::disconnect(gr_top_block_sptr top_block) +void Pass_Through::disconnect(gr::top_block_sptr top_block) { // Nothing to disconnect } -gr_basic_block_sptr Pass_Through::get_left_block() +gr::basic_block_sptr Pass_Through::get_left_block() { return kludge_copy_; } -gr_basic_block_sptr Pass_Through::get_right_block() +gr::basic_block_sptr Pass_Through::get_right_block() { return kludge_copy_; } diff --git a/src/algorithms/libs/pass_through.h b/src/algorithms/libs/pass_through.h index 4af8f43b3..f35801d5c 100644 --- a/src/algorithms/libs/pass_through.h +++ b/src/algorithms/libs/pass_through.h @@ -33,9 +33,11 @@ #ifndef GNSS_SDR_PASS_THROUGH_H_ #define GNSS_SDR_PASS_THROUGH_H_ -#include -#include -#include +#include +//#include +#include +//#include +//#include #include "gnss_block_interface.h" class ConfigurationInterface; @@ -73,10 +75,10 @@ public: { return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); private: std::string item_type_; @@ -84,7 +86,8 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_kludge_copy_sptr kludge_copy_; + //gr_kludge_copy_sptr kludge_copy_; + gr::blocks::copy::sptr kludge_copy_; size_t item_size_; }; diff --git a/src/algorithms/observables/adapters/CMakeLists.txt b/src/algorithms/observables/adapters/CMakeLists.txt index 425c43e2e..3969f6d0d 100644 --- a/src/algorithms/observables/adapters/CMakeLists.txt +++ b/src/algorithms/observables/adapters/CMakeLists.txt @@ -25,9 +25,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/observables/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(obs_adapters ${OBS_ADAPTER_SOURCES}) -target_link_libraries(obs_adapters obs_gr_blocks) +target_link_libraries(obs_adapters obs_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES}) diff --git a/src/algorithms/observables/adapters/gps_l1_ca_observables.cc b/src/algorithms/observables/adapters/gps_l1_ca_observables.cc index 6bcbf77c5..fe4372cf0 100644 --- a/src/algorithms/observables/adapters/gps_l1_ca_observables.cc +++ b/src/algorithms/observables/adapters/gps_l1_ca_observables.cc @@ -33,9 +33,6 @@ #include "gps_l1_ca_observables.h" #include "configuration_interface.h" #include "gps_l1_ca_observables_cc.h" -#include -//#include -//#include #include #include @@ -45,11 +42,11 @@ GpsL1CaObservables::GpsL1CaObservables(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : - role_(role), - in_streams_(in_streams), - out_streams_(out_streams), - queue_(queue) + boost::shared_ptr queue) : + role_(role), + in_streams_(in_streams), + out_streams_(out_streams), + queue_(queue) { int output_rate_ms; output_rate_ms = configuration->property(role + ".output_rate_ms", 500); @@ -74,7 +71,7 @@ GpsL1CaObservables::~GpsL1CaObservables() -void GpsL1CaObservables::connect(gr_top_block_sptr top_block) +void GpsL1CaObservables::connect(gr::top_block_sptr top_block) { // Nothing to connect internally DLOG(INFO) << "nothing to connect internally"; @@ -82,7 +79,7 @@ void GpsL1CaObservables::connect(gr_top_block_sptr top_block) -void GpsL1CaObservables::disconnect(gr_top_block_sptr top_block) +void GpsL1CaObservables::disconnect(gr::top_block_sptr top_block) { // Nothing to disconnect } @@ -90,7 +87,7 @@ void GpsL1CaObservables::disconnect(gr_top_block_sptr top_block) -gr_basic_block_sptr GpsL1CaObservables::get_left_block() +gr::basic_block_sptr GpsL1CaObservables::get_left_block() { return observables_; } @@ -98,7 +95,7 @@ gr_basic_block_sptr GpsL1CaObservables::get_left_block() -gr_basic_block_sptr GpsL1CaObservables::get_right_block() +gr::basic_block_sptr GpsL1CaObservables::get_right_block() { return observables_; } diff --git a/src/algorithms/observables/adapters/gps_l1_ca_observables.h b/src/algorithms/observables/adapters/gps_l1_ca_observables.h index fa1342a26..c1f6fa787 100644 --- a/src/algorithms/observables/adapters/gps_l1_ca_observables.h +++ b/src/algorithms/observables/adapters/gps_l1_ca_observables.h @@ -35,7 +35,7 @@ #include "observables_interface.h" #include "gps_l1_ca_observables_cc.h" -#include +#include class ConfigurationInterface; @@ -46,25 +46,25 @@ class GpsL1CaObservables : public ObservablesInterface { public: GpsL1CaObservables(ConfigurationInterface* configuration, - std::string role, - unsigned int in_streams, - unsigned int out_streams, - gr_msg_queue_sptr queue); + std::string role, + unsigned int in_streams, + unsigned int out_streams, + boost::shared_ptr queue); virtual ~GpsL1CaObservables(); std::string role() { return role_; } - //! return "GPS_L1_CA_Observables" + //! Returns "GPS_L1_CA_Observables" std::string implementation() { return "GPS_L1_CA_Observables"; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); void reset() { return; @@ -84,7 +84,7 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; }; #endif diff --git a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt index 5fc9ca449..f1ffa09ca 100644 --- a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt @@ -25,8 +25,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/libs ${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} ) -add_library(obs_gr_blocks ${OBS_GR_BLOCKS_SOURCES}) \ No newline at end of file +add_library(obs_gr_blocks ${OBS_GR_BLOCKS_SOURCES} ) +target_link_libraries(obs_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES}) diff --git a/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc index a6528a1cc..3e1196f48 100644 --- a/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc @@ -35,9 +35,8 @@ #include #include #include -#include "math.h" #include "control_message_factory.h" -#include +#include #include #include #include "gnss_synchro.h" @@ -47,15 +46,15 @@ using google::LogMessage; gps_l1_ca_observables_cc_sptr -gps_l1_ca_make_observables_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging) +gps_l1_ca_make_observables_cc(unsigned int nchannels, boost::shared_ptr queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging) { return gps_l1_ca_observables_cc_sptr(new gps_l1_ca_observables_cc(nchannels, queue, dump, dump_filename, output_rate_ms, flag_averaging)); } -gps_l1_ca_observables_cc::gps_l1_ca_observables_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging) : - gr_block ("gps_l1_ca_observables_cc", gr_make_io_signature (nchannels, nchannels, sizeof(Gnss_Synchro)), - gr_make_io_signature(nchannels, nchannels, sizeof(Gnss_Synchro))) +gps_l1_ca_observables_cc::gps_l1_ca_observables_cc(unsigned int nchannels, boost::shared_ptr queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging) : + gr::block("gps_l1_ca_observables_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)), + gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro))) { // initialize internal vars d_queue = queue; @@ -138,14 +137,14 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni if(current_gnss_synchro_map.size() > 0) { /* - * 2.1 Use CURRENT set of measurements and find the nearest satellite + * 2.1 Use CURRENT set of measurements and find the nearest satellite * common RX time algorithm */ //; // what is the most recent symbol TOW in the current set? -> this will be the reference symbol gnss_synchro_iter = max_element(current_gnss_synchro_map.begin(), current_gnss_synchro_map.end(), pairCompare_gnss_synchro_d_TOW_at_current_symbol); - double d_TOW_reference=gnss_synchro_iter->second.d_TOW_at_current_symbol; - double d_ref_PRN_rx_time_ms=gnss_synchro_iter->second.Prn_timestamp_ms; + double d_TOW_reference = gnss_synchro_iter->second.d_TOW_at_current_symbol; + double d_ref_PRN_rx_time_ms = gnss_synchro_iter->second.Prn_timestamp_ms; //int reference_channel= gnss_synchro_iter->second.Channel_ID; // Now compute RX time differences due to the PRN alignement in the correlators @@ -155,16 +154,16 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni for(gnss_synchro_iter = current_gnss_synchro_map.begin(); gnss_synchro_iter != current_gnss_synchro_map.end(); gnss_synchro_iter++) { // compute the required symbol history shift in order to match the reference symbol - delta_rx_time_ms=gnss_synchro_iter->second.Prn_timestamp_ms-d_ref_PRN_rx_time_ms; + delta_rx_time_ms = gnss_synchro_iter->second.Prn_timestamp_ms-d_ref_PRN_rx_time_ms; //std::cout<<"delta_rx_time_ms="<second.d_TOW_at_current_symbol)*1000.0+delta_rx_time_ms+GPS_STARTOFFSET_ms; + traveltime_ms = (d_TOW_reference-gnss_synchro_iter->second.d_TOW_at_current_symbol)*1000.0 + delta_rx_time_ms + GPS_STARTOFFSET_ms; pseudorange_m = traveltime_ms * GPS_C_m_ms; // [m] // update the pseudorange object current_gnss_synchro[gnss_synchro_iter->second.Channel_ID] = gnss_synchro_iter->second; current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Pseudorange_m = pseudorange_m; current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Flag_valid_pseudorange = true; - current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].d_TOW_at_current_symbol=round(d_TOW_reference*1000)/1000+GPS_STARTOFFSET_ms/1000.0; + current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].d_TOW_at_current_symbol = round(d_TOW_reference*1000)/1000 + GPS_STARTOFFSET_ms/1000.0; } } @@ -203,4 +202,3 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni return 1; //Output the observables } - diff --git a/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.h b/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.h index 6153330ca..289faf8c9 100644 --- a/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.h +++ b/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.h @@ -32,8 +32,8 @@ #define GNSS_SDR_GPS_L1_CA_OBSERVABLES_CC_H #include -#include -#include +#include +#include #include #include #include @@ -48,12 +48,12 @@ class gps_l1_ca_observables_cc; typedef boost::shared_ptr gps_l1_ca_observables_cc_sptr; gps_l1_ca_observables_cc_sptr -gps_l1_ca_make_observables_cc(unsigned int n_channels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging); +gps_l1_ca_make_observables_cc(unsigned int n_channels, boost::shared_ptr queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging); /*! * \brief This class implements a block that computes GPS L1 C/A observables */ -class gps_l1_ca_observables_cc : public gr_block +class gps_l1_ca_observables_cc : public gr::block { public: ~gps_l1_ca_observables_cc (); @@ -63,11 +63,11 @@ public: private: friend gps_l1_ca_observables_cc_sptr - gps_l1_ca_make_observables_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging); - gps_l1_ca_observables_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging); + gps_l1_ca_make_observables_cc(unsigned int nchannels, boost::shared_ptr queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging); + gps_l1_ca_observables_cc(unsigned int nchannels, boost::shared_ptr queue, bool dump, std::string dump_filename, int output_rate_ms, bool flag_averaging); // class private vars - gr_msg_queue_sptr d_queue; + boost::shared_ptr d_queue; bool d_dump; bool d_flag_averaging; long int d_sample_counter; diff --git a/src/algorithms/output_filter/adapters/CMakeLists.txt b/src/algorithms/output_filter/adapters/CMakeLists.txt index 7e5054aed..b07d81819 100644 --- a/src/algorithms/output_filter/adapters/CMakeLists.txt +++ b/src/algorithms/output_filter/adapters/CMakeLists.txt @@ -25,8 +25,9 @@ include_directories( $(CMAKE_CURRENT_SOURCE_DIR) ${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/receiver - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) -add_library(out_adapters ${OUTPUTFILTER_ADAPTER_SOURCES}) \ No newline at end of file +add_library(out_adapters ${OUTPUTFILTER_ADAPTER_SOURCES}) +target_link_libraries(out_adapters ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES}) diff --git a/src/algorithms/output_filter/adapters/file_output_filter.cc b/src/algorithms/output_filter/adapters/file_output_filter.cc index b8684b899..fee95da13 100644 --- a/src/algorithms/output_filter/adapters/file_output_filter.cc +++ b/src/algorithms/output_filter/adapters/file_output_filter.cc @@ -32,7 +32,7 @@ #include "file_output_filter.h" #include #include -#include +#include #include "configuration_interface.h" using google::LogMessage; @@ -66,7 +66,7 @@ FileOutputFilter::FileOutputFilter(ConfigurationInterface* configuration, LOG_AT_LEVEL(WARNING) << item_type_ << " Unrecognized item type. Using short."; item_size_ = sizeof(short); } - file_sink_ = gr_make_file_sink(item_size_, filename_.c_str()); + file_sink_ = gr::blocks::file_sink::make(item_size_, filename_.c_str()); DLOG(INFO) << "file sink(" << file_sink_->unique_id() << ")"; } @@ -77,27 +77,28 @@ FileOutputFilter::~FileOutputFilter() -void FileOutputFilter::connect(gr_top_block_sptr top_block) +void FileOutputFilter::connect(gr::top_block_sptr top_block) { DLOG(INFO) << "nothing to connect internally"; } -void FileOutputFilter::disconnect(gr_top_block_sptr top_block) +void FileOutputFilter::disconnect(gr::top_block_sptr top_block) { // Nothing to disconnect internally } -gr_basic_block_sptr FileOutputFilter::get_left_block() +gr::basic_block_sptr FileOutputFilter::get_left_block() { return file_sink_; } -gr_basic_block_sptr FileOutputFilter::get_right_block() +gr::basic_block_sptr FileOutputFilter::get_right_block() { - return file_sink_; + //return file_sink_;//gr_block_sptr(); + return gr::blocks::file_sink::sptr(); } diff --git a/src/algorithms/output_filter/adapters/file_output_filter.h b/src/algorithms/output_filter/adapters/file_output_filter.h index 3d6f65970..d9ae0b1ac 100644 --- a/src/algorithms/output_filter/adapters/file_output_filter.h +++ b/src/algorithms/output_filter/adapters/file_output_filter.h @@ -36,7 +36,7 @@ #define GNSS_SDR_FILE_OUTPUT_FILTER_H_ #include "gnss_block_interface.h" -#include +#include class ConfigurationInterface; @@ -48,9 +48,9 @@ class FileOutputFilter : public GNSSBlockInterface { public: FileOutputFilter(ConfigurationInterface* configuration, - std::string role, - unsigned int in_streams, - unsigned int out_streams); + std::string role, + unsigned int in_streams, + unsigned int out_streams); virtual ~FileOutputFilter(); std::string role() @@ -65,13 +65,13 @@ public: { return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); private: - gr_file_sink_sptr file_sink_; + gr::blocks::file_sink::sptr file_sink_; size_t item_size_; std::string filename_; std::string item_type_; diff --git a/src/algorithms/output_filter/adapters/null_sink_output_filter.cc b/src/algorithms/output_filter/adapters/null_sink_output_filter.cc index 409b7b767..14047bd2b 100644 --- a/src/algorithms/output_filter/adapters/null_sink_output_filter.cc +++ b/src/algorithms/output_filter/adapters/null_sink_output_filter.cc @@ -32,7 +32,7 @@ #include "null_sink_output_filter.h" #include #include -#include +#include #include "configuration_interface.h" using google::LogMessage; @@ -41,9 +41,9 @@ NullSinkOutputFilter::NullSinkOutputFilter(ConfigurationInterface* configuration std::string role, unsigned int in_streams, unsigned int out_streams) : - role_(role), - in_streams_(in_streams), - out_streams_(out_streams) + role_(role), + in_streams_(in_streams), + out_streams_(out_streams) { std::string default_item_type = "short"; item_type_ = configuration->property(role + ".item_type", default_item_type); @@ -64,7 +64,7 @@ NullSinkOutputFilter::NullSinkOutputFilter(ConfigurationInterface* configuration LOG_AT_LEVEL(WARNING) << item_type_ << " unrecognized item type. Using float"; item_size_ = sizeof(float); } - sink_ = gr_make_null_sink(item_size_); + sink_ = gr::blocks::null_sink::make(item_size_); DLOG(INFO) << "null_sink(" << sink_->unique_id() << ")"; } @@ -75,29 +75,30 @@ NullSinkOutputFilter::~NullSinkOutputFilter() -void NullSinkOutputFilter::connect(gr_top_block_sptr top_block) +void NullSinkOutputFilter::connect(gr::top_block_sptr top_block) { DLOG(INFO) << "nothing to connect internally"; } -void NullSinkOutputFilter::disconnect(gr_top_block_sptr top_block) +void NullSinkOutputFilter::disconnect(gr::top_block_sptr top_block) { // Nothing to connect } -gr_basic_block_sptr NullSinkOutputFilter::get_left_block() +gr::basic_block_sptr NullSinkOutputFilter::get_left_block() { return sink_; } -gr_basic_block_sptr NullSinkOutputFilter::get_right_block() +gr::basic_block_sptr NullSinkOutputFilter::get_right_block() { LOG_AT_LEVEL(WARNING) << "Right block of a signal sink should not be retrieved"; - return gr_block_sptr(); + //return gr::blocks::sptr::make(); + return sink_; } diff --git a/src/algorithms/output_filter/adapters/null_sink_output_filter.h b/src/algorithms/output_filter/adapters/null_sink_output_filter.h index a81e4dc19..2cb625493 100644 --- a/src/algorithms/output_filter/adapters/null_sink_output_filter.h +++ b/src/algorithms/output_filter/adapters/null_sink_output_filter.h @@ -9,7 +9,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -38,7 +38,7 @@ #define GNSS_SDR_NULL_SINK_OUTPUT_FILTER_H_ #include "gnss_block_interface.h" -#include +#include class ConfigurationInterface; @@ -62,6 +62,7 @@ public: { return role_; } + //! Returns "Null_Sink_Output_Filter" std::string implementation() { return "Null_Sink_Output_Filter"; @@ -70,13 +71,14 @@ public: { return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); private: - gr_block_sptr sink_; + //gr_block_sptr sink_; + gr::blocks::null_sink::sptr sink_; size_t item_size_; std::string item_type_; std::string role_; diff --git a/src/algorithms/resampler/adapters/CMakeLists.txt b/src/algorithms/resampler/adapters/CMakeLists.txt index 32eb2b2de..a41a147fe 100644 --- a/src/algorithms/resampler/adapters/CMakeLists.txt +++ b/src/algorithms/resampler/adapters/CMakeLists.txt @@ -22,9 +22,9 @@ include_directories( $(CMAKE_CURRENT_SOURCE_DIR) ${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/algorithms/resampler/gnuradio_blocks - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(resampler_adapters ${RESAMPLER_ADAPTER_SOURCES}) -target_link_libraries(resampler_adapters resampler_gr_blocks) \ No newline at end of file +target_link_libraries(resampler_adapters resampler_gr_blocks) diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc index a02cbacc9..5a2c402e3 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc @@ -30,7 +30,7 @@ */ #include "direct_resampler_conditioner.h" -#include +#include #include "direct_resampler_conditioner_cc.h" //#include "direct_resampler_conditioner_ss.h" #include "configuration_interface.h" @@ -46,22 +46,18 @@ DirectResamplerConditioner::DirectResamplerConditioner( { std::string default_item_type = "short"; std::string default_dump_file = "./data/signal_conditioner.dat"; - sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", - (double)4000000.0); - sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", - (double)2048000.0); - item_type_ = configuration->property(role + ".item_type", - default_item_type); + sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", (double)4000000.0); + sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", (double)2048000.0); + item_type_ = configuration->property(role + ".item_type", default_item_type); dump_ = configuration->property(role + ".dump", false); - DLOG(INFO) << "dump_ is "<< dump_; - dump_filename_ = configuration->property(role + ".dump_filename", - default_dump_file); + DLOG(INFO) << "dump_ is " << dump_; + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); if (item_type_.compare("gr_complex") == 0) { item_size_ = sizeof(gr_complex); resampler_ = direct_resampler_make_conditioner_cc(sample_freq_in_, - sample_freq_out_); + sample_freq_out_); DLOG(INFO) << "sample_freq_in " << sample_freq_in_; DLOG(INFO) << "sample_freq_out" << sample_freq_out_; DLOG(INFO) << "Item size " << item_size_; @@ -77,13 +73,13 @@ DirectResamplerConditioner::DirectResamplerConditioner( else { LOG_AT_LEVEL(WARNING) << item_type_ - << " unrecognized item type for resampler"; + << " unrecognized item type for resampler"; item_size_ = sizeof(short); } if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; - file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); + file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } } @@ -93,7 +89,7 @@ DirectResamplerConditioner::~DirectResamplerConditioner() {} -void DirectResamplerConditioner::connect(gr_top_block_sptr top_block) +void DirectResamplerConditioner::connect(gr::top_block_sptr top_block) { if (dump_) { @@ -107,7 +103,7 @@ void DirectResamplerConditioner::connect(gr_top_block_sptr top_block) } -void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block) +void DirectResamplerConditioner::disconnect(gr::top_block_sptr top_block) { if (dump_) { @@ -116,13 +112,13 @@ void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block) } -gr_basic_block_sptr DirectResamplerConditioner::get_left_block() +gr::basic_block_sptr DirectResamplerConditioner::get_left_block() { return resampler_; } -gr_basic_block_sptr DirectResamplerConditioner::get_right_block() +gr::basic_block_sptr DirectResamplerConditioner::get_right_block() { return resampler_; } diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.h b/src/algorithms/resampler/adapters/direct_resampler_conditioner.h index b067f9018..9616ec3fa 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.h +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.h @@ -33,7 +33,7 @@ #ifndef GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_H_ #define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_H_ -#include +#include #include "gnss_block_interface.h" class ConfigurationInterface; @@ -63,10 +63,10 @@ public: { return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); private: std::string role_; @@ -79,8 +79,8 @@ private: std::string dump_filename_; double sample_freq_in_; double sample_freq_out_; - gr_block_sptr resampler_; - gr_block_sptr file_sink_; + gr::block_sptr resampler_; + gr::block_sptr file_sink_; }; #endif /*GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_H_*/ diff --git a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt index 54223c619..fce242d27 100644 --- a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt @@ -24,8 +24,8 @@ set(RESAMPLER_GR_BLOCKS_SOURCES include_directories( $(CMAKE_CURRENT_SOURCE_DIR) - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) -add_library(resampler_gr_blocks ${RESAMPLER_GR_BLOCKS_SOURCES}) \ No newline at end of file +add_library(resampler_gr_blocks ${RESAMPLER_GR_BLOCKS_SOURCES}) diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc index 7d060ef7f..e723d9115 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc @@ -34,7 +34,7 @@ #include "direct_resampler_conditioner_cc.h" #include -#include +#include #include #include @@ -53,8 +53,8 @@ direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc( direct_resampler_conditioner_cc::direct_resampler_conditioner_cc( double sample_freq_in, double sample_freq_out) : - gr_block("direct_resampler_conditioner_cc", gr_make_io_signature(1, 1, - sizeof(gr_complex)), gr_make_io_signature(1, 1, + gr::block("direct_resampler_conditioner_cc", gr::io_signature::make(1, 1, + sizeof(gr_complex)), gr::io_signature::make(1, 1, sizeof(gr_complex))), d_sample_freq_in(sample_freq_in), d_sample_freq_out(sample_freq_out), d_phase(0), d_lphase(0), d_history(1) diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h index 81c8059d0..733f3dbfe 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h @@ -39,7 +39,7 @@ #ifndef GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H #define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H -#include +#include class direct_resampler_conditioner_cc; typedef boost::shared_ptr direct_resampler_conditioner_cc_sptr; @@ -52,7 +52,7 @@ direct_resampler_make_conditioner_cc(double sample_freq_in, * * Direct resampling without interpolation */ -class direct_resampler_conditioner_cc: public gr_block +class direct_resampler_conditioner_cc: public gr::block { private: friend direct_resampler_conditioner_cc_sptr diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_ss.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_ss.cc index 3c4d5a256..dd01c5858 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_ss.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_ss.cc @@ -35,7 +35,7 @@ #include "direct_resampler_conditioner_ss.h" #include "gps_sdr_signal_processing.h" #include -#include +#include #include #include @@ -52,8 +52,8 @@ direct_resampler_conditioner_ss_sptr direct_resampler_make_conditioner_ss( direct_resampler_conditioner_ss::direct_resampler_conditioner_ss( double sample_freq_in, double sample_freq_out) : - gr_block("direct_resampler_make_conditioner_ss", gr_make_io_signature(1, - 1, sizeof(short)), gr_make_io_signature(1, 1, sizeof(short))), + gr::block("direct_resampler_make_conditioner_ss", gr::io_signature::make(1, + 1, sizeof(short)), gr::io_signature::make(1, 1, sizeof(short))), d_sample_freq_in(sample_freq_in), d_sample_freq_out( sample_freq_out), d_phase(0), d_lphase(0), d_history(1) { diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_ss.h b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_ss.h index 2a21716e3..43ef48c4e 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_ss.h +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_ss.h @@ -32,7 +32,7 @@ #ifndef GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_SS_H #define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_SS_H -#include +#include class direct_resampler_conditioner_ss; typedef boost::shared_ptr @@ -46,7 +46,7 @@ direct_resampler_make_conditioner_ss(double sample_freq_in, * * Direct resampling without interpolation */ -class direct_resampler_conditioner_ss: public gr_block +class direct_resampler_conditioner_ss: public gr::block { private: diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index bd9f01e73..a3227a95a 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -54,6 +54,9 @@ endif($ENV{GN3S_DRIVER}) if($ENV{RTLSDR_DRIVER}) + set(RTLSDR_DRIVER ON) +endif($ENV{RTLSDR_DRIVER}) +if(RTLSDR_DRIVER) ################################################################################ # OsmoSDR - http://sdr.osmocom.org/trac/ ################################################################################ @@ -69,23 +72,23 @@ if($ENV{RTLSDR_DRIVER}) set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} rtlsdr_signal_source.cc) set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GROSMOSDR_LIBRARIES}) set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${RTL_DRIVER_INCLUDE_DIRS}) -endif($ENV{RTLSDR_DRIVER}) +endif(RTLSDR_DRIVER) set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc uhd_signal_source.cc ${OPT_DRIVER_SOURCES}) + include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${OPT_DRIVER_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src/core/system_parameters ${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/algorithms/libs - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} - ${GR_UHD_INCLUDE_DIRS} ${UHD_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + ${GFlags_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} ) add_library(signal_source_adapters ${SIGNAL_SOURCE_ADAPTER_SOURCES}) -target_link_libraries(signal_source_adapters gnss_sp_libs ${Boost_LIBRARIES} ${UHD_LIBRARIES} ${GNURADIO_UHD_LIBRARIES} ${OPT_LIBRARIES}) +target_link_libraries(signal_source_adapters ${Boost_LIBRARIES} ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${UHD_LIBRARIES} ${GNURADIO_UHD_LIBRARIES} ${OPT_LIBRARIES} gnss_sp_libs) diff --git a/src/algorithms/signal_source/adapters/file_signal_source.cc b/src/algorithms/signal_source/adapters/file_signal_source.cc index bb4d7f6df..46353398f 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_signal_source.cc @@ -41,7 +41,7 @@ #include #include #include -#include +//#include using google::LogMessage; @@ -51,12 +51,12 @@ DEFINE_string(signal_source, "-", FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : - role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) + boost::shared_ptr queue) : + role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { std::string default_filename = "../data/my_capture.dat"; std::string default_item_type = "short"; - std::string default_dump_filename = "../data/my_capture.dat"; + std::string default_dump_filename = "../data/my_capture_dump.dat"; samples_ = configuration->property(role + ".samples", 0); sampling_frequency_ = configuration->property(role + ".sampling_frequency", 0); @@ -91,7 +91,8 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, } try { - file_source_ = gr_make_file_source(item_size_, filename_.c_str(), repeat_); + file_source_ = gr::blocks::file_source::make(item_size_, filename_.c_str(), repeat_); + } catch (const std::exception &e) { @@ -110,7 +111,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, <<"gnss-sdr --config_file=my_GNSS_SDR_configuration.conf" << std::endl; LOG_AT_LEVEL(INFO) << "file_signal_source: Unable to open the samples file " - << filename_.c_str() << ", exiting the program."; + << filename_.c_str() << ", exiting the program."; throw(e); } @@ -141,9 +142,11 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, if (size > 0) { - samples_ = floor((double)size / (double)item_size()) - ceil(0.1 * (double)sampling_frequency_); //process all the samples available in the file excluding the last 100 ms + samples_ = floor((double)size / (double)item_size() - ceil(0.002 * (double)sampling_frequency_)); //process all the samples available in the file excluding the last 2 ms } } + std::cout << samples_ << std::endl; + //if(samples_ > 0) samples_ = 0; CHECK(samples_ > 0) << "File does not contain enough samples to process."; double signal_duration_s; signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_); @@ -155,13 +158,15 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, if (dump_) { - sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); + //sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); + sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << sink_->unique_id() << ")"; } if (enable_throttle_control_) { - throttle_ = gr_make_throttle(item_size_, sampling_frequency_); + throttle_ = gr::blocks::throttle::make(item_size_, sampling_frequency_); + } DLOG(INFO) << "File source filename " << filename_; DLOG(INFO) << "Samples " << samples_; @@ -182,54 +187,54 @@ FileSignalSource::~FileSignalSource() -void FileSignalSource::connect(gr_top_block_sptr top_block) +void FileSignalSource::connect(gr::top_block_sptr top_block) { - if (samples_ > 0) - { - if (enable_throttle_control_ == true) + if (samples_ > 0) { - top_block->connect(file_source_, 0, throttle_, 0); - DLOG(INFO) << "connected file source to throttle"; - top_block->connect(throttle_, 0, valve_, 0); - DLOG(INFO) << "connected throttle to valve"; - if (dump_) - { - top_block->connect(valve_, 0, sink_, 0); - DLOG(INFO) << "connected valve to file sink"; - } + if (enable_throttle_control_ == true) + { + top_block->connect(file_source_, 0, throttle_, 0); + DLOG(INFO) << "connected file source to throttle"; + top_block->connect(throttle_, 0, valve_, 0); + DLOG(INFO) << "connected throttle to valve"; + if (dump_) + { + top_block->connect(valve_, 0, sink_, 0); + DLOG(INFO) << "connected valve to file sink"; + } + } + else + { + top_block->connect(file_source_, 0, valve_, 0); + DLOG(INFO) << "connected file source to valve"; + if (dump_) + { + top_block->connect(valve_, 0, sink_, 0); + DLOG(INFO) << "connected valve to file sink"; + } + } } - else + else { - top_block->connect(file_source_, 0, valve_, 0); - DLOG(INFO) << "connected file source to valve"; - if (dump_) - { - top_block->connect(valve_, 0, sink_, 0); - DLOG(INFO) << "connected valve to file sink"; - } + if (enable_throttle_control_ == true) + { + top_block->connect(file_source_, 0, throttle_, 0); + DLOG(INFO) << "connected file source to throttle"; + if (dump_) + { + top_block->connect(file_source_, 0, sink_, 0); + DLOG(INFO) << "connected file source to sink"; + } + } + else + { + if (dump_) + { + top_block->connect(file_source_, 0, sink_, 0); + DLOG(INFO) << "connected file source to sink"; + } + } } - } - else - { - if (enable_throttle_control_ == true) - { - top_block->connect(file_source_, 0, throttle_, 0); - DLOG(INFO) << "connected file source to throttle"; - if (dump_) - { - top_block->connect(file_source_, 0, sink_, 0); - DLOG(INFO) << "connected file source to sink"; - } - } - else - { - if (dump_) - { - top_block->connect(file_source_, 0, sink_, 0); - DLOG(INFO) << "connected file source to sink"; - } - } - } } @@ -237,85 +242,86 @@ void FileSignalSource::connect(gr_top_block_sptr top_block) -void FileSignalSource::disconnect(gr_top_block_sptr top_block) +void FileSignalSource::disconnect(gr::top_block_sptr top_block) { - if (samples_ > 0) - { - if (enable_throttle_control_ == true) + if (samples_ > 0) { - top_block->disconnect(file_source_, 0, throttle_, 0); - DLOG(INFO) << "disconnected file source to throttle"; - top_block->disconnect(throttle_, 0, valve_, 0); - DLOG(INFO) << "disconnected throttle to valve"; - if (dump_) - { - top_block->disconnect(valve_, 0, sink_, 0); - DLOG(INFO) << "disconnected valve to file sink"; - } + if (enable_throttle_control_ == true) + { + top_block->disconnect(file_source_, 0, throttle_, 0); + DLOG(INFO) << "disconnected file source to throttle"; + top_block->disconnect(throttle_, 0, valve_, 0); + DLOG(INFO) << "disconnected throttle to valve"; + if (dump_) + { + top_block->disconnect(valve_, 0, sink_, 0); + DLOG(INFO) << "disconnected valve to file sink"; + } + } + else + { + top_block->disconnect(file_source_, 0, valve_, 0); + DLOG(INFO) << "disconnected file source to valve"; + if (dump_) + { + top_block->disconnect(valve_, 0, sink_, 0); + DLOG(INFO) << "disconnected valve to file sink"; + } + } } - else + else { - top_block->disconnect(file_source_, 0, valve_, 0); - DLOG(INFO) << "disconnected file source to valve"; - if (dump_) - { - top_block->disconnect(valve_, 0, sink_, 0); - DLOG(INFO) << "disconnected valve to file sink"; - } + if (enable_throttle_control_ == true) + { + top_block->disconnect(file_source_, 0, throttle_, 0); + DLOG(INFO) << "disconnected file source to throttle"; + if (dump_) + { + top_block->disconnect(file_source_, 0, sink_, 0); + DLOG(INFO) << "disconnected file source to sink"; + } + } + else + { + if (dump_) + { + top_block->disconnect(file_source_, 0, sink_, 0); + DLOG(INFO) << "disconnected file source to sink"; + } + } } - } - else - { - if (enable_throttle_control_ == true) - { - top_block->disconnect(file_source_, 0, throttle_, 0); - DLOG(INFO) << "disconnected file source to throttle"; - if (dump_) - { - top_block->disconnect(file_source_, 0, sink_, 0); - DLOG(INFO) << "disconnected file source to sink"; - } - } - else - { - if (dump_) - { - top_block->disconnect(file_source_, 0, sink_, 0); - DLOG(INFO) << "disconnected file source to sink"; - } - } - } } -gr_basic_block_sptr FileSignalSource::get_left_block() +gr::basic_block_sptr FileSignalSource::get_left_block() { - LOG_AT_LEVEL(WARNING) << "Left block of a signal source should not be retrieved"; - return gr_block_sptr(); + LOG_AT_LEVEL(WARNING) << "Left block of a signal source should not be retrieved"; + //return gr_block_sptr(); + return gr::blocks::file_source::sptr(); } -gr_basic_block_sptr FileSignalSource::get_right_block() +gr::basic_block_sptr FileSignalSource::get_right_block() { - if (samples_ > 0) - { - return valve_; - } - else - { - if (enable_throttle_control_ == true) + if (samples_ > 0) { - return throttle_; + return valve_; } - else + else { - return file_source_; + if (enable_throttle_control_ == true) + { + return throttle_; + } + else + { + return file_source_; + } } - } } diff --git a/src/algorithms/signal_source/adapters/file_signal_source.h b/src/algorithms/signal_source/adapters/file_signal_source.h index 61e72630e..1fbca1799 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.h +++ b/src/algorithms/signal_source/adapters/file_signal_source.h @@ -36,11 +36,14 @@ #define GNSS_SDR_FILE_SIGNAL_SOURCE_H_ #include "gnss_block_interface.h" -#include -#include -#include -#include -#include +//#include +#include +//#include +#include +//#include +#include +#include +#include class ConfigurationInterface; @@ -53,7 +56,7 @@ class FileSignalSource: public GNSSBlockInterface public: FileSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); virtual ~FileSignalSource(); std::string role() @@ -72,10 +75,10 @@ public: { return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); std::string filename() { return filename_; @@ -108,11 +111,14 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_file_source_sptr file_source_; - gr_block_sptr valve_; - gr_block_sptr sink_; - gr_block_sptr throttle_; - gr_msg_queue_sptr queue_; +// gr_file_source_sptr file_source_; + gr::blocks::file_source::sptr file_source_; + //gr_block_sptr valve_; + boost::shared_ptr valve_; + gr::blocks::file_sink::sptr sink_; +// gr_block_sptr throttle_; + gr::blocks::throttle::sptr throttle_; + boost::shared_ptr queue_; size_t item_size_; // Throttle control bool enable_throttle_control_; diff --git a/src/algorithms/signal_source/adapters/gn3s_signal_source.cc b/src/algorithms/signal_source/adapters/gn3s_signal_source.cc index f5d541208..1840b7f86 100644 --- a/src/algorithms/signal_source/adapters/gn3s_signal_source.cc +++ b/src/algorithms/signal_source/adapters/gn3s_signal_source.cc @@ -29,8 +29,8 @@ */ #include "gn3s_signal_source.h" -#include -#include +#include +#include #include #include "configuration_interface.h" #include @@ -39,7 +39,7 @@ using google::LogMessage; Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, gr_msg_queue_sptr queue) : + std::string role, unsigned int in_stream, unsigned int out_stream, gr::blocks::file_sink::sptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) { std::string default_item_type = "short"; @@ -73,7 +73,7 @@ Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration, if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; - file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); + file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); } if (dump_) { @@ -88,7 +88,7 @@ Gn3sSignalSource::~Gn3sSignalSource() -void Gn3sSignalSource::connect(gr_top_block_sptr top_block) +void Gn3sSignalSource::connect(gr::top_block_sptr top_block) { if (dump_) { @@ -103,7 +103,7 @@ void Gn3sSignalSource::connect(gr_top_block_sptr top_block) -void Gn3sSignalSource::disconnect(gr_top_block_sptr top_block) +void Gn3sSignalSource::disconnect(gr::top_block_sptr top_block) { if (dump_) { @@ -112,14 +112,14 @@ void Gn3sSignalSource::disconnect(gr_top_block_sptr top_block) } -gr_basic_block_sptr Gn3sSignalSource::get_left_block() +gr::basic_block_sptr Gn3sSignalSource::get_left_block() { LOG_AT_LEVEL(WARNING) << "Left block of a signal source should not be retrieved"; - return gr_block_sptr(); + return gr::block_sptr(); } -gr_basic_block_sptr Gn3sSignalSource::get_right_block() +gr::basic_block_sptr Gn3sSignalSource::get_right_block() { return gn3s_source_; } diff --git a/src/algorithms/signal_source/adapters/gn3s_signal_source.h b/src/algorithms/signal_source/adapters/gn3s_signal_source.h index 78887682a..dee95e778 100644 --- a/src/algorithms/signal_source/adapters/gn3s_signal_source.h +++ b/src/algorithms/signal_source/adapters/gn3s_signal_source.h @@ -32,9 +32,9 @@ #ifndef GN3S_SIGNAL_SOURCE_H_ #define GN3S_SIGNAL_SOURCE_H_ -#include +#include #include "gnss_block_interface.h" -#include +#include class ConfigurationInterface; @@ -46,7 +46,7 @@ class Gn3sSignalSource: public GNSSBlockInterface public: Gn3sSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, - unsigned int out_stream, gr_msg_queue_sptr queue); + unsigned int out_stream, boost::shared_ptr queue); virtual ~Gn3sSignalSource(); std::string role() @@ -79,9 +79,9 @@ private: long samples_; bool dump_; std::string dump_filename_; - gr_block_sptr gn3s_source_; - gr_block_sptr file_sink_; - gr_msg_queue_sptr queue_; + gr::block_sptr gn3s_source_; + gr::blocks::file_sink::sptr file_sink_; + boost::shared_ptr queue_; }; #endif /*GN3S_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/signal_source/adapters/rtlsdr_signal_source.cc b/src/algorithms/signal_source/adapters/rtlsdr_signal_source.cc index ec673230b..67d8b9daf 100644 --- a/src/algorithms/signal_source/adapters/rtlsdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/rtlsdr_signal_source.cc @@ -30,9 +30,7 @@ */ #include "rtlsdr_signal_source.h" -#include -#include -#include +#include #include "configuration_interface.h" #include "gnss_sdr_valve.h" #include @@ -46,7 +44,7 @@ using google::LogMessage; RtlsdrSignalSource::RtlsdrSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, unsigned int out_stream, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) { @@ -74,7 +72,7 @@ RtlsdrSignalSource::RtlsdrSignalSource(ConfigurationInterface* configuration, { item_size_ = sizeof(gr_complex); // 1. Make the driver instance - rtlsdr_source_ = osmosdr_make_source_c(); + rtlsdr_source_ = osmosdr::source::make(); // 2 set sampling rate rtlsdr_source_->set_sample_rate(sample_rate_); @@ -121,7 +119,7 @@ RtlsdrSignalSource::RtlsdrSignalSource(ConfigurationInterface* configuration, if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; - file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); + file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } } @@ -133,7 +131,7 @@ RtlsdrSignalSource::~RtlsdrSignalSource() -void RtlsdrSignalSource::connect(gr_top_block_sptr top_block) +void RtlsdrSignalSource::connect(gr::top_block_sptr top_block) { if (samples_ != 0) { @@ -157,7 +155,7 @@ void RtlsdrSignalSource::connect(gr_top_block_sptr top_block) -void RtlsdrSignalSource::disconnect(gr_top_block_sptr top_block) +void RtlsdrSignalSource::disconnect(gr::top_block_sptr top_block) { if (samples_ != 0) { @@ -178,15 +176,15 @@ void RtlsdrSignalSource::disconnect(gr_top_block_sptr top_block) -gr_basic_block_sptr RtlsdrSignalSource::get_left_block() +gr::basic_block_sptr RtlsdrSignalSource::get_left_block() { LOG_AT_LEVEL(WARNING) << "Trying to get signal source left block."; - return gr_basic_block_sptr(); + return gr::basic_block_sptr(); } -gr_basic_block_sptr RtlsdrSignalSource::get_right_block() +gr::basic_block_sptr RtlsdrSignalSource::get_right_block() { if (samples_ != 0) { diff --git a/src/algorithms/signal_source/adapters/rtlsdr_signal_source.h b/src/algorithms/signal_source/adapters/rtlsdr_signal_source.h index 9e0df3796..81c74022c 100644 --- a/src/algorithms/signal_source/adapters/rtlsdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/rtlsdr_signal_source.h @@ -33,9 +33,10 @@ #define GNSS_SDR_RTLSDR_SIGNAL_SOURCE_H_ #include -#include -#include -#include +#include +//#include +#include +#include #include "gnss_block_interface.h" class ConfigurationInterface; @@ -48,7 +49,7 @@ class RtlsdrSignalSource: public GNSSBlockInterface public: RtlsdrSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, - unsigned int out_stream, gr_msg_queue_sptr queue); + unsigned int out_stream, boost::shared_ptr queue); virtual ~RtlsdrSignalSource(); @@ -69,10 +70,10 @@ public: return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); private: std::string role_; @@ -93,11 +94,11 @@ private: bool dump_; std::string dump_filename_; - boost::shared_ptr rtlsdr_source_; + boost::shared_ptr rtlsdr_source_; - gr_block_sptr valve_; - gr_block_sptr file_sink_; - gr_msg_queue_sptr queue_; + boost::shared_ptr valve_; + gr::blocks::file_sink::sptr file_sink_; + boost::shared_ptr queue_; }; #endif /*GNSS_SDR_RTLSDR_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.cc b/src/algorithms/signal_source/adapters/uhd_signal_source.cc index 00f8256bc..e1fae30ea 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.cc +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.cc @@ -30,10 +30,12 @@ #include "uhd_signal_source.h" //#include -#include +//#include +#include #include #include -#include +//#include +//#include #include "configuration_interface.h" #include "gnss_sdr_valve.h" #include @@ -45,7 +47,7 @@ using google::LogMessage; UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, unsigned int out_stream, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) { @@ -94,7 +96,9 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, // fc32: Complex floating point (32-bit floats) range [-1.0, +1.0]. // sc16: Complex signed integer (16-bit integers) range [-32768, +32767]. // sc8: Complex signed integer (8-bit integers) range [-128, 127]. - uhd_source_ = uhd_make_usrp_source(dev_addr, uhd::stream_args_t("fc32")); + //uhd_source_ = uhd_make_usrp_source(dev_addr, uhd::stream_args_t("fc32")); + uhd_source_ = gr::uhd::usrp_source::make(dev_addr, uhd::stream_args_t("fc32")); + // 2.1 set sampling clock reference // Set the clock source for the usrp device. @@ -174,7 +178,8 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; - file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); + //file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); + file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } } @@ -186,7 +191,7 @@ UhdSignalSource::~UhdSignalSource() -void UhdSignalSource::connect(gr_top_block_sptr top_block) +void UhdSignalSource::connect(gr::top_block_sptr top_block) { if (samples_ != 0) { @@ -210,7 +215,7 @@ void UhdSignalSource::connect(gr_top_block_sptr top_block) -void UhdSignalSource::disconnect(gr_top_block_sptr top_block) +void UhdSignalSource::disconnect(gr::top_block_sptr top_block) { if (samples_ != 0) { @@ -232,15 +237,16 @@ void UhdSignalSource::disconnect(gr_top_block_sptr top_block) -gr_basic_block_sptr UhdSignalSource::get_left_block() +gr::basic_block_sptr UhdSignalSource::get_left_block() { LOG_AT_LEVEL(WARNING) << "Trying to get signal source left block."; - return gr_basic_block_sptr(); + //return gr_basic_block_sptr(); + return gr::uhd::usrp_source::sptr(); } -gr_basic_block_sptr UhdSignalSource::get_right_block() +gr::basic_block_sptr UhdSignalSource::get_right_block() { if (samples_ != 0) { diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.h b/src/algorithms/signal_source/adapters/uhd_signal_source.h index 15953f791..ee163209b 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.h +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.h @@ -32,9 +32,11 @@ #define GNSS_SDR_UHD_SIGNAL_SOURCE_H_ #include -#include -#include -#include +#include +#include +#include +#include +//#include #include "gnss_block_interface.h" class ConfigurationInterface; @@ -48,7 +50,7 @@ class UhdSignalSource: public GNSSBlockInterface public: UhdSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, - unsigned int out_stream, gr_msg_queue_sptr queue); + unsigned int out_stream, boost::shared_ptr queue); virtual ~UhdSignalSource(); @@ -69,10 +71,10 @@ public: return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); private: @@ -95,11 +97,13 @@ private: bool dump_; std::string dump_filename_; - boost::shared_ptr uhd_source_; + //boost::shared_ptr uhd_source_; + gr::uhd::usrp_source::sptr uhd_source_; - gr_block_sptr valve_; - gr_block_sptr file_sink_; - gr_msg_queue_sptr queue_; + boost::shared_ptr valve_; + //gr_block_sptr file_sink_; + gr::blocks::file_sink::sptr file_sink_; + boost::shared_ptr queue_; }; #endif /*GNSS_SDR_UHD_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt b/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt index cea217b64..df3cf5224 100644 --- a/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt @@ -25,9 +25,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/telemetry_decoder/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/telemetry_decoder/libs - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(telemetry_decoder_adapters ${TELEMETRY_DECODER_ADAPTER_SOURCES}) -target_link_libraries(telemetry_decoder_adapters telemetry_decoder_gr_blocks) \ No newline at end of file +target_link_libraries(telemetry_decoder_adapters telemetry_decoder_gr_blocks) diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc index 2e8d18a00..f5fb1bbec 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc @@ -33,7 +33,7 @@ #include "gps_l1_ca_telemetry_decoder.h" #include "configuration_interface.h" #include "gps_l1_ca_telemetry_decoder_cc.h" -#include +#include #include #include @@ -54,7 +54,7 @@ GpsL1CaTelemetryDecoder::GpsL1CaTelemetryDecoder(ConfigurationInterface* configu std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), @@ -93,26 +93,26 @@ void GpsL1CaTelemetryDecoder::set_satellite(Gnss_Satellite satellite) } -void GpsL1CaTelemetryDecoder::connect(gr_top_block_sptr top_block) +void GpsL1CaTelemetryDecoder::connect(gr::top_block_sptr top_block) { // Nothing to connect internally DLOG(INFO) << "nothing to connect internally"; } -void GpsL1CaTelemetryDecoder::disconnect(gr_top_block_sptr top_block) +void GpsL1CaTelemetryDecoder::disconnect(gr::top_block_sptr top_block) { // Nothing to disconnect } -gr_basic_block_sptr GpsL1CaTelemetryDecoder::get_left_block() +gr::basic_block_sptr GpsL1CaTelemetryDecoder::get_left_block() { return telemetry_decoder_; } -gr_basic_block_sptr GpsL1CaTelemetryDecoder::get_right_block() +gr::basic_block_sptr GpsL1CaTelemetryDecoder::get_right_block() { return telemetry_decoder_; } diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h index 0932fa57f..8aaa447b5 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h @@ -35,8 +35,7 @@ #include "telemetry_decoder_interface.h" #include "gps_l1_ca_telemetry_decoder_cc.h" - -#include +#include class ConfigurationInterface; @@ -51,7 +50,7 @@ public: std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); virtual ~GpsL1CaTelemetryDecoder(); std::string role() @@ -64,10 +63,10 @@ public: { return "GPS_L1_CA_Telemetry_Decoder"; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); void set_satellite(Gnss_Satellite satellite); void set_channel(int channel){telemetry_decoder_->set_channel(channel);} void reset() @@ -90,7 +89,7 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; }; #endif diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt index 31d8fe942..ba1b66664 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt @@ -26,9 +26,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/system_parameters ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/telemetry_decoder/libs - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} ) add_library(telemetry_decoder_gr_blocks ${TELEMETRY_DECODER_GR_BLOCKS_SOURCES}) -target_link_libraries(telemetry_decoder_gr_blocks telemetry_decoder_lib gnss_system_parameters) \ No newline at end of file +target_link_libraries(telemetry_decoder_gr_blocks telemetry_decoder_lib gnss_system_parameters) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc index 7244179c2..2f8cea8e3 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -55,7 +55,7 @@ using google::LogMessage; */ gps_l1_ca_telemetry_decoder_cc_sptr gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, gr_msg_queue_sptr queue, bool dump) + int vector_length, boost::shared_ptr queue, bool dump) { return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, if_freq, fs_in, vector_length, queue, dump)); @@ -79,10 +79,10 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc( long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump) : - gr_block ("gps_navigation_cc", gr_make_io_signature (1, 1, sizeof(Gnss_Synchro)), - gr_make_io_signature(1, 1, sizeof(Gnss_Synchro))) + gr::block("gps_navigation_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), + gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { // initialize internal vars d_queue = queue; @@ -118,9 +118,10 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc( } } d_sample_counter = 0; + //d_preamble_code_phase_seconds = 0; d_stat = 0; d_preamble_index = 0; - d_symbol_accumulator=0; + d_symbol_accumulator = 0; d_symbol_accumulator_counter = 0; d_frame_bit_index = 0; d_preamble_time_seconds = 0; @@ -128,9 +129,9 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc( d_GPS_frame_4bytes = 0; d_prev_GPS_frame_4bytes = 0; d_flag_parity = false; - d_TOW_at_Preamble=0; - d_TOW_at_current_symbol=0; - flag_TOW_set=false; + d_TOW_at_Preamble = 0; + d_TOW_at_current_symbol = 0; + flag_TOW_set = false; //set_history(d_samples_per_bit*8); // At least a history of 8 bits are needed to correlate with the preamble } @@ -302,25 +303,26 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i consume_each(1); //one by one Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block //1. Copy the current tracking output - current_synchro_data=in[0][0]; + current_synchro_data = in[0][0]; //2. Add the telemetry decoder information - if (this->d_flag_preamble==true and d_GPS_FSM.d_nav.d_TOW>0) //update TOW at the preamble instant (todo: check for valid d_TOW) - { - d_TOW_at_Preamble=d_GPS_FSM.d_nav.d_TOW+GPS_SUBFRAME_SECONDS; //we decoded the current TOW when the last word of the subframe arrive, so, we have a lag of ONE SUBFRAME - d_TOW_at_current_symbol=d_TOW_at_Preamble+GPS_CA_PREAMBLE_LENGTH_BITS/GPS_CA_TELEMETRY_RATE_BITS_SECOND; - Prn_timestamp_at_preamble_ms=in[0][0].Tracking_timestamp_secs * 1000.0; - if (flag_TOW_set==false) - { - flag_TOW_set=true; - } - }else{ - d_TOW_at_current_symbol=d_TOW_at_current_symbol+GPS_L1_CA_CODE_PERIOD; - } + { + d_TOW_at_Preamble = d_GPS_FSM.d_nav.d_TOW + GPS_SUBFRAME_SECONDS; //we decoded the current TOW when the last word of the subframe arrive, so, we have a lag of ONE SUBFRAME + d_TOW_at_current_symbol = d_TOW_at_Preamble + GPS_CA_PREAMBLE_LENGTH_BITS/GPS_CA_TELEMETRY_RATE_BITS_SECOND; + Prn_timestamp_at_preamble_ms = in[0][0].Tracking_timestamp_secs * 1000.0; + if (flag_TOW_set==false) + { + flag_TOW_set = true; + } + } + else + { + d_TOW_at_current_symbol = d_TOW_at_current_symbol + GPS_L1_CA_CODE_PERIOD; + } - current_synchro_data.d_TOW=d_TOW_at_Preamble; - current_synchro_data.d_TOW_at_current_symbol=d_TOW_at_current_symbol; + current_synchro_data.d_TOW = d_TOW_at_Preamble; + current_synchro_data.d_TOW_at_current_symbol = d_TOW_at_current_symbol; current_synchro_data.Flag_valid_word = (d_flag_frame_sync == true and d_flag_parity == true and flag_TOW_set==true); current_synchro_data.Flag_preamble = d_flag_preamble; current_synchro_data.Prn_timestamp_ms = in[0][0].Tracking_timestamp_secs * 1000.0; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h index 58feb60ad..3af97d0f0 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h @@ -37,8 +37,8 @@ #include "concurrent_queue.h" #include #include -#include -#include +#include +#include //#include #include "gnss_satellite.h" @@ -50,13 +50,13 @@ typedef boost::shared_ptr gps_l1_ca_telemetry_de gps_l1_ca_telemetry_decoder_cc_sptr gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, gr_msg_queue_sptr queue, bool dump); + int vector_length, boost::shared_ptr queue, bool dump); /*! * \brief This class implements a block that decodes the NAV data defined in IS-GPS-200E * */ -class gps_l1_ca_telemetry_decoder_cc : public gr_block +class gps_l1_ca_telemetry_decoder_cc : public gr::block { public: ~gps_l1_ca_telemetry_decoder_cc(); @@ -65,10 +65,10 @@ public: /*! * \brief Set the satellite data queue */ - void set_ephemeris_queue(concurrent_queue *ephemeris_queue){d_GPS_FSM.d_ephemeris_queue=ephemeris_queue;} - void set_iono_queue(concurrent_queue *iono_queue){d_GPS_FSM.d_iono_queue=iono_queue;} - void set_almanac_queue(concurrent_queue *almanac_queue){d_GPS_FSM.d_almanac_queue=almanac_queue;} - void set_utc_model_queue(concurrent_queue *utc_model_queue){d_GPS_FSM.d_utc_model_queue=utc_model_queue;} + void set_ephemeris_queue(concurrent_queue *ephemeris_queue){d_GPS_FSM.d_ephemeris_queue = ephemeris_queue;} + void set_iono_queue(concurrent_queue *iono_queue){d_GPS_FSM.d_iono_queue = iono_queue;} + void set_almanac_queue(concurrent_queue *almanac_queue){d_GPS_FSM.d_almanac_queue = almanac_queue;} + void set_utc_model_queue(concurrent_queue *utc_model_queue){d_GPS_FSM.d_utc_model_queue = utc_model_queue;} int general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); @@ -77,9 +77,9 @@ public: private: friend gps_l1_ca_telemetry_decoder_cc_sptr gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned - int vector_length, gr_msg_queue_sptr queue, bool dump); - gps_l1_ca_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned - int vector_length, gr_msg_queue_sptr queue, bool dump); + int vector_length, boost::shared_ptr queue, bool dump); + gps_l1_ca_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned + int vector_length, boost::shared_ptr queue, bool dump); bool gps_word_parityCheck(unsigned int gpsword); // constants @@ -111,7 +111,7 @@ private: Gps_Navigation_Message d_nav; GpsL1CaSubframeFsm d_GPS_FSM; - gr_msg_queue_sptr d_queue; + boost::shared_ptr d_queue; unsigned int d_vector_length; bool d_dump; Gnss_Satellite d_satellite; diff --git a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt index 5cc415af5..3d0d126da 100644 --- a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt @@ -26,8 +26,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/telemetry_decoder/adapters - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} ) add_library(telemetry_decoder_lib ${TELEMETRY_DECODER_LIB_SOURCES}) diff --git a/src/algorithms/tracking/adapters/CMakeLists.txt b/src/algorithms/tracking/adapters/CMakeLists.txt index 111e3403c..fec8eabf8 100644 --- a/src/algorithms/tracking/adapters/CMakeLists.txt +++ b/src/algorithms/tracking/adapters/CMakeLists.txt @@ -16,7 +16,15 @@ # along with GNSS-SDR. If not, see . # - +#if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +#set(TRACKING_ADAPTER_SOURCES +# galileo_e1_dll_pll_veml_tracking.cc +# galileo_e1_tcp_connector_tracking.cc +# gps_l1_ca_dll_fll_pll_tracking.cc +# gps_l1_ca_dll_pll_tracking.cc +# gps_l1_ca_tcp_connector_tracking.cc +#) +#else(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(TRACKING_ADAPTER_SOURCES galileo_e1_dll_pll_veml_tracking.cc galileo_e1_tcp_connector_tracking.cc @@ -25,6 +33,7 @@ set(TRACKING_ADAPTER_SOURCES gps_l1_ca_dll_pll_tracking.cc gps_l1_ca_tcp_connector_tracking.cc ) +#endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") include_directories( $(CMAKE_CURRENT_SOURCE_DIR) @@ -34,9 +43,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/algorithms/tracking/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/tracking/libs ${CMAKE_SOURCE_DIR}/src/algorithms/libs - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) add_library(tracking_adapters ${TRACKING_ADAPTER_SOURCES}) -target_link_libraries(tracking_adapters tracking_gr_blocks gnss_sp_libs) \ No newline at end of file +target_link_libraries(tracking_adapters tracking_gr_blocks gnss_sp_libs) diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc index 203a9a074..bcef73d7f 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc @@ -41,7 +41,7 @@ #ifdef GNSS_SDR_USE_BOOST_ROUND #include #endif -#include +//#include #include #include @@ -50,7 +50,7 @@ using google::LogMessage; GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { @@ -148,22 +148,22 @@ void GalileoE1DllPllVemlTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) tracking_->set_gnss_synchro(p_gnss_synchro); } -void GalileoE1DllPllVemlTracking::connect(gr_top_block_sptr top_block) +void GalileoE1DllPllVemlTracking::connect(gr::top_block_sptr top_block) { //nothing to connect, now the tracking uses gr_sync_decimator } -void GalileoE1DllPllVemlTracking::disconnect(gr_top_block_sptr top_block) +void GalileoE1DllPllVemlTracking::disconnect(gr::top_block_sptr top_block) { //nothing to disconnect, now the tracking uses gr_sync_decimator } -gr_basic_block_sptr GalileoE1DllPllVemlTracking::get_left_block() +gr::basic_block_sptr GalileoE1DllPllVemlTracking::get_left_block() { return tracking_; } -gr_basic_block_sptr GalileoE1DllPllVemlTracking::get_right_block() +gr::basic_block_sptr GalileoE1DllPllVemlTracking::get_right_block() { return tracking_; } diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h index 33e0bd0c5..791b518ea 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h @@ -39,7 +39,7 @@ #include "tracking_interface.h" #include "galileo_e1_dll_pll_veml_tracking_cc.h" -#include +#include class ConfigurationInterface; @@ -56,7 +56,7 @@ public: std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); virtual ~GalileoE1DllPllVemlTracking(); @@ -75,10 +75,10 @@ public: return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); /*! @@ -110,7 +110,7 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; concurrent_queue *channel_internal_queue_; }; diff --git a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc index 18d63c5f7..0697a02c8 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc @@ -42,7 +42,7 @@ #ifdef GNSS_SDR_USE_BOOST_ROUND #include #endif -#include +//#include #include #include @@ -51,7 +51,7 @@ using google::LogMessage; GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { @@ -152,22 +152,22 @@ void GalileoE1TcpConnectorTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchr tracking_->set_gnss_synchro(p_gnss_synchro); } -void GalileoE1TcpConnectorTracking::connect(gr_top_block_sptr top_block) +void GalileoE1TcpConnectorTracking::connect(gr::top_block_sptr top_block) { //nothing to connect, now the tracking uses gr_sync_decimator } -void GalileoE1TcpConnectorTracking::disconnect(gr_top_block_sptr top_block) +void GalileoE1TcpConnectorTracking::disconnect(gr::top_block_sptr top_block) { //nothing to disconnect, now the tracking uses gr_sync_decimator } -gr_basic_block_sptr GalileoE1TcpConnectorTracking::get_left_block() +gr::basic_block_sptr GalileoE1TcpConnectorTracking::get_left_block() { return tracking_; } -gr_basic_block_sptr GalileoE1TcpConnectorTracking::get_right_block() +gr::basic_block_sptr GalileoE1TcpConnectorTracking::get_right_block() { return tracking_; } diff --git a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h index 1ce79af00..45548f92e 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h +++ b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.h @@ -41,7 +41,7 @@ #include "tracking_interface.h" #include "galileo_e1_tcp_connector_tracking_cc.h" -#include +#include class ConfigurationInterface; @@ -57,7 +57,7 @@ public: std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); virtual ~GalileoE1TcpConnectorTracking(); @@ -75,10 +75,10 @@ public: return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); /*! @@ -110,7 +110,7 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; concurrent_queue *channel_internal_queue_; }; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.cc index a09fec41d..5bba6c900 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.cc @@ -41,7 +41,7 @@ #ifdef GNSS_SDR_USE_BOOST_ROUND #include #endif -#include +//#include #include #include @@ -52,7 +52,7 @@ GpsL1CaDllFllPllTracking::GpsL1CaDllFllPllTracking( std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), @@ -152,22 +152,22 @@ void GpsL1CaDllFllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) return tracking_->set_gnss_synchro(p_gnss_synchro); } -void GpsL1CaDllFllPllTracking::connect(gr_top_block_sptr top_block) +void GpsL1CaDllFllPllTracking::connect(gr::top_block_sptr top_block) { //nothing to connect, now the tracking uses gr_sync_decimator } -void GpsL1CaDllFllPllTracking::disconnect(gr_top_block_sptr top_block) +void GpsL1CaDllFllPllTracking::disconnect(gr::top_block_sptr top_block) { //nothing to disconnect, now the tracking uses gr_sync_decimator } -gr_basic_block_sptr GpsL1CaDllFllPllTracking::get_left_block() +gr::basic_block_sptr GpsL1CaDllFllPllTracking::get_left_block() { return tracking_; } -gr_basic_block_sptr GpsL1CaDllFllPllTracking::get_right_block() +gr::basic_block_sptr GpsL1CaDllFllPllTracking::get_right_block() { return tracking_; } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.h index 55b5eff50..bc0bbe23f 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.h @@ -40,7 +40,7 @@ #include "tracking_interface.h" #include "gps_l1_ca_dll_fll_pll_tracking_cc.h" -#include +#include class ConfigurationInterface; @@ -54,7 +54,7 @@ public: std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); virtual ~GpsL1CaDllFllPllTracking(); @@ -73,10 +73,10 @@ public: return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); void set_channel(unsigned int channel); void set_channel_queue(concurrent_queue *channel_internal_queue); @@ -96,7 +96,7 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; concurrent_queue *channel_internal_queue_; }; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_optim_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_optim_tracking.cc index 090815031..b81031bd0 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_optim_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_optim_tracking.cc @@ -40,7 +40,7 @@ #include "GPS_L1_CA.h" #include "configuration_interface.h" #include -#include +#include #include #include @@ -49,7 +49,7 @@ using google::LogMessage; GpsL1CaDllPllOptimTracking::GpsL1CaDllPllOptimTracking( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { @@ -141,22 +141,22 @@ void GpsL1CaDllPllOptimTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) tracking_->set_gnss_synchro(p_gnss_synchro); } -void GpsL1CaDllPllOptimTracking::connect(gr_top_block_sptr top_block) +void GpsL1CaDllPllOptimTracking::connect(gr::top_block_sptr top_block) { //nothing to connect, now the tracking uses gr_sync_decimator } -void GpsL1CaDllPllOptimTracking::disconnect(gr_top_block_sptr top_block) +void GpsL1CaDllPllOptimTracking::disconnect(gr::top_block_sptr top_block) { //nothing to disconnect, now the tracking uses gr_sync_decimator } -gr_basic_block_sptr GpsL1CaDllPllOptimTracking::get_left_block() +gr::basic_block_sptr GpsL1CaDllPllOptimTracking::get_left_block() { return tracking_; } -gr_basic_block_sptr GpsL1CaDllPllOptimTracking::get_right_block() +gr::basic_block_sptr GpsL1CaDllPllOptimTracking::get_right_block() { return tracking_; } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_optim_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_optim_tracking.h index 87be4f1a9..6969e6bb4 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_optim_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_optim_tracking.h @@ -41,7 +41,7 @@ #include "tracking_interface.h" #include "gps_l1_ca_dll_pll_optim_tracking_cc.h" -#include +#include class ConfigurationInterface; @@ -57,7 +57,7 @@ public: std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); virtual ~GpsL1CaDllPllOptimTracking(); @@ -76,10 +76,10 @@ public: return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); /*! @@ -110,7 +110,7 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; concurrent_queue *channel_internal_queue_; }; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc index 8cfbcf4d7..33e9b291f 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc @@ -41,7 +41,7 @@ #ifdef GNSS_SDR_USE_BOOST_ROUND #include #endif -#include +//#include #include #include @@ -50,7 +50,7 @@ using google::LogMessage; GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { @@ -146,22 +146,22 @@ void GpsL1CaDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) tracking_->set_gnss_synchro(p_gnss_synchro); } -void GpsL1CaDllPllTracking::connect(gr_top_block_sptr top_block) +void GpsL1CaDllPllTracking::connect(gr::top_block_sptr top_block) { //nothing to connect, now the tracking uses gr_sync_decimator } -void GpsL1CaDllPllTracking::disconnect(gr_top_block_sptr top_block) +void GpsL1CaDllPllTracking::disconnect(gr::top_block_sptr top_block) { //nothing to disconnect, now the tracking uses gr_sync_decimator } -gr_basic_block_sptr GpsL1CaDllPllTracking::get_left_block() +gr::basic_block_sptr GpsL1CaDllPllTracking::get_left_block() { return tracking_; } -gr_basic_block_sptr GpsL1CaDllPllTracking::get_right_block() +gr::basic_block_sptr GpsL1CaDllPllTracking::get_right_block() { return tracking_; } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h index 86a66636d..5eb0f9bb7 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h @@ -40,7 +40,7 @@ #include "tracking_interface.h" #include "gps_l1_ca_dll_pll_tracking_cc.h" -#include +#include class ConfigurationInterface; @@ -56,7 +56,7 @@ public: std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); virtual ~GpsL1CaDllPllTracking(); @@ -75,10 +75,10 @@ public: return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); /*! @@ -109,7 +109,7 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; concurrent_queue *channel_internal_queue_; }; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc index f082ddeae..c8bff74da 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc @@ -41,7 +41,7 @@ #ifdef GNSS_SDR_USE_BOOST_ROUND #include #endif -#include +//#include #include #include @@ -50,7 +50,7 @@ using google::LogMessage; GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue) : + boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { @@ -149,22 +149,22 @@ void GpsL1CaTcpConnectorTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) tracking_->set_gnss_synchro(p_gnss_synchro); } -void GpsL1CaTcpConnectorTracking::connect(gr_top_block_sptr top_block) +void GpsL1CaTcpConnectorTracking::connect(gr::top_block_sptr top_block) { //nothing to connect, now the tracking uses gr_sync_decimator } -void GpsL1CaTcpConnectorTracking::disconnect(gr_top_block_sptr top_block) +void GpsL1CaTcpConnectorTracking::disconnect(gr::top_block_sptr top_block) { //nothing to disconnect, now the tracking uses gr_sync_decimator } -gr_basic_block_sptr GpsL1CaTcpConnectorTracking::get_left_block() +gr::basic_block_sptr GpsL1CaTcpConnectorTracking::get_left_block() { return tracking_; } -gr_basic_block_sptr GpsL1CaTcpConnectorTracking::get_right_block() +gr::basic_block_sptr GpsL1CaTcpConnectorTracking::get_right_block() { return tracking_; } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h index ec153a287..1f5c9c265 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.h @@ -40,7 +40,7 @@ #include "tracking_interface.h" #include "gps_l1_ca_tcp_connector_tracking_cc.h" -#include +#include class ConfigurationInterface; @@ -56,7 +56,7 @@ public: std::string role, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); virtual ~GpsL1CaTcpConnectorTracking(); @@ -75,10 +75,10 @@ public: return item_size_; } - void connect(gr_top_block_sptr top_block); - void disconnect(gr_top_block_sptr top_block); - gr_basic_block_sptr get_left_block(); - gr_basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); /*! @@ -109,7 +109,7 @@ private: std::string role_; unsigned int in_streams_; unsigned int out_streams_; - gr_msg_queue_sptr queue_; + boost::shared_ptr queue_; concurrent_queue *channel_internal_queue_; }; diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index 6b2b0c7ea..c05966a62 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -16,6 +16,15 @@ # along with GNSS-SDR. If not, see . # +#if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +#set(TRACKING_GR_BLOCKS_SOURCES +# galileo_e1_dll_pll_veml_tracking_cc.cc +# galileo_e1_tcp_connector_tracking_cc.cc +# gps_l1_ca_dll_fll_pll_tracking_cc.cc +# gps_l1_ca_dll_pll_tracking_cc.cc +# gps_l1_ca_tcp_connector_tracking_cc.cc +#) +#else(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(TRACKING_GR_BLOCKS_SOURCES galileo_e1_dll_pll_veml_tracking_cc.cc galileo_e1_tcp_connector_tracking_cc.cc @@ -24,6 +33,7 @@ set(TRACKING_GR_BLOCKS_SOURCES gps_l1_ca_dll_pll_tracking_cc.cc gps_l1_ca_tcp_connector_tracking_cc.cc ) +#endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") include_directories( $(CMAKE_CURRENT_SOURCE_DIR) @@ -32,9 +42,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/receiver ${CMAKE_SOURCE_DIR}/src/algorithms/tracking/libs ${CMAKE_SOURCE_DIR}/src/algorithms/libs - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} ) add_library(tracking_gr_blocks ${TRACKING_GR_BLOCKS_SOURCES}) -target_link_libraries(tracking_gr_blocks tracking_lib ${GNURADIO_CORE_LIBRARIES} gnss_sp_libs ${Boost_LINK_LIBRARIES} ) \ No newline at end of file +target_link_libraries(tracking_gr_blocks tracking_lib ${GNURADIO_RUNTIME_LIBRARIES} gnss_sp_libs ${Boost_LIBRARIES} ) diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc index 0fa8783ea..22d11e01f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc @@ -46,8 +46,8 @@ #include #include #include -#include "math.h" -#include +//#include "math.h" +#include #include #include @@ -67,7 +67,7 @@ galileo_e1_dll_pll_veml_make_tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -89,15 +89,15 @@ galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips, float very_early_late_space_chips): - gr_block ("galileo_e1_dll_pll_veml_tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(Gnss_Synchro))) + gr::block("galileo_e1_dll_pll_veml_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), + gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { this->set_relative_rate(1.0/vector_length); // initialize internal vars @@ -418,7 +418,7 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect { std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ; ControlMessageFactory* cmf = new ControlMessageFactory(); - if (d_queue != gr_msg_queue_sptr()) + if (d_queue != gr::msg_queue::sptr()) { d_queue->handle(cmf->GetQueueMessage(d_channel, 2)); } @@ -438,7 +438,7 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect // This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0 current_synchro_data.Code_phase_secs = 0; current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad; - current_synchro_data.Carrier_Doppler_hz= (double)d_carrier_doppler_hz; + current_synchro_data.Carrier_Doppler_hz = (double)d_carrier_doppler_hz; current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz; *out[0] = current_synchro_data; diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.h index 40f397307..390a70a61 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.h @@ -40,8 +40,8 @@ #include #include #include -#include -#include +#include +#include #include "concurrent_queue.h" #include "gnss_synchro.h" @@ -52,6 +52,7 @@ class galileo_e1_dll_pll_veml_tracking_cc; + typedef boost::shared_ptr galileo_e1_dll_pll_veml_tracking_cc_sptr; @@ -59,7 +60,7 @@ galileo_e1_dll_pll_veml_tracking_cc_sptr galileo_e1_dll_pll_veml_make_tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -72,7 +73,7 @@ galileo_e1_dll_pll_veml_make_tracking_cc(long if_freq, * Minus Late) tracking block for Galileo E1 signals */ -class galileo_e1_dll_pll_veml_tracking_cc: public gr_block +class galileo_e1_dll_pll_veml_tracking_cc: public gr::block { public: @@ -96,7 +97,7 @@ private: galileo_e1_dll_pll_veml_make_tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -107,7 +108,7 @@ private: galileo_e1_dll_pll_veml_tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -120,7 +121,7 @@ private: void update_local_carrier(); // tracking configuration vars - gr_msg_queue_sptr d_queue; + boost::shared_ptr d_queue; concurrent_queue *d_channel_internal_queue; unsigned int d_vector_length; bool d_dump; diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index 3707aec15..5d1f069cd 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -49,8 +49,8 @@ #include #include #include -#include "math.h" -#include +//#include "math.h" +#include #include #include @@ -72,7 +72,7 @@ galileo_e1_tcp_connector_make_tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -96,7 +96,7 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -104,8 +104,8 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( float early_late_space_chips, float very_early_late_space_chips, size_t port_ch0): - gr_block ("Galileo_E1_Tcp_Connector_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(Gnss_Synchro))) + gr::block("Galileo_E1_Tcp_Connector_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), + gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { this->set_relative_rate(1.0/vector_length); // initialize internal vars @@ -431,7 +431,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_ve { std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ; ControlMessageFactory* cmf = new ControlMessageFactory(); - if (d_queue != gr_msg_queue_sptr()) + if (d_queue != gr::msg_queue::sptr()) { d_queue->handle(cmf->GetQueueMessage(d_channel, 2)); } @@ -447,11 +447,11 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_ve current_synchro_data.Prompt_I = (double)(*d_Prompt).real(); current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag(); // Tracking_timestamp_secs is aligned with the PRN start sample - current_synchro_data.Tracking_timestamp_secs=((double)d_sample_counter+(double)d_next_prn_length_samples+(double)d_next_rem_code_phase_samples)/(double)d_fs_in; + current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter+(double)d_next_prn_length_samples+(double)d_next_rem_code_phase_samples)/(double)d_fs_in; // This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0 - current_synchro_data.Code_phase_secs=0; + current_synchro_data.Code_phase_secs = 0; current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad; - current_synchro_data.Carrier_Doppler_hz= (double)d_carrier_doppler_hz; + current_synchro_data.Carrier_Doppler_hz = (double)d_carrier_doppler_hz; current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz; *out[0] = current_synchro_data; diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h index c202fe46e..970fa8dee 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h @@ -42,9 +42,8 @@ #include #include #include -#include -#include - +#include +#include #include "concurrent_queue.h" #include "gnss_synchro.h" #include "correlator.h" @@ -60,7 +59,7 @@ galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -73,7 +72,7 @@ galileo_e1_tcp_connector_make_tracking_cc(long if_freq, * \brief This class implements a code DLL + carrier PLL VEML (Very Early * Minus Late) tracking block for Galileo E1 signals */ -class Galileo_E1_Tcp_Connector_Tracking_cc: public gr_block +class Galileo_E1_Tcp_Connector_Tracking_cc: public gr::block { public: @@ -97,7 +96,7 @@ private: galileo_e1_tcp_connector_make_tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -109,7 +108,7 @@ private: Galileo_E1_Tcp_Connector_Tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -123,7 +122,7 @@ private: void update_local_carrier(); // tracking configuration vars - gr_msg_queue_sptr d_queue; + boost::shared_ptr d_queue; concurrent_queue *d_channel_internal_queue; unsigned int d_vector_length; bool d_dump; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc index 9b9160010..2ca631a41 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc @@ -48,8 +48,8 @@ #include #include #include -#include "math.h" -#include +//#include "math.h" +#include #include #include @@ -71,7 +71,7 @@ gps_l1_ca_dll_fll_pll_make_tracking_cc( long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, int order, float fll_bw_hz, @@ -98,7 +98,7 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, int order, @@ -106,14 +106,14 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc( float pll_bw_hz, float dll_bw_hz, float early_late_space_chips) : - gr_block ("Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(Gnss_Synchro))) + gr::block("Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), + gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { // initialize internal vars d_queue = queue; d_dump = dump; - d_acquisition_gnss_synchro=NULL; + d_acquisition_gnss_synchro = NULL; d_if_freq = (double)if_freq; d_fs_in = (double)fs_in; @@ -124,7 +124,7 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc( // Initialize tracking variables ========================================== d_carrier_loop_filter.set_params(fll_bw_hz,pll_bw_hz,order); - d_code_loop_filter=Tracking_2nd_DLL_filter(GPS_L1_CA_CODE_PERIOD); + d_code_loop_filter = Tracking_2nd_DLL_filter(GPS_L1_CA_CODE_PERIOD); d_code_loop_filter.set_DLL_BW(dll_bw_hz); // Get space for a vector with the C/A code replica sampled 1x/chip @@ -496,7 +496,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto { std::cout << "Channel " << d_channel << " loss of lock!" << std::endl; ControlMessageFactory* cmf = new ControlMessageFactory(); - if (d_queue != gr_msg_queue_sptr()) { + if (d_queue != gr::msg_queue::sptr()) { d_queue->handle(cmf->GetQueueMessage(d_channel, 2)); } delete cmf; @@ -538,25 +538,25 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto T_prn_samples = T_prn_seconds * d_fs_in; float code_error_filt_samples; - code_error_filt_samples=T_prn_seconds*code_error_filt_chips*T_chip_seconds*(float)d_fs_in; //[seconds] - d_acc_code_phase_samples=d_acc_code_phase_samples+code_error_filt_samples; + code_error_filt_samples = T_prn_seconds*code_error_filt_chips*T_chip_seconds*(float)d_fs_in; //[seconds] + d_acc_code_phase_samples = d_acc_code_phase_samples + code_error_filt_samples; K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_samples; d_current_prn_length_samples = round(K_blk_samples); //round to a discrete sample d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error // ########### Output the tracking data to navigation and PVT ########## - current_synchro_data.Prompt_I=(double)(*d_Prompt).real(); - current_synchro_data.Prompt_Q=(double)(*d_Prompt).imag(); + current_synchro_data.Prompt_I = (double)(*d_Prompt).real(); + current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag(); // Tracking_timestamp_secs is aligned with the PRN start sample - current_synchro_data.Tracking_timestamp_secs=((double)d_sample_counter+(double)d_current_prn_length_samples+d_rem_code_phase_samples)/d_fs_in; + current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter + (double)d_current_prn_length_samples + d_rem_code_phase_samples)/d_fs_in; // This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, Code_phase_secs=0 - current_synchro_data.Code_phase_secs=0; - current_synchro_data.Carrier_phase_rads=d_acc_carrier_phase_rad; - current_synchro_data.Carrier_Doppler_hz=d_carrier_doppler_hz; - current_synchro_data.CN0_dB_hz=d_CN0_SNV_dB_Hz; - current_synchro_data.Flag_valid_tracking=true; - *out[0] =current_synchro_data; + current_synchro_data.Code_phase_secs = 0; + current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad; + current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; + current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz; + current_synchro_data.Flag_valid_tracking = true; + *out[0] = current_synchro_data; } else { diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.h index e54abd958..8775f21e6 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.h @@ -41,8 +41,8 @@ #include #include #include -#include -#include +#include +#include //#include #include "concurrent_queue.h" #include "gps_sdr_signal_processing.h" @@ -53,6 +53,7 @@ #include "correlator.h" class Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc; + typedef boost::shared_ptr gps_l1_ca_dll_fll_pll_tracking_cc_sptr; @@ -61,7 +62,7 @@ gps_l1_ca_dll_fll_pll_make_tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, int order, @@ -75,7 +76,7 @@ gps_l1_ca_dll_fll_pll_make_tracking_cc( /*! * \brief This class implements a DLL and a FLL assisted PLL tracking loop block */ -class Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc: public gr_block +class Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc: public gr::block { public: @@ -111,7 +112,7 @@ private: long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, int order, @@ -124,7 +125,7 @@ private: long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, int order, @@ -137,7 +138,7 @@ private: // class private vars Gnss_Synchro *d_acquisition_gnss_synchro; - gr_msg_queue_sptr d_queue; + boost::shared_ptr d_queue; concurrent_queue *d_channel_internal_queue; unsigned int d_vector_length; bool d_dump; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc index a374bde49..c85c9f2d0 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include @@ -65,7 +65,7 @@ gps_l1_ca_dll_pll_make_optim_tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -81,7 +81,7 @@ gps_l1_ca_dll_pll_make_optim_tracking_cc( void Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) { - ninput_items_required[0] = d_gnuradio_forecast_samples ; //set the required available samples in each call + ninput_items_required[0] = d_gnuradio_forecast_samples; //set the required available samples in each call } @@ -90,14 +90,15 @@ Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips) : - gr_block ("Gps_L1_Ca_Dll_Pll_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(Gnss_Synchro))) + gr::block("Gps_L1_Ca_Dll_Pll_Tracking_cc", + gr::io_signature::make(1, 1, sizeof(gr_complex)), + gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { //gr_sync_decimator ("Gps_L1_Ca_Dll_Pll_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), @@ -108,7 +109,7 @@ Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc( d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; - d_gnuradio_forecast_samples=(int)d_vector_length*2; + d_gnuradio_forecast_samples = (int)d_vector_length*2; d_dump_filename = dump_filename; // Initialize tracking ========================================== @@ -188,7 +189,7 @@ void Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::start_tracking() unsigned long int acq_trk_diff_samples; float acq_trk_diff_seconds; - acq_trk_diff_samples = d_sample_counter - d_acq_sample_stamp;//-d_vector_length; + acq_trk_diff_samples = d_sample_counter - d_acq_sample_stamp; //-d_vector_length; std::cout << "acq_trk_diff_samples=" << acq_trk_diff_samples << std::endl; acq_trk_diff_seconds = (float)acq_trk_diff_samples / (float)d_fs_in; //doppler effect @@ -241,25 +242,25 @@ void Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::start_tracking() int associated_chip_index; int code_length_chips = (int)GPS_L1_CA_CODE_LENGTH_CHIPS; double code_phase_step_chips; - int early_late_spc_samples; - int epl_loop_length_samples; + int early_late_spc_samples; + int epl_loop_length_samples; // unified loop for E, P, L code vectors code_phase_step_chips = ((double)d_code_freq_chips) / ((double)d_fs_in); tcode_chips = 0; // Alternative EPL code generation (40% of speed improvement!) - early_late_spc_samples=round(d_early_late_spc_chips/code_phase_step_chips); - epl_loop_length_samples=d_current_prn_length_samples+early_late_spc_samples*2; + early_late_spc_samples = round(d_early_late_spc_chips / code_phase_step_chips); + epl_loop_length_samples = d_current_prn_length_samples +early_late_spc_samples*2; for (int i=0; iPRN) << std::endl; - DLOG(INFO) << "Start tracking for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " received" << std::endl; + DLOG(INFO) << "Start tracking for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " received"; // enable tracking d_pull_in = true; d_enable_tracking = true; std::cout << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz - << " Code Phase correction [samples]=" << delay_correction_samples - << " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples << std::endl; + << " Code Phase correction [samples]=" << delay_correction_samples + << " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples << std::endl; } @@ -295,8 +296,8 @@ void Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::update_local_code() int associated_chip_index; int code_length_chips = (int)GPS_L1_CA_CODE_LENGTH_CHIPS; double code_phase_step_chips; - int early_late_spc_samples; - int epl_loop_length_samples; + int early_late_spc_samples; + int epl_loop_length_samples; // unified loop for E, P, L code vectors code_phase_step_chips = ((double)d_code_freq_chips) / ((double)d_fs_in); @@ -304,17 +305,17 @@ void Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::update_local_code() tcode_chips = -rem_code_phase_chips; //EPL code generation - early_late_spc_samples=round(d_early_late_spc_chips/code_phase_step_chips); - epl_loop_length_samples=d_current_prn_length_samples+early_late_spc_samples*2; + early_late_spc_samples = round(d_early_late_spc_chips / code_phase_step_chips); + epl_loop_length_samples = d_current_prn_length_samples + early_late_spc_samples*2; for (int i=0; itelemetry_decoder - Gnss_Synchro current_synchro_data; - // Fill the acquisition data - current_synchro_data = *d_acquisition_gnss_synchro; + // 28/11/2011 ACQ to TRK transition BUG CORRECTION + float acq_trk_shif_correction_samples; + int acq_to_trk_delay_samples; + acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; + acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod((float)acq_to_trk_delay_samples, (float)d_current_prn_length_samples); + //std::cout<<"acq_trk_shif_correction="<telemetry_decoder + Gnss_Synchro current_synchro_data; + // Fill the acquisition data + current_synchro_data = *d_acquisition_gnss_synchro; - // Block input data and block output stream pointers - const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignement - Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; + // Block input data and block output stream pointers + const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignement + Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; - // Generate local code and carrier replicas (using \hat{f}_d(k-1)) + // Generate local code and carrier replicas (using \hat{f}_d(k-1)) - //update_local_code(); //disabled in the speed optimized tracking! + //update_local_code(); //disabled in the speed optimized tracking! - update_local_carrier(); + update_local_carrier(); // perform Early, Prompt and Late correlation d_correlator.Carrier_wipeoff_and_EPL_volk_custom(d_current_prn_length_samples, @@ -418,20 +417,20 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec // New code Doppler frequency estimation d_code_freq_chips = GPS_L1_CA_CODE_RATE_HZ + ((d_carrier_doppler_hz * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ); //carrier phase accumulator for (K) doppler estimation - d_acc_carrier_phase_rad=d_acc_carrier_phase_rad+GPS_TWO_PI*d_carrier_doppler_hz*GPS_L1_CA_CODE_PERIOD; - //remanent carrier phase to prevent overflow in the code NCO - d_rem_carr_phase_rad=d_rem_carr_phase_rad+GPS_TWO_PI*d_carrier_doppler_hz*GPS_L1_CA_CODE_PERIOD; - d_rem_carr_phase_rad=fmod(d_rem_carr_phase_rad,GPS_TWO_PI); + d_acc_carrier_phase_rad = d_acc_carrier_phase_rad + GPS_TWO_PI*d_carrier_doppler_hz*GPS_L1_CA_CODE_PERIOD; + //remnant carrier phase to prevent overflow in the code NCO + d_rem_carr_phase_rad = d_rem_carr_phase_rad + GPS_TWO_PI*d_carrier_doppler_hz*GPS_L1_CA_CODE_PERIOD; + d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, GPS_TWO_PI); // ################## DLL ########################################################## // DLL discriminator - code_error_chips =dll_nc_e_minus_l_normalized(*d_Early, *d_Late); //[chips/Ti] + code_error_chips = dll_nc_e_minus_l_normalized(*d_Early, *d_Late); //[chips/Ti] // Code discriminator filter code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); //[chips/second] //Code phase accumulator float code_error_filt_secs; - code_error_filt_secs=(GPS_L1_CA_CODE_PERIOD*code_error_filt_chips)/GPS_L1_CA_CODE_RATE_HZ; //[seconds] - d_acc_code_phase_secs=d_acc_code_phase_secs+code_error_filt_secs; + code_error_filt_secs = (GPS_L1_CA_CODE_PERIOD*code_error_filt_chips) / GPS_L1_CA_CODE_RATE_HZ; //[seconds] + d_acc_code_phase_secs = d_acc_code_phase_secs + code_error_filt_secs; // ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT ####################### @@ -450,51 +449,51 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### - if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES) - { - // fill buffer with prompt correlator output values - d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt; - d_cn0_estimation_counter++; - } - else - { - d_cn0_estimation_counter = 0; - // Code lock indicator - d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS); - // Carrier lock indicator - d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES); - // Loss of lock detection - if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0) - { - d_carrier_lock_fail_counter++; - } - else - { - if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; - } - if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER) - { - std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ; - ControlMessageFactory* cmf = new ControlMessageFactory(); - if (d_queue != gr_msg_queue_sptr()) - { - d_queue->handle(cmf->GetQueueMessage(d_channel, 2)); - } - delete cmf; - d_carrier_lock_fail_counter = 0; - d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine - } - } + if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES) + { + // fill buffer with prompt correlator output values + d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt; + d_cn0_estimation_counter++; + } + else + { + d_cn0_estimation_counter = 0; + // Code lock indicator + d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS); + // Carrier lock indicator + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES); + // Loss of lock detection + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0) + { + d_carrier_lock_fail_counter++; + } + else + { + if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; + } + if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER) + { + std::cout << "Channel " << d_channel << " loss of lock!" << std::endl; + ControlMessageFactory* cmf = new ControlMessageFactory(); + if (d_queue != gr::msg_queue::sptr()) + { + d_queue->handle(cmf->GetQueueMessage(d_channel, 2)); + } + delete cmf; + d_carrier_lock_fail_counter = 0; + d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine + } + } // ########### Output the tracking data to navigation and PVT ########## current_synchro_data.Prompt_I = (double)(*d_Prompt).real(); current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag(); // Tracking_timestamp_secs is aligned with the PRN start sample - current_synchro_data.Tracking_timestamp_secs=((double)d_sample_counter+(double)d_current_prn_length_samples+(double)d_rem_code_phase_samples)/(double)d_fs_in; + current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter + (double)d_current_prn_length_samples + (double)d_rem_code_phase_samples) / (double)d_fs_in; // This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0 - current_synchro_data.Code_phase_secs=0; + current_synchro_data.Code_phase_secs = 0; current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad; - current_synchro_data.Carrier_Doppler_hz= (double)d_carrier_doppler_hz; + current_synchro_data.Carrier_Doppler_hz = (double)d_carrier_doppler_hz; current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz; *out[0] = current_synchro_data; @@ -510,7 +509,7 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec d_last_seg = floor(d_sample_counter / d_fs_in); std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; std::cout << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", Doppler="<PRN) - << ", Doppler="< queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -74,7 +74,7 @@ gps_l1_ca_dll_pll_make_optim_tracking_cc(long if_freq, /*! * \brief This class implements a DLL + PLL tracking loop block */ -class Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc: public gr_block +class Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc: public gr::block { public: @@ -103,7 +103,7 @@ private: gps_l1_ca_dll_pll_make_optim_tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -113,7 +113,7 @@ private: Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -123,7 +123,7 @@ private: void update_local_carrier(); // tracking configuration vars - gr_msg_queue_sptr d_queue; + boost::shared_ptr d_queue; concurrent_queue *d_channel_internal_queue; unsigned int d_vector_length; bool d_dump; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc index 4c3bf59bf..5d2868902 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc @@ -45,8 +45,8 @@ #include #include #include -#include "math.h" -#include +//#include "math.h" +#include #include #include @@ -66,7 +66,7 @@ gps_l1_ca_dll_pll_make_tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -91,14 +91,14 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips) : - gr_block ("Gps_L1_Ca_Dll_Pll_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(Gnss_Synchro))) + gr::block("Gps_L1_Ca_Dll_Pll_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), + gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { //gr_sync_decimator ("Gps_L1_Ca_Dll_Pll_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), @@ -480,7 +480,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in { std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ; ControlMessageFactory* cmf = new ControlMessageFactory(); - if (d_queue != gr_msg_queue_sptr()) + if (d_queue != gr::msg_queue::sptr()) { d_queue->handle(cmf->GetQueueMessage(d_channel, 2)); } @@ -494,11 +494,11 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in current_synchro_data.Prompt_I = (double)(*d_Prompt).real(); current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag(); // Tracking_timestamp_secs is aligned with the PRN start sample - current_synchro_data.Tracking_timestamp_secs=((double)d_sample_counter+(double)d_current_prn_length_samples+(double)d_rem_code_phase_samples)/(double)d_fs_in; + current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter + (double)d_current_prn_length_samples + (double)d_rem_code_phase_samples)/(double)d_fs_in; // This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0 - current_synchro_data.Code_phase_secs=0; + current_synchro_data.Code_phase_secs = 0; current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad; - current_synchro_data.Carrier_Doppler_hz= (double)d_carrier_doppler_hz; + current_synchro_data.Carrier_Doppler_hz = (double)d_carrier_doppler_hz; current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz; *out[0] = current_synchro_data; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.h index 622885db4..f0c55b8b1 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.h @@ -40,8 +40,8 @@ #include #include #include -#include -#include +#include +#include //#include #include "concurrent_queue.h" #include "gps_sdr_signal_processing.h" @@ -54,6 +54,7 @@ class Gps_L1_Ca_Dll_Pll_Tracking_cc; + typedef boost::shared_ptr gps_l1_ca_dll_pll_tracking_cc_sptr; @@ -61,7 +62,7 @@ gps_l1_ca_dll_pll_tracking_cc_sptr gps_l1_ca_dll_pll_make_tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -73,7 +74,7 @@ gps_l1_ca_dll_pll_make_tracking_cc(long if_freq, /*! * \brief This class implements a DLL + PLL tracking loop block */ -class Gps_L1_Ca_Dll_Pll_Tracking_cc: public gr_block +class Gps_L1_Ca_Dll_Pll_Tracking_cc: public gr::block { public: @@ -102,7 +103,7 @@ private: gps_l1_ca_dll_pll_make_tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -112,7 +113,7 @@ private: Gps_L1_Ca_Dll_Pll_Tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -122,7 +123,7 @@ private: void update_local_carrier(); // tracking configuration vars - gr_msg_queue_sptr d_queue; + boost::shared_ptr d_queue; concurrent_queue *d_channel_internal_queue; unsigned int d_vector_length; bool d_dump; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index 28c30b12c..55d4588da 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -47,8 +47,8 @@ #include #include #include -#include "math.h" -#include +//#include "math.h" +#include #include #include #include @@ -69,7 +69,7 @@ gps_l1_ca_tcp_connector_make_tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -95,15 +95,15 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips, size_t port_ch0) : - gr_block ("Gps_L1_Ca_Tcp_Connector_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(Gnss_Synchro))) + gr::block("Gps_L1_Ca_Tcp_Connector_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), + gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { //gr_sync_decimator ("Gps_L1_Ca_Tcp_Connector_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), @@ -518,7 +518,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec { std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ; ControlMessageFactory* cmf = new ControlMessageFactory(); - if (d_queue != gr_msg_queue_sptr()) { + if (d_queue != gr::msg_queue::sptr()) { d_queue->handle(cmf->GetQueueMessage(d_channel, 2)); } delete cmf; @@ -534,7 +534,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag(); current_synchro_data.Tracking_timestamp_secs = d_sample_counter_seconds; current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad; - current_synchro_data.Carrier_Doppler_hz= (double)d_carrier_doppler_hz; + current_synchro_data.Carrier_Doppler_hz = (double)d_carrier_doppler_hz; current_synchro_data.Code_phase_secs = (double)d_code_phase_samples * (1/(float)d_fs_in); current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz; *out[0] = current_synchro_data; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h index 83dea2e56..7aa712739 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h @@ -40,8 +40,8 @@ #include #include #include -#include -#include +#include +#include //#include #include "concurrent_queue.h" #include "gps_sdr_signal_processing.h" @@ -61,7 +61,7 @@ gps_l1_ca_tcp_connector_tracking_cc_sptr gps_l1_ca_tcp_connector_make_tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -74,7 +74,7 @@ gps_l1_ca_tcp_connector_make_tracking_cc(long if_freq, /*! * \brief This class implements a DLL + PLL tracking loop block */ -class Gps_L1_Ca_Tcp_Connector_Tracking_cc: public gr_block +class Gps_L1_Ca_Tcp_Connector_Tracking_cc: public gr::block { public: @@ -103,7 +103,7 @@ private: gps_l1_ca_tcp_connector_make_tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -114,7 +114,7 @@ private: Gps_L1_Ca_Tcp_Connector_Tracking_cc(long if_freq, long fs_in, unsigned int vector_length, - gr_msg_queue_sptr queue, + boost::shared_ptr queue, bool dump, std::string dump_filename, float pll_bw_hz, @@ -125,7 +125,7 @@ private: void update_local_carrier(); // tracking configuration vars - gr_msg_queue_sptr d_queue; + boost::shared_ptr d_queue; concurrent_queue *d_channel_internal_queue; unsigned int d_vector_length; bool d_dump; diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index d0940789d..223e7af14 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -33,10 +33,8 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/system_parameters ${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/receiver - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} ${VOLK_INCLUDE_DIRS} ) add_library(tracking_lib ${TRACKING_LIB_SOURCES}) -target_link_libraries(tracking_lib ${VOLK_LIBRARIES} ${GNURADIO_CORE_LIBRARIES}) \ No newline at end of file +target_link_libraries(tracking_lib ${VOLK_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES}) \ No newline at end of file diff --git a/src/algorithms/tracking/libs/cordic.cc b/src/algorithms/tracking/libs/cordic.cc index a56762317..d706daf2c 100644 --- a/src/algorithms/tracking/libs/cordic.cc +++ b/src/algorithms/tracking/libs/cordic.cc @@ -33,7 +33,8 @@ */ #include -#include +//#include +#include #include "cordic.h" diff --git a/src/algorithms/tracking/libs/correlator.cc b/src/algorithms/tracking/libs/correlator.cc index af004bb5b..d53e4d748 100644 --- a/src/algorithms/tracking/libs/correlator.cc +++ b/src/algorithms/tracking/libs/correlator.cc @@ -34,7 +34,7 @@ */ #include -#include +//#include #include "correlator.h" #define LV_HAVE_SSE3 @@ -55,7 +55,7 @@ unsigned long Correlator::next_power_2(unsigned long v) -void Correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out) +void Correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out) { gr_complex bb_signal_sample(0,0); @@ -77,7 +77,7 @@ void Correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const -void Correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_unaligned) +void Correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_unaligned) { gr_complex* bb_signal; //gr_complex* input_aligned; @@ -85,21 +85,23 @@ void Correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr //todo: do something if posix_memalign fails if (posix_memalign((void**)&bb_signal, 16, signal_length_samples * sizeof(gr_complex)) == 0) {}; - if (input_vector_unaligned==true) - { - //todo: do something if posix_memalign fails - //if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){}; - //memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex)); + if (input_vector_unaligned == true) + { + //todo: do something if posix_memalign fails + //if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){}; + //memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex)); - volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples); - }else{ - /* - * todo: There is a problem with the aligned version of volk_32fc_x2_multiply_32fc_a. - * It crashes even if the is_aligned() work function returns true. Im keeping the unaligned version in both cases.. - */ - //use directly the input vector - volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples); - } + volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples); + } + else + { + /* + * todo: There is a problem with the aligned version of volk_32fc_x2_multiply_32fc_a. + * It crashes even if the is_aligned() work function returns true. Im keeping the unaligned version in both cases.. + */ + //use directly the input vector + volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples); + } volk_32fc_x2_dot_prod_32fc_a(E_out, bb_signal, E_code, signal_length_samples * sizeof(gr_complex)); volk_32fc_x2_dot_prod_32fc_a(P_out, bb_signal, P_code, signal_length_samples * sizeof(gr_complex)); @@ -112,12 +114,12 @@ void Correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr //} } -void Correlator::Carrier_wipeoff_and_EPL_volk_custom(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_unaligned) +void Correlator::Carrier_wipeoff_and_EPL_volk_custom(int signal_length_samples, const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_unaligned) { volk_cw_epl_corr_u(input, carrier, E_code, P_code, L_code, E_out, P_out, L_out, signal_length_samples); } -void Correlator::Carrier_wipeoff_and_VEPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* VE_code,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* VL_code,gr_complex* VE_out,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out,gr_complex* VL_out,bool input_vector_aligned) +void Correlator::Carrier_wipeoff_and_VEPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* VE_code, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* VL_code, gr_complex* VE_out, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* VL_out, bool input_vector_aligned) { gr_complex* bb_signal; gr_complex* input_aligned; @@ -125,17 +127,19 @@ void Correlator::Carrier_wipeoff_and_VEPL_volk(int signal_length_samples,const g //todo: do something if posix_memalign fails if (posix_memalign((void**)&bb_signal, 16, signal_length_samples * sizeof(gr_complex)) == 0) {}; - if (input_vector_aligned==false) - { - //todo: do something if posix_memalign fails - if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){}; - memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex)); + if (input_vector_aligned == false) + { + //todo: do something if posix_memalign fails + if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){}; + memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex)); - volk_32fc_x2_multiply_32fc_a(bb_signal, input_aligned, carrier, signal_length_samples); - }else{ - //use directly the input vector - volk_32fc_x2_multiply_32fc_a(bb_signal, input, carrier, signal_length_samples); - } + volk_32fc_x2_multiply_32fc_a(bb_signal, input_aligned, carrier, signal_length_samples); + } + else + { + //use directly the input vector + volk_32fc_x2_multiply_32fc_a(bb_signal, input, carrier, signal_length_samples); + } volk_32fc_x2_dot_prod_32fc_a(VE_out, bb_signal, VE_code, signal_length_samples * sizeof(gr_complex)); volk_32fc_x2_dot_prod_32fc_a(E_out, bb_signal, E_code, signal_length_samples * sizeof(gr_complex)); @@ -144,16 +148,19 @@ void Correlator::Carrier_wipeoff_and_VEPL_volk(int signal_length_samples,const g volk_32fc_x2_dot_prod_32fc_a(VL_out, bb_signal, VL_code, signal_length_samples * sizeof(gr_complex)); free(bb_signal); - if (input_vector_aligned==false) - { - free(input_aligned); - } + if (input_vector_aligned == false) + { + free(input_aligned); + } } +/* void Correlator::cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a() { // - struct volk_func_desc desc=volk_32fc_x2_dot_prod_32fc_a_get_func_desc(); + //struct volk_func_desc desc=volk_32fc_x2_dot_prod_32fc_a_get_func_desc(); + volk_func_desc_t desc = volk_32fc_x2_dot_prod_32fc_get_func_desc(); + std::vector arch_list; for(int i = 0; i < desc.n_archs; ++i) @@ -187,7 +194,7 @@ void Correlator::cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a() void Correlator::cpu_arch_test_volk_32fc_x2_multiply_32fc_a() { // - struct volk_func_desc desc = volk_32fc_x2_multiply_32fc_a_get_func_desc(); + volk_func_desc_t desc = volk_32fc_x2_multiply_32fc_a_get_func_desc(); std::vector arch_list; for(int i = 0; i < desc.n_archs; ++i) @@ -218,7 +225,7 @@ void Correlator::cpu_arch_test_volk_32fc_x2_multiply_32fc_a() std::cout << "Selected architecture for volk_32fc_x2_multiply_32fc_a_best_arch is " << this->volk_32fc_x2_multiply_32fc_a_best_arch << std::endl; } - +*/ Correlator::Correlator () { diff --git a/src/algorithms/tracking/libs/correlator.h b/src/algorithms/tracking/libs/correlator.h index 4361b2091..f0de57f48 100644 --- a/src/algorithms/tracking/libs/correlator.h +++ b/src/algorithms/tracking/libs/correlator.h @@ -38,7 +38,7 @@ #define GNSS_SDR_CORRELATOR_H_ #include -#include +#include /*! @@ -52,10 +52,10 @@ class Correlator { public: - void Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out); - void Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out,bool input_vector_aligned); - void Carrier_wipeoff_and_EPL_volk_custom(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out,bool input_vector_aligned); - void Carrier_wipeoff_and_VEPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* VE_code,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* VL_code,gr_complex* VE_out,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out,gr_complex* VL_out,bool input_vector_unaligned); + void Carrier_wipeoff_and_EPL_generic(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out); + void Carrier_wipeoff_and_EPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_aligned); + void Carrier_wipeoff_and_EPL_volk_custom(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_aligned); + void Carrier_wipeoff_and_VEPL_volk(int signal_length_samples, const gr_complex* input, gr_complex* carrier, gr_complex* VE_code, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* VL_code, gr_complex* VE_out, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* VL_out, bool input_vector_unaligned); Correlator(); ~Correlator(); private: diff --git a/src/algorithms/tracking/libs/lock_detectors.cc b/src/algorithms/tracking/libs/lock_detectors.cc index abc510cc5..d1fc60471 100644 --- a/src/algorithms/tracking/libs/lock_detectors.cc +++ b/src/algorithms/tracking/libs/lock_detectors.cc @@ -50,7 +50,7 @@ #include "GPS_L1_CA.h" #include "Galileo_E1.h" #include -#include +//#include /* * Signal-to-Noise (SNR) (\f$\rho\f$) estimator using the Signal-to-Noise Variance (SNV) estimator: diff --git a/src/algorithms/tracking/libs/tcp_packet_data.cc b/src/algorithms/tracking/libs/tcp_packet_data.cc index 820574bce..9f63e5ffd 100644 --- a/src/algorithms/tracking/libs/tcp_packet_data.cc +++ b/src/algorithms/tracking/libs/tcp_packet_data.cc @@ -32,11 +32,9 @@ tcp_packet_data::tcp_packet_data() { - - proc_pack_code_error = 0; + proc_pack_code_error = 0; proc_pack_carr_error = 0; proc_pack_carrier_doppler_hz = 0; } -tcp_packet_data::~tcp_packet_data() { -} +tcp_packet_data::~tcp_packet_data() {} diff --git a/src/algorithms/tracking/libs/tracking_2nd_PLL_filter.cc b/src/algorithms/tracking/libs/tracking_2nd_PLL_filter.cc index 09d093e77..3882efd21 100644 --- a/src/algorithms/tracking/libs/tracking_2nd_PLL_filter.cc +++ b/src/algorithms/tracking/libs/tracking_2nd_PLL_filter.cc @@ -53,7 +53,7 @@ void Tracking_2nd_PLL_filter::set_PLL_BW(float pll_bw_hz) { //Calculate filter coefficient values d_pllnoisebandwidth = pll_bw_hz; - calculate_lopp_coef(&d_tau1_carr, &d_tau2_carr, d_pllnoisebandwidth, d_plldampingratio, 0.25);// Calculate filter coefficient values + calculate_lopp_coef(&d_tau1_carr, &d_tau2_carr, d_pllnoisebandwidth, d_plldampingratio, 0.25); // Calculate filter coefficient values } @@ -74,7 +74,7 @@ void Tracking_2nd_PLL_filter::initialize() float Tracking_2nd_PLL_filter::get_carrier_nco(float PLL_discriminator) { float carr_nco; - carr_nco = d_old_carr_nco+(d_tau2_carr/d_tau1_carr)*(PLL_discriminator - d_old_carr_error) + PLL_discriminator * (d_pdi_carr/d_tau1_carr); + carr_nco = d_old_carr_nco + (d_tau2_carr/d_tau1_carr)*(PLL_discriminator - d_old_carr_error) + PLL_discriminator * (d_pdi_carr/d_tau1_carr); d_old_carr_nco = carr_nco; d_old_carr_error = PLL_discriminator; return carr_nco; @@ -84,7 +84,7 @@ Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter (float pdi_carr) { //--- PLL variables -------------------------------------------------------- d_pdi_carr = pdi_carr;// Summation interval for carrier - d_plldampingratio=0.65; + d_plldampingratio = 0.65; } @@ -92,7 +92,7 @@ Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter () { //--- PLL variables -------------------------------------------------------- d_pdi_carr = 0.001;// Summation interval for carrier - d_plldampingratio=0.65; + d_plldampingratio = 0.65; } diff --git a/src/algorithms/tracking/libs/tracking_2nd_PLL_filter.h b/src/algorithms/tracking/libs/tracking_2nd_PLL_filter.h index 4f05b0e59..265200d5d 100644 --- a/src/algorithms/tracking/libs/tracking_2nd_PLL_filter.h +++ b/src/algorithms/tracking/libs/tracking_2nd_PLL_filter.h @@ -59,11 +59,12 @@ private: float d_old_carr_nco; void calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k); + public: void set_PLL_BW(float pll_bw_hz); //! Set PLL loop bandwidth [Hz] void initialize(); float get_carrier_nco(float PLL_discriminator); - Tracking_2nd_PLL_filter(float pdi_carr); + Tracking_2nd_PLL_filter(float pdi_carr); Tracking_2nd_PLL_filter(); ~Tracking_2nd_PLL_filter(); }; diff --git a/src/algorithms/tracking/libs/tracking_FLL_PLL_filter.cc b/src/algorithms/tracking/libs/tracking_FLL_PLL_filter.cc index b25bf70c6..4ed871b3b 100644 --- a/src/algorithms/tracking/libs/tracking_FLL_PLL_filter.cc +++ b/src/algorithms/tracking/libs/tracking_FLL_PLL_filter.cc @@ -34,7 +34,7 @@ #include "tracking_FLL_PLL_filter.h" #include -void Tracking_FLL_PLL_filter::set_params(float fll_bw_hz,float pll_bw_hz, int order) +void Tracking_FLL_PLL_filter::set_params(float fll_bw_hz, float pll_bw_hz, int order) { /* * Filter design (Kaplan 2nd ed., Pag. 181 Fig. 181) @@ -48,12 +48,12 @@ void Tracking_FLL_PLL_filter::set_params(float fll_bw_hz,float pll_bw_hz, int or d_pll_b3 = 2.400; d_pll_a3 = 1.100; d_pll_a2 = 1.414; - d_pll_w0p = pll_bw_hz/0.7845; - d_pll_w0p2 = d_pll_w0p*d_pll_w0p; - d_pll_w0p3 = d_pll_w0p2*d_pll_w0p; + d_pll_w0p = pll_bw_hz / 0.7845; + d_pll_w0p2 = d_pll_w0p * d_pll_w0p; + d_pll_w0p3 = d_pll_w0p2 * d_pll_w0p; - d_pll_w0f = fll_bw_hz/0.53; - d_pll_w0f2 = d_pll_w0f*d_pll_w0f; + d_pll_w0f = fll_bw_hz / 0.53; + d_pll_w0f2 = d_pll_w0f * d_pll_w0f; } else { @@ -61,9 +61,9 @@ void Tracking_FLL_PLL_filter::set_params(float fll_bw_hz,float pll_bw_hz, int or * 2nd order PLL with 1st order FLL assist */ d_pll_a2 = 1.414; - d_pll_w0p = pll_bw_hz/0.53; - d_pll_w0p2 = d_pll_w0p*d_pll_w0p; - d_pll_w0f = fll_bw_hz/0.25; + d_pll_w0p = pll_bw_hz / 0.53; + d_pll_w0p2 = d_pll_w0p * d_pll_w0p; + d_pll_w0f = fll_bw_hz / 0.25; } } @@ -107,9 +107,9 @@ float Tracking_FLL_PLL_filter::get_carrier_error(float FLL_discriminator, float * 2nd order PLL with 1st order FLL assist */ float pll_w_new; - pll_w_new = d_pll_w + PLL_discriminator * d_pll_w0p2 * correlation_time_s + FLL_discriminator * d_pll_w0f * correlation_time_s ; + pll_w_new = d_pll_w + PLL_discriminator * d_pll_w0p2 * correlation_time_s + FLL_discriminator * d_pll_w0f * correlation_time_s; carrier_error_hz = 0.5 * (pll_w_new + d_pll_w) + d_pll_a2 * d_pll_w0p * PLL_discriminator; - d_pll_w =pll_w_new; + d_pll_w = pll_w_new; /*std::cout<<" d_pll_w = "< +#include // All the outputs are in RADIANS /* @@ -46,10 +46,10 @@ * \f$I_{PS2},Q_{PS2}\f$ are the inphase and quadrature prompt correlator outputs respectively at sample time \f$t_2\f$. The output is in [radians/second]. */ -float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2,float t1, float t2) +float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2, float t1, float t2) { - float cross,dot; - dot = prompt_s1.real()*prompt_s2.real() + prompt_s1.imag()*prompt_s2.imag(); + float cross, dot; + dot = prompt_s1.real()*prompt_s2.real() + prompt_s1.imag()*prompt_s2.imag(); cross = prompt_s1.real()*prompt_s2.imag() - prompt_s2.real()*prompt_s1.imag(); return atan2(cross, dot) / (t2-t1); } @@ -116,7 +116,7 @@ float dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1) float dll_nc_vemlp_normalized(gr_complex very_early_s1, gr_complex early_s1, gr_complex late_s1, gr_complex very_late_s1) { float P_early, P_late; - P_early = std::sqrt(std::norm(very_early_s1)+std::norm(early_s1)); - P_late = std::sqrt(std::norm(very_late_s1)+std::norm(late_s1)); + P_early = std::sqrt(std::norm(very_early_s1) + std::norm(early_s1)); + P_late = std::sqrt(std::norm(very_late_s1) + std::norm(late_s1)); return (P_early - P_late) / ((P_early + P_late)); } diff --git a/src/algorithms/tracking/libs/tracking_discriminators.h b/src/algorithms/tracking/libs/tracking_discriminators.h index ee6f0b5bf..465914d57 100644 --- a/src/algorithms/tracking/libs/tracking_discriminators.h +++ b/src/algorithms/tracking/libs/tracking_discriminators.h @@ -50,7 +50,7 @@ * \f$I_{PS1},Q_{PS1}\f$ are the inphase and quadrature prompt correlator outputs respectively at sample time \f$t_1\f$, and * \f$I_{PS2},Q_{PS2}\f$ are the inphase and quadrature prompt correlator outputs respectively at sample time \f$t_2\f$. The output is in [radians/second]. */ -float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2,float t1, float t2); +float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2, float t1, float t2); /*! \brief PLL four quadrant arctan discriminator diff --git a/src/core/interfaces/gnss_block_interface.h b/src/core/interfaces/gnss_block_interface.h index 7960d1c63..59b0d1a6f 100644 --- a/src/core/interfaces/gnss_block_interface.h +++ b/src/core/interfaces/gnss_block_interface.h @@ -38,8 +38,8 @@ #ifndef GNSS_SDR_GNSS_BLOCK_INTERFACE_H_ #define GNSS_SDR_GNSS_BLOCK_INTERFACE_H_ -#include -#include +//#include +#include /*! * \brief This abstract class represents an interface to GNSS blocks. @@ -57,10 +57,10 @@ public: virtual std::string role() = 0; virtual std::string implementation() = 0; virtual size_t item_size() = 0; - virtual void connect(gr_top_block_sptr top_block) = 0; - virtual void disconnect(gr_top_block_sptr top_block) = 0; - virtual gr_basic_block_sptr get_left_block() = 0; - virtual gr_basic_block_sptr get_right_block() = 0; + virtual void connect(gr::top_block_sptr top_block) = 0; + virtual void disconnect(gr::top_block_sptr top_block) = 0; + virtual gr::basic_block_sptr get_left_block() = 0; + virtual gr::basic_block_sptr get_right_block() = 0; }; #endif /*GNSS_SDR_GNSS_BLOCK_INTERFACE_H_*/ diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index 0d9f7421c..dc9f439b5 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -31,7 +31,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/libs/supl ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl + ${GLOG_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} ) add_library(rx_core_lib ${CORE_LIBS_SOURCES}) -target_link_libraries (rx_core_lib supl_library) \ No newline at end of file +target_link_libraries (rx_core_lib supl_library) diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index 70555a9d1..004bd691b 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -34,319 +34,348 @@ gnss_sdr_supl_client::gnss_sdr_supl_client() -{ +{} -} gnss_sdr_supl_client::~gnss_sdr_supl_client() -{ - -} +{} void gnss_sdr_supl_client::print_assistance() { - if (assist.set & SUPL_RRLP_ASSIST_REFTIME) { - fprintf(stdout, "T %ld %ld %ld %ld\n", assist.time.gps_week, assist.time.gps_tow, - assist.time.stamp.tv_sec, assist.time.stamp.tv_usec); - } + if (assist.set & SUPL_RRLP_ASSIST_REFTIME) + { + fprintf(stdout, "T %ld %ld %ld %ld\n", assist.time.gps_week, assist.time.gps_tow, + assist.time.stamp.tv_sec, assist.time.stamp.tv_usec); + } - if (assist.set & SUPL_RRLP_ASSIST_UTC) { - fprintf(stdout, "U %d %d %d %d %d %d %d %d\n", - assist.utc.a0, assist.utc.a1, assist.utc.delta_tls, - assist.utc.tot, assist.utc.wnt, assist.utc.wnlsf, - assist.utc.dn, assist.utc.delta_tlsf); - } + if (assist.set & SUPL_RRLP_ASSIST_UTC) + { + fprintf(stdout, "U %d %d %d %d %d %d %d %d\n", + assist.utc.a0, assist.utc.a1, assist.utc.delta_tls, + assist.utc.tot, assist.utc.wnt, assist.utc.wnlsf, + assist.utc.dn, assist.utc.delta_tlsf); + } - if (assist.set & SUPL_RRLP_ASSIST_REFLOC) { - fprintf(stdout, "L %f %f %d\n", assist.pos.lat, assist.pos.lon, assist.pos.uncertainty); - } + if (assist.set & SUPL_RRLP_ASSIST_REFLOC) + { + fprintf(stdout, "L %f %f %d\n", assist.pos.lat, assist.pos.lon, assist.pos.uncertainty); + } - if (assist.set & SUPL_RRLP_ASSIST_IONO) { - fprintf(stdout, "I %d %d %d %d %d %d %d %d\n", - assist.iono.a0, assist.iono.a1, assist.iono.a2, assist.iono.a3, - assist.iono.b0, assist.iono.b1, assist.iono.b2, assist.iono.b3); - } + if (assist.set & SUPL_RRLP_ASSIST_IONO) + { + fprintf(stdout, "I %d %d %d %d %d %d %d %d\n", + assist.iono.a0, assist.iono.a1, assist.iono.a2, assist.iono.a3, + assist.iono.b0, assist.iono.b1, assist.iono.b2, assist.iono.b3); + } - if (assist.cnt_eph) { - int i; + if (assist.cnt_eph) + { + int i; - fprintf(stdout, "E %d\n", assist.cnt_eph); + fprintf(stdout, "E %d\n", assist.cnt_eph); - for (i = 0; i < assist.cnt_eph; i++) { - struct supl_ephemeris_s *e = &assist.eph[i]; + for (i = 0; i < assist.cnt_eph; i++) + { + struct supl_ephemeris_s *e = &assist.eph[i]; - fprintf(stdout, "e %d %d %d %d %d %d %d %d %d %d", - e->prn, e->delta_n, e->M0, e->A_sqrt, e->OMEGA_0, e->i0, e->w, e->OMEGA_dot, e->i_dot, e->e); - fprintf(stdout, " %d %d %d %d %d %d", - e->Cuc, e->Cus, e->Crc, e->Crs, e->Cic, e->Cis); - fprintf(stdout, " %d %d %d %d %d %d", - e->toe, e->IODC, e->toc, e->AF0, e->AF1, e->AF2); - fprintf(stdout, " %d %d %d %d %d\n", - e->bits, e->ura, e->health, e->tgd, e->AODA); - } - } + fprintf(stdout, "e %d %d %d %d %d %d %d %d %d %d", + e->prn, e->delta_n, e->M0, e->A_sqrt, e->OMEGA_0, e->i0, e->w, e->OMEGA_dot, e->i_dot, e->e); + fprintf(stdout, " %d %d %d %d %d %d", + e->Cuc, e->Cus, e->Crc, e->Crs, e->Cic, e->Cis); + fprintf(stdout, " %d %d %d %d %d %d", + e->toe, e->IODC, e->toc, e->AF0, e->AF1, e->AF2); + fprintf(stdout, " %d %d %d %d %d\n", + e->bits, e->ura, e->health, e->tgd, e->AODA); + } + } - if (assist.cnt_alm) { - int i; + if (assist.cnt_alm) + { + int i; - fprintf(stdout, "A %d\n", assist.cnt_alm); - for (i = 0; i < assist.cnt_alm; i++) { - struct supl_almanac_s *a = &assist.alm[i]; + fprintf(stdout, "A %d\n", assist.cnt_alm); + for (i = 0; i < assist.cnt_alm; i++) + { + struct supl_almanac_s *a = &assist.alm[i]; - fprintf(stdout, "a %d %d %d %d %d ", - a->prn, a->e, a->toa, a->Ksii, a->OMEGA_dot); - fprintf(stdout, "%d %d %d %d %d %d\n", - a->A_sqrt, a->OMEGA_0, a->w, a->M0, a->AF0, a->AF1); - } - } + fprintf(stdout, "a %d %d %d %d %d ", + a->prn, a->e, a->toa, a->Ksii, a->OMEGA_dot); + fprintf(stdout, "%d %d %d %d %d %d\n", + a->A_sqrt, a->OMEGA_0, a->w, a->M0, a->AF0, a->AF1); + } + } - if (assist.cnt_acq) { - int i; + if (assist.cnt_acq) + { + int i; - fprintf(stdout, "Q %d %d\n", assist.cnt_acq, assist.acq_time); - for (i = 0; i < assist.cnt_acq; i++) { - struct supl_acquis_s *q = &assist.acq[i]; + fprintf(stdout, "Q %d %d\n", assist.cnt_acq, assist.acq_time); + for (i = 0; i < assist.cnt_acq; i++) + { + struct supl_acquis_s *q = &assist.acq[i]; - fprintf(stdout, "q %d %d %d ", - q->prn, q->parts, q->doppler0); - if (q->parts & SUPL_ACQUIS_DOPPLER) { - fprintf(stdout, "%d %d ", q->doppler1, q->d_win); - } else { - fprintf(stdout, "0 0 "); - } - fprintf(stdout, "%d %d %d %d ", - q->code_ph, q->code_ph_int, q->bit_num, q->code_ph_win); - if (q->parts & SUPL_ACQUIS_ANGLE) { - fprintf(stdout, "%d %d\n", q->az, q->el); - } else { - fprintf(stdout, "0 0\n"); - } - } - } + fprintf(stdout, "q %d %d %d ", + q->prn, q->parts, q->doppler0); + if (q->parts & SUPL_ACQUIS_DOPPLER) + { + fprintf(stdout, "%d %d ", q->doppler1, q->d_win); + } + else + { + fprintf(stdout, "0 0 "); + } + fprintf(stdout, "%d %d %d %d ", + q->code_ph, q->code_ph_int, q->bit_num, q->code_ph_win); + if (q->parts & SUPL_ACQUIS_ANGLE) + { + fprintf(stdout, "%d %d\n", q->az, q->el); + } + else + { + fprintf(stdout, "0 0\n"); + } + } + } } + + int gnss_sdr_supl_client::get_assistance(int i_mcc, int i_mns, int i_lac, int i_ci) { - // SET SUPL CLIENT INFORMATION - // GSM CELL PARAMETERS - mcc=i_mcc; - mns=i_mns; - lac=i_lac; - ci=i_ci; - supl_set_gsm_cell(&ctx,mcc,mns,lac,ci); + // SET SUPL CLIENT INFORMATION + // GSM CELL PARAMETERS + mcc = i_mcc; + mns = i_mns; + lac = i_lac; + ci = i_ci; + supl_set_gsm_cell(&ctx,mcc,mns,lac,ci); - // PERFORM SUPL COMMUNICATION - char *cstr = new char[server_name.length() + 1]; - strcpy(cstr, server_name.c_str()); + // PERFORM SUPL COMMUNICATION + char *cstr = new char[server_name.length() + 1]; + strcpy(cstr, server_name.c_str()); - int err; - ctx.p.request=request; // select assistance info request from a pre-defined set + int err; + ctx.p.request = request; // select assistance info request from a pre-defined set - //std::cout<<"mcc="<> boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", gps_ephemeris_map); + ifs.close(); + } + catch (std::exception& e) + { + LOG_AT_LEVEL(ERROR)<< e.what() << "File: "<< file_name; + return false; + } return true; } bool gnss_sdr_supl_client::save_ephemeris_xml(const std::string file_name) { - try { - std::ofstream ofs(file_name.c_str(), std::ofstream::trunc | std::ofstream::out); - boost::archive::xml_oarchive xml(ofs); - xml << boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", gps_ephemeris_map); - ofs.close(); - }catch (std::exception& e) - { - LOG_AT_LEVEL(ERROR)<< e.what() << std::endl; - return false; - } + try + { + std::ofstream ofs(file_name.c_str(), std::ofstream::trunc | std::ofstream::out); + boost::archive::xml_oarchive xml(ofs); + xml << boost::serialization::make_nvp("GNSS-SDR_ephemeris_map", gps_ephemeris_map); + ofs.close(); + } + catch (std::exception& e) + { + LOG_AT_LEVEL(ERROR) << e.what(); + return false; + } return true; } diff --git a/src/core/libs/gnss_sdr_supl_client.h b/src/core/libs/gnss_sdr_supl_client.h index c084a9e8d..6ee12718d 100644 --- a/src/core/libs/gnss_sdr_supl_client.h +++ b/src/core/libs/gnss_sdr_supl_client.h @@ -41,11 +41,9 @@ #include #include #include - extern "C" { #include "supl.h" } - #include "GPS_L1_CA.h" #include "gps_ephemeris.h" #include "gps_iono.h" @@ -61,68 +59,66 @@ extern "C" { class gnss_sdr_supl_client { private: - - // GSM CELL INFO - int mcc; - int mns; - int lac; - int ci; - // assistance protocol structure - supl_ctx_t ctx; - // assistance data - supl_assist_t assist; - + // GSM CELL INFO + int mcc; + int mns; + int lac; + int ci; + // assistance protocol structure + supl_ctx_t ctx; + // assistance data + supl_assist_t assist; public: - // SUPL SERVER INFO - std::string server_name; - int server_port; - int request; - // ephemeris map - std::map gps_ephemeris_map; - // almanac map - std::map gps_almanac_map; + // SUPL SERVER INFO + std::string server_name; + int server_port; + int request; + // ephemeris map + std::map gps_ephemeris_map; + // almanac map + std::map gps_almanac_map; - // ionospheric model - Gps_Iono gps_iono; - // reference time - Gps_Ref_Time gps_time; - // UTC model - Gps_Utc_Model gps_utc; - // reference location - Gps_Ref_Location gps_ref_loc; - // Acquisition Assistance map - std::map gps_acq_map; + // ionospheric model + Gps_Iono gps_iono; + // reference time + Gps_Ref_Time gps_time; + // UTC model + Gps_Utc_Model gps_utc; + // reference location + Gps_Ref_Location gps_ref_loc; + // Acquisition Assistance map + std::map gps_acq_map; - /* - * \brief Initiates the TCP SSL SUPL connection to the SUPL server and request assistance data using the provided GSM Base station parameters - * \param i_mcc Current network MCC (Mobile country code), 3 digits. - * \param i_mns Current network MNC (Mobile Network code), 2 or 3 digits. - * \param i_lac Current network LAC (Location area code),16 bits, 1-65520 are valid values. - * \param i_ci Cell Identity (16 bits, 0-65535 are valid values). - * \return Error code -> 0 no errors. - */ - int get_assistance(int i_mcc, int i_mns, int i_lac, int i_ci); - /* - * \brief Read the received SUPL data and stores it into the corresponding class members (gps_ephemeris_map, gps_almanac_map, gps_iono, gps_time, gps_utc, gps_acq_map, and gps_ref_loc) - * - */ - void read_supl_data(); + /* + * \brief Initiates the TCP SSL SUPL connection to the SUPL server and request assistance data using the provided GSM Base station parameters + * \param i_mcc Current network MCC (Mobile country code), 3 digits. + * \param i_mns Current network MNC (Mobile Network code), 2 or 3 digits. + * \param i_lac Current network LAC (Location area code),16 bits, 1-65520 are valid values. + * \param i_ci Cell Identity (16 bits, 0-65535 are valid values). + * \return Error code -> 0 no errors. + */ + int get_assistance(int i_mcc, int i_mns, int i_lac, int i_ci); + /* + * \brief Read the received SUPL data and stores it into the corresponding class members (gps_ephemeris_map, gps_almanac_map, gps_iono, gps_time, gps_utc, gps_acq_map, and gps_ref_loc) + * + */ + void read_supl_data(); - /*! - * \brief Read ephemeris map from XML file - */ - bool load_ephemeris_xml(const std::string file_name); + /*! + * \brief Read ephemeris map from XML file + */ + bool load_ephemeris_xml(const std::string file_name); - /*! - * \brief Save ephemeris map to XML file. - */ - bool save_ephemeris_xml(const std::string file_name); + /*! + * \brief Save ephemeris map to XML file. + */ + bool save_ephemeris_xml(const std::string file_name); - /* - * Prints SUPL data to std::cout. Use it for debug purposes only. - */ - void print_assistance(); - gnss_sdr_supl_client(); + /* + * Prints SUPL data to std::cout. Use it for debug purposes only. + */ + void print_assistance(); + gnss_sdr_supl_client(); ~gnss_sdr_supl_client(); }; diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index ed533f390..92ba365f8 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -54,10 +54,11 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/algorithms/PVT/adapters ${CMAKE_SOURCE_DIR}/src/algorithms/PVT/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs - ${GNURADIO_CORE_INCLUDE_DIRS} ${ARMADILLO_INCLUDE_DIRS} + ${GLOG_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} ) -link_directories(${Boost_LIBRARY_DIR}) + #Enable GN3S module if the driver is present if( $ENV{GN3S_DRIVER} ) @@ -65,12 +66,13 @@ if( $ENV{GN3S_DRIVER} ) add_definitions(-DGN3S_DRIVER) endif($ENV{GN3S_DRIVER} ) -#Enable RTL-SDR module if the driver is present -if( $ENV{RTLSDR_DRIVER} ) - message( "Precompiler RTLSDR_DRIVER enabled" ) - add_definitions(-DRTLSDR_DRIVER) -endif($ENV{RTLSDR_DRIVER} ) - - add_library(gnss_rx ${GNSS_RECEIVER_SOURCES}) -target_link_libraries(gnss_rx ${Boost_LIBRARIES} ${ARMADILLO_LIBRARIES} ${GNURADIO_CORE_LIBRARIES} gnss_system_parameters gnss_sp_libs signal_source_adapters datatype_adapters input_filter_adapters conditioner_adapters resampler_adapters acq_adapters tracking_lib tracking_adapters channel_adapters telemetry_decoder_adapters obs_adapters pvt_adapters pvt_lib out_adapters rx_core_lib) \ No newline at end of file +target_link_libraries(gnss_rx ${Boost_LIBRARIES} ${ARMADILLO_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} + gnss_system_parameters gnss_sp_libs + signal_source_adapters datatype_adapters + input_filter_adapters + conditioner_adapters resampler_adapters + acq_adapters tracking_lib tracking_adapters + channel_adapters telemetry_decoder_adapters + obs_adapters pvt_adapters pvt_lib + out_adapters rx_core_lib) diff --git a/src/core/receiver/concurrent_map.h b/src/core/receiver/concurrent_map.h index 46befeb6d..99ce17059 100644 --- a/src/core/receiver/concurrent_map.h +++ b/src/core/receiver/concurrent_map.h @@ -42,7 +42,7 @@ template */ class concurrent_map { - typedef typename std::map::iterator Data_iterator; //iterator is ambit dependant + typedef typename std::map::iterator Data_iterator; //iterator is ambit dependant private: std::map the_map; boost::mutex the_mutex; @@ -50,16 +50,16 @@ public: void write(int key, Data const& data) { boost::mutex::scoped_lock lock(the_mutex); - the_map.insert(std::pair(key,data)); + the_map.insert(std::pair(key, data)); lock.unlock(); } std::map get_map_copy() - { - boost::mutex::scoped_lock lock(the_mutex); - return the_map; - lock.unlock(); - } + { + boost::mutex::scoped_lock lock(the_mutex); + return the_map; + lock.unlock(); + } int size() { @@ -70,18 +70,21 @@ public: bool read(int key, Data& p_data) { - boost::mutex::scoped_lock lock(the_mutex); - Data_iterator data_iter; - data_iter = the_map.find(key); - if (data_iter != the_map.end()) - { - p_data= data_iter->second; - lock.unlock(); - return true; - }else{ - lock.unlock(); - return false; - } + boost::mutex::scoped_lock lock(the_mutex); + Data_iterator data_iter; + data_iter = the_map.find(key); + if (data_iter != the_map.end()) + { + p_data = data_iter->second; + lock.unlock(); + return true; + } + else + { + lock.unlock(); + return false; + } } }; + #endif diff --git a/src/core/receiver/control_message_factory.cc b/src/core/receiver/control_message_factory.cc index 60e9db787..7aa54a8e6 100644 --- a/src/core/receiver/control_message_factory.cc +++ b/src/core/receiver/control_message_factory.cc @@ -44,14 +44,14 @@ ControlMessageFactory::ControlMessageFactory() ControlMessageFactory::~ControlMessageFactory() {} -gr_message_sptr ControlMessageFactory::GetQueueMessage(unsigned int who, unsigned int what) +boost::shared_ptr ControlMessageFactory::GetQueueMessage(unsigned int who, unsigned int what) { ControlMessage *control_message = new ControlMessage; control_message->who = who; control_message->what = what; - gr_message_sptr queue_message = gr_make_message(0, 0, 0, sizeof(ControlMessage)); + boost::shared_ptr queue_message = gr::message::make(0, 0, 0, sizeof(ControlMessage)); memcpy(queue_message->msg(), control_message, sizeof(ControlMessage)); delete control_message; @@ -59,7 +59,7 @@ gr_message_sptr ControlMessageFactory::GetQueueMessage(unsigned int who, unsigne return queue_message; } -std::vector* ControlMessageFactory::GetControlMessages(gr_message_sptr queue_message) +std::vector* ControlMessageFactory::GetControlMessages(boost::shared_ptr queue_message) { std::vector* control_messages = new std::vector(); unsigned int control_messages_count = queue_message->length() / sizeof(ControlMessage); diff --git a/src/core/receiver/control_message_factory.h b/src/core/receiver/control_message_factory.h index ffc7d3c19..c7ddd3398 100644 --- a/src/core/receiver/control_message_factory.h +++ b/src/core/receiver/control_message_factory.h @@ -33,7 +33,7 @@ #ifndef GNSS_SDR_CONTROL_MESSAGE_FACTORY_H_ #define GNSS_SDR_CONTROL_MESSAGE_FACTORY_H_ -#include +#include //! Message described by who sent it and what it says typedef struct ControlMessage_ @@ -58,8 +58,8 @@ public: //! Virtual destructor virtual ~ControlMessageFactory(); - gr_message_sptr GetQueueMessage(unsigned int who, unsigned int what); - std::vector* GetControlMessages(gr_message_sptr queue_message); + boost::shared_ptr GetQueueMessage(unsigned int who, unsigned int what); + std::vector* GetControlMessages(gr::message::sptr queue_message); }; #endif /*GNSS_SDR_CONTROL_MESSAGE_FACTORY_H_*/ diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 888571b8f..22b56241d 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -41,7 +41,7 @@ #include "concurrent_queue.h" #include "concurrent_map.h" #include -#include +#include #include #include #include @@ -156,7 +156,7 @@ void ControlThread::run() -void ControlThread::set_control_queue(gr_msg_queue_sptr control_queue) +void ControlThread::set_control_queue(boost::shared_ptr control_queue) { if (flowgraph_->running()) { @@ -192,7 +192,7 @@ bool ControlThread::read_assistance_from_XML() void ControlThread::init() { // Instantiates a control queue, a GNSS flowgraph, and a control message factory - control_queue_ = gr_make_msg_queue(0); + control_queue_ = gr::msg_queue::make(0); flowgraph_ = new GNSSFlowgraph(configuration_, control_queue_); control_message_factory_ = new ControlMessageFactory(); stop_ = false; @@ -322,7 +322,7 @@ void ControlThread::init() void ControlThread::read_control_messages() { DLOG(INFO) << "Reading control messages from queue"; - gr_message_sptr queue_message = control_queue_->delete_head(); + boost::shared_ptr queue_message = control_queue_->delete_head(); if (queue_message != 0) { control_messages_ = control_message_factory_->GetControlMessages( @@ -504,7 +504,7 @@ void ControlThread::keyboard_listener() { std::cout << "Quit keystroke order received, stopping GNSS-SDR !!" << std::endl; ControlMessageFactory* cmf = new ControlMessageFactory(); - if (control_queue_ != gr_msg_queue_sptr()) + if (control_queue_ != gr::msg_queue::sptr()) { control_queue_->handle(cmf->GetQueueMessage(200, 0)); } diff --git a/src/core/receiver/control_thread.h b/src/core/receiver/control_thread.h index 33aa05a2e..190493e75 100644 --- a/src/core/receiver/control_thread.h +++ b/src/core/receiver/control_thread.h @@ -36,7 +36,7 @@ #define GNSS_SDR_CONTROL_THREAD_H_ #include -#include +#include #include "control_message_factory.h" #include "gnss_sdr_supl_client.h" @@ -80,7 +80,7 @@ public: * * \param[in] gr_msg_queue_sptr control_queue */ - void set_control_queue(gr_msg_queue_sptr control_queue); + void set_control_queue(boost::shared_ptr control_queue); unsigned int processed_control_messages() @@ -109,12 +109,12 @@ private: /*! * \brief SUPL assistance classes */ - gnss_sdr_supl_client supl_client_acquisition_; - gnss_sdr_supl_client supl_client_ephemeris_; - int supl_mcc; // Current network MCC (Mobile country code), 3 digits. - int supl_mns; //Current network MNC (Mobile Network code), 2 or 3 digits. - int supl_lac; // Current network LAC (Location area code),16 bits, 1-65520 are valid values. - int supl_ci; // Cell Identity (16 bits, 0-65535 are valid values). + gnss_sdr_supl_client supl_client_acquisition_; + gnss_sdr_supl_client supl_client_ephemeris_; + int supl_mcc; // Current network MCC (Mobile country code), 3 digits. + int supl_mns; // Current network MNC (Mobile Network code), 2 or 3 digits. + int supl_lac; // Current network LAC (Location area code),16 bits, 1-65520 are valid values. + int supl_ci; // Cell Identity (16 bits, 0-65535 are valid values). void init(); bool read_assistance_from_XML(); @@ -127,7 +127,7 @@ private: void apply_action(unsigned int what); GNSSFlowgraph *flowgraph_; ConfigurationInterface *configuration_; - gr_msg_queue_sptr control_queue_; + boost::shared_ptr control_queue_; ControlMessageFactory *control_message_factory_; std::vector *control_messages_; bool stop_; diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 2543c1d65..f81a7d6a9 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -86,7 +86,7 @@ GNSSBlockFactory::~GNSSBlockFactory() GNSSBlockInterface* GNSSBlockFactory::GetSignalSource( - ConfigurationInterface *configuration, gr_msg_queue_sptr queue) + ConfigurationInterface *configuration, boost::shared_ptr queue) { std::string default_implementation = "File_Signal_Source"; std::string implementation = configuration->property( @@ -100,7 +100,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetSignalSource( GNSSBlockInterface* GNSSBlockFactory::GetSignalConditioner( - ConfigurationInterface *configuration, gr_msg_queue_sptr queue) + ConfigurationInterface *configuration, boost::shared_ptr queue) { std::string default_implementation = "Pass_Through"; std::string signal_conditioner = configuration->property( @@ -139,7 +139,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetSignalConditioner( GNSSBlockInterface* GNSSBlockFactory::GetObservables( - ConfigurationInterface *configuration, gr_msg_queue_sptr queue) + ConfigurationInterface *configuration, boost::shared_ptr queue) { std::string default_implementation = "GPS_L1_CA_Observables"; std::string implementation = configuration->property( @@ -155,7 +155,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetObservables( GNSSBlockInterface* GNSSBlockFactory::GetPVT( - ConfigurationInterface *configuration, gr_msg_queue_sptr queue) + ConfigurationInterface *configuration, boost::shared_ptr queue) { std::string default_implementation = "Pass_Through"; std::string implementation = configuration->property( @@ -169,7 +169,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetPVT( GNSSBlockInterface* GNSSBlockFactory::GetOutputFilter( - ConfigurationInterface *configuration, gr_msg_queue_sptr queue) + ConfigurationInterface *configuration, boost::shared_ptr queue) { std::string default_implementation = "Null_Sink_Output_Filter"; std::string implementation = configuration->property( @@ -183,7 +183,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetOutputFilter( GNSSBlockInterface* GNSSBlockFactory::GetChannel( ConfigurationInterface *configuration, std::string acq, std::string trk, std::string tlm, int channel, - gr_msg_queue_sptr queue) + boost::shared_ptr queue) { std::stringstream stream; stream << channel; @@ -206,7 +206,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetChannel( std::vector* GNSSBlockFactory::GetChannels( - ConfigurationInterface *configuration, gr_msg_queue_sptr queue) + ConfigurationInterface *configuration, boost::shared_ptr queue) { std::string default_implementation = "Pass_Through"; unsigned int channel_count = @@ -246,7 +246,7 @@ std::vector* GNSSBlockFactory::GetChannels( GNSSBlockInterface* GNSSBlockFactory::GetBlock( ConfigurationInterface *configuration, std::string role, std::string implementation, unsigned int in_streams, - unsigned int out_streams, gr_msg_queue_sptr queue) + unsigned int out_streams, boost::shared_ptr queue) { GNSSBlockInterface* block = NULL; //Change to nullptr when available in compilers (C++11) diff --git a/src/core/receiver/gnss_block_factory.h b/src/core/receiver/gnss_block_factory.h index 9099ffdbe..35b4fef67 100644 --- a/src/core/receiver/gnss_block_factory.h +++ b/src/core/receiver/gnss_block_factory.h @@ -38,7 +38,7 @@ #include #include -#include +#include class ConfigurationInterface; class GNSSBlockInterface; @@ -52,27 +52,27 @@ public: GNSSBlockFactory(); virtual ~GNSSBlockFactory(); GNSSBlockInterface* GetSignalSource( - ConfigurationInterface *configuration, gr_msg_queue_sptr queue); + ConfigurationInterface *configuration, boost::shared_ptr queue); GNSSBlockInterface* GetSignalConditioner( - ConfigurationInterface *configuration, gr_msg_queue_sptr queue); + ConfigurationInterface *configuration, boost::shared_ptr queue); GNSSBlockInterface* GetPVT(ConfigurationInterface *configuration, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); GNSSBlockInterface* GetObservables(ConfigurationInterface *configuration, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); GNSSBlockInterface* GetOutputFilter( - ConfigurationInterface *configuration, gr_msg_queue_sptr queue); + ConfigurationInterface *configuration, boost::shared_ptr queue); GNSSBlockInterface* GetChannel(ConfigurationInterface *configuration, std::string acq, std::string trk, std::string tlm, int channel, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); std::vector* GetChannels( - ConfigurationInterface *configuration, gr_msg_queue_sptr queue); + ConfigurationInterface *configuration, boost::shared_ptr queue); /* * \brief Returns the block with the required configuration and implementation */ GNSSBlockInterface* GetBlock(ConfigurationInterface* configuration, std::string role, std::string implementation, unsigned int in_streams, unsigned int out_streams, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); }; #endif /*GNSS_SDR_BLOCK_FACTORY_H_*/ diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index e720b3047..d66896363 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -47,7 +47,7 @@ using google::LogMessage; GNSSFlowgraph::GNSSFlowgraph(ConfigurationInterface *configuration, - gr_msg_queue_sptr queue) + boost::shared_ptr queue) { connected_ = false; running_ = false; @@ -508,7 +508,7 @@ void GNSSFlowgraph::init() blocks_->push_back(channels->at(i)); } - top_block_ = gr_make_top_block("GNSSFlowgraph"); + top_block_ = gr::make_top_block("GNSSFlowgraph"); delete channels; @@ -539,7 +539,6 @@ void GNSSFlowgraph::set_signals_list() std::set::iterator available_gnss_prn_iter; - /* * Loop to create the list of GNSS Signals * To add signals from other systems, add another loop 'for' @@ -560,7 +559,7 @@ void GNSSFlowgraph::set_signals_list() * Loop to create the list of Galileo E1 B signals */ - std::set available_galileo_prn = { 11, 12 ,19, 20 }; + std::set available_galileo_prn = { 11, 12, 19, 20 }; for (available_gnss_prn_iter = available_galileo_prn.begin(); available_gnss_prn_iter @@ -581,7 +580,6 @@ void GNSSFlowgraph::set_signals_list() for (unsigned int i = 0; i < channels_count_; i++) { - std::string gnss_system = (configuration_->property("Channel" + boost::lexical_cast(i) + ".system", default_system)); diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 6f4b0257a..83637c5f3 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -38,8 +38,8 @@ #include #include #include -#include -#include +#include +#include #include "GPS_L1_CA.h" #include "gnss_signal.h" @@ -60,7 +60,7 @@ public: * \brief Constructor that initializes the receiver flowgraph */ GNSSFlowgraph(ConfigurationInterface* configuration, - gr_msg_queue_sptr queue); + boost::shared_ptr queue); /*! * \brief Virtual destructor @@ -132,8 +132,8 @@ private: ConfigurationInterface *configuration_; GNSSBlockFactory *block_factory_; std::vector* blocks_; - gr_top_block_sptr top_block_; - gr_msg_queue_sptr queue_; + gr::top_block_sptr top_block_; + boost::shared_ptr queue_; std::list available_GNSS_signals_; std::vector channels_state_; }; diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index fbf66225d..acd5d5d85 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -33,6 +33,7 @@ include_directories( $(CMAKE_CURRENT_SOURCE_DIR) ${GLOG_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + ${GFlags_INCLUDE_DIRS} ) link_directories(${Boost_LIBRARY_DIR}) diff --git a/src/core/system_parameters/GPS_L1_CA.h b/src/core/system_parameters/GPS_L1_CA.h index 384e3ce6a..d0d248a6d 100644 --- a/src/core/system_parameters/GPS_L1_CA.h +++ b/src/core/system_parameters/GPS_L1_CA.h @@ -34,7 +34,7 @@ #include #include -#include +#include // std::pair #include // Physical constants @@ -132,11 +132,11 @@ const double PI_TWO_N23 = (3.745070282923929e-007); //!< Pi*2^-23 // SUBFRAME 1-5 (TLM and HOW) -const std::vector> TOW({{31,17}}); -const std::vector> INTEGRITY_STATUS_FLAG({{23,1}}); -const std::vector> ALERT_FLAG({{48,1}}); -const std::vector> ANTI_SPOOFING_FLAG({{49,1}}); -const std::vector> SUBFRAME_ID({{50,3}}); +const std::vector > TOW( { {31,17} } ); +const std::vector > INTEGRITY_STATUS_FLAG({{23,1}}); +const std::vector > ALERT_FLAG({{48,1}}); +const std::vector > ANTI_SPOOFING_FLAG({{49,1}}); +const std::vector > SUBFRAME_ID({{50,3}}); // SUBFRAME 1 diff --git a/src/core/system_parameters/gnss_signal.cc b/src/core/system_parameters/gnss_signal.cc index 19347844a..78c491442 100644 --- a/src/core/system_parameters/gnss_signal.cc +++ b/src/core/system_parameters/gnss_signal.cc @@ -32,14 +32,14 @@ Gnss_Signal::Gnss_Signal() { - this->signal = ""; + this->signal = ""; } Gnss_Signal::Gnss_Signal(Gnss_Satellite satellite_,std::string signal_) { - this->satellite = satellite_; - this->signal = signal_; + this->satellite = satellite_; + this->signal = signal_; } @@ -49,13 +49,13 @@ Gnss_Signal::~Gnss_Signal() std::string Gnss_Signal::get_signal() const { - return this->signal; + return this->signal; } Gnss_Satellite Gnss_Signal::get_satellite() const { - return this->satellite; + return this->satellite; } @@ -67,7 +67,7 @@ std::ostream& operator<<(std::ostream &out, const Gnss_Signal &sig) // output } -bool operator== (const Gnss_Signal &sig1, const Gnss_Signal &sig2) +bool operator==(const Gnss_Signal &sig1, const Gnss_Signal &sig2) { bool equal = false; diff --git a/src/core/system_parameters/gnss_synchro.h b/src/core/system_parameters/gnss_synchro.h index 9c57fbe1b..2bb2ffa02 100644 --- a/src/core/system_parameters/gnss_synchro.h +++ b/src/core/system_parameters/gnss_synchro.h @@ -40,8 +40,6 @@ class Gnss_Synchro { public: - //reset(); - //~Gnss_Synchro(); // Satellite and signal info char System; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) char Signal[3]; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) @@ -56,23 +54,21 @@ public: double Prompt_I; //!< Set by Tracking processing block double Prompt_Q; //!< Set by Tracking processing block double CN0_dB_hz; //!< Set by Tracking processing block - double Carrier_Doppler_hz; //!< Set by Tracking processing block + double Carrier_Doppler_hz; //!< Set by Tracking processing block double Carrier_phase_rads; //!< Set by Tracking processing block //old double Code_phase_secs; //!< Set by Tracking processing block double Tracking_timestamp_secs; //!< Set by Tracking processing block //new unsigned long int PRN_start_sample; //!< Set by Tracking processing block - bool Flag_valid_tracking; //Telemetry Decoder - //double Preamble_timestamp_ms; //!< Set by Telemetry Decoder processing block - double Prn_timestamp_ms;//!< Set by Telemetry Decoder processing block - double Prn_timestamp_at_preamble_ms;//!< Set by Telemetry Decoder processing block - //int Preamble_symbol_counter; //!< Set by Telemetry Decoder processing block - bool Flag_valid_word;//!< Set by Telemetry Decoder processing block - bool Flag_preamble;//!< Set by Telemetry Decoder processing block - double d_TOW; //!< Set by Telemetry Decoder processing block + double Prn_timestamp_ms; //!< Set by Telemetry Decoder processing block + double Prn_timestamp_at_preamble_ms; //!< Set by Telemetry Decoder processing block + + bool Flag_valid_word; //!< Set by Telemetry Decoder processing block + bool Flag_preamble; //!< Set by Telemetry Decoder processing block + double d_TOW; //!< Set by Telemetry Decoder processing block double d_TOW_at_current_symbol; // Pseudorange double Pseudorange_m; diff --git a/src/core/system_parameters/gps_acq_assist.cc b/src/core/system_parameters/gps_acq_assist.cc index dc62cf884..4ee828f92 100644 --- a/src/core/system_parameters/gps_acq_assist.cc +++ b/src/core/system_parameters/gps_acq_assist.cc @@ -32,8 +32,5 @@ #include "gps_acq_assist.h" -Gps_Acq_Assist::Gps_Acq_Assist() -{ - -} +Gps_Acq_Assist::Gps_Acq_Assist() {} diff --git a/src/core/system_parameters/gps_acq_assist.h b/src/core/system_parameters/gps_acq_assist.h index a44a17384..b3061e150 100644 --- a/src/core/system_parameters/gps_acq_assist.h +++ b/src/core/system_parameters/gps_acq_assist.h @@ -45,26 +45,23 @@ */ class Gps_Acq_Assist { -private: - public: + unsigned int i_satellite_PRN; //!< SV PRN NUMBER + double d_TOW; //!< Time Of Week assigned to the acquisition data + double d_Doppler0; //!< Doppler (0 order term) [Hz] + double d_Doppler1; //!< Doppler (1 order term) [Hz] + double dopplerUncertainty; //!< Doppler Uncertainty [Hz] + double Code_Phase; //!< Code phase [chips] + double Code_Phase_int; //!< Integer Code Phase [1 C/A code period] + double GPS_Bit_Number; //!< GPS Bit Number + double Code_Phase_window; //!< Code Phase search window [chips] + double Azimuth; //!< Satellite Azimuth [deg] + double Elevation; //!< Satellite Elevation [deg] - unsigned int i_satellite_PRN; // SV PRN NUMBER - double d_TOW; // Time Of Week assigned to the acquisition data - double d_Doppler0; //Doppler (0 order term) [Hz] - double d_Doppler1; //Doppler (1 order term) [Hz] - double dopplerUncertainty; // Doppler Uncertainty [Hz] - double Code_Phase; // Code phase [Chips] - double Code_Phase_int; // Integer Code Phase [1 C/A code period] - double GPS_Bit_Number; // GPS Bit Number - double Code_Phase_window; // Code Phase search window [Chips] - double Azimuth; // Satellite Azimuth [deg] - double Elevation; // Satellite Elevation [deg] - - /*! - * Default constructor - */ - Gps_Acq_Assist(); + /*! + * Default constructor + */ + Gps_Acq_Assist(); }; #endif diff --git a/src/core/system_parameters/gps_almanac.cc b/src/core/system_parameters/gps_almanac.cc index b6e9c9c04..163a79966 100644 --- a/src/core/system_parameters/gps_almanac.cc +++ b/src/core/system_parameters/gps_almanac.cc @@ -32,8 +32,5 @@ #include "gps_almanac.h" -Gps_Almanac::Gps_Almanac() -{ - -} +Gps_Almanac::Gps_Almanac() {} diff --git a/src/core/system_parameters/gps_almanac.h b/src/core/system_parameters/gps_almanac.h index b0ef51123..ab893e866 100644 --- a/src/core/system_parameters/gps_almanac.h +++ b/src/core/system_parameters/gps_almanac.h @@ -42,22 +42,19 @@ */ class Gps_Almanac { -private: - public: - - unsigned int i_satellite_PRN; // SV PRN NUMBER + unsigned int i_satellite_PRN; //!< SV PRN NUMBER double d_Delta_i; - double d_Toa; //!< Almanac data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] + double d_Toa; //!< Almanac data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] double d_M_0; //!< Mean Anomaly at Reference Time [semi-circles] double d_e_eccentricity; //!< Eccentricity [dimensionless] double d_sqrt_A; //!< Square Root of the Semi-Major Axis [sqrt(m)] double d_OMEGA0; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles] double d_OMEGA; //!< Argument of Perigee [semi-cicles] double d_OMEGA_DOT; //!< Rate of Right Ascension [semi-circles/s] - int i_SV_health; // SV Health - double d_A_f0; //!< Coefficient 0 of code phase offset model [s] - double d_A_f1; //!< Coefficient 1 of code phase offset model [s/s] + int i_SV_health; // SV Health + double d_A_f0; //!< Coefficient 0 of code phase offset model [s] + double d_A_f1; //!< Coefficient 1 of code phase offset model [s/s] /*! * Default constructor diff --git a/src/core/system_parameters/gps_ephemeris.cc b/src/core/system_parameters/gps_ephemeris.cc index bb9c5ae3b..1f64cc26b 100644 --- a/src/core/system_parameters/gps_ephemeris.cc +++ b/src/core/system_parameters/gps_ephemeris.cc @@ -34,255 +34,252 @@ Gps_Ephemeris::Gps_Ephemeris() { + i_satellite_PRN = 0; + d_TOW = 0; + d_Crs = 0; + d_Delta_n = 0; + d_M_0 = 0; + d_Cuc = 0; + d_e_eccentricity = 0; + d_Cus = 0; + d_sqrt_A = 0; + d_Toe = 0; + d_Toc = 0; + d_Cic = 0; + d_OMEGA0 = 0; + d_Cis = 0; + d_i_0 = 0; + d_Crc = 0; + d_OMEGA = 0; + d_OMEGA_DOT = 0; + d_IDOT = 0; + i_code_on_L2 = 0; + i_GPS_week = 0; + b_L2_P_data_flag = false; + i_SV_accuracy = 0; + i_SV_health = 0; + d_TGD = 0; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s] + d_IODC = 0; //!< Issue of Data, Clock + i_AODO = 0; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s] - i_satellite_PRN=0; - d_TOW=0; - d_Crs=0; - d_Delta_n=0; - d_M_0=0; - d_Cuc=0; - d_e_eccentricity=0; - d_Cus=0; - d_sqrt_A=0; - d_Toe=0; - d_Toc=0; - d_Cic=0; - d_OMEGA0=0; - d_Cis=0; - d_i_0=0; - d_Crc=0; - d_OMEGA=0; - d_OMEGA_DOT=0; - d_IDOT=0; - i_code_on_L2=0; - i_GPS_week=0; - b_L2_P_data_flag=false; - i_SV_accuracy=0; - i_SV_health=0; - d_TGD=0; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s] - d_IODC=0; //!< Issue of Data, Clock - i_AODO=0; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s] + b_fit_interval_flag = false;//!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours. + d_spare1 = 0; + d_spare2 = 0; - b_fit_interval_flag=false;//!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours. - d_spare1=0; - d_spare2=0; + d_A_f0 = 0; //!< Coefficient 0 of code phase offset model [s] + d_A_f1 = 0; //!< Coefficient 1 of code phase offset model [s/s] + d_A_f2 = 0; //!< Coefficient 2 of code phase offset model [s/s^2] - d_A_f0=0; //!< Coefficient 0 of code phase offset model [s] - d_A_f1=0; //!< Coefficient 1 of code phase offset model [s/s] - d_A_f2=0; //!< Coefficient 2 of code phase offset model [s/s^2] - - b_integrity_status_flag=false; - b_alert_flag=false; //!< If true, indicates that the SV URA may be worse than indicated in d_SV_accuracy, use that SV at our own risk. - b_antispoofing_flag=false; //!< If true, the AntiSpoofing mode is ON in that SV + b_integrity_status_flag = false; + b_alert_flag = false; //!< If true, indicates that the SV URA may be worse than indicated in d_SV_accuracy, use that SV at our own risk. + b_antispoofing_flag = false; //!< If true, the AntiSpoofing mode is ON in that SV - //Plane A (info from http://www.navcen.uscg.gov/?Do=constellationStatus) - satelliteBlock[9] = "IIA"; - satelliteBlock[31] = "IIR-M"; - satelliteBlock[8] = "IIA"; - satelliteBlock[7] = "IIR-M"; - satelliteBlock[27] = "IIA"; - //Plane B - satelliteBlock[16] = "IIR"; - satelliteBlock[25] = "IIF"; - satelliteBlock[28] = "IIR"; - satelliteBlock[12] = "IIR-M"; - satelliteBlock[30] = "IIA"; - //Plane C - satelliteBlock[29] = "IIR-M"; - satelliteBlock[3] = "IIA"; - satelliteBlock[19] = "IIR"; - satelliteBlock[17] = "IIR-M"; - satelliteBlock[6] = "IIA"; - //Plane D - satelliteBlock[2] = "IIR"; - satelliteBlock[1] = "IIF"; - satelliteBlock[21] = "IIR"; - satelliteBlock[4] = "IIA"; - satelliteBlock[11] = "IIR"; - satelliteBlock[24] = "IIA"; // Decommissioned from active service on 04 Nov 2011 - //Plane E - satelliteBlock[20] = "IIR"; - satelliteBlock[22] = "IIR"; - satelliteBlock[5] = "IIR-M"; - satelliteBlock[18] = "IIR"; - satelliteBlock[32] = "IIA"; - satelliteBlock[10] = "IIA"; - //Plane F - satelliteBlock[14] = "IIR"; - satelliteBlock[15] = "IIR-M"; - satelliteBlock[13] = "IIR"; - satelliteBlock[23] = "IIR"; - satelliteBlock[26] = "IIA"; + //Plane A (info from http://www.navcen.uscg.gov/?Do=constellationStatus) + satelliteBlock[9] = "IIA"; + satelliteBlock[31] = "IIR-M"; + satelliteBlock[8] = "IIA"; + satelliteBlock[7] = "IIR-M"; + satelliteBlock[27] = "IIA"; + //Plane B + satelliteBlock[16] = "IIR"; + satelliteBlock[25] = "IIF"; + satelliteBlock[28] = "IIR"; + satelliteBlock[12] = "IIR-M"; + satelliteBlock[30] = "IIA"; + //Plane C + satelliteBlock[29] = "IIR-M"; + satelliteBlock[3] = "IIA"; + satelliteBlock[19] = "IIR"; + satelliteBlock[17] = "IIR-M"; + satelliteBlock[6] = "IIA"; + //Plane D + satelliteBlock[2] = "IIR"; + satelliteBlock[1] = "IIF"; + satelliteBlock[21] = "IIR"; + satelliteBlock[4] = "IIA"; + satelliteBlock[11] = "IIR"; + satelliteBlock[24] = "IIA"; // Decommissioned from active service on 04 Nov 2011 + //Plane E + satelliteBlock[20] = "IIR"; + satelliteBlock[22] = "IIR"; + satelliteBlock[5] = "IIR-M"; + satelliteBlock[18] = "IIR"; + satelliteBlock[32] = "IIA"; + satelliteBlock[10] = "IIA"; + //Plane F + satelliteBlock[14] = "IIR"; + satelliteBlock[15] = "IIR-M"; + satelliteBlock[13] = "IIR"; + satelliteBlock[23] = "IIR"; + satelliteBlock[26] = "IIA"; } double Gps_Ephemeris::check_t(double time) { - double corrTime; - double half_week = 302400; // seconds - corrTime = time; - if (time > half_week) - { - corrTime = time - 2*half_week; - } - else if (time < -half_week) - { - corrTime = time + 2*half_week; - } - return corrTime; + double corrTime; + double half_week = 302400; // seconds + corrTime = time; + if (time > half_week) + { + corrTime = time - 2*half_week; + } + else if (time < -half_week) + { + corrTime = time + 2*half_week; + } + return corrTime; } // 20.3.3.3.3.1 User Algorithm for SV Clock Correction. -//clkDrift= af0 + af1.*(tTX - toc) + af2.*(tTX - toc).^2; double Gps_Ephemeris::sv_clock_drift(double transmitTime) { - double dt; - dt = check_t(transmitTime - d_Toc); - d_satClkDrift = d_A_f0 + d_A_f1*dt + (d_A_f2 * dt)*(d_A_f2 * dt); - return d_satClkDrift; + double dt; + dt = check_t(transmitTime - d_Toc); + d_satClkDrift = d_A_f0 + d_A_f1*dt + (d_A_f2 * dt)*(d_A_f2 * dt); + return d_satClkDrift; } + // compute the relativistic correction term double Gps_Ephemeris::sv_clock_relativistic_term(double transmitTime) { - double tk; - double a; - double n; - double n0; - double E; - double E_old; - double dE; - double M; + double tk; + double a; + double n; + double n0; + double E; + double E_old; + double dE; + double M; - // Restore semi-major axis - a = d_sqrt_A*d_sqrt_A; + // Restore semi-major axis + a = d_sqrt_A*d_sqrt_A; - // Time from ephemeris reference epoch - tk = check_t(transmitTime - d_Toe); + // Time from ephemeris reference epoch + tk = check_t(transmitTime - d_Toe); - // Computed mean motion - n0 = sqrt(GM / (a*a*a)); - // Corrected mean motion - n = n0 + d_Delta_n; - // Mean anomaly - M = d_M_0 + n * tk; + // Computed mean motion + n0 = sqrt(GM / (a*a*a)); + // Corrected mean motion + n = n0 + d_Delta_n; + // Mean anomaly + M = d_M_0 + n * tk; - // Reduce mean anomaly to between 0 and 2pi - M = fmod((M + 2*GPS_PI), (2*GPS_PI)); + // Reduce mean anomaly to between 0 and 2pi + M = fmod((M + 2*GPS_PI), (2*GPS_PI)); - // Initial guess of eccentric anomaly - E = M; + // Initial guess of eccentric anomaly + E = M; - // --- Iteratively compute eccentric anomaly ---------------------------- - for (int ii = 1; ii<20; ii++) - { - E_old = E; - E = M + d_e_eccentricity * sin(E); - dE = fmod(E - E_old, 2*GPS_PI); - if (fabs(dE) < 1e-12) - { - //Necessary precision is reached, exit from the loop - break; - } - } + // --- Iteratively compute eccentric anomaly ---------------------------- + for (int ii = 1; ii<20; ii++) + { + E_old = E; + E = M + d_e_eccentricity * sin(E); + dE = fmod(E - E_old, 2*GPS_PI); + if (fabs(dE) < 1e-12) + { + //Necessary precision is reached, exit from the loop + break; + } + } - // Compute relativistic correction term - d_dtr = F * d_e_eccentricity * d_sqrt_A * sin(E); - return d_dtr; + // Compute relativistic correction term + d_dtr = F * d_e_eccentricity * d_sqrt_A * sin(E); + return d_dtr; } + void Gps_Ephemeris::satellitePosition(double transmitTime) { - double tk; - double a; - double n; - double n0; - double M; - double E; - double E_old; - double dE; - double nu; - double phi; - double u; - double r; - double i; - double Omega; + double tk; + double a; + double n; + double n0; + double M; + double E; + double E_old; + double dE; + double nu; + double phi; + double u; + double r; + double i; + double Omega; - // Find satellite's position ---------------------------------------------- + // Find satellite's position ---------------------------------------------- - // Restore semi-major axis - a = d_sqrt_A*d_sqrt_A; + // Restore semi-major axis + a = d_sqrt_A*d_sqrt_A; - // Time from ephemeris reference epoch - tk = check_t(transmitTime - d_Toe); + // Time from ephemeris reference epoch + tk = check_t(transmitTime - d_Toe); - // Computed mean motion - n0 = sqrt(GM / (a*a*a)); + // Computed mean motion + n0 = sqrt(GM / (a*a*a)); - // Corrected mean motion - n = n0 + d_Delta_n; + // Corrected mean motion + n = n0 + d_Delta_n; - // Mean anomaly - M = d_M_0 + n * tk; + // Mean anomaly + M = d_M_0 + n * tk; - // Reduce mean anomaly to between 0 and 2pi - M = fmod((M + 2*GPS_PI), (2*GPS_PI)); + // Reduce mean anomaly to between 0 and 2pi + M = fmod((M + 2*GPS_PI), (2*GPS_PI)); - // Initial guess of eccentric anomaly - E = M; + // Initial guess of eccentric anomaly + E = M; - // --- Iteratively compute eccentric anomaly ---------------------------- - for (int ii = 1; ii<20; ii++) - { - E_old = E; - E = M + d_e_eccentricity * sin(E); - dE = fmod(E - E_old, 2*GPS_PI); - if (fabs(dE) < 1e-12) - { - //Necessary precision is reached, exit from the loop - break; - } - } + // --- Iteratively compute eccentric anomaly ---------------------------- + for (int ii = 1; ii<20; ii++) + { + E_old = E; + E = M + d_e_eccentricity * sin(E); + dE = fmod(E - E_old, 2*GPS_PI); + if (fabs(dE) < 1e-12) + { + //Necessary precision is reached, exit from the loop + break; + } + } - // Compute relativistic correction term (now is in sepparated function) - //d_dtr = F * d_e_eccentricity * d_sqrt_A * sin(E); + // Compute the true anomaly + double tmp_Y = sqrt(1.0 - d_e_eccentricity * d_e_eccentricity) * sin(E); + double tmp_X = cos(E) - d_e_eccentricity; + nu = atan2(tmp_Y, tmp_X); - // Compute the true anomaly - double tmp_Y = sqrt(1.0 - d_e_eccentricity * d_e_eccentricity) * sin(E); - double tmp_X = cos(E) - d_e_eccentricity; - nu = atan2(tmp_Y, tmp_X); + // Compute angle phi (argument of Latitude) + phi = nu + d_OMEGA; - // Compute angle phi (argument of Latitude) - phi = nu + d_OMEGA; + // Reduce phi to between 0 and 2*pi rad + phi = fmod((phi), (2*GPS_PI)); - // Reduce phi to between 0 and 2*pi rad - phi = fmod((phi), (2*GPS_PI)); + // Correct argument of latitude + u = phi + d_Cuc * cos(2*phi) + d_Cus * sin(2*phi); - // Correct argument of latitude - u = phi + d_Cuc * cos(2*phi) + d_Cus * sin(2*phi); + // Correct radius + r = a * (1 - d_e_eccentricity*cos(E)) + d_Crc * cos(2*phi) + d_Crs * sin(2*phi); - // Correct radius - r = a * (1 - d_e_eccentricity*cos(E)) + d_Crc * cos(2*phi) + d_Crs * sin(2*phi); + // Correct inclination + i = d_i_0 + d_IDOT * tk + d_Cic * cos(2*phi) + d_Cis * sin(2*phi); - // Correct inclination - i = d_i_0 + d_IDOT * tk + d_Cic * cos(2*phi) + d_Cis * sin(2*phi); + // Compute the angle between the ascending node and the Greenwich meridian + Omega = d_OMEGA0 + (d_OMEGA_DOT - OMEGA_EARTH_DOT)*tk - OMEGA_EARTH_DOT * d_Toe; - // Compute the angle between the ascending node and the Greenwich meridian - Omega = d_OMEGA0 + (d_OMEGA_DOT - OMEGA_EARTH_DOT)*tk - OMEGA_EARTH_DOT * d_Toe; + // Reduce to between 0 and 2*pi rad + Omega = fmod((Omega + 2*GPS_PI), (2*GPS_PI)); - // Reduce to between 0 and 2*pi rad - Omega = fmod((Omega + 2*GPS_PI), (2*GPS_PI)); + // --- Compute satellite coordinates in Earth-fixed coordinates + d_satpos_X = cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega); + d_satpos_Y = cos(u) * r * sin(Omega) + sin(u) * r * cos(i) * cos(Omega); + d_satpos_Z = sin(u) * r * sin(i); - // --- Compute satellite coordinates in Earth-fixed coordinates - d_satpos_X = cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega); - d_satpos_Y = cos(u) * r * sin(Omega) + sin(u) * r * cos(i) * cos(Omega); - d_satpos_Z = sin(u) * r * sin(i); - - // Satellite's velocity. Can be useful for Vector Tracking loops - double Omega_dot = d_OMEGA_DOT - OMEGA_EARTH_DOT; - d_satvel_X = - Omega_dot * (cos(u) * r + sin(u) * r * cos(i)) + d_satpos_X * cos(Omega) - d_satpos_Y * cos(i) * sin(Omega); - d_satvel_Y = Omega_dot * (cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega)) + d_satpos_X * sin(Omega) + d_satpos_Y * cos(i) * cos(Omega); - d_satvel_Z = d_satpos_Y * sin(i); + // Satellite's velocity. Can be useful for Vector Tracking loops + double Omega_dot = d_OMEGA_DOT - OMEGA_EARTH_DOT; + d_satvel_X = - Omega_dot * (cos(u) * r + sin(u) * r * cos(i)) + d_satpos_X * cos(Omega) - d_satpos_Y * cos(i) * sin(Omega); + d_satvel_Y = Omega_dot * (cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega)) + d_satpos_X * sin(Omega) + d_satpos_Y * cos(i) * cos(Omega); + d_satvel_Z = d_satpos_Y * sin(i); } diff --git a/src/core/system_parameters/gps_ephemeris.h b/src/core/system_parameters/gps_ephemeris.h index c4d439386..995d73757 100644 --- a/src/core/system_parameters/gps_ephemeris.h +++ b/src/core/system_parameters/gps_ephemeris.h @@ -36,7 +36,6 @@ #include #include "boost/assign.hpp" #include - #include "GPS_L1_CA.h" @@ -115,7 +114,7 @@ public: bool b_antispoofing_flag; //!< If true, the AntiSpoofing mode is ON in that SV // clock terms derived from ephemeris data - double d_satClkDrift; // GPS clock error + double d_satClkDrift; // GPS clock error double d_dtr; // relativistic clock correction term // satellite positions diff --git a/src/core/system_parameters/gps_iono.cc b/src/core/system_parameters/gps_iono.cc index 1ec73785a..0feae970a 100644 --- a/src/core/system_parameters/gps_iono.cc +++ b/src/core/system_parameters/gps_iono.cc @@ -34,7 +34,7 @@ Gps_Iono::Gps_Iono() { - valid=false; + valid = false; } diff --git a/src/core/system_parameters/gps_iono.h b/src/core/system_parameters/gps_iono.h index 6aa0a11fd..d65e603e8 100644 --- a/src/core/system_parameters/gps_iono.h +++ b/src/core/system_parameters/gps_iono.h @@ -45,9 +45,8 @@ class Gps_Iono private: public: - - // valid flag - bool valid; + // valid flag + bool valid; // Ionospheric parameters double d_alpha0; //!< Coefficient 0 of a cubic equation representing the amplitude of the vertical delay [s] double d_alpha1; //!< Coefficient 1 of a cubic equation representing the amplitude of the vertical delay [s/semi-circle] diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index 6c73d15b3..5f53d02f1 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -31,182 +31,181 @@ */ #include "gps_navigation_message.h" -#include #include "boost/date_time/posix_time/posix_time.hpp" void Gps_Navigation_Message::reset() { - b_valid_ephemeris_set_flag = false; - d_TOW = 0; - d_TOW_SF1 = 0; - d_TOW_SF2 = 0; - d_TOW_SF3 = 0; - d_TOW_SF4 = 0; - d_TOW_SF5 = 0; + b_valid_ephemeris_set_flag = false; + d_TOW = 0; + d_TOW_SF1 = 0; + d_TOW_SF2 = 0; + d_TOW_SF3 = 0; + d_TOW_SF4 = 0; + d_TOW_SF5 = 0; - d_IODE_SF2 = 0; - d_IODE_SF3 = 0; - d_Crs = 0; - d_Delta_n = 0; - d_M_0 = 0; - d_Cuc = 0; - d_e_eccentricity = 0; - d_Cus = 0; - d_sqrt_A = 0; - d_Toe = 0; - d_Toc = 0; - d_Cic = 0; - d_OMEGA0 = 0; - d_Cis = 0; - d_i_0 = 0; - d_Crc = 0; - d_OMEGA = 0; - d_OMEGA_DOT = 0; - d_IDOT = 0; - i_code_on_L2 = 0; - i_GPS_week = 0; - b_L2_P_data_flag = false; - i_SV_accuracy = 0; - i_SV_health = 0; - d_TGD = 0; - d_IODC = -1; - i_AODO = 0; + d_IODE_SF2 = 0; + d_IODE_SF3 = 0; + d_Crs = 0; + d_Delta_n = 0; + d_M_0 = 0; + d_Cuc = 0; + d_e_eccentricity = 0; + d_Cus = 0; + d_sqrt_A = 0; + d_Toe = 0; + d_Toc = 0; + d_Cic = 0; + d_OMEGA0 = 0; + d_Cis = 0; + d_i_0 = 0; + d_Crc = 0; + d_OMEGA = 0; + d_OMEGA_DOT = 0; + d_IDOT = 0; + i_code_on_L2 = 0; + i_GPS_week = 0; + b_L2_P_data_flag = false; + i_SV_accuracy = 0; + i_SV_health = 0; + d_TGD = 0; + d_IODC = -1; + i_AODO = 0; - b_fit_interval_flag = false; - d_spare1 = 0; - d_spare2 = 0; + b_fit_interval_flag = false; + d_spare1 = 0; + d_spare2 = 0; - d_A_f0 = 0; - d_A_f1 = 0; - d_A_f2 = 0; + d_A_f0 = 0; + d_A_f1 = 0; + d_A_f2 = 0; - //clock terms - //d_master_clock=0; - d_dtr = 0; - d_satClkCorr = 0; + //clock terms + //d_master_clock=0; + d_dtr = 0; + d_satClkCorr = 0; - // satellite positions - d_satpos_X = 0; - d_satpos_Y = 0; - d_satpos_Z = 0; + // satellite positions + d_satpos_X = 0; + d_satpos_Y = 0; + d_satpos_Z = 0; - // info - i_channel_ID = 0; - i_satellite_PRN = 0; + // info + i_channel_ID = 0; + i_satellite_PRN = 0; - // time synchro - d_subframe_timestamp_ms = 0; + // time synchro + d_subframe_timestamp_ms = 0; - // flags - b_alert_flag = false; - b_integrity_status_flag = false; - b_antispoofing_flag = false; + // flags + b_alert_flag = false; + b_integrity_status_flag = false; + b_antispoofing_flag = false; - // Ionosphere and UTC - flag_iono_valid=false; - flag_utc_model_valid=true; - d_alpha0 = 0; - d_alpha1 = 0; - d_alpha2 = 0; - d_alpha3 = 0; - d_beta0 = 0; - d_beta1 = 0; - d_beta2 = 0; - d_beta3 = 0; - d_A1 = 0; - d_A0 = 0; - d_t_OT = 0; - i_WN_T = 0; - d_DeltaT_LS = 0; - i_WN_LSF = 0; - i_DN = 0; - d_DeltaT_LSF= 0; + // Ionosphere and UTC + flag_iono_valid = false; + flag_utc_model_valid = true; + d_alpha0 = 0; + d_alpha1 = 0; + d_alpha2 = 0; + d_alpha3 = 0; + d_beta0 = 0; + d_beta1 = 0; + d_beta2 = 0; + d_beta3 = 0; + d_A1 = 0; + d_A0 = 0; + d_t_OT = 0; + i_WN_T = 0; + d_DeltaT_LS = 0; + i_WN_LSF = 0; + i_DN = 0; + d_DeltaT_LSF= 0; - //Almanac - d_Toa = 0; - i_WN_A = 0; - for (int i=1; i < 32; i++ ) - { - almanacHealth[i] = 0; - } + //Almanac + d_Toa = 0; + i_WN_A = 0; + for (int i=1; i < 32; i++ ) + { + almanacHealth[i] = 0; + } - // Satellite velocity - d_satvel_X = 0; - d_satvel_Y = 0; - d_satvel_Z = 0; + // Satellite velocity + d_satvel_X = 0; + d_satvel_Y = 0; + d_satvel_Z = 0; - //Plane A (info from http://www.navcen.uscg.gov/?Do=constellationStatus) - satelliteBlock[9] = "IIA"; - satelliteBlock[31] = "IIR-M"; - satelliteBlock[8] = "IIA"; - satelliteBlock[7] = "IIR-M"; - satelliteBlock[27] = "IIA"; - //Plane B - satelliteBlock[16] = "IIR"; - satelliteBlock[25] = "IIF"; - satelliteBlock[28] = "IIR"; - satelliteBlock[12] = "IIR-M"; - satelliteBlock[30] = "IIA"; - //Plane C - satelliteBlock[29] = "IIR-M"; - satelliteBlock[3] = "IIA"; - satelliteBlock[19] = "IIR"; - satelliteBlock[17] = "IIR-M"; - satelliteBlock[6] = "IIA"; - //Plane D - satelliteBlock[2] = "IIR"; - satelliteBlock[1] = "IIF"; - satelliteBlock[21] = "IIR"; - satelliteBlock[4] = "IIA"; - satelliteBlock[11] = "IIR"; - satelliteBlock[24] = "IIA"; // Decommissioned from active service on 04 Nov 2011 - //Plane E - satelliteBlock[20] = "IIR"; - satelliteBlock[22] = "IIR"; - satelliteBlock[5] = "IIR-M"; - satelliteBlock[18] = "IIR"; - satelliteBlock[32] = "IIA"; - satelliteBlock[10] = "IIA"; - //Plane F - satelliteBlock[14] = "IIR"; - satelliteBlock[15] = "IIR-M"; - satelliteBlock[13] = "IIR"; - satelliteBlock[23] = "IIR"; - satelliteBlock[26] = "IIA"; + //Plane A (info from http://www.navcen.uscg.gov/?Do=constellationStatus) + satelliteBlock[9] = "IIA"; + satelliteBlock[31] = "IIR-M"; + satelliteBlock[8] = "IIA"; + satelliteBlock[7] = "IIR-M"; + satelliteBlock[27] = "IIA"; + //Plane B + satelliteBlock[16] = "IIR"; + satelliteBlock[25] = "IIF"; + satelliteBlock[28] = "IIR"; + satelliteBlock[12] = "IIR-M"; + satelliteBlock[30] = "IIA"; + //Plane C + satelliteBlock[29] = "IIR-M"; + satelliteBlock[3] = "IIA"; + satelliteBlock[19] = "IIR"; + satelliteBlock[17] = "IIR-M"; + satelliteBlock[6] = "IIA"; + //Plane D + satelliteBlock[2] = "IIR"; + satelliteBlock[1] = "IIF"; + satelliteBlock[21] = "IIR"; + satelliteBlock[4] = "IIA"; + satelliteBlock[11] = "IIR"; + satelliteBlock[24] = "IIA"; // Decommissioned from active service on 04 Nov 2011 + //Plane E + satelliteBlock[20] = "IIR"; + satelliteBlock[22] = "IIR"; + satelliteBlock[5] = "IIR-M"; + satelliteBlock[18] = "IIR"; + satelliteBlock[32] = "IIA"; + satelliteBlock[10] = "IIA"; + //Plane F + satelliteBlock[14] = "IIR"; + satelliteBlock[15] = "IIR-M"; + satelliteBlock[13] = "IIR"; + satelliteBlock[23] = "IIR"; + satelliteBlock[26] = "IIA"; } Gps_Navigation_Message::Gps_Navigation_Message() { - reset(); + reset(); } void Gps_Navigation_Message::print_gps_word_bytes(unsigned int GPS_word) { - std::cout << " Word ="; - std::cout << std::bitset<32>(GPS_word); - std::cout << std::endl; + std::cout << " Word ="; + std::cout << std::bitset<32>(GPS_word); + std::cout << std::endl; } bool Gps_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector> parameter) { - bool value; + bool value; - if (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1) - { - value = true; - } - else - { - value = false; - } - return value; + if (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1) + { + value = true; + } + else + { + value = false; + } + return value; } @@ -214,20 +213,20 @@ bool Gps_Navigation_Message::read_navigation_bool(std::bitset unsigned long int Gps_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector> parameter) { - unsigned long int value = 0; - int num_of_slices = parameter.size(); - for (int i=0; i bits, const std::vector> parameter) { - signed long int value = 0; - int num_of_slices = parameter.size(); - // Discriminate between 64 bits and 32 bits compiler - int long_int_size_bytes = sizeof(signed long int); - if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system - { - // read the MSB and perform the sign extension - if (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1) - { - value ^= 0xFFFFFFFFFFFFFFFF; //64 bits variable - } - else - { - value &= 0; - } + signed long int value = 0; + int num_of_slices = parameter.size(); + // Discriminate between 64 bits and 32 bits compiler + int long_int_size_bytes = sizeof(signed long int); + if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system + { + // read the MSB and perform the sign extension + if (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1) + { + value ^= 0xFFFFFFFFFFFFFFFF; //64 bits variable + } + else + { + value &= 0; + } - for (int i=0; i half_week) - { - corrTime = time - 2*half_week; - } - else if (time < -half_week) - { - corrTime = time + 2*half_week; - } - return corrTime; + double corrTime; + double half_week = 302400; // seconds + corrTime = time; + if (time > half_week) + { + corrTime = time - 2*half_week; + } + else if (time < -half_week) + { + corrTime = time + 2*half_week; + } + return corrTime; } @@ -319,11 +318,11 @@ double Gps_Navigation_Message::check_t(double time) // 20.3.3.3.3.1 User Algorithm for SV Clock Correction. double Gps_Navigation_Message::sv_clock_correction(double transmitTime) { - double dt; - dt = check_t(transmitTime - d_Toc); - d_satClkCorr = (d_A_f2 * dt + d_A_f1) * dt + d_A_f0 + d_dtr; - double correctedTime = transmitTime - d_satClkCorr; - return correctedTime; + double dt; + dt = check_t(transmitTime - d_Toc); + d_satClkCorr = (d_A_f2 * dt + d_A_f1) * dt + d_A_f0 + d_dtr; + double correctedTime = transmitTime - d_satClkCorr; + return correctedTime; } @@ -332,96 +331,96 @@ double Gps_Navigation_Message::sv_clock_correction(double transmitTime) void Gps_Navigation_Message::satellitePosition(double transmitTime) { - double tk; - double a; - double n; - double n0; - double M; - double E; - double E_old; - double dE; - double nu; - double phi; - double u; - double r; - double i; - double Omega; + double tk; + double a; + double n; + double n0; + double M; + double E; + double E_old; + double dE; + double nu; + double phi; + double u; + double r; + double i; + double Omega; - // Find satellite's position ---------------------------------------------- + // Find satellite's position ---------------------------------------------- - // Restore semi-major axis - a = d_sqrt_A*d_sqrt_A; + // Restore semi-major axis + a = d_sqrt_A*d_sqrt_A; - // Time from ephemeris reference epoch - tk = check_t(transmitTime - d_Toe); + // Time from ephemeris reference epoch + tk = check_t(transmitTime - d_Toe); - // Computed mean motion - n0 = sqrt(GM / (a*a*a)); + // Computed mean motion + n0 = sqrt(GM / (a*a*a)); - // Corrected mean motion - n = n0 + d_Delta_n; + // Corrected mean motion + n = n0 + d_Delta_n; - // Mean anomaly - M = d_M_0 + n * tk; + // Mean anomaly + M = d_M_0 + n * tk; - // Reduce mean anomaly to between 0 and 2pi - M = fmod((M + 2*GPS_PI), (2*GPS_PI)); + // Reduce mean anomaly to between 0 and 2pi + M = fmod((M + 2*GPS_PI), (2*GPS_PI)); - // Initial guess of eccentric anomaly - E = M; + // Initial guess of eccentric anomaly + E = M; - // --- Iteratively compute eccentric anomaly ---------------------------- - for (int ii = 1; ii<20; ii++) - { - E_old = E; - E = M + d_e_eccentricity * sin(E); - dE = fmod(E - E_old, 2*GPS_PI); - if (fabs(dE) < 1e-12) - { - //Necessary precision is reached, exit from the loop - break; - } - } + // --- Iteratively compute eccentric anomaly ---------------------------- + for (int ii = 1; ii<20; ii++) + { + E_old = E; + E = M + d_e_eccentricity * sin(E); + dE = fmod(E - E_old, 2*GPS_PI); + if (fabs(dE) < 1e-12) + { + //Necessary precision is reached, exit from the loop + break; + } + } - // Compute relativistic correction term - d_dtr = F * d_e_eccentricity * d_sqrt_A * sin(E); + // Compute relativistic correction term + d_dtr = F * d_e_eccentricity * d_sqrt_A * sin(E); - // Compute the true anomaly - double tmp_Y = sqrt(1.0 - d_e_eccentricity * d_e_eccentricity) * sin(E); - double tmp_X = cos(E) - d_e_eccentricity; - nu = atan2(tmp_Y, tmp_X); + // Compute the true anomaly + double tmp_Y = sqrt(1.0 - d_e_eccentricity * d_e_eccentricity) * sin(E); + double tmp_X = cos(E) - d_e_eccentricity; + nu = atan2(tmp_Y, tmp_X); - // Compute angle phi (argument of Latitude) - phi = nu + d_OMEGA; + // Compute angle phi (argument of Latitude) + phi = nu + d_OMEGA; - // Reduce phi to between 0 and 2*pi rad - phi = fmod((phi), (2*GPS_PI)); + // Reduce phi to between 0 and 2*pi rad + phi = fmod((phi), (2*GPS_PI)); - // Correct argument of latitude - u = phi + d_Cuc * cos(2*phi) + d_Cus * sin(2*phi); + // Correct argument of latitude + u = phi + d_Cuc * cos(2*phi) + d_Cus * sin(2*phi); - // Correct radius - r = a * (1 - d_e_eccentricity*cos(E)) + d_Crc * cos(2*phi) + d_Crs * sin(2*phi); + // Correct radius + r = a * (1 - d_e_eccentricity*cos(E)) + d_Crc * cos(2*phi) + d_Crs * sin(2*phi); - // Correct inclination - i = d_i_0 + d_IDOT * tk + d_Cic * cos(2*phi) + d_Cis * sin(2*phi); + // Correct inclination + i = d_i_0 + d_IDOT * tk + d_Cic * cos(2*phi) + d_Cis * sin(2*phi); - // Compute the angle between the ascending node and the Greenwich meridian - Omega = d_OMEGA0 + (d_OMEGA_DOT - OMEGA_EARTH_DOT)*tk - OMEGA_EARTH_DOT * d_Toe; + // Compute the angle between the ascending node and the Greenwich meridian + Omega = d_OMEGA0 + (d_OMEGA_DOT - OMEGA_EARTH_DOT)*tk - OMEGA_EARTH_DOT * d_Toe; - // Reduce to between 0 and 2*pi rad - Omega = fmod((Omega + 2*GPS_PI), (2*GPS_PI)); + // Reduce to between 0 and 2*pi rad + Omega = fmod((Omega + 2*GPS_PI), (2*GPS_PI)); - // --- Compute satellite coordinates in Earth-fixed coordinates - d_satpos_X = cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega); - d_satpos_Y = cos(u) * r * sin(Omega) + sin(u) * r * cos(i) * cos(Omega); - d_satpos_Z = sin(u) * r * sin(i); + // --- Compute satellite coordinates in Earth-fixed coordinates + d_satpos_X = cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega); + d_satpos_Y = cos(u) * r * sin(Omega) + sin(u) * r * cos(i) * cos(Omega); + d_satpos_Z = sin(u) * r * sin(i); - // Satellite's velocity. Can be useful for Vector Tracking loops - double Omega_dot = d_OMEGA_DOT - OMEGA_EARTH_DOT; - d_satvel_X = - Omega_dot * (cos(u) * r + sin(u) * r * cos(i)) + d_satpos_X * cos(Omega) - d_satpos_Y * cos(i) * sin(Omega); - d_satvel_Y = Omega_dot * (cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega)) + d_satpos_X * sin(Omega) + d_satpos_Y * cos(i) * cos(Omega); - d_satvel_Z = d_satpos_Y * sin(i); + // Satellite's velocity. Can be useful for Vector Tracking loops + double Omega_dot = d_OMEGA_DOT - OMEGA_EARTH_DOT; + d_satvel_X = - Omega_dot * (cos(u) * r + sin(u) * r * cos(i)) + d_satpos_X * cos(Omega) - d_satpos_Y * cos(i) * sin(Omega); + d_satvel_Y = Omega_dot * (cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega)) + d_satpos_X * sin(Omega) + d_satpos_Y * cos(i) * cos(Omega); + d_satvel_Z = d_satpos_Y * sin(i); } @@ -430,238 +429,238 @@ void Gps_Navigation_Message::satellitePosition(double transmitTime) int Gps_Navigation_Message::subframe_decoder(char *subframe) { - int subframe_ID = 0; - int SV_data_ID = 0; - int SV_page = 0; - //double tmp_TOW; + int subframe_ID = 0; + int SV_data_ID = 0; + int SV_page = 0; + //double tmp_TOW; - unsigned int gps_word; + unsigned int gps_word; - // UNPACK BYTES TO BITS AND REMOVE THE CRC REDUNDANCE - std::bitset subframe_bits; - std::bitset word_bits; - for (int i=0; i<10; i++) - { - memcpy(&gps_word, &subframe[i*4], sizeof(char)*4); - word_bits = std::bitset<(GPS_WORD_BITS+2)>(gps_word); - for (int j=0; j subframe_bits; + std::bitset word_bits; + for (int i=0; i<10; i++) + { + memcpy(&gps_word, &subframe[i*4], sizeof(char)*4); + word_bits = std::bitset<(GPS_WORD_BITS+2)>(gps_word); + for (int j=0; j= 0) // is not in the past - { - //Detect if the effectivity time and user's time is within six hours = 6 * 60 *60 = 21600 s - int secondOfLeapSecondEvent = i_DN * 24 * 60 * 60; - if (weeksToLeapSecondEvent > 0) - { - t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); - } - else //we are in the same week than the leap second event - { - if (abs(gpstime_corrected - secondOfLeapSecondEvent) > 21600) - { - /* 20.3.3.5.2.4a - * Whenever the effectivity time indicated by the WN_LSF and the DN values - * is not in the past (relative to the user's present time), and the user's - * present time does not fall in the time span which starts at six hours prior - * to the effectivity time and ends at six hours after the effectivity time, - * the UTC/GPS-time relationship is given by - */ - t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); - } - else - { - /* 20.3.3.5.2.4b - * Whenever the user's current time falls within the time span of six hours - * prior to the effectivity time to six hours after the effectivity time, - * proper accommodation of the leap second event with a possible week number - * transition is provided by the following expression for UTC: - */ - int W = fmod(gpstime_corrected - Delta_t_UTC - 43200, 86400) + 43200; - t_utc_daytime = fmod(W, 86400 + d_DeltaT_LSF - d_DeltaT_LS); - //implement something to handle a leap second event! - } - if ( (gpstime_corrected - secondOfLeapSecondEvent) > 21600) - { - Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800*(double)(i_GPS_week - i_WN_T)); - t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); - } - } - } - else // the effectivity time is in the past - { - /* 20.3.3.5.2.4c - * Whenever the effectivity time of the leap second event, as indicated by the - * WNLSF and DN values, is in the "past" (relative to the user's current time), - * and the user�s current time does not fall in the time span as given above - * in 20.3.3.5.2.4b,*/ - Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800 * (double)(i_GPS_week - i_WN_T)); - t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); - } + if ((weeksToLeapSecondEvent) >= 0) // is not in the past + { + //Detect if the effectivity time and user's time is within six hours = 6 * 60 *60 = 21600 s + int secondOfLeapSecondEvent = i_DN * 24 * 60 * 60; + if (weeksToLeapSecondEvent > 0) + { + t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); + } + else //we are in the same week than the leap second event + { + if (abs(gpstime_corrected - secondOfLeapSecondEvent) > 21600) + { + /* 20.3.3.5.2.4a + * Whenever the effectivity time indicated by the WN_LSF and the DN values + * is not in the past (relative to the user's present time), and the user's + * present time does not fall in the time span which starts at six hours prior + * to the effectivity time and ends at six hours after the effectivity time, + * the UTC/GPS-time relationship is given by + */ + t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); + } + else + { + /* 20.3.3.5.2.4b + * Whenever the user's current time falls within the time span of six hours + * prior to the effectivity time to six hours after the effectivity time, + * proper accommodation of the leap second event with a possible week number + * transition is provided by the following expression for UTC: + */ + int W = fmod(gpstime_corrected - Delta_t_UTC - 43200, 86400) + 43200; + t_utc_daytime = fmod(W, 86400 + d_DeltaT_LSF - d_DeltaT_LS); + //implement something to handle a leap second event! + } + if ( (gpstime_corrected - secondOfLeapSecondEvent) > 21600) + { + Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800*(double)(i_GPS_week - i_WN_T)); + t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); + } + } + } + else // the effectivity time is in the past + { + /* 20.3.3.5.2.4c + * Whenever the effectivity time of the leap second event, as indicated by the + * WNLSF and DN values, is in the "past" (relative to the user's current time), + * and the user�s current time does not fall in the time span as given above + * in 20.3.3.5.2.4b,*/ + Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800 * (double)(i_GPS_week - i_WN_T)); + t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); + } - double secondsOfWeekBeforeToday = 43200 * floor(gpstime_corrected / 43200); - t_utc = secondsOfWeekBeforeToday + t_utc_daytime; - return t_utc; + double secondsOfWeekBeforeToday = 43200 * floor(gpstime_corrected / 43200); + t_utc = secondsOfWeekBeforeToday + t_utc_daytime; + return t_utc; } Gps_Ephemeris Gps_Navigation_Message::get_ephemeris() { - Gps_Ephemeris ephemeris; - ephemeris.i_satellite_PRN=i_satellite_PRN; - ephemeris.d_TOW=d_TOW; - ephemeris.d_Crs=d_Crs; - ephemeris.d_Delta_n=d_Delta_n; - ephemeris.d_M_0=d_M_0; - ephemeris.d_Cuc=d_Cuc; - ephemeris.d_e_eccentricity=d_e_eccentricity; - ephemeris.d_Cus=d_Cus; - ephemeris.d_sqrt_A=d_sqrt_A; - ephemeris.d_Toe=d_Toe; - ephemeris.d_Toc=d_Toc; - ephemeris.d_Cic=d_Cic; - ephemeris.d_OMEGA0=d_OMEGA0; - ephemeris.d_Cis=d_Cis; - ephemeris.d_i_0=d_i_0; - ephemeris.d_Crc=d_Crc; - ephemeris.d_OMEGA=d_OMEGA; - ephemeris.d_OMEGA_DOT=d_OMEGA_DOT; - ephemeris.d_IDOT=d_IDOT; - ephemeris.i_code_on_L2=i_code_on_L2; - ephemeris.i_GPS_week=i_GPS_week; - ephemeris.b_L2_P_data_flag=b_L2_P_data_flag; - ephemeris.i_SV_accuracy=i_SV_accuracy; - ephemeris.i_SV_health=i_SV_health; - ephemeris.d_TGD=d_TGD; - ephemeris.d_IODC=d_IODC; - ephemeris.i_AODO=i_AODO; - ephemeris.b_fit_interval_flag=b_fit_interval_flag; - ephemeris.d_spare1=d_spare1; - ephemeris.d_spare2=d_spare2; - ephemeris.d_A_f0=d_A_f0; - ephemeris.d_A_f1=d_A_f1; - ephemeris.d_A_f2=d_A_f2; - ephemeris.b_integrity_status_flag=b_integrity_status_flag; - ephemeris.b_alert_flag=b_alert_flag; - ephemeris.b_antispoofing_flag=b_antispoofing_flag; + Gps_Ephemeris ephemeris; + ephemeris.i_satellite_PRN = i_satellite_PRN; + ephemeris.d_TOW = d_TOW; + ephemeris.d_Crs = d_Crs; + ephemeris.d_Delta_n = d_Delta_n; + ephemeris.d_M_0 = d_M_0; + ephemeris.d_Cuc = d_Cuc; + ephemeris.d_e_eccentricity = d_e_eccentricity; + ephemeris.d_Cus = d_Cus; + ephemeris.d_sqrt_A = d_sqrt_A; + ephemeris.d_Toe = d_Toe; + ephemeris.d_Toc = d_Toc; + ephemeris.d_Cic = d_Cic; + ephemeris.d_OMEGA0 = d_OMEGA0; + ephemeris.d_Cis = d_Cis; + ephemeris.d_i_0 = d_i_0; + ephemeris.d_Crc = d_Crc; + ephemeris.d_OMEGA = d_OMEGA; + ephemeris.d_OMEGA_DOT = d_OMEGA_DOT; + ephemeris.d_IDOT = d_IDOT; + ephemeris.i_code_on_L2 = i_code_on_L2; + ephemeris.i_GPS_week = i_GPS_week; + ephemeris.b_L2_P_data_flag = b_L2_P_data_flag; + ephemeris.i_SV_accuracy = i_SV_accuracy; + ephemeris.i_SV_health = i_SV_health; + ephemeris.d_TGD = d_TGD; + ephemeris.d_IODC = d_IODC; + ephemeris.i_AODO = i_AODO; + ephemeris.b_fit_interval_flag = b_fit_interval_flag; + ephemeris.d_spare1 = d_spare1; + ephemeris.d_spare2 = d_spare2; + ephemeris.d_A_f0 = d_A_f0; + ephemeris.d_A_f1 = d_A_f1; + ephemeris.d_A_f2 = d_A_f2; + ephemeris.b_integrity_status_flag = b_integrity_status_flag; + ephemeris.b_alert_flag = b_alert_flag; + ephemeris.b_antispoofing_flag = b_antispoofing_flag; - return ephemeris; + return ephemeris; } Gps_Iono Gps_Navigation_Message::get_iono() { - Gps_Iono iono; - iono.d_alpha0=d_alpha0; - iono.d_alpha1=d_alpha1; - iono.d_alpha2=d_alpha2; - iono.d_alpha3=d_alpha3; - iono.d_beta0=d_beta0; - iono.d_beta1=d_beta1; - iono.d_beta2=d_beta2; - iono.d_beta3=d_beta3; - iono.valid=flag_iono_valid; - //WARNING: We clear flag_utc_model_valid in order to not re-send the same information to the ionospheric parameters queue - flag_iono_valid=false; - return iono; + Gps_Iono iono; + iono.d_alpha0 = d_alpha0; + iono.d_alpha1 = d_alpha1; + iono.d_alpha2 = d_alpha2; + iono.d_alpha3 = d_alpha3; + iono.d_beta0 = d_beta0; + iono.d_beta1 = d_beta1; + iono.d_beta2 = d_beta2; + iono.d_beta3 = d_beta3; + iono.valid = flag_iono_valid; + //WARNING: We clear flag_utc_model_valid in order to not re-send the same information to the ionospheric parameters queue + flag_iono_valid = false; + return iono; } Gps_Utc_Model Gps_Navigation_Message::get_utc_model() { - Gps_Utc_Model utc_model; + Gps_Utc_Model utc_model; - utc_model.valid=flag_utc_model_valid; + utc_model.valid = flag_utc_model_valid; // UTC parameters - utc_model.d_A1=d_A1; - utc_model.d_A0=d_A0; - utc_model.d_t_OT=d_t_OT; - utc_model.i_WN_T=i_WN_T; - utc_model.d_DeltaT_LS=d_DeltaT_LS; - utc_model.i_WN_LSF=i_WN_LSF; - utc_model.i_DN=i_DN; - utc_model.d_DeltaT_LSF=d_DeltaT_LSF; - // warning: We clear flag_utc_model_valid in order to not re-send the same information to the ionospheric parameters queue - d_DeltaT_LSF=false; - return utc_model; + utc_model.d_A1 = d_A1; + utc_model.d_A0 = d_A0; + utc_model.d_t_OT = d_t_OT; + utc_model.i_WN_T = i_WN_T; + utc_model.d_DeltaT_LS = d_DeltaT_LS; + utc_model.i_WN_LSF = i_WN_LSF; + utc_model.i_DN = i_DN; + utc_model.d_DeltaT_LSF = d_DeltaT_LSF; + // warning: We clear flag_utc_model_valid in order to not re-send the same information to the ionospheric parameters queue + d_DeltaT_LSF = false; + return utc_model; } + bool Gps_Navigation_Message::satellite_validation() { - bool flag_data_valid = false; - b_valid_ephemeris_set_flag = false; + bool flag_data_valid = false; + b_valid_ephemeris_set_flag = false; - // First Step: - // check Issue Of Ephemeris Data (IODE IODC..) to find a possible interrupted reception - // and check if the data have been filled (!=0) - if (d_TOW_SF1 != 0 and d_TOW_SF2 != 0 and d_TOW_SF3 != 0) - { - if (d_IODE_SF2 == d_IODE_SF3 and d_IODC == d_IODE_SF2 and d_IODC!= -1) - { - flag_data_valid = true; - b_valid_ephemeris_set_flag=true; - } - } - return flag_data_valid; + // First Step: + // check Issue Of Ephemeris Data (IODE IODC..) to find a possible interrupted reception + // and check if the data have been filled (!=0) + if (d_TOW_SF1 != 0 and d_TOW_SF2 != 0 and d_TOW_SF3 != 0) + { + if (d_IODE_SF2 == d_IODE_SF3 and d_IODC == d_IODE_SF2 and d_IODC!= -1) + { + flag_data_valid = true; + b_valid_ephemeris_set_flag = true; + } + } + return flag_data_valid; } diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index 4936740b8..3213f74a2 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -39,7 +39,7 @@ #include #include #include "boost/assign.hpp" -#include +#include #include "GPS_L1_CA.h" #include "gps_ephemeris.h" #include "gps_iono.h" diff --git a/src/core/system_parameters/gps_ref_location.cc b/src/core/system_parameters/gps_ref_location.cc index f9c945e8a..75ee24a7d 100644 --- a/src/core/system_parameters/gps_ref_location.cc +++ b/src/core/system_parameters/gps_ref_location.cc @@ -1,5 +1,5 @@ /*! - * \file gps_ref_time.cc + * \file gps_ref_location.cc * \brief Interface of a GPS REFERENCE LOCATION storage * * \author Javier Arribas, 2013. jarribas(at)cttc.es @@ -33,7 +33,6 @@ Gps_Ref_Location::Gps_Ref_Location() { - valid=false; - + valid = false; } diff --git a/src/core/system_parameters/gps_ref_location.h b/src/core/system_parameters/gps_ref_location.h index da8844ed6..e7989e87c 100644 --- a/src/core/system_parameters/gps_ref_location.h +++ b/src/core/system_parameters/gps_ref_location.h @@ -41,15 +41,11 @@ */ class Gps_Ref_Location { -private: - public: - - bool valid; + bool valid; double lat; double lon; double uncertainty; - /*! * Default constructor */ diff --git a/src/core/system_parameters/gps_ref_time.cc b/src/core/system_parameters/gps_ref_time.cc index c432b3309..ebf05e680 100644 --- a/src/core/system_parameters/gps_ref_time.cc +++ b/src/core/system_parameters/gps_ref_time.cc @@ -33,7 +33,6 @@ Gps_Ref_Time::Gps_Ref_Time() { - valid=false; - + valid = false; } diff --git a/src/core/system_parameters/gps_ref_time.h b/src/core/system_parameters/gps_ref_time.h index 982b3af07..1acfce346 100644 --- a/src/core/system_parameters/gps_ref_time.h +++ b/src/core/system_parameters/gps_ref_time.h @@ -41,17 +41,12 @@ */ class Gps_Ref_Time { -private: - public: - - bool valid; - double d_TOW; - double d_Week; - - double d_tv_sec; - double d_tv_usec; - + bool valid; + double d_TOW; + double d_Week; + double d_tv_sec; + double d_tv_usec; /*! * Default constructor */ diff --git a/src/core/system_parameters/gps_utc_model.cc b/src/core/system_parameters/gps_utc_model.cc index a38afa329..98f071c04 100644 --- a/src/core/system_parameters/gps_utc_model.cc +++ b/src/core/system_parameters/gps_utc_model.cc @@ -32,7 +32,7 @@ Gps_Utc_Model::Gps_Utc_Model() { - valid=false; + valid = false; d_A1 = 0; d_A0 = 0; d_t_OT = 0; @@ -40,7 +40,7 @@ Gps_Utc_Model::Gps_Utc_Model() d_DeltaT_LS = 0; i_WN_LSF = 0; i_DN = 0; - d_DeltaT_LSF= 0; + d_DeltaT_LSF = 0; } diff --git a/src/core/system_parameters/gps_utc_model.h b/src/core/system_parameters/gps_utc_model.h index afa684c85..34a695dde 100644 --- a/src/core/system_parameters/gps_utc_model.h +++ b/src/core/system_parameters/gps_utc_model.h @@ -42,11 +42,8 @@ */ class Gps_Utc_Model { -private: - public: - - bool valid; + bool valid; // UTC parameters double d_A1; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s] double d_A0; //!< Constant of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s] diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 067c939cc..8d381a83e 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -27,14 +27,20 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} ${ARMADILLO_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} ) add_definitions( -DGNSS_SDR_VERSION="${VERSION}" ) +if(OS_IS_MACOSX) + # Tell the linker where the libraries installed by MacPorts are + link_directories( /opt/local/lib ) +endif(OS_IS_MACOSX) + add_executable(gnss-sdr ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) -target_link_libraries(gnss-sdr ${Boost_LIBRARIES} ${GLOG_LIBRARIES} ${GFlags_LIBS} ${ARMADILLO_LIBRARIES} gnss_sp_libs gnss_rx) +target_link_libraries(gnss-sdr ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GFlags_LIBS} ${GLOG_LIBRARIES} ${ARMADILLO_LIBRARIES} gnss_sp_libs gnss_rx) + install(TARGETS gnss-sdr DESTINATION ${CMAKE_SOURCE_DIR}/install diff --git a/src/main/main.cc b/src/main/main.cc index b687bd7d6..2c1f88782 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include "control_thread.h" #include #include diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index e78a03637..00dd0a698 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -58,6 +58,8 @@ if(GTEST_DIR_LOCAL) add_library(gtest ${GTEST_DIR}/src/gtest-all.cc ${GTEST_DIR}/src/gtest_main.cc) set(GTEST_LIBRARIES gtest) endif(GTEST_DIR_LOCAL) + +#find_library(GnuradioAnalog) include_directories( ${GTEST_INCLUDE_DIRECTORIES} @@ -67,7 +69,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/libs ${CMAKE_SOURCE_DIR}/src/core/libs/supl ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp - ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl + ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl ${CMAKE_SOURCE_DIR}/src/algorithms/libs ${CMAKE_SOURCE_DIR}/src/algorithms/resampler/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/channel/adapters @@ -82,13 +84,12 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/algorithms/output_filter/adapters ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} - ${GNURADIO_GRUEL_INCLUDE_DIRS} + # ${GNURADIO_RUNTIME_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ) find_library( - GR_ANALOG_LIBRARIES + GNURADIO_ANALOG_LIBRARIES NAMES gnuradio-analog PATHS /usr/local/lib /usr/local/lib64 @@ -96,8 +97,9 @@ find_library( /usr/lib64 ) + add_executable(run_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cc) -target_link_libraries(run_tests ${Boost_LIBRARIES} ${GFLAGS_LIBS} ${GLOG_LIBRARIES} ${GTEST_LIBRARIES} ${GR_ANALOG_LIBRARIES} gnss_sp_libs gnss_rx) +target_link_libraries(run_tests ${Boost_LIBRARIES} ${GFLAGS_LIBS} ${GLOG_LIBRARIES} ${GTEST_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_ANALOG_LIBRARIES} gnss_sp_libs gnss_rx) install(TARGETS run_tests DESTINATION ${CMAKE_SOURCE_DIR}/install) diff --git a/src/tests/arithmetic/cordic_test.cc b/src/tests/arithmetic/cordic_test.cc index 4f6422461..3cb0ae0dc 100644 --- a/src/tests/arithmetic/cordic_test.cc +++ b/src/tests/arithmetic/cordic_test.cc @@ -39,7 +39,7 @@ #include #include #include // for RAND_MAX -#include +#include #include "nco_lib.h" TEST(Cordic_Test, StandardCIsFasterThanCordic) @@ -52,23 +52,21 @@ TEST(Cordic_Test, StandardCIsFasterThanCordic) float* d_carr_sign_I; float* d_carr_sign_Q; // carrier parameters - int d_vector_length=4000; + int d_vector_length = 4000; float phase_rad; float phase_step_rad; - float carrier_freq=2000; - float d_fs_in=4000000; + float carrier_freq = 2000; + float d_fs_in = 4000000; phase_step_rad = (float)GPS_TWO_PI*carrier_freq / (float)d_fs_in; // space for carrier wipeoff and signal baseband vectors if (posix_memalign((void**)&d_carr_sign, 16, d_vector_length * sizeof(std::complex) * 2) == 0){}; - if (posix_memalign((void**)&d_carr_sign_I, 16, d_vector_length * sizeof(float) * 2) == 0){}; if (posix_memalign((void**)&d_carr_sign_Q, 16, d_vector_length * sizeof(float) * 2) == 0){}; double sin_d,cos_d; double sin_f,cos_f; - double niter = 10000; struct timeval tv; @@ -79,12 +77,12 @@ TEST(Cordic_Test, StandardCIsFasterThanCordic) for(int i=0; icordic_get_cos_sin(phase_rad, cos_d, sin_d); - d_carr_sign[j]=std::complex(cos_d,-sin_d); - phase_rad=phase_rad+phase_step_rad; + d_carr_sign[j] = std::complex(cos_d, -sin_d); + phase_rad = phase_rad + phase_step_rad; } } @@ -101,8 +99,8 @@ TEST(Cordic_Test, StandardCIsFasterThanCordic) { cos_f = std::cos(phase_rad); sin_f = std::sin(phase_rad); - d_carr_sign[j]=std::complex(cos_f,-sin_f); - phase_rad=phase_rad+phase_step_rad; + d_carr_sign[j] =std::complex(cos_f, -sin_f); + phase_rad = phase_rad + phase_step_rad; } } gettimeofday(&tv, NULL); @@ -113,7 +111,7 @@ TEST(Cordic_Test, StandardCIsFasterThanCordic) long long int begin3 = tv.tv_sec * 1000000 + tv.tv_usec; for(int i=0; iGetQueueMessage(0, 0); + gr::message::sptr queue_message = factory->GetQueueMessage(0, 0); ControlMessage *control_message = (ControlMessage*)queue_message->msg(); unsigned int expected0 = 0; @@ -64,7 +64,7 @@ TEST(Control_Message_Factory_Test, GetControlMessages) control_message->who = 1; control_message->what = 4; - gr_message_sptr queue_message = gr_make_message(0, 0, 0, sizeof(ControlMessage)); + gr::message::sptr queue_message = gr::message::make(0, 0, 0, sizeof(ControlMessage)); memcpy(queue_message->msg(), control_message, sizeof(ControlMessage)); std::vector *control_messages = factory->GetControlMessages(queue_message); @@ -91,7 +91,7 @@ TEST(Control_Message_Factory_Test, GetControlMessagesWrongSize) control_message->what = 4; int another_int = 10; - gr_message_sptr queue_message = gr_make_message(0, 0, 0, sizeof(ControlMessage) + sizeof(int)); + gr::message::sptr queue_message = gr::message::make(0, 0, 0, sizeof(ControlMessage) + sizeof(int)); memcpy(queue_message->msg(), control_message, sizeof(ControlMessage)); memcpy(queue_message->msg() + sizeof(ControlMessage), &another_int, sizeof(int)); std::vector *control_messages = factory->GetControlMessages(queue_message); diff --git a/src/tests/control_thread/control_thread_test.cc b/src/tests/control_thread/control_thread_test.cc index e37fea655..d1f4c7684 100644 --- a/src/tests/control_thread/control_thread_test.cc +++ b/src/tests/control_thread/control_thread_test.cc @@ -31,7 +31,7 @@ */ #include -#include +#include #include "control_thread.h" #include "in_memory_configuration.h" @@ -47,15 +47,17 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages) config->set_property("SignalSource.repeat", "true"); config->set_property("SignalConditioner.implementation", "Pass_Through"); config->set_property("SignalConditioner.item_type", "gr_complex"); - config->set_property("Channels.count", "12"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); - config->set_property("Acquisition.item_type", "gr_complex"); + config->set_property("Channels.count", "2"); + config->set_property("Acquisition1.implementation", "GPS_L1_CA_PCPS_Acquisition"); + config->set_property("Acquisition1.item_type", "gr_complex"); + config->set_property("Acquisition2.implementation", "GPS_L1_CA_PCPS_Acquisition"); + config->set_property("Acquisition2.item_type", "gr_complex"); config->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking"); config->set_property("Tracking.item_type", "gr_complex"); - config->set_property("Navigation.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("Navigation.item_type", "gr_complex"); - config->set_property("Pseudorange.implementation", "GPS_L1_CA_Observables"); - config->set_property("Pseudorange.item_type", "gr_complex"); + config->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder"); + config->set_property("TelemetryDecoder.item_type", "gr_complex"); + config->set_property("Observables.implementation", "GPS_L1_CA_Observables"); + config->set_property("Observables.item_type", "gr_complex"); config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); config->set_property("PVT.item_type", "gr_complex"); config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); @@ -63,7 +65,7 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages) ControlThread *control_thread = new ControlThread(config); - gr_msg_queue_sptr control_queue = gr_make_msg_queue(0); + gr::msg_queue::sptr control_queue = gr::msg_queue::make(0); ControlMessageFactory *control_msg_factory = new ControlMessageFactory(); control_queue->handle(control_msg_factory->GetQueueMessage(0,0)); @@ -112,15 +114,15 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages2) config->set_property("SignalSource.sampling_frequency", "4000000"); config->set_property("SignalConditioner.implementation", "Pass_Through"); config->set_property("SignalConditioner.item_type", "gr_complex"); - config->set_property("Channels.count", "12"); + config->set_property("Channels.count", "1"); config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); config->set_property("Acquisition.item_type", "gr_complex"); config->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking"); config->set_property("Tracking.item_type", "gr_complex"); - config->set_property("Navigation.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("Navigation.item_type", "gr_complex"); - config->set_property("Pseudorange.implementation", "GPS_L1_CA_Observables"); - config->set_property("Pseudorange.item_type", "gr_complex"); + config->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder"); + config->set_property("TelemetryDecoder.item_type", "gr_complex"); + config->set_property("Observables.implementation", "GPS_L1_CA_Observables"); + config->set_property("Observables.item_type", "gr_complex"); config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); config->set_property("PVT.item_type", "gr_complex"); config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); @@ -128,7 +130,7 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages2) ControlThread *control_thread = new ControlThread(config); - gr_msg_queue_sptr control_queue = gr_make_msg_queue(0); + gr::msg_queue::sptr control_queue = gr::msg_queue::make(0); ControlMessageFactory *control_msg_factory = new ControlMessageFactory(); control_queue->handle(control_msg_factory->GetQueueMessage(0,0)); diff --git a/src/tests/flowgraph/gnss_flowgraph_test.cc b/src/tests/flowgraph/gnss_flowgraph_test.cc index 9d9904391..4f2f4d724 100644 --- a/src/tests/flowgraph/gnss_flowgraph_test.cc +++ b/src/tests/flowgraph/gnss_flowgraph_test.cc @@ -31,7 +31,7 @@ */ #include -#include +#include #include "gnss_flowgraph.h" #include "gnss_block_interface.h" #include "in_memory_configuration.h" @@ -62,7 +62,7 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStop) config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - GNSSFlowgraph* flowgraph = new GNSSFlowgraph(config, gr_make_msg_queue(0)); + GNSSFlowgraph* flowgraph = new GNSSFlowgraph(config, gr::msg_queue::make(0)); EXPECT_STREQ("File_Signal_Source", flowgraph->signal_source()->implementation().c_str()); EXPECT_STREQ("Pass_Through", flowgraph->signal_conditioner()->implementation().c_str()); diff --git a/src/tests/gnss_block/file_signal_source_test.cc b/src/tests/gnss_block/file_signal_source_test.cc index 3a9590bd2..78ccb157d 100644 --- a/src/tests/gnss_block/file_signal_source_test.cc +++ b/src/tests/gnss_block/file_signal_source_test.cc @@ -30,44 +30,44 @@ */ #include -#include -#include -#include -#include +//#include +#include +#include +#include #include #include "file_signal_source.h" #include "in_memory_configuration.h" TEST(FileSignalSource, Instantiate) { - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - InMemoryConfiguration* config = new InMemoryConfiguration(); + boost::shared_ptr queue = gr::msg_queue::make(0); + InMemoryConfiguration* config = new InMemoryConfiguration(); - config->set_property("Test.samples", "0"); - config->set_property("Test.sampling_frequency", "0"); - config->set_property("Test.filename", "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat"); - config->set_property("Test.item_type", "gr_complex"); - config->set_property("Test.repeat", "false"); + config->set_property("Test.samples", "0"); + config->set_property("Test.sampling_frequency", "0"); + config->set_property("Test.filename", "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat"); + config->set_property("Test.item_type", "gr_complex"); + config->set_property("Test.repeat", "false"); - FileSignalSource *signal_source = new FileSignalSource(config, "Test", 1, 1, queue); + FileSignalSource *signal_source = new FileSignalSource(config, "Test", 1, 1, queue); - EXPECT_STREQ("../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat", signal_source->filename().c_str()); - EXPECT_STREQ("gr_complex", signal_source->item_type().c_str()); - EXPECT_TRUE(signal_source->repeat() == false); + EXPECT_STREQ("../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat", signal_source->filename().c_str()); + EXPECT_STREQ("gr_complex", signal_source->item_type().c_str()); + EXPECT_TRUE(signal_source->repeat() == false); - delete signal_source; + delete signal_source; } TEST(FileSignalSource, InstantiateFileNotExists) { - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - InMemoryConfiguration* config = new InMemoryConfiguration(); + boost::shared_ptr queue = gr::msg_queue::make(0); + InMemoryConfiguration* config = new InMemoryConfiguration(); - config->set_property("Test.samples", "0"); - config->set_property("Test.sampling_frequency", "0"); - config->set_property("Test.filename", "./signal_samples/i_dont_exist.dat"); - config->set_property("Test.item_type", "gr_complex"); - config->set_property("Test.repeat", "false"); + config->set_property("Test.samples", "0"); + config->set_property("Test.sampling_frequency", "0"); + config->set_property("Test.filename", "./signal_samples/i_dont_exist.dat"); + config->set_property("Test.item_type", "gr_complex"); + config->set_property("Test.repeat", "false"); - EXPECT_THROW(new FileSignalSource(config, "Test", 1, 1, queue), std::exception); + EXPECT_THROW(new FileSignalSource(config, "Test", 1, 1, queue), std::exception); } diff --git a/src/tests/gnss_block/fir_filter_test.cc b/src/tests/gnss_block/fir_filter_test.cc index ea3454b0e..87d33ccda 100644 --- a/src/tests/gnss_block/fir_filter_test.cc +++ b/src/tests/gnss_block/fir_filter_test.cc @@ -32,11 +32,11 @@ #include #include #include -#include +#include #include #include -#include -#include +#include +#include #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "in_memory_configuration.h" @@ -50,8 +50,8 @@ class Fir_Filter_Test: public ::testing::Test protected: Fir_Filter_Test() { - queue = gr_make_msg_queue(0); - top_block = gr_make_top_block("Fir filter test"); + queue = gr::msg_queue::make(0); + top_block = gr::make_top_block("Fir filter test"); config = new InMemoryConfiguration(); item_size = sizeof(gr_complex); } @@ -60,8 +60,8 @@ protected: delete config; } void init(); - gr_msg_queue_sptr queue; - gr_top_block_sptr top_block; + boost::shared_ptr queue; + gr::top_block_sptr top_block; InMemoryConfiguration* config; size_t item_size; }; @@ -112,9 +112,9 @@ TEST_F(Fir_Filter_Test, ConnectAndRun) ASSERT_NO_THROW( { filter->connect(top_block); - gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); - gr_block_sptr null_sink = gr_make_null_sink(item_size); + boost::shared_ptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); + boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + boost::shared_ptr null_sink = gr::blocks::null_sink::make(item_size); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, filter->get_left_block(), 0); diff --git a/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc b/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc index 5837faf3a..363834f3c 100644 --- a/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc +++ b/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc @@ -35,13 +35,13 @@ #include #include #include -#include -#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "in_memory_configuration.h" @@ -55,8 +55,8 @@ class GalileoE1DllPllVemlTrackingInternalTest: public ::testing::Test protected: GalileoE1DllPllVemlTrackingInternalTest() { - queue = gr_make_msg_queue(0); - top_block = gr_make_top_block("Tracking test"); + queue = gr::msg_queue::make(0); + top_block = gr::make_top_block("Tracking test"); factory = new GNSSBlockFactory(); config = new InMemoryConfiguration(); item_size = sizeof(gr_complex); @@ -72,8 +72,8 @@ protected: void init(); - gr_msg_queue_sptr queue; - gr_top_block_sptr top_block; + gr::msg_queue::sptr queue; + gr::top_block_sptr top_block; GNSSBlockFactory* factory; InMemoryConfiguration* config; Gnss_Synchro gnss_synchro; @@ -187,10 +187,10 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults) ASSERT_NO_THROW( { std::string file = "../src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat"; const char * file_name = file.c_str(); - gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false); - gr_skiphead_sptr skip_head = gr_make_skiphead(sizeof(gr_complex), skiphead_sps); - gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), num_samples, queue); - gr_null_sink_sptr sink = gr_make_null_sink(sizeof(Gnss_Synchro)); + gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex),file_name,false); + gr::blocks::skiphead::sptr skip_head = gr::blocks::skiphead::make(sizeof(gr_complex), skiphead_sps); + boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), num_samples, queue); + gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); top_block->connect(file_source, 0, skip_head, 0); top_block->connect(skip_head, 0, valve, 0); top_block->connect(valve, 0, tracking->get_left_block(), 0); diff --git a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc index 890332fbc..2b2456413 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc @@ -45,13 +45,13 @@ #include #include #include -#include -#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include #include "gnss_block_factory.h" #include "gnss_block_interface.h" @@ -67,8 +67,8 @@ class GalileoE1PcpsAmbiguousAcquisitionGSoCTest: public ::testing::Test protected: GalileoE1PcpsAmbiguousAcquisitionGSoCTest() { - queue = gr_make_msg_queue(0); - top_block = gr_make_top_block("Acquisition test"); + queue = gr::msg_queue::make(0); + top_block = gr::make_top_block("Acquisition test"); factory = new GNSSBlockFactory(); config = new InMemoryConfiguration(); item_size = sizeof(gr_complex); @@ -87,8 +87,8 @@ protected: void wait_message(); void stop_queue(); - gr_msg_queue_sptr queue; - gr_top_block_sptr top_block; + gr::msg_queue::sptr queue; + gr::top_block_sptr top_block; GNSSBlockFactory* factory; InMemoryConfiguration* config; Gnss_Synchro gnss_synchro; @@ -102,14 +102,13 @@ protected: void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::init() { - gnss_synchro.Channel_ID=0; + gnss_synchro.Channel_ID = 0; gnss_synchro.System = 'E'; std::string signal = "1C"; - signal.copy(gnss_synchro.Signal,2,0); - gnss_synchro.PRN=11; + signal.copy(gnss_synchro.Signal, 2, 0); + gnss_synchro.PRN = 11; config->set_property("GNSS-SDR.internal_fs_hz", "4000000"); - config->set_property("Acquisition.item_type", "gr_complex"); config->set_property("Acquisition.if", "0"); config->set_property("Acquisition.sampled_ms", "4"); @@ -169,9 +168,8 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun) ASSERT_NO_THROW( { acquisition->connect(top_block); - gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); - + boost::shared_ptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); + boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."<< std::endl; @@ -232,8 +230,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults) ASSERT_NO_THROW( { std::string file = "../src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat"; const char * file_name = file.c_str(); - gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false); - + gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false); top_block->connect(file_source, 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."<< std::endl; diff --git a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc index 252eca8c3..a6da62e8e 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc @@ -35,12 +35,12 @@ #include #include #include -#include -#include +#include +#include #include #include -#include -#include +#include +#include #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "in_memory_configuration.h" @@ -55,8 +55,8 @@ class GalileoE1PcpsAmbiguousAcquisitionTest: public ::testing::Test protected: GalileoE1PcpsAmbiguousAcquisitionTest() { - queue = gr_make_msg_queue(0); - top_block = gr_make_top_block("Acquisition test"); + queue = gr::msg_queue::make(0); + top_block = gr::make_top_block("Acquisition test"); factory = new GNSSBlockFactory(); config = new InMemoryConfiguration(); item_size = sizeof(gr_complex); @@ -75,8 +75,8 @@ protected: void wait_message(); void stop_queue(); - gr_msg_queue_sptr queue; - gr_top_block_sptr top_block; + gr::msg_queue::sptr queue; + gr::top_block_sptr top_block; GNSSBlockFactory* factory; InMemoryConfiguration* config; Gnss_Synchro gnss_synchro; @@ -89,11 +89,11 @@ protected: void GalileoE1PcpsAmbiguousAcquisitionTest::init() { - gnss_synchro.Channel_ID=0; + gnss_synchro.Channel_ID = 0; gnss_synchro.System = 'E'; std::string signal = "1C"; - signal.copy(gnss_synchro.Signal,2,0); - gnss_synchro.PRN=1; + signal.copy(gnss_synchro.Signal, 2, 0); + gnss_synchro.PRN = 1; config->set_property("GNSS-SDR.internal_fs_hz", "4000000"); config->set_property("Acquisition.item_type", "gr_complex"); @@ -137,111 +137,112 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate) delete acquisition; } + TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun) { - int fs_in = 4000000; - int nsamples = 4*fs_in; - struct timeval tv; + int fs_in = 4000000; + int nsamples = 4*fs_in; + struct timeval tv; long long int begin = 0; long long int end = 0; init(); - GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); + GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); - ASSERT_NO_THROW( { - acquisition->connect(top_block); + ASSERT_NO_THROW( { + acquisition->connect(top_block); - gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + boost::shared_ptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); + boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); - top_block->connect(source, 0, valve, 0); - top_block->connect(valve, 0, acquisition->get_left_block(), 0); - }) << "Failure connecting the blocks of acquisition test."<< std::endl; + top_block->connect(source, 0, valve, 0); + top_block->connect(valve, 0, acquisition->get_left_block(), 0); + }) << "Failure connecting the blocks of acquisition test."<< std::endl; - EXPECT_NO_THROW( { - gettimeofday(&tv, NULL); - begin = tv.tv_sec *1000000 + tv.tv_usec; - top_block->run(); // Start threads and wait - gettimeofday(&tv, NULL); - end = tv.tv_sec *1000000 + tv.tv_usec; - }) << "Failure running he top_block."<< std::endl; - - delete acquisition; - std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; + EXPECT_NO_THROW( { + gettimeofday(&tv, NULL); + begin = tv.tv_sec *1000000 + tv.tv_usec; + top_block->run(); // Start threads and wait + gettimeofday(&tv, NULL); + end = tv.tv_sec *1000000 + tv.tv_usec; + }) << "Failure running he top_block."<< std::endl; + delete acquisition; + std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; } + TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) { - struct timeval tv; + struct timeval tv; long long int begin = 0; long long int end = 0; double expected_delay_samples = 2920; //18250; double expected_doppler_hz = -632; init(); - GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); + GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue); - ASSERT_NO_THROW( { - acquisition->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_channel(gnss_synchro.Channel_ID); + }) << "Failure setting channel."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_gnss_synchro(&gnss_synchro); + }) << "Failure setting gnss_synchro."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_channel_queue(&channel_internal_queue); - }) << "Failure setting channel_internal_queue."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_channel_queue(&channel_internal_queue); + }) << "Failure setting channel_internal_queue."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); + }) << "Failure setting threshold."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", - 10000)); - }) << "Failure setting doppler_max."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", + 10000)); + }) << "Failure setting doppler_max."<< std::endl; - ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", - 500)); - }) << "Failure setting doppler_step."<< std::endl; + ASSERT_NO_THROW( { + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", + 500)); + }) << "Failure setting doppler_step."<< std::endl; - ASSERT_NO_THROW( { - acquisition->connect(top_block); - }) << "Failure connecting acquisition to the top_block."<< std::endl; + ASSERT_NO_THROW( { + acquisition->connect(top_block); + }) << "Failure connecting acquisition to the top_block."<< std::endl; - ASSERT_NO_THROW( { - std::string file = "../src/tests/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat"; - const char * file_name = file.c_str(); - gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false); - top_block->connect(file_source, 0, acquisition->get_left_block(), 0); - }) << "Failure connecting the blocks of acquisition test."<< std::endl; + ASSERT_NO_THROW( { + std::string file = "../src/tests/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat"; + const char * file_name = file.c_str(); + gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex),file_name,false); + top_block->connect(file_source, 0, acquisition->get_left_block(), 0); + }) << "Failure connecting the blocks of acquisition test."<< std::endl; - start_queue(); - acquisition->init(); - acquisition->reset(); + start_queue(); + acquisition->init(); + acquisition->reset(); - EXPECT_NO_THROW( { - gettimeofday(&tv, NULL); - begin = tv.tv_sec *1000000 + tv.tv_usec; - top_block->run(); // Start threads and wait - gettimeofday(&tv, NULL); - end = tv.tv_sec *1000000 + tv.tv_usec; - }) << "Failure running he top_block."<< std::endl; + EXPECT_NO_THROW( { + gettimeofday(&tv, NULL); + begin = tv.tv_sec *1000000 + tv.tv_usec; + top_block->run(); // Start threads and wait + gettimeofday(&tv, NULL); + end = tv.tv_sec *1000000 + tv.tv_usec; + }) << "Failure running he top_block."<< std::endl; - ch_thread.join(); + ch_thread.join(); - unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples; - std::cout << "Acquired " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; - EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; + unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples; + std::cout << "Acquired " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; + EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; - double delay_error_samples = abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); - float delay_error_chips = (float)(delay_error_samples*1023/4000000); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_samples = abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); + float delay_error_chips = (float)(delay_error_samples*1023/4000000); + double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); - EXPECT_LE(doppler_error_hz, 166) << "Doppler error exceeds the expected value: 166 Hz = 2/(3*integration period)"; - EXPECT_LT(delay_error_chips, 0.175) << "Delay error exceeds the expected value: 0.175 chips"; + EXPECT_LE(doppler_error_hz, 166) << "Doppler error exceeds the expected value: 166 Hz = 2/(3*integration period)"; + EXPECT_LT(delay_error_chips, 0.175) << "Delay error exceeds the expected value: 0.175 chips"; - delete acquisition; + delete acquisition; } diff --git a/src/tests/gnss_block/gnss_block_factory_test.cc b/src/tests/gnss_block/gnss_block_factory_test.cc index 9fdaa9ff2..f2e5ab927 100644 --- a/src/tests/gnss_block/gnss_block_factory_test.cc +++ b/src/tests/gnss_block/gnss_block_factory_test.cc @@ -34,7 +34,7 @@ */ -#include +#include #include #include #include "in_memory_configuration.h" @@ -53,7 +53,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateFileSignalSource) configuration->set_property("SignalSource.implementation", "File_Signal_Source"); configuration->set_property("SignalSource.filename", "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue); @@ -72,7 +72,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateUHDSignalSource) InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("SignalSource.implementation", "UHD_Signal_Source"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue); @@ -90,7 +90,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongSignalSource) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("SignalSource.implementation", "Pepito"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue); @@ -106,7 +106,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateSignalConditioner) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("SignalConditioner.implementation", "Signal_Conditioner"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); GNSSBlockInterface *signal_conditioner = factory->GetSignalConditioner(configuration, queue); @@ -123,7 +123,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateSignalConditioner) TEST(GNSS_Block_Factory_Test, InstantiateFIRFilter) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); configuration->set_property("InputFilter.implementation", "Fir_Filter"); @@ -160,7 +160,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateFIRFilter) TEST(GNSS_Block_Factory_Test, InstantiateFreqXlatingFIRFilter) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); configuration->set_property("InputFilter.implementation", "Freq_Xlating_Fir_Filter"); @@ -201,7 +201,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateDirectResampler) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("Resampler.implementation", "Direct_Resampler"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); GNSSBlockInterface *resampler = factory->GetBlock(configuration, "Resampler", "Direct_Resampler", 1,1, queue); @@ -218,7 +218,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPcpsAcquisition) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); AcquisitionInterface *acquisition = (AcquisitionInterface*)factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 1, queue); @@ -236,7 +236,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1PcpsAmbiguousAcquisition) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); AcquisitionInterface *acquisition = (AcquisitionInterface*)factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1, queue); @@ -254,7 +254,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllFllPllTracking) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_FLL_PLL_Tracking", 1, 1, queue); @@ -272,7 +272,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllPllTracking) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1, queue); @@ -290,7 +290,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTcpConnectorTracking) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("Tracking.implementation", "GPS_L1_CA_TCP_CONNECTOR_Tracking"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1, queue); @@ -308,7 +308,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1DllPllVemlTracking) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1, queue); @@ -326,7 +326,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTelemetryDecoder) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); TelemetryDecoderInterface *telemetry_decoder = (TelemetryDecoderInterface*)factory->GetBlock(configuration, "TelemetryDecoder", "GPS_L1_CA_Telemetry_Decoder", 1, 1, queue); @@ -354,7 +354,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateChannels) configuration->set_property("Channel1.item_type", "gr_complex"); configuration->set_property("Acquisition1.implementation", "GPS_L1_CA_PCPS_Acquisition"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); @@ -374,7 +374,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateObservables) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("Observables.implementation", "Pass_Through"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue); @@ -392,7 +392,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaObservables) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("Observables.implementation", "GPS_L1_CA_Observables"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue); @@ -410,7 +410,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongObservables) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("Observables.implementation", "Pepito"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue); @@ -426,7 +426,7 @@ TEST(GNSS_Block_Factory_Test, InstantiatePvt) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("PVT.implementation", "Pass_Through"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue); @@ -444,7 +444,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPvt) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("PVT.implementation", "GPS_L1_CA_PVT"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue); @@ -462,7 +462,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongPvt) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("PVT.implementation", "Pepito"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue); @@ -480,7 +480,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateNullSinkOutputFilter) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue); @@ -498,7 +498,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateFileOutputFilter) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("OutputFilter.implementation", "File_Output_Filter"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue); @@ -516,7 +516,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongOutputFilter) { InMemoryConfiguration *configuration = new InMemoryConfiguration(); configuration->set_property("OutputFilter.implementation", "Pepito"); - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); GNSSBlockFactory *factory = new GNSSBlockFactory(); GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue); diff --git a/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc index 7e0662faf..03b86d85c 100644 --- a/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc @@ -35,12 +35,12 @@ #include #include #include -#include -#include +#include +#include #include #include -#include -#include +#include +#include #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "in_memory_configuration.h" @@ -54,8 +54,8 @@ class GpsL1CaPcpsAcquisitionTest: public ::testing::Test protected: GpsL1CaPcpsAcquisitionTest() { - queue = gr_make_msg_queue(0); - top_block = gr_make_top_block("Acquisition test"); + queue = gr::msg_queue::make(0); + top_block = gr::make_top_block("Acquisition test"); factory = new GNSSBlockFactory(); config = new InMemoryConfiguration(); item_size = sizeof(gr_complex); @@ -74,8 +74,8 @@ protected: void wait_message(); void stop_queue(); - gr_msg_queue_sptr queue; - gr_top_block_sptr top_block; + gr::msg_queue::sptr queue; + gr::top_block_sptr top_block; GNSSBlockFactory* factory; InMemoryConfiguration* config; Gnss_Synchro gnss_synchro; @@ -152,8 +152,8 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) ASSERT_NO_THROW( { acquisition->connect(top_block); - gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); - gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + boost::shared_ptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); + boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."<< std::endl; @@ -164,7 +164,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) top_block->run(); // Start threads and wait gettimeofday(&tv, NULL); end = tv.tv_sec *1000000 + tv.tv_usec; - }) << "Failure running he top_block."<< std::endl; + }) << "Failure running the top_block."<< std::endl; delete acquisition; std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl; @@ -214,7 +214,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) ASSERT_NO_THROW( { std::string file = "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat"; const char * file_name = file.c_str(); - gr_file_source_sptr file_source = gr_make_file_source(sizeof(gr_complex),file_name,false); + gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false); top_block->connect(file_source, 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."<< std::endl; diff --git a/src/tests/gnuradio_block/direct_resampler_conditioner_cc_test.cc b/src/tests/gnuradio_block/direct_resampler_conditioner_cc_test.cc index 8925e464f..91691eed0 100644 --- a/src/tests/gnuradio_block/direct_resampler_conditioner_cc_test.cc +++ b/src/tests/gnuradio_block/direct_resampler_conditioner_cc_test.cc @@ -35,11 +35,11 @@ #include #include #include -#include +#include #include #include -#include -#include +#include +#include #include "gnss_sdr_valve.h" #include "direct_resampler_conditioner_cc.h" @@ -50,10 +50,10 @@ TEST(Direct_Resampler_Conditioner_Cc_Test, InstantiationAndRunTest) double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz struct timeval tv; int nsamples = 1000000; //Number of samples to be computed - gr_msg_queue_sptr queue = gr_make_msg_queue(0); - gr_top_block_sptr top_block = gr_make_top_block("direct_resampler_conditioner_cc_test"); - gr_block_sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); - gr_block_sptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); + gr::top_block_sptr top_block = gr::make_top_block("direct_resampler_conditioner_cc_test"); + boost::shared_ptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); + boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); long long int begin = 0; long long int end = 0; @@ -62,7 +62,7 @@ TEST(Direct_Resampler_Conditioner_Cc_Test, InstantiationAndRunTest) }) << "Failure in instantiation of direct_resampler_conditioner."; direct_resampler_conditioner_cc_sptr resampler = direct_resampler_make_conditioner_cc(fs_in, fs_out); - gr_block_sptr sink = gr_make_null_sink(sizeof(gr_complex)); + gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(gr_complex)); EXPECT_NO_THROW( { top_block->connect(source, 0, valve, 0); diff --git a/src/tests/gnuradio_block/gnss_sdr_valve_test.cc b/src/tests/gnuradio_block/gnss_sdr_valve_test.cc index 2dda04181..31afcfd49 100644 --- a/src/tests/gnuradio_block/gnss_sdr_valve_test.cc +++ b/src/tests/gnuradio_block/gnss_sdr_valve_test.cc @@ -32,22 +32,22 @@ #include -#include +#include #include #include -#include -#include +#include +#include #include "gnss_sdr_valve.h" TEST(Valve_Test, CheckEventSentAfter100Samples) { - gr_msg_queue_sptr queue = gr_make_msg_queue(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); - gr_top_block_sptr top_block = gr_make_top_block("gnss_sdr_valve_test"); + gr::top_block_sptr top_block = gr::make_top_block("gnss_sdr_valve_test"); - gr_block_sptr source = gr::analog::sig_source_f::make(100, gr::analog::GR_CONST_WAVE, 100, 1, 0); - gr_block_sptr valve = gnss_sdr_make_valve(sizeof(float), 100, queue); - gr_block_sptr sink = gr_make_null_sink(sizeof(float)); + gr::analog::sig_source_f::sptr source = gr::analog::sig_source_f::make(100, gr::analog::GR_CONST_WAVE, 100, 1, 0); + boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(float), 100, queue); + gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(float)); unsigned int expected0 = 0; EXPECT_EQ(expected0, queue->count()); diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index 0fa895213..dec4f4d7e 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -56,8 +56,8 @@ concurrent_map global_gps_utc_model_map; int main(int argc, char **argv) { - google::ParseCommandLineFlags(&argc, &argv, true); - testing::InitGoogleTest(&argc, argv); + google::ParseCommandLineFlags(&argc, &argv, true); + testing::InitGoogleTest(&argc, argv); google::InitGoogleLogging(argv[0]); return RUN_ALL_TESTS(); } diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 6d8b75b2b..fdbb28eca 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -47,9 +47,9 @@ #include "control_thread.h" -#include "arithmetic/complex_arithmetic_libc.cc" -#include "arithmetic/correlations_libc.cc" -#include "arithmetic/cordic_test.cc" +//#include "arithmetic/complex_arithmetic_libc.cc" +//#include "arithmetic/correlations_libc.cc" +//#include "arithmetic/cordic_test.cc" #include "configuration/file_configuration_test.cc" #include "configuration/in_memory_configuration_test.cc" #include "control_thread/control_message_factory_test.cc"