Switch to GNU Radio 3.7.x API

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@368 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Javier Arribas 2013-07-04 13:47:40 +00:00
parent 1e242e3e61
commit 58b280afb6
206 changed files with 4239 additions and 4751 deletions

View File

@ -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=<INSTALL_DIR>
CONFIGURE_COMMAND ${GLOG_CONFIGURE} --prefix=<INSTALL_DIR>
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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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")

View File

@ -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

View File

@ -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)

View File

@ -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 <target1> <target2> ...)
# ADD_CUSTOM_COMMAND(<the usual args> ${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)

View File

@ -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")

View File

@ -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(<description> <dependencies list>)
########################################################################
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)
")

View File

@ -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)))
")

View File

@ -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;

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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 <pthread.h>
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 <sched.h>
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)

View File

@ -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")

View File

@ -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)

View File

@ -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<size_t> and vector<unsigned int> (on 32-bit machines) and
# vector<long unsigned int> (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__':

View File

@ -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)

View File

@ -31,7 +31,7 @@
#ifndef INCLUDED_GN3S_API_H
#define INCLUDED_GN3S_API_H
#include <gruel/attributes.h>
#include <gnuradio/attributes.h>
#ifdef gr_gn3s_EXPORTS
# define GN3S_API __GR_ATTR_EXPORT

View File

@ -31,7 +31,7 @@
#define INCLUDED_GN3S_SOURCE_CC_H
#include "gn3s_api.h"
#include <gr_block.h>
#include <gnuradio/block.h>
#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

View File

@ -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)

View File

@ -33,7 +33,7 @@
#include <gn3s_source_cc.h>
#include <gn3s_defines.h>
#include <gr_io_signature.h>
#include <gnuradio/io_signature.h>
/*
@ -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.

View File

@ -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
)

View File

@ -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})
target_link_libraries(pvt_adapters pvt_gr_blocks ${ARMADILLO_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES})

View File

@ -34,7 +34,6 @@
#include "gps_l1_ca_pvt.h"
#include "configuration_interface.h"
#include "gps_l1_ca_pvt_cc.h"
#include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -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<gr::msg_queue> 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_;
}

View File

@ -38,7 +38,7 @@
#include "pvt_interface.h"
#include "gps_l1_ca_pvt_cc.h"
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/msg_queue.h>
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<gr::msg_queue> 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<gr::msg_queue> queue_;
};
#endif

View File

@ -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})
target_link_libraries(pvt_gr_blocks pvt_lib ${ARMADILLO_LIBRARIES})

View File

@ -34,9 +34,8 @@
#include <map>
#include <algorithm>
#include <bitset>
#include <cmath>
#include "math.h"
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_complex.h>
#include <gnuradio/io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include "control_message_factory.h"
@ -51,15 +50,15 @@ extern concurrent_map<Gps_Iono> global_gps_iono_map;
extern concurrent_map<Gps_Utc_Model> 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<gr::msg_queue> 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<gr::msg_queue> 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<int,Gps_Ephemeris>::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<int,Gps_Ephemeris>::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<int,Gps_Ephemeris>::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<int,Gps_Ephemeris>::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; i<d_nchannels ; i++)
{
tmp_double = in[i][0].Pseudorange_m;
d_dump_file.write((char*)&tmp_double, sizeof(double));
tmp_double = 0;
d_dump_file.write((char*)&tmp_double, sizeof(double));
d_dump_file.write((char*)&d_rx_time, sizeof(double));
}
}
catch (std::ifstream::failure e)
{
std::cout << "Exception writing observables dump file " << e.what() << 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; i<d_nchannels ; i++)
{
tmp_double = in[i][0].Pseudorange_m;
d_dump_file.write((char*)&tmp_double, sizeof(double));
tmp_double = 0;
d_dump_file.write((char*)&tmp_double, sizeof(double));
d_dump_file.write((char*)&d_rx_time, sizeof(double));
}
}
catch (std::ifstream::failure e)
{
std::cout << "Exception writing observables dump file " << e.what() << std::endl;
}
}
}
consume_each(1); //one by one
return 0;

View File

@ -31,8 +31,8 @@
#define GNSS_SDR_GPS_L1_CA_PVT_CC_H
#include <fstream>
#include <gnuradio/gr_block.h>
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/block.h>
#include <gnuradio/msg_queue.h>
#include <queue>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
@ -51,18 +51,18 @@ class gps_l1_ca_pvt_cc;
typedef boost::shared_ptr<gps_l1_ca_pvt_cc> 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<gr::msg_queue> 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<gr::msg_queue> 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<gr::msg_queue> 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<gr::msg_queue> d_queue;
bool d_dump;
bool b_rinex_header_writen;
Rinex_Printer *rp;

View File

@ -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} )
target_link_libraries(pvt_lib ${Boost_LIBRARIES} ${GFlags_LIBS} ${GLOG_LIBRARIES} ${ARMADILLO_LIBRARIES} )

View File

@ -28,13 +28,12 @@
* -------------------------------------------------------------------------
*/
#include "armadillo"
#include <armadillo>
#include "gps_l1_ca_ls_pvt.h"
#include "GPS_L1_CA.h"
#include <glog/log_severity.h>
#include <glog/logging.h>
#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<int,Gnss_Synchro> gnss_pseudoranges_map, double GPS_current_time, bool flag_averaging)
{
std::map<int,Gnss_Synchro>::iterator gnss_pseudoranges_iter;
std::map<int,Gps_Ephemeris>::iterator gps_ephemeris_iter;
int valid_pseudoranges=gnss_pseudoranges_map.size();
std::map<int,Gnss_Synchro>::iterator gnss_pseudoranges_iter;
std::map<int,Gps_Ephemeris>::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="<<obs(obs_counter)<<"[m]"<< std::endl;
// ********************************************************************************
// ****** SOLVE LEAST SQUARES******************************************************
// ********************************************************************************
d_valid_observations = valid_obs;
DLOG(INFO) << "(new)PVT: valid observations=" << valid_obs << std::endl;
// 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);
if (valid_obs >= 4)
{
arma::vec mypos;
DLOG(INFO) << "satpos=" << satpos << std::endl;
DLOG(INFO) << "obs="<< obs << std::endl;
DLOG(INFO) << "W=" << W <<std::endl;
mypos = leastSquarePos(satpos, obs, W);
DLOG(INFO) << "(new)Position at TOW=" << GPS_current_time << " in ECEF (X,Y,Z) = " << mypos << std::endl;
gps_l1_ca_ls_pvt::cart2geo(mypos(0), mypos(1), mypos(2), 4);
}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++;
}
// Compute UTC time and print PVT solution
double secondsperweek = 604800.0; // number of seconds in one week (7*24*60*60)
boost::posix_time::time_duration t = boost::posix_time::seconds(utc + secondsperweek*(double)GPS_week);
// 22 August 1999 last GPS time roll over
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
d_position_UTC_time = p_time;
// ********************************************************************************
// ****** SOLVE LEAST SQUARES******************************************************
// ********************************************************************************
d_valid_observations = valid_obs;
DLOG(INFO) << "(new)PVT: valid observations=" << valid_obs << std::endl;
DLOG(INFO) << "(new)Position at " << boost::posix_time::to_simple_string(p_time)
<< " is Lat = " << d_latitude_d << " [deg], Long = " << d_longitude_d
<< " [deg], Height= " << d_height_m << " [m]" << std::endl;
if (valid_obs >= 4)
{
arma::vec mypos;
DLOG(INFO)<<"satpos="<<satpos<<std::endl;
DLOG(INFO)<<"obs="<<obs<<std::endl;
DLOG(INFO)<<"W="<<W<<std::endl;
mypos=leastSquarePos(satpos,obs,W);
DLOG(INFO) << "(new)Position at TOW=" << GPS_current_time << " in ECEF (X,Y,Z) = " << mypos << std::endl;
gps_l1_ca_ls_pvt::cart2geo(mypos(0), mypos(1), mypos(2), 4);
// ######## LOG FILE #########
if(d_flag_dump_enabled == true)
{
// MULTIPLEXED FILE RECORDING - Record results to file
try
{
double tmp_double;
// PVT GPS time
tmp_double = GPS_current_time;
d_dump_file.write((char*)&tmp_double, sizeof(double));
// ECEF User Position East [m]
tmp_double = mypos(0);
d_dump_file.write((char*)&tmp_double, sizeof(double));
// ECEF User Position North [m]
tmp_double = mypos(1);
d_dump_file.write((char*)&tmp_double, sizeof(double));
// ECEF User Position Up [m]
tmp_double = mypos(2);
d_dump_file.write((char*)&tmp_double, sizeof(double));
// User clock offset [s]
tmp_double = mypos(3);
d_dump_file.write((char*)&tmp_double, sizeof(double));
// GEO user position Latitude [deg]
tmp_double = d_latitude_d;
d_dump_file.write((char*)&tmp_double, sizeof(double));
// GEO user position Longitude [deg]
tmp_double = d_longitude_d;
d_dump_file.write((char*)&tmp_double, sizeof(double));
// GEO user position Height [m]
tmp_double = d_height_m;
d_dump_file.write((char*)&tmp_double, sizeof(double));
}
catch (std::ifstream::failure e)
{
std::cout << "Exception writing PVT LS dump file "<< e.what() << std::endl;
}
}
// Compute UTC time and print PVT solution
double secondsperweek = 604800.0; // number of seconds in one week (7*24*60*60)
boost::posix_time::time_duration t = boost::posix_time::seconds(utc + secondsperweek*(double)GPS_week);
// 22 August 1999 last GPS time roll over
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
d_position_UTC_time = p_time;
// MOVING AVERAGE PVT
if (flag_averaging == true)
{
if (d_hist_longitude_d.size() == (unsigned int)d_averaging_depth)
{
// Pop oldest value
d_hist_longitude_d.pop_back();
d_hist_latitude_d.pop_back();
d_hist_height_m.pop_back();
// Push new values
d_hist_longitude_d.push_front(d_longitude_d);
d_hist_latitude_d.push_front(d_latitude_d);
d_hist_height_m.push_front(d_height_m);
DLOG(INFO) << "(new)Position at " << boost::posix_time::to_simple_string(p_time)
<< " is Lat = " << d_latitude_d << " [deg], Long = " << d_longitude_d
<< " [deg], Height= " << d_height_m << " [m]" << std::endl;
d_avg_latitude_d = 0;
d_avg_longitude_d = 0;
d_avg_height_m = 0;
for (unsigned int i=0; i<d_hist_longitude_d.size(); i++)
{
d_avg_latitude_d = d_avg_latitude_d + d_hist_latitude_d.at(i);
d_avg_longitude_d = d_avg_longitude_d + d_hist_longitude_d.at(i);
d_avg_height_m = d_avg_height_m + d_hist_height_m.at(i);
}
d_avg_latitude_d = d_avg_latitude_d / (double)d_averaging_depth;
d_avg_longitude_d = d_avg_longitude_d / (double)d_averaging_depth;
d_avg_height_m = d_avg_height_m / (double)d_averaging_depth;
b_valid_position = true;
return true; //indicates that the returned position is valid
}
else
{
//int current_depth=d_hist_longitude_d.size();
// Push new values
d_hist_longitude_d.push_front(d_longitude_d);
d_hist_latitude_d.push_front(d_latitude_d);
d_hist_height_m.push_front(d_height_m);
// ######## LOG FILE #########
if(d_flag_dump_enabled == true)
{
// MULTIPLEXED FILE RECORDING - Record results to file
try
{
double tmp_double;
// PVT GPS time
tmp_double = GPS_current_time;
d_dump_file.write((char*)&tmp_double, sizeof(double));
// ECEF User Position East [m]
tmp_double = mypos(0);
d_dump_file.write((char*)&tmp_double, sizeof(double));
// ECEF User Position North [m]
tmp_double = mypos(1);
d_dump_file.write((char*)&tmp_double, sizeof(double));
// ECEF User Position Up [m]
tmp_double = mypos(2);
d_dump_file.write((char*)&tmp_double, sizeof(double));
// User clock offset [s]
tmp_double = mypos(3);
d_dump_file.write((char*)&tmp_double, sizeof(double));
// GEO user position Latitude [deg]
tmp_double = d_latitude_d;
d_dump_file.write((char*)&tmp_double, sizeof(double));
// GEO user position Longitude [deg]
tmp_double = d_longitude_d;
d_dump_file.write((char*)&tmp_double, sizeof(double));
// GEO user position Height [m]
tmp_double = d_height_m;
d_dump_file.write((char*)&tmp_double, sizeof(double));
}
catch (std::ifstream::failure e)
{
std::cout << "Exception writing PVT LS dump file "<< e.what() << std::endl;
}
}
// MOVING AVERAGE PVT
if (flag_averaging == true)
{
if (d_hist_longitude_d.size() == (unsigned int)d_averaging_depth)
{
// Pop oldest value
d_hist_longitude_d.pop_back();
d_hist_latitude_d.pop_back();
d_hist_height_m.pop_back();
// Push new values
d_hist_longitude_d.push_front(d_longitude_d);
d_hist_latitude_d.push_front(d_latitude_d);
d_hist_height_m.push_front(d_height_m);
d_avg_latitude_d = 0;
d_avg_longitude_d = 0;
d_avg_height_m = 0;
for (unsigned int i=0; i<d_hist_longitude_d.size(); i++)
{
d_avg_latitude_d = d_avg_latitude_d + d_hist_latitude_d.at(i);
d_avg_longitude_d = d_avg_longitude_d + d_hist_longitude_d.at(i);
d_avg_height_m = d_avg_height_m + d_hist_height_m.at(i);
}
d_avg_latitude_d = d_avg_latitude_d / (double)d_averaging_depth;
d_avg_longitude_d = d_avg_longitude_d / (double)d_averaging_depth;
d_avg_height_m = d_avg_height_m / (double)d_averaging_depth;
b_valid_position = true;
return true; //indicates that the returned position is valid
}
else
{
//int current_depth=d_hist_longitude_d.size();
// Push new values
d_hist_longitude_d.push_front(d_longitude_d);
d_hist_latitude_d.push_front(d_latitude_d);
d_hist_height_m.push_front(d_height_m);
d_avg_latitude_d = d_latitude_d;
d_avg_longitude_d = d_longitude_d;
d_avg_height_m = d_height_m;
b_valid_position = false;
return false; //indicates that the returned position is not valid yet
}
}
else
{
b_valid_position = true;
return true; //indicates that the returned position is valid
}
}
else
{
b_valid_position = false;
return false;
}
d_avg_latitude_d = d_latitude_d;
d_avg_longitude_d = d_longitude_d;
d_avg_height_m = d_height_m;
b_valid_position = false;
return false; //indicates that the returned position is not valid yet
}
}
else
{
b_valid_position = true;
return true; //indicates that the returned position is valid
}
}
else
{
b_valid_position = false;
return false;
}
}

View File

@ -38,7 +38,8 @@
#include <stdio.h>
#include <sys/time.h>
#include <time.h>
#include <math.h>
//#include <math.h>
#include <cmath>
#include <map>
#include <algorithm>
#include "gps_navigation_message.h"

View File

@ -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 << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl
<< "<kml xmlns=\"http://www.opengis.net/kml/2.2\">" << std::endl

View File

@ -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;

View File

@ -60,10 +60,10 @@ public:
~Nmea_Printer();
private:
std::string nmea_filename ; //<! String with the NMEA log filename
std::ofstream nmea_file_descriptor ; //<! Output file stream for NMEA log file
std::string nmea_filename; // String with the NMEA log filename
std::ofstream nmea_file_descriptor; // Output file stream for NMEA log file
std::string nmea_devname;
int nmea_dev_descriptor ; //<! NMEA serial device descriptor (i.e. COM port)
int nmea_dev_descriptor; // NMEA serial device descriptor (i.e. COM port)
gps_l1_ca_ls_pvt* d_PVT_data;
int init_serial (std::string serial_device); //serial port control
void close_serial ();

View File

@ -33,14 +33,13 @@
#include "gps_ephemeris.h"
#include "gps_iono.h"
#include "gps_utc_model.h"
#include "GPS_L1_CA.h"
#include <ostream>
#include <fstream>
#include <stdlib.h> // for getenv()
#include <iostream>
#include <string>
#include <math.h> // for floor
#include <cmath> // for floor
#include <algorithm> // 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;
}

View File

@ -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})
target_link_libraries(acq_adapters gnss_sp_libs acq_gr_blocks ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES})

View File

@ -36,20 +36,17 @@
#include <iostream>
#include <string>
#include <boost/lexical_cast.hpp>
#include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include <boost/math/distributions/exponential.hpp>
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<gr::msg_queue> 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_;
}

View File

@ -36,7 +36,7 @@
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "pcps_acquisition_cc.h"
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/msg_queue.h>
#include <gnuradio/blocks/stream_to_vector.h>
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<gr::msg_queue> 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<gr::msg_queue> queue_;
concurrent_queue<int> *channel_internal_queue_;
float calculate_threshold(float pfa);
};

View File

@ -37,22 +37,21 @@
#include "GPS_L1_CA.h"
#include "configuration_interface.h"
#include <iostream>
#include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include <stdexcept>
#include <boost/math/distributions/exponential.hpp>
#include <gnuradio/msg_queue.h>
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<std::string>(channel_) + ".pfa", 0.0);
if(pfa==0.0) pfa = configuration_->property(role_+".pfa", 0.0);
float pfa = configuration_->property(role_ + boost::lexical_cast<std::string>(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_;
}

View File

@ -38,7 +38,7 @@
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "pcps_acquisition_cc.h"
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/msg_queue.h>
#include <gnuradio/blocks/stream_to_vector.h>
@ -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<gr::msg_queue> 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<gr::msg_queue> queue_;
concurrent_queue<int> *channel_internal_queue_;
float calculate_threshold(float pfa);

View File

@ -37,7 +37,6 @@
#include "GPS_L1_CA.h"
#include "configuration_interface.h"
#include <iostream>
#include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -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<gr::msg_queue> 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_;
}

View File

@ -37,7 +37,7 @@
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "pcps_assisted_acquisition_cc.h"
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/msg_queue.h>
#include <gnuradio/blocks/stream_to_vector.h>
@ -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<gr::msg_queue> 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<gr::msg_queue> queue_;
concurrent_queue<int> *channel_internal_queue_;
};

View File

@ -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})

View File

@ -34,7 +34,7 @@
#include "pcps_acquisition_cc.h"
#include "gnss_signal_processing.h"
#include "control_message_factory.h"
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/io_signature.h>
#include <sstream>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -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<float> * 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();
}

View File

@ -50,8 +50,8 @@
#define GNSS_SDR_PCPS_ACQUISITION_CC_H_
#include <fstream>
#include <gnuradio/gr_block.h>
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/block.h>
#include <gnuradio/msg_queue.h>
#include <gnuradio/gr_complex.h>
#include <gnuradio/fft/fft.h>
#include <queue>
@ -61,12 +61,13 @@
#include "gnss_synchro.h"
class pcps_acquisition_cc;
typedef boost::shared_ptr<pcps_acquisition_cc>
pcps_acquisition_cc_sptr;
typedef boost::shared_ptr<pcps_acquisition_cc> 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<int> *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<int> *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<float> * code);
/*!
* \brief Sets local code for PCPS acquisition algorithm.
* \param code - Pointer to the PRN code.
*/
void set_local_code(std::complex<float> * 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<int> *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<int> *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_*/

View File

@ -34,7 +34,7 @@
#include "gnss_signal_processing.h"
#include "control_message_factory.h"
#include "gps_acq_assist.h"
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/io_signature.h>
#include <sstream>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -47,403 +47,410 @@ extern concurrent_map<Gps_Acq_Assist> 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<gr::msg_queue> 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<gr::msg_queue> 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<d_num_doppler_points;i++)
{
delete[] d_grid_data[i];
delete[] d_grid_doppler_wipeoffs[i];
}
delete d_grid_data;
for (int i=0;i<d_num_doppler_points;i++)
{
delete[] d_grid_data[i];
delete[] d_grid_doppler_wipeoffs[i];
}
delete d_grid_data;
}
pcps_assisted_acquisition_cc::~pcps_assisted_acquisition_cc()
{
free(d_carrier);
free(d_fft_codes);
delete d_ifft;
delete d_fft_if;
if (d_dump)
{
d_dump_file.close();
}
free(d_carrier);
free(d_fft_codes);
delete d_ifft;
delete d_fft_if;
if (d_dump)
{
d_dump_file.close();
}
}
void pcps_assisted_acquisition_cc::set_local_code(std::complex<float> * 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 "<<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;
}
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 "<< 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;i<d_num_doppler_points;i++)
{
for (unsigned int j=0;j<d_fft_size;j++)
{
d_grid_data[i][j]=0.0;
}
}
d_well_count = 0;
for (int i=0;i<d_num_doppler_points;i++)
{
for (unsigned int j=0;j<d_fft_size;j++)
{
d_grid_data[i][j] = 0.0;
}
}
}
void pcps_assisted_acquisition_cc::redefine_grid()
{
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);
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<d_num_doppler_points;i++)
{
d_grid_data[i]=new float[d_fft_size];
}
d_grid_data=new float*[d_num_doppler_points];
for (int i=0; i<d_num_doppler_points; i++)
{
d_grid_data[i] = new float[d_fft_size];
}
// create the carrier Doppler wipeoff signals
int doppler_hz;
// create the carrier Doppler wipeoff signals
int doppler_hz;
float phase_step_rad;
d_grid_doppler_wipeoffs=new gr_complex*[d_num_doppler_points];
for (int doppler_index=0;doppler_index<d_num_doppler_points;doppler_index++)
{
d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_points];
for (int doppler_index=0; doppler_index<d_num_doppler_points; doppler_index++)
{
doppler_hz=d_doppler_min+d_doppler_step*doppler_index;
// doppler search steps
// compute the carrier doppler wipe-off signal and store it
phase_step_rad = (float)GPS_TWO_PI*doppler_hz / (float)d_fs_in;
d_grid_doppler_wipeoffs[doppler_index]=new gr_complex[d_fft_size];
fxp_nco(d_grid_doppler_wipeoffs[doppler_index], d_fft_size,0, phase_step_rad);
}
doppler_hz = d_doppler_min+d_doppler_step*doppler_index;
// doppler search steps
// compute the carrier doppler wipe-off signal and store it
phase_step_rad = (float)GPS_TWO_PI*doppler_hz / (float)d_fs_in;
d_grid_doppler_wipeoffs[doppler_index] = new gr_complex[d_fft_size];
fxp_nco(d_grid_doppler_wipeoffs[doppler_index], d_fft_size,0, phase_step_rad);
}
}
double pcps_assisted_acquisition_cc::search_maximum()
{
float magt = 0.0;
float fft_normalization_factor;
int index_doppler = 0;
unsigned int tmp_intex_t;
unsigned int index_time = 0;
float magt = 0.0;
float fft_normalization_factor;
int index_doppler = 0;
unsigned int tmp_intex_t;
unsigned int index_time = 0;
for (int i=0;i<d_num_doppler_points;i++)
{
volk_32f_index_max_16u_a(&tmp_intex_t,d_grid_data[i],d_fft_size);
if (d_grid_data[i][tmp_intex_t] > magt)
{
magt = d_grid_data[i][index_time];
index_doppler = i;
index_time = tmp_intex_t;
}
}
for (int i=0;i<d_num_doppler_points;i++)
{
volk_32f_index_max_16u_a(&tmp_intex_t,d_grid_data[i],d_fft_size);
if (d_grid_data[i][tmp_intex_t] > 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_index<d_num_doppler_points;doppler_index++)
{
// doppler search steps
// Perform the carrier wipe-off
volk_32fc_x2_multiply_32fc_u(d_fft_if->get_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_index<d_num_doppler_points; doppler_index++)
{
// doppler search steps
// Perform the carrier wipe-off
volk_32fc_x2_multiply_32fc_u(d_fft_if->get_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<max_dwells -> 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<max_dwells -> 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 "<<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;
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;
}

View File

@ -49,8 +49,8 @@
#define GNSS_SDR_PCPS_assisted_acquisition_cc_H_
#include <fstream>
#include <gnuradio/gr_block.h>
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/block.h>
#include <gnuradio/msg_queue.h>
#include <gnuradio/gr_complex.h>
#include <gnuradio/fft/fft.h>
#include <queue>
@ -60,12 +60,14 @@
#include "gnss_synchro.h"
class pcps_assisted_acquisition_cc;
typedef boost::shared_ptr<pcps_assisted_acquisition_cc>
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<gr::msg_queue> 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<gr::msg_queue> 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<gr::msg_queue> 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<int> *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<gr::msg_queue> d_queue;
concurrent_queue<int> *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<float> * code);
/*!
* \brief Sets local code for PCPS acquisition algorithm.
* \param code - Pointer to the PRN code.
*/
void set_local_code(std::complex<float> * 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<int> *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<int> *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);
};

View File

@ -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)
target_link_libraries(channel_adapters channel_fsm ${GNURADIO_RUNTIME_LIBRARIES})

View File

@ -39,8 +39,8 @@
#include <sstream>
#include <boost/lexical_cast.hpp>
#include <boost/thread/thread.hpp>
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_message.h>
#include <gnuradio/io_signature.h>
#include <gnuradio/message.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -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<gr::msg_queue> 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<std::string>(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();
}

View File

@ -35,8 +35,8 @@
#ifndef GNSS_SDR_CHANNEL_H_
#define GNSS_SDR_CHANNEL_H_
#include <gnuradio/gr_null_sink.h>
#include <gnuradio/gr_msg_queue.h>
//#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/msg_queue.h>
#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<gr::msg_queue> 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<gr::msg_queue> queue_;
concurrent_queue<int> channel_internal_queue_;
boost::thread ch_thread_;
void run();

View File

@ -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})
add_library(channel_fsm ${CHANNEL_FSM_SOURCES})

View File

@ -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<gr::msg_queue> 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;

View File

@ -44,7 +44,7 @@
#include "acquisition_interface.h"
#include "tracking_interface.h"
#include "telemetry_decoder_interface.h"
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/msg_queue.h>
#include <iostream>
#include <cstring>
@ -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<gr::msg_queue> 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<gr::msg_queue> queue_;
unsigned int channel_;
};

View File

@ -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})
add_library(conditioner_adapters ${COND_ADAPTER_SOURCES})

View File

@ -35,8 +35,8 @@
#include <sstream>
#include <boost/lexical_cast.hpp>
#include <boost/thread/thread.hpp>
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_message.h>
#include <gnuradio/io_signature.h>
#include <gnuradio/message.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -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<gr::msg_queue> 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();
}

View File

@ -32,8 +32,7 @@
#ifndef GNSS_SDR_SIGNAL_CONDITIONER_H_
#define GNSS_SDR_SIGNAL_CONDITIONER_H_
#include <gnuradio/gr_null_sink.h>
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/msg_queue.h>
#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<gr::msg_queue> 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<gr::msg_queue> queue_;
};
#endif /*GNSS_SDR_SIGNAL_CONDITIONER_H_*/

View File

@ -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})
target_link_libraries(datatype_adapters ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES})

View File

@ -30,8 +30,6 @@
#include "ishort_to_complex.h"
#include "configuration_interface.h"
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_file_sink.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -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<gr::msg_queue> 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_;
}

View File

@ -34,7 +34,8 @@
#include "gnss_synchro.h"
#include "gnss_block_interface.h"
#include <gnuradio/blocks/interleaved_short_to_complex.h>
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/msg_queue.h>
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<gr::msg_queue> 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<gr::msg_queue> queue_;
gr::blocks::file_sink::sptr file_sink_;
};
#endif

View File

@ -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})
target_link_libraries(input_filter_adapters ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES})

View File

@ -32,8 +32,6 @@
#include "configuration_interface.h"
#include <string>
#include <boost/lexical_cast.hpp>
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_file_sink.h>
#include <gnuradio/filter/pm_remez.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -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<gr::msg_queue> 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

View File

@ -33,10 +33,14 @@
#ifndef GNSS_SDR_FIR_FILTER_H_
#define GNSS_SDR_FIR_FILTER_H_
#include <cmath>
#include <gnuradio/gr_complex.h>
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/filter/fir_filter_ccf.h>
#include <gnuradio/msg_queue.h>
#include "gnss_synchro.h"
#include "gnss_block_interface.h"
#include <gnuradio/filter/fir_filter_ccf.h>
#include <gnuradio/gr_msg_queue.h>
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<gr::msg_queue> 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<gr::msg_queue> queue_;
gr::blocks::file_sink::sptr file_sink_;
void init();
};

View File

@ -32,8 +32,8 @@
#include "configuration_interface.h"
#include <string>
#include <boost/lexical_cast.hpp>
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_file_sink.h>
//#include <gnuradio/io_signature.h>
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/filter/pm_remez.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -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<gr::msg_queue> 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_<<std::endl;
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());
}
}
@ -78,7 +78,7 @@ FreqXlatingFirFilter::~FreqXlatingFirFilter()
void FreqXlatingFirFilter::connect(gr_top_block_sptr top_block)
void FreqXlatingFirFilter::connect(gr::top_block_sptr top_block)
{
if (dump_)
{
@ -92,7 +92,7 @@ void FreqXlatingFirFilter::connect(gr_top_block_sptr top_block)
void FreqXlatingFirFilter::disconnect(gr_top_block_sptr top_block)
void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block)
{
if (dump_)
{
@ -102,13 +102,13 @@ void FreqXlatingFirFilter::disconnect(gr_top_block_sptr top_block)
}
gr_basic_block_sptr FreqXlatingFirFilter::get_left_block()
gr::basic_block_sptr FreqXlatingFirFilter::get_left_block()
{
return freq_xlating_fir_filter_ccf_;
}
gr_basic_block_sptr FreqXlatingFirFilter::get_right_block()
gr::basic_block_sptr FreqXlatingFirFilter::get_right_block()
{
return freq_xlating_fir_filter_ccf_;
}

View File

@ -36,7 +36,8 @@
#include "gnss_synchro.h"
#include "gnss_block_interface.h"
#include <gnuradio/filter/freq_xlating_fir_filter_ccf.h>
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/msg_queue.h>
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<gr::msg_queue> 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<gr::msg_queue> queue_;
gr::blocks::file_sink::sptr file_sink_;
void init();
};

View File

@ -16,6 +16,15 @@
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
#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})
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})

View File

@ -34,6 +34,7 @@
#include <complex>
#include <iostream>
#include <gnuradio/math.h>
#include "Galileo_E1.h"
#include "gnss_signal_processing.h"

View File

@ -31,28 +31,28 @@
*/
#include "gnss_sdr_valve.h"
#include <gnuradio/gr_io_signature.h>
#include "control_message_factory.h"
#include <gnuradio/io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#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<gr::block> 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<gnss_sdr_valve> (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;
}

View File

@ -34,30 +34,32 @@
#define GNSS_SDR_GNSS_SDR_VALVE_H_
#include <cstring>
#include <gr_sync_block.h>
#include <gr_msg_queue.h>
#include <gnuradio/sync_block.h>
#include <gnuradio/msg_queue.h>
#include <boost/shared_ptr.hpp>
gr_block_sptr gnss_sdr_make_valve (size_t sizeof_stream_item,
boost::shared_ptr<gr::block> 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<gr::block> 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);
};

View File

@ -32,7 +32,7 @@
*/
#include "gnss_signal_processing.h"
#include <gr_fxpt.h> // fixed point sine and cosine
#include <gnuradio/fxpt.h> // fixed point sine and cosine
void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps)
@ -44,7 +44,7 @@ void complex_exp_gen(std::complex<float>* _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<float>* _dest, double _f, double _fs, unsigned
//_dest[i] = std::complex<float>(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<float>(cos_f, sin_f);
phase_i += phase_step_i;
}
@ -69,7 +69,7 @@ void complex_exp_gen_conj(std::complex<float>* _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<float>* _dest, double _f, double _fs, uns
//_dest[i] = std::complex<float>(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<float>(cos_f, -sin_f);
phase_i += phase_step_i;
}

View File

@ -31,7 +31,6 @@
*/
#include "gps_sdr_signal_processing.h"
#include <math.h>
#include <stdlib.h>
#include <cmath>

View File

@ -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<float> *dest, int n_samples,float start_phase_rad, float phase_step_rad)
void sse_nco(std::complex<float> *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<sse_loops_four_op;i++)
{
vx.f[0]=phase_rad;
phase_rad=phase_rad+phase_step_rad;
vx.f[1]=phase_rad;
phase_rad=phase_rad+phase_step_rad;
vx.f[2]=phase_rad;
phase_rad=phase_rad+phase_step_rad;
vx.f[3]=phase_rad;
phase_rad=phase_rad+phase_step_rad;
sincos_ps(vx.v, &sin4.v, &cos4.v);
dest[index] = std::complex<float>(cos4.f[0], -sin4.f[0]);
index++;
dest[index] = std::complex<float>(cos4.f[1], -sin4.f[1]);
index++;
dest[index] = std::complex<float>(cos4.f[2], -sin4.f[2]);
index++;
dest[index] = std::complex<float>(cos4.f[3], -sin4.f[3]);
index++;
}
for(int i=0;i<remnant_ops;i++)
{
vx.f[i]=phase_rad;
phase_rad=phase_rad+phase_step_rad;
}
int index = 0;
for(int i = 0;i<sse_loops_four_op;i++)
{
vx.f[0] = phase_rad;
phase_rad = phase_rad+phase_step_rad;
vx.f[1] = phase_rad;
phase_rad = phase_rad+phase_step_rad;
vx.f[2] = phase_rad;
phase_rad = phase_rad+phase_step_rad;
vx.f[3] = phase_rad;
phase_rad = phase_rad+phase_step_rad;
sincos_ps(vx.v, &sin4.v, &cos4.v);
dest[index] = std::complex<float>(cos4.f[0], -sin4.f[0]);
index++;
dest[index] = std::complex<float>(cos4.f[1], -sin4.f[1]);
index++;
dest[index] = std::complex<float>(cos4.f[2], -sin4.f[2]);
index++;
dest[index] = std::complex<float>(cos4.f[3], -sin4.f[3]);
index++;
}
for(int i = 0;i<remnant_ops;i++)
{
vx.f[i] = phase_rad;
phase_rad = phase_rad+phase_step_rad;
}
sincos_ps(vx.v, &sin4.v, &cos4.v);
for(int i=0;i<remnant_ops;i++)
{
dest[index] = std::complex<float>(cos4.f[i], -sin4.f[i]);
index++;
}
for(int i = 0;i<remnant_ops;i++)
{
dest[index] = std::complex<float>(cos4.f[i], -sin4.f[i]);
index++;
}
}
void fxp_nco(std::complex<float> *dest, int n_samples,float start_phase_rad, float phase_step_rad)
void fxp_nco(std::complex<float> *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<float> *dest, int n_samples,float start_phase_rad, float phase_step_rad)
void fxp_nco_cpyref(std::complex<float> *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<float> *dest, int n_samples,float start_phase_rad, float phase_step_rad)
void std_nco(std::complex<float> *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;
}
}

View File

@ -37,7 +37,7 @@
#ifndef GNSS_SDR_NCO_LIB_CC_H_
#define GNSS_SDR_NCO_LIB_CC_H_
#include <gr_fxpt.h>
#include <gnuradio/fxpt.h>
#include <xmmintrin.h>
#include <sse_mathfun.h>
#include <cmath>

View File

@ -33,7 +33,7 @@
#include "pass_through.h"
#include <iostream>
#include <gnuradio/gr_io_signature.h>
//#include <gnuradio/io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#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_;
}

View File

@ -33,9 +33,11 @@
#ifndef GNSS_SDR_PASS_THROUGH_H_
#define GNSS_SDR_PASS_THROUGH_H_
#include <gr_hier_block2.h>
#include <gr_kludge_copy.h>
#include <gr_file_sink.h>
#include <gnuradio/hier_block2.h>
//#include <gr_kludge_copy.h>
#include <gnuradio/blocks/copy.h>
//#include <gr_file_sink.h>
//#include <gnuradio/blocks/file_sink.h>
#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_;
};

View File

@ -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})

View File

@ -33,9 +33,6 @@
#include "gps_l1_ca_observables.h"
#include "configuration_interface.h"
#include "gps_l1_ca_observables_cc.h"
#include <gnuradio/gr_io_signature.h>
//#include <gnuradio/gr_stream_to_vector.h>
//#include <gnuradio/gr_vector_to_stream.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -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<gr::msg_queue> 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_;
}

View File

@ -35,7 +35,7 @@
#include "observables_interface.h"
#include "gps_l1_ca_observables_cc.h"
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/msg_queue.h>
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<gr::msg_queue> 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<gr::msg_queue> queue_;
};
#endif

View File

@ -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})
add_library(obs_gr_blocks ${OBS_GR_BLOCKS_SOURCES} )
target_link_libraries(obs_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES})

View File

@ -35,9 +35,8 @@
#include <algorithm>
#include <bitset>
#include <cmath>
#include "math.h"
#include "control_message_factory.h"
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#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<gr::msg_queue> 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<gr::msg_queue> 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="<<delta_rx_time_ms<<std::endl;
//compute the pseudorange
traveltime_ms=(d_TOW_reference-gnss_synchro_iter->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
}

View File

@ -32,8 +32,8 @@
#define GNSS_SDR_GPS_L1_CA_OBSERVABLES_CC_H
#include <fstream>
#include <gnuradio/gr_block.h>
#include <gnuradio/gr_msg_queue.h>
#include <gnuradio/block.h>
#include <gnuradio/msg_queue.h>
#include <queue>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
@ -48,12 +48,12 @@ class gps_l1_ca_observables_cc;
typedef boost::shared_ptr<gps_l1_ca_observables_cc> 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<gr::msg_queue> 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<gr::msg_queue> 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<gr::msg_queue> 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<gr::msg_queue> d_queue;
bool d_dump;
bool d_flag_averaging;
long int d_sample_counter;

View File

@ -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})
add_library(out_adapters ${OUTPUTFILTER_ADAPTER_SOURCES})
target_link_libraries(out_adapters ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES})

View File

@ -32,7 +32,7 @@
#include "file_output_filter.h"
#include <glog/log_severity.h>
#include <glog/logging.h>
#include <gr_io_signature.h>
#include <gnuradio/io_signature.h>
#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();
}

View File

@ -36,7 +36,7 @@
#define GNSS_SDR_FILE_OUTPUT_FILTER_H_
#include "gnss_block_interface.h"
#include <gr_file_sink.h>
#include <gnuradio/blocks/file_sink.h>
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_;

View File

@ -32,7 +32,7 @@
#include "null_sink_output_filter.h"
#include <glog/log_severity.h>
#include <glog/logging.h>
#include <gr_io_signature.h>
#include <gnuradio/io_signature.h>
#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_;
}

View File

@ -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 <gr_null_sink.h>
#include <gnuradio/blocks/null_sink.h>
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_;

View File

@ -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)
target_link_libraries(resampler_adapters resampler_gr_blocks)

View File

@ -30,7 +30,7 @@
*/
#include "direct_resampler_conditioner.h"
#include <gnuradio/gr_file_sink.h>
#include <gnuradio/blocks/file_sink.h>
#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_;
}

View File

@ -33,7 +33,7 @@
#ifndef GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_H_
#define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_H_
#include <gnuradio/gr_hier_block2.h>
#include <gnuradio/hier_block2.h>
#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_*/

View File

@ -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})
add_library(resampler_gr_blocks ${RESAMPLER_GR_BLOCKS_SOURCES})

View File

@ -34,7 +34,7 @@
#include "direct_resampler_conditioner_cc.h"
#include <iostream>
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -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)

View File

@ -39,7 +39,7 @@
#ifndef GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H
#define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H
#include <gnuradio/gr_block.h>
#include <gnuradio/block.h>
class direct_resampler_conditioner_cc;
typedef boost::shared_ptr<direct_resampler_conditioner_cc> 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

View File

@ -35,7 +35,7 @@
#include "direct_resampler_conditioner_ss.h"
#include "gps_sdr_signal_processing.h"
#include <iostream>
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -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)
{

View File

@ -32,7 +32,7 @@
#ifndef GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_SS_H
#define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_SS_H
#include <gnuradio/gr_block.h>
#include <gnuradio/block.h>
class direct_resampler_conditioner_ss;
typedef boost::shared_ptr<direct_resampler_conditioner_ss>
@ -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:

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