1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

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

This commit is contained in:
Marc Majoral 2019-01-25 18:02:07 +01:00
commit f127729eb0
625 changed files with 8404 additions and 7480 deletions

View File

@ -47,13 +47,20 @@ DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeBlocks: Merge
IncludeCategories:
- Regex: '^<.*\.h>'
- Regex: '^.*.h"'
Priority: 1
- Regex: '^<.*'
- Regex: '^.*(boost|gflags|glog|gnsssdr|gpstk|gtest|gnuradio|pmt|uhd|volk)/'
Priority: 2
- Regex: '^.*(armadillo|matio|pugixml)'
Priority: 2
- Regex: '.*'
Priority: 3
- Regex: '^<.*\.h>'
Priority: 4
- Regex: '^<.*'
Priority: 5
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
@ -73,7 +80,7 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements

3
.clang-tidy Normal file
View File

@ -0,0 +1,3 @@
---
Checks: '-*,boost-use-to-string,cert-dcl21-cpp,cert-dcl58-cpp,cert-env33-c,cert-err52-cpp,cert-err60-cpp,cert-flp30-c,clang-analyzer-cplusplus*,cppcoreguidelines-pro-type-static-cast-downcast,cppcoreguidelines-slicing,google-build-namespaces,google-runtime-int,google-runtime-references,llvm-header-guard,misc-misplaced-const,misc-new-delete-overloads,misc-non-copyable-objects,misc-static-assert,misc-throw-by-value-catch-by-reference,misc-uniqueptr-reset-release,modernize-deprecated-headers,modernize-loop-convert,modernize-pass-by-value,modernize-raw-string-literal,modernize-use-auto,modernize-use-bool-literals,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-noexcept,modernize-use-nullptr,modernize-use-using,performance-faster-string-find,performance-inefficient-algorithm,performance-move-const-arg,performance-type-promotion-in-math-fn,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,readability-container-size-empty,readability-named-parameter,readability-non-const-parameter,readability-string-compare'
HeaderFilterRegex: '.*'

View File

@ -115,9 +115,9 @@ endif()
set(VERSION_INFO_MAJOR_VERSION 0)
set(VERSION_INFO_API_COMPAT 0)
if(${THIS_IS_A_RELEASE})
set(VERSION_INFO_MINOR_VERSION 9)
set(VERSION_INFO_MINOR_VERSION 10)
else()
set(VERSION_INFO_MINOR_VERSION 9.git-${GIT_BRANCH}-${GIT_COMMIT_HASH})
set(VERSION_INFO_MINOR_VERSION 10.git-${GIT_BRANCH}-${GIT_COMMIT_HASH})
endif()
set(VERSION ${VERSION_INFO_MAJOR_VERSION}.${VERSION_INFO_API_COMPAT}.${VERSION_INFO_MINOR_VERSION})
@ -1131,7 +1131,13 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
endif()
message(FATAL_ERROR "libtool is required to build matio from source")
endif()
if(EXISTS "/usr/bin/aclocal" OR EXISTS "/usr/bin/aclocal-1.16" OR EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10")
if(EXISTS "/usr/bin/aclocal" OR
EXISTS "/usr/bin/aclocal-1.16" OR
EXISTS "/usr/bin/aclocal-1.15" OR
EXISTS "/usr/bin/aclocal-1.14" OR
EXISTS "/usr/bin/aclocal-1.13" OR
EXISTS "/usr/bin/aclocal-1.11" OR
EXISTS "/usr/bin/aclocal-1.10")
message(STATUS "Automake found.")
else()
message(" aclocal has not been found.")
@ -1612,6 +1618,26 @@ if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
endif()
########################################################################
# clang-tidy https://clang.llvm.org/extra/clang-tidy/index.html
########################################################################
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(NOT (CMAKE_VERSION VERSION_LESS "3.6"))
find_program(
CLANG_TIDY_EXE
NAMES "clang-tidy"
DOC "Path to clang-tidy executable"
)
if(NOT CLANG_TIDY_EXE)
message(STATUS "clang-tidy not found.")
else()
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks=*")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
endif()
endif()
########################################################################
# Create uninstall target

View File

@ -17,8 +17,9 @@
# - Try to find GFlags
#
# The following variables are optionally searched for defaults
# GFlags_ROOT_DIR: Base directory where all GFlags components are found
# The following CMake and environment variables are optionally searched
# for defaults:
# GFLAGS_ROOT: Base directory where all GFlags components are found
#
# The following are set after configuration is done:
# GFlags_FOUND
@ -30,39 +31,45 @@ if(APPLE)
find_path(GFlags_ROOT_DIR
libgflags.dylib
PATHS
/opt/local/lib
/usr/local/lib
/opt/local/lib
/usr/local/lib
${GFLAGS_ROOT}/lib
$ENV{GFLAGS_ROOT}/lib
)
else()
find_path(GFlags_ROOT_DIR
libgflags.so
HINTS
/usr/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/powerpc-linux-gnuspe
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib/i386-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/x86_64-kfreebsd-gnu
/usr/lib/i386-kfreebsd-gnu
/usr/lib/m68k-linux-gnu
/usr/lib/sh4-linux-gnu
/usr/lib/sparc64-linux-gnu
/usr/lib/x86_64-linux-gnux32
/usr/lib/alpha-linux-gnu
/usr/lib64
/usr/lib
/usr/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/powerpc-linux-gnuspe
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib/i386-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/x86_64-kfreebsd-gnu
/usr/lib/i386-kfreebsd-gnu
/usr/lib/m68k-linux-gnu
/usr/lib/sh4-linux-gnu
/usr/lib/sparc64-linux-gnu
/usr/lib/x86_64-linux-gnux32
/usr/lib/alpha-linux-gnu
/usr/lib64
/usr/lib
${GFLAGS_ROOT}/lib
$ENV{GFLAGS_ROOT}/lib
${GFLAGS_ROOT}/lib64
$ENV{GFLAGS_ROOT}/lib64
)
endif()
@ -71,10 +78,12 @@ if(GFlags_ROOT_DIR)
find_path(GFlags_INCLUDE_DIRS
gflags/gflags.h
HINTS
/opt/local/include
/usr/local/include
/usr/include
${GFlags_ROOT_DIR}/src
/opt/local/include
/usr/local/include
/usr/include
${GFlags_ROOT_DIR}/src
${GFLAGS_ROOT}/include
$ENV{GFLAGS_ROOT}/include
)
# Find the libraries

View File

@ -142,6 +142,8 @@ find_library(GFORTRAN NAMES gfortran
/usr/lib/gcc/powerpc64le-linux-gnu/8
/usr/lib/gcc/s390x-linux-gnu/8
/usr/lib/gcc/alpha-linux-gnu/8
${GFORTRAN_ROOT}/lib
$ENV{GFORTRAN_ROOT}/lib
)
include(FindPackageHandleStandardArgs)

View File

@ -68,6 +68,10 @@ macro(_FIND_GLOG_LIBRARIES _var)
/usr/lib/alpha-linux-gnu
/usr/lib64
/usr/lib
${GLOG_ROOT}/lib
$ENV{GLOG_ROOT}/lib
${GLOG_ROOT}/lib64
$ENV{GLOG_ROOT}/lib64
PATH_SUFFIXES lib
)
mark_as_advanced(${_var})

View File

@ -17,11 +17,14 @@
find_program(SW_GENERATOR_BIN gnss_sim
PATHS /usr/bin
/usr/local/bin
/opt/local/bin
${CMAKE_INSTALL_PREFIX}/bin
PATH_SUFFIXES bin)
/usr/local/bin
/opt/local/bin
${CMAKE_INSTALL_PREFIX}/bin
${GNSSSIMULATOR_ROOT}/bin
$ENV{GNSSSIMULATOR_ROOT}/bin
PATH_SUFFIXES bin
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GNSSSIMULATOR DEFAULT_MSG SW_GENERATOR_BIN)
find_package_handle_standard_args(GNSSSIMULATOR DEFAULT_MSG SW_GENERATOR_BIN)
mark_as_advanced(SW_GENERATOR_BIN)

View File

@ -65,29 +65,29 @@ function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE)
set(PC_LIBDIR ${PC_GNURADIO_${EXTVAR}_LIBDIR})
# look for include files
find_path(
${INCVAR_NAME}
find_path(${INCVAR_NAME}
NAMES ${INCFILE}
HINTS $ENV{GNURADIO_RUNTIME_DIR}/include
${PC_INCDIR}
${CMAKE_INSTALL_PREFIX}/include
${GNURADIO_INSTALL_PREFIX}/include
${PC_INCDIR}
${CMAKE_INSTALL_PREFIX}/include
${GNURADIO_INSTALL_PREFIX}/include
PATHS /usr/local/include
/usr/include
${GNURADIO_INSTALL_PREFIX}/include
${GNURADIO_ROOT}/include
$ENV{GNURADIO_ROOT}/include
)
# look for libs
foreach(libname ${PC_GNURADIO_${EXTVAR}_LIBRARIES})
find_library(
${LIBVAR_NAME}_${libname}
find_library(${LIBVAR_NAME}_${libname}
NAMES ${libname} ${libname}-${PC_GNURADIO_RUNTIME_VERSION}
HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib
${PC_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib/
${CMAKE_INSTALL_PREFIX}/lib64/
${GNURADIO_INSTALL_PREFIX}/lib/
${GNURADIO_INSTALL_PREFIX}/lib64
${PC_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
${GNURADIO_INSTALL_PREFIX}/lib
${GNURADIO_INSTALL_PREFIX}/lib64
PATHS /usr/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
@ -115,6 +115,10 @@ function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE)
/usr/lib64
/usr/lib
${GNURADIO_INSTALL_PREFIX}/lib
${GNURADIO_ROOT}/lib
$ENV{GNURADIO_ROOT}/lib
${GNURADIO_ROOT}/lib64
$ENV{GNURADIO_ROOT}/lib64
)
list(APPEND ${LIBVAR_NAME} ${${LIBVAR_NAME}_${libname}})
endforeach()
@ -174,6 +178,8 @@ if(NOT PC_GNURADIO_RUNTIME_VERSION)
PATHS /usr/local/include
/usr/include
${GNURADIO_INSTALL_PREFIX}/include
${GNURADIO_ROOT}/include
$ENV{GNURADIO_ROOT}/include
)
if(GNURADIO_VERSION_GREATER_THAN_373)
set(PC_GNURADIO_RUNTIME_VERSION "3.7.4+")
@ -187,6 +193,8 @@ if(NOT PC_GNURADIO_RUNTIME_VERSION)
PATHS /usr/local/include
/usr/include
${GNURADIO_INSTALL_PREFIX}/include
${GNURADIO_ROOT}/include
$ENV{GNURADIO_ROOT}/include
)
if(GNURADIO_VERSION_GREATER_THAN_38)
set(PC_GNURADIO_RUNTIME_VERSION "3.8.0+")

View File

@ -24,7 +24,7 @@
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Gperftools_ROOT_DIR Set this variable to the root installation of
# GPERFTOOLS_ROOT Set this variable to the root installation of
# Gperftools if the module has problems finding
# the proper installation path.
#
@ -36,19 +36,37 @@
find_library(GPERFTOOLS_TCMALLOC
NAMES tcmalloc
HINTS ${Gperftools_ROOT_DIR}/lib)
HINTS ${Gperftools_ROOT_DIR}/lib
${GPERFTOOLS_ROOT}/lib
$ENV{GPERFTOOLS_ROOT}/lib
${GPERFTOOLS_ROOT}/lib64
$ENV{GPERFTOOLS_ROOT}/lib64
)
find_library(GPERFTOOLS_PROFILER
NAMES profiler
HINTS ${Gperftools_ROOT_DIR}/lib)
HINTS ${Gperftools_ROOT_DIR}/lib
${GPERFTOOLS_ROOT}/lib
$ENV{GPERFTOOLS_ROOT}/lib
${GPERFTOOLS_ROOT}/lib64
$ENV{GPERFTOOLS_ROOT}/lib64
)
find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER
NAMES tcmalloc_and_profiler
HINTS ${Gperftools_ROOT_DIR}/lib)
HINTS ${Gperftools_ROOT_DIR}/lib
${GPERFTOOLS_ROOT}/lib
$ENV{GPERFTOOLS_ROOT}/lib
${GPERFTOOLS_ROOT}/lib64
$ENV{GPERFTOOLS_ROOT}/lib64
)
find_path(GPERFTOOLS_INCLUDE_DIR
NAMES gperftools/heap-profiler.h
HINTS ${Gperftools_ROOT_DIR}/include)
HINTS ${Gperftools_ROOT_DIR}/include
${GPERFTOOLS_ROOT}/include
$ENV{GPERFTOOLS_ROOT}/include
)
set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_TCMALLOC_AND_PROFILER})

View File

@ -24,14 +24,23 @@
find_path(GPSTK_INCLUDE_DIR gpstk/Rinex3ObsBase.hpp
HINTS /usr/include
/usr/local/include
/opt/local/include)
/usr/local/include
/opt/local/include
${GPSTK_ROOT}/include
$ENV{GPSTK_ROOT}/include
)
set(GPSTK_NAMES ${GPSTK_NAMES} gpstk libgpstk)
find_library(GPSTK_LIBRARY NAMES ${GPSTK_NAMES}
HINTS /usr/lib
/usr/local/lib
/opt/local/lib)
/usr/local/lib
/opt/local/lib
${GPSTK_ROOT}/lib
$ENV{GPSTK_ROOT}/lib
${GPSTK_ROOT}/lib64
$ENV{GPSTK_ROOT}/lib64
)
# handle the QUIETLY and REQUIRED arguments and set GPSTK_FOUND to TRUE if
# all listed variables are TRUE

View File

@ -30,6 +30,8 @@ find_path(
PATHS ${CMAKE_INSTALL_PREFIX}/include
/usr/include
/usr/local/include
${GRDBFCTTC_ROOT}/include
$ENV{GRDBFCTTC_ROOT}/include
)
find_library(
@ -43,6 +45,10 @@ find_library(
/usr/lib64
/usr/local/lib
/usr/local/lib64
${GRDBFCTTC_ROOT}/lib
$ENV{GRDBFCTTC_ROOT}/lib
${GRDBFCTTC_ROOT}/lib64
$ENV{GRDBFCTTC_ROOT}/lib64
)
include(FindPackageHandleStandardArgs)

View File

@ -30,6 +30,8 @@ find_path(
PATHS ${CMAKE_INSTALL_PREFIX}/include
/usr/local/include
/usr/include
${GRGN3S_ROOT}/include
$ENV{GRGN3S_ROOT}/include
)
find_library(
@ -43,6 +45,10 @@ find_library(
/usr/local/lib64
/usr/lib
/usr/lib64
${GRGN3S_ROOT}/lib
$ENV{GRGN3S_ROOT}/lib
${GRGN3S_ROOT}/lib64
$ENV{GRGN3S_ROOT}/lib64
)
include(FindPackageHandleStandardArgs)

View File

@ -18,21 +18,21 @@
include(FindPkgConfig)
pkg_check_modules(PC_IIO gnuradio-iio)
find_path(
IIO_INCLUDE_DIRS
find_path(IIO_INCLUDE_DIRS
NAMES gnuradio/iio/api.h
HINTS $ENV{IIO_DIR}/include
${PC_IIO_INCLUDEDIR}
${PC_IIO_INCLUDEDIR}
PATHS ${CMAKE_INSTALL_PREFIX}/include
/usr/local/include
/usr/include
${GRIIO_ROOT}/include
$ENV{GRIIO_ROOT}/include
)
find_library(
IIO_LIBRARIES
find_library(IIO_LIBRARIES
NAMES gnuradio-iio
HINTS $ENV{IIO_DIR}/lib
${PC_IIO_LIBDIR}
${PC_IIO_LIBDIR}
PATHS ${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
/usr/local/lib
@ -61,6 +61,10 @@ find_library(
/usr/lib/sparc64-linux-gnu
/usr/lib/x86_64-linux-gnux32
/usr/lib/sh4-linux-gnu
${GRIIO_ROOT}/lib
$ENV{GRIIO_ROOT}/lib
${GRIIO_ROOT}/lib64
$ENV{GRIIO_ROOT}/lib64
)
include(FindPackageHandleStandardArgs)

View File

@ -34,14 +34,20 @@
# GROSMOSDR_LIBRARIES The gr-osmosdr libraries (gnuradio-osmosdr)
# GROSMOSDR_INCLUDE_DIR The location of gr-osmosdr headers
include(FindPkgConfig)
pkg_check_modules(GROSMOSDR_PKG gnuradio-osmosdr)
find_path(GROSMOSDR_INCLUDE_DIR
NAMES osmosdr/source.h
NAMES
osmosdr/source.h
osmosdr/api.h
PATHS
${GROSMOSDR_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
${GROSMOSDR_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
/opt/local/include
${GROSMOSDR_ROOT}/include
$ENV{GROSMOSDR_ROOT}/include
)
find_library(GROSMOSDR_LIBRARIES
@ -50,6 +56,7 @@ find_library(GROSMOSDR_LIBRARIES
${GROSMOSDR_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
/opt/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
@ -74,6 +81,10 @@ find_library(GROSMOSDR_LIBRARIES
/usr/lib/x86_64-linux-gnux32
/usr/lib/alpha-linux-gnu
/usr/lib64
${GROSMOSDR_ROOT}/lib
$ENV{GROSMOSDR_ROOT}/lib
${GROSMOSDR_ROOT}/lib64
$ENV{GROSMOSDR_ROOT}/lib64
)
include(FindPackageHandleStandardArgs)

View File

@ -27,6 +27,8 @@ find_path(
/usr/local/include
/usr/include
/opt/local/include
${LIBIIO_ROOT}/include
$ENV{LIBIIO_ROOT}/include
)
find_library(
@ -63,6 +65,10 @@ find_library(
/usr/lib/x86_64-linux-gnux32
/usr/lib/sh4-linux-gnu
/Library/Frameworks/iio.framework/
${LIBIIO_ROOT}/lib
$ENV{LIBIIO_ROOT}/lib
${LIBIIO_ROOT}/lib64
$ENV{LIBIIO_ROOT}/lib64
)
include(FindPackageHandleStandardArgs)

View File

@ -28,12 +28,16 @@
# LIBOSMOSDR_LIBRARIES The libosmosdr libraries
# LIBOSMOSDR_INCLUDE_DIR The location of libosmosdr headers
include(FindPkgConfig)
pkg_check_modules(LIBOSMOSDR_PKG libosmosdr)
find_path(LIBOSMOSDR_INCLUDE_DIR NAMES osmosdr.h
PATHS
${LIBOSMOSDR_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
${LIBOSMOSDR_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
${LIBOSMOSDR_ROOT}/include
$ENV{LIBOSMOSDR_ROOT}/include
)
find_library(LIBOSMOSDR_LIBRARIES NAMES osmosdr
@ -65,7 +69,11 @@ find_library(LIBOSMOSDR_LIBRARIES NAMES osmosdr
/usr/lib/x86_64-linux-gnux32
/usr/lib/alpha-linux-gnu
/usr/lib64
)
${LIBOSMOSDR_ROOT}/lib
$ENV{LIBOSMOSDR_ROOT}/lib
${LIBOSMOSDR_ROOT}/lib64
$ENV{LIBOSMOSDR_ROOT}/lib64
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBOSMOSDR DEFAULT_MSG LIBOSMOSDR_INCLUDE_DIR LIBOSMOSDR_LIBRARIES)

View File

@ -32,6 +32,8 @@ find_path(LOG4CPP_INCLUDE_DIR log4cpp/Category.hh
/opt/local/include
/usr/local/include
/usr/include
${LOG4CPP_ROOT}/include
$ENV{LOG4CPP_ROOT}/include
)
set(LOG4CPP_NAMES log4cpp)
@ -68,6 +70,10 @@ find_library(LOG4CPP_LIBRARY
/usr/lib
/usr/local/lib
/opt/local/lib
${LOG4CPP_ROOT}/lib
$ENV{LOG4CPP_ROOT}/lib
${LOG4CPP_ROOT}/lib64
$ENV{LOG4CPP_ROOT}/lib64
)
if(LOG4CPP_INCLUDE_DIR AND LOG4CPP_LIBRARY)

View File

@ -60,10 +60,24 @@
#
# Look for the header file.
find_path(MATIO_INCLUDE_DIR NAMES matio.h DOC "The MATIO include directory")
find_path(MATIO_INCLUDE_DIR
NAMES matio.h
HINTS
${MATIO_ROOT}/include
$ENV{MATIO_ROOT}/include
DOC "The MATIO include directory"
)
# Look for the library.
find_library(MATIO_LIBRARY NAMES matio DOC "The MATIO library")
find_library(MATIO_LIBRARY
NAMES matio
HINTS
${MATIO_ROOT}/lib
$ENV{MATIO_ROOT}/lib
${MATIO_ROOT}/lib64
$ENV{MATIO_ROOT}/lib64
DOC "The MATIO library"
)
if(MATIO_INCLUDE_DIR)
# ---------------------------------------------------

View File

@ -20,17 +20,22 @@
# The following environment variable is optionally searched
# OPENBLAS_HOME: Base directory where all OpenBlas components are found
set(OPEN_BLAS_SEARCH_PATHS /lib/
/lib64/
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/OpenBLAS/lib
/opt/local/lib
/usr/lib/openblas-base
$ENV{OPENBLAS_HOME}/lib
)
set(OPEN_BLAS_SEARCH_PATHS
/lib
/lib64/
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/OpenBLAS/lib
/opt/local/lib
/usr/lib/openblas-base
$ENV{OPENBLAS_HOME}/lib
${OPENBLAS_ROOT}/lib
$ENV{OPENBLAS_ROOT}/lib
${OPENBLAS_ROOT}/lib64
$ENV{OPENBLAS_ROOT}/lib64
)
find_library(OPENBLAS NAMES openblas PATHS ${OPEN_BLAS_SEARCH_PATHS})

View File

@ -20,41 +20,50 @@ pkg_check_modules(PC_ORC "orc-0.4 > 0.4.22")
find_program(ORCC_EXECUTABLE orcc
HINTS ${PC_ORC_TOOLSDIR}
PATHS ${ORC_ROOT}/bin ${CMAKE_INSTALL_PREFIX}/bin)
PATHS ${ORC_ROOT}/bin
${CMAKE_INSTALL_PREFIX}/bin
)
find_path(ORC_INCLUDE_DIR NAMES orc/orc.h
find_path(ORC_INCLUDE_DIR
NAMES orc/orc.h
HINTS ${PC_ORC_INCLUDEDIR}
PATHS ${ORC_ROOT}/include/orc-0.4 ${CMAKE_INSTALL_PREFIX}/include/orc-0.4)
PATHS ${ORC_ROOT}/include/orc-0.4
${CMAKE_INSTALL_PREFIX}/include/orc-0.4
)
find_path(ORC_LIBRARY_DIR NAMES ${CMAKE_SHARED_LIBRARY_PREFIX}orc-0.4${CMAKE_SHARED_LIBRARY_SUFFIX}
find_path(ORC_LIBRARY_DIR
NAMES ${CMAKE_SHARED_LIBRARY_PREFIX}orc-0.4${CMAKE_SHARED_LIBRARY_SUFFIX}
HINTS ${PC_ORC_LIBDIR}
/usr/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib64
/usr/lib
PATHS ${ORC_ROOT}/lib${LIB_SUFFIX} ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
/usr/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib64
/usr/lib
${ORC_ROOT}/lib
$ENV{ORC_ROOT}/lib
PATHS
${ORC_ROOT}/lib${LIB_SUFFIX}
${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
)
find_library(ORC_LIB orc-0.4
HINTS ${PC_ORC_LIBRARY_DIRS}
PATHS ${ORC_ROOT}/lib${LIB_SUFFIX} ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
list(APPEND ORC_LIBRARY
${ORC_LIB}
PATHS ${ORC_ROOT}/lib${LIB_SUFFIX}
${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
)
list(APPEND ORC_LIBRARY ${ORC_LIB})
set(ORC_INCLUDE_DIRS ${ORC_INCLUDE_DIR})
set(ORC_LIBRARIES ${ORC_LIBRARY})

View File

@ -48,10 +48,12 @@
if(EXISTS $ENV{PCAPDIR})
find_path(PCAP_INCLUDE_DIR
NAMES
pcap/pcap.h
pcap.h
pcap/pcap.h
pcap.h
PATHS
$ENV{PCAPDIR}
${PCAP_ROOT}/include
$ENV{PCAP_ROOT}/include
NO_DEFAULT_PATH
)
find_library(PCAP_LIBRARY
@ -59,18 +61,25 @@ if(EXISTS $ENV{PCAPDIR})
pcap
PATHS
$ENV{PCAPDIR}
${PCAP_ROOT}/lib
$ENV{PCAP_ROOT}/lib
NO_DEFAULT_PATH
)
else()
find_path(PCAP_INCLUDE_DIR
NAMES
pcap/pcap.h
pcap.h
pcap/pcap.h
pcap.h
HINTS
${PCAP_ROOT}/include
$ENV{PCAP_ROOT}/include
)
find_library(PCAP_LIBRARY
NAMES
pcap
HINTS
${PCAP_ROOT}/lib
$ENV{PCAP_ROOT}/lib
)
endif()

View File

@ -26,28 +26,36 @@
find_path(PUGIXML_INCLUDE_DIR
NAMES pugixml.hpp
PATHS ${PUGIXML_HOME}/include
/usr/include
/usr/local/include
/opt/local/include)
/usr/include
/usr/local/include
/opt/local/include
${PUGIXML_ROOT}/include
$ENV{PUGIXML_ROOT}/include
)
find_library(PUGIXML_LIBRARY
NAMES pugixml
PATHS ${PUGIXML_HOME}/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/aarch64-linux-gnu
/usr/lib/arm-linux-gnueabi
/usr/lib/arm-linux-gnueabihf
/usr/lib/i386-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/mipsel-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/local/lib
/opt/local/lib
/usr/lib
/usr/lib64
/usr/local/lib64)
/usr/lib/x86_64-linux-gnu
/usr/lib/aarch64-linux-gnu
/usr/lib/arm-linux-gnueabi
/usr/lib/arm-linux-gnueabihf
/usr/lib/i386-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/mipsel-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/local/lib
/opt/local/lib
/usr/lib
/usr/lib64
/usr/local/lib64
${PUGIXML_ROOT}/lib
$ENV{PUGIXML_ROOT}/lib
${PUGIXML_ROOT}/lib64
$ENV{PUGIXML_ROOT}/lib64
)
# Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found.
include(FindPackageHandleStandardArgs)

View File

@ -18,27 +18,31 @@
include(FindPkgConfig)
pkg_check_modules(PC_TELEORBIT teleorbit)
find_path(
TELEORBIT_INCLUDE_DIRS
find_path(TELEORBIT_INCLUDE_DIRS
NAMES teleorbit/api.h
HINTS $ENV{TELEORBIT_DIR}/include
${PC_TELEORBIT_INCLUDEDIR}
${PC_TELEORBIT_INCLUDEDIR}
PATHS ${CMAKE_INSTALL_PREFIX}/include
/usr/local/include
/usr/include
${TELEORBIT_ROOT}/include
$ENV{TELEORBIT_ROOT}/include
)
find_library(
TELEORBIT_LIBRARIES
find_library(TELEORBIT_LIBRARIES
NAMES gnuradio-teleorbit
HINTS $ENV{TELEORBIT_DIR}/lib
${PC_TELEORBIT_LIBDIR}
${PC_TELEORBIT_LIBDIR}
PATHS ${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
${TELEORBIT_ROOT}/lib
$ENV{TELEORBIT_ROOT}/lib
${TELEORBIT_ROOT}/lib64
$ENV{TELEORBIT_ROOT}/lib64
)
include(FindPackageHandleStandardArgs)

View File

@ -22,21 +22,21 @@
include(FindPkgConfig)
pkg_check_modules(PC_UHD uhd)
find_path(
UHD_INCLUDE_DIRS
find_path(UHD_INCLUDE_DIRS
NAMES uhd/config.hpp
HINTS $ENV{UHD_DIR}/include
${PC_UHD_INCLUDEDIR}
${PC_UHD_INCLUDEDIR}
PATHS /usr/local/include
/usr/include
${GNURADIO_INSTALL_PREFIX}/include
${UHD_ROOT}/include
$ENV{UHD_ROOT}/include
)
find_library(
UHD_LIBRARIES
find_library(UHD_LIBRARIES
NAMES uhd
HINTS $ENV{UHD_DIR}/lib
${PC_UHD_LIBDIR}
${PC_UHD_LIBDIR}
PATHS /usr/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
@ -64,6 +64,10 @@ find_library(
/usr/lib64
/usr/lib
${GNURADIO_INSTALL_PREFIX}/lib
${UHD_ROOT}/lib
$ENV{UHD_ROOT}/lib
${UHD_ROOT}/lib64
$ENV{UHD_ROOT}/lib64
)
include(FindPackageHandleStandardArgs)

View File

@ -22,18 +22,18 @@
include(FindPkgConfig)
pkg_check_modules(PC_VOLK volk)
find_path(
VOLK_INCLUDE_DIRS
find_path(VOLK_INCLUDE_DIRS
NAMES volk/volk.h
HINTS $ENV{VOLK_DIR}/include
${PC_VOLK_INCLUDEDIR}
PATHS /usr/local/include
/usr/include
${CMAKE_INSTALL_PREFIX}/include
${VOLK_ROOT}/include
$ENV{VOLK_ROOT}/include
)
find_library(
VOLK_LIBRARIES
find_library(VOLK_LIBRARIES
NAMES volk
HINTS $ENV{VOLK_DIR}/lib
${PC_VOLK_LIBDIR}
@ -65,6 +65,10 @@ find_library(
/usr/lib/alpha-linux-gnu
/usr/lib64
${CMAKE_INSTALL_PREFIX}/lib
${VOLK_ROOT}/lib
$ENV{VOLK_ROOT}/lib
${VOLK_ROOT}/lib64
$ENV{VOLK_ROOT}/lib64
)
include(FindPackageHandleStandardArgs)

View File

@ -22,26 +22,30 @@
include(FindPkgConfig)
pkg_check_modules(PC_VOLK_GNSSSDR volk_gnsssdr)
find_path(
VOLK_GNSSSDR_INCLUDE_DIRS
find_path(VOLK_GNSSSDR_INCLUDE_DIRS
NAMES volk_gnsssdr/volk_gnsssdr.h
HINTS $ENV{VOLK_GNSSSDR_DIR}/include
${PC_VOLK_GNSSSDR_INCLUDEDIR}
${PC_VOLK_GNSSSDR_INCLUDEDIR}
PATHS /usr/local/include
/usr/include
${GNURADIO_INSTALL_PREFIX}/include
${VOLKGNSSSDR_ROOT}/include
$ENV{VOLKGNSSSDR_ROOT}/include
)
find_library(
VOLK_GNSSSDR_LIBRARIES
find_library(VOLK_GNSSSDR_LIBRARIES
NAMES volk_gnsssdr
HINTS $ENV{VOLK_GNSSSDR_DIR}/lib
${PC_VOLK_GNSSSDR_LIBDIR}
${PC_VOLK_GNSSSDR_LIBDIR}
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
${GNURADIO_INSTALL_PREFIX}/lib
${VOLKGNSSSDR_ROOT}/lib
$ENV{VOLKGNSSSDR_ROOT}/lib
${VOLKGNSSSDR_ROOT}/lib64
$ENV{VOLKGNSSSDR_ROOT}/lib64
)
include(FindPackageHandleStandardArgs)

View File

@ -18,20 +18,20 @@
##########################################################
# Toolchain file for Open Embedded
##########################################################
set( CMAKE_SYSTEM_NAME Linux )
set(CMAKE_SYSTEM_NAME Linux)
string(REGEX MATCH "sysroots/([a-zA-Z0-9]+)" CMAKE_SYSTEM_PROCESSOR $ENV{SDKTARGETSYSROOT})
string(REGEX REPLACE "sysroots/" "" CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE )
set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE ) #same flags for C sources
set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE ) #same flags for C sources
set( CMAKE_LIBRARY_PATH $ENV{OECORE_TARGET_SYSROOT}/usr/lib )
set(CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE) # same flags for C sources
set(CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE) # same flags for C sources
set(CMAKE_LIBRARY_PATH $ENV{OECORE_TARGET_SYSROOT}/usr/lib)
set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
set(CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set ( ORC_INCLUDE_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/include/orc-0.4 )
set ( ORC_LIBRARY_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/lib )
set(ORC_INCLUDE_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/include/orc-0.4)
set(ORC_LIBRARY_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/lib)

View File

@ -17,7 +17,7 @@
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif()
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
@ -28,11 +28,11 @@ foreach(file ${files})
COMMAND @CMAKE_COMMAND@ -E remove \"$ENV{DESTDIR}${file}\"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endif()
else()
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
endif()
endforeach()

View File

@ -1,6 +1,6 @@
## [Unreleased](https://github.com/gnss-sdr/gnss-sdr/tree/next)
## [0.0.10](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.10)
Next release will have several improvements in different dimensions, addition of new features and bug fixes:
This release has several improvements in different dimensions, addition of new features and bug fixes:
### Improvements in Accuracy:
@ -14,7 +14,7 @@ Next release will have several improvements in different dimensions, addition of
- Internal Finite State Machines rewritten for improved continuity in delivering position fixes. This fixes a bug that was stalling the receiver after about six hours of continuous operation.
- Redesign of the time counter for enhanced continuity.
- Improved flow graph in multisystem configurations: the receiver does not get stalled anymore if no signal is found from the first system.
- Improved flow graph in multi-system configurations: the receiver does not get stalled anymore if no signal is found from the first system.
- Improved acquisition and tracking sensitivity.
- Added mechanisms for Assisted GNSS, thus shortening the Time-To-First-Fix. Provision of data via XML files or via SUPL v1.0. Documented at https://gnss-sdr.org/docs/sp-blocks/global-parameters/
- Other minor bug fixes.
@ -23,7 +23,7 @@ Next release will have several improvements in different dimensions, addition of
### Improvements in Efficiency:
- Added the possibility of non-blocking acquisition, which works well when using real-time data from an RF front-end.
- Improved flow graph in multiband configurations: satellites acquired in one band are immediately searched in others.
- Improved flow graph in multi-band configurations: satellites acquired in one band are immediately searched in others.
- Complex local codes have been replaced by real codes, alleviating the computational burden.
- New volk_gnsssdr kernels: volk_gnsssdr_16i_xn_resampler_16i_xn.h, volk_gnsssdr_16ic_16i_rotator_dot_prod_16ic_xn.h, volk_gnsssdr_32f_xn_resampler_32f_xn.h, volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn.h
- Some AVX2 implementations added to the volk_gnsssdr library.
@ -64,13 +64,14 @@ Next release will have several improvements in different dimensions, addition of
### Improvements in Maintainability:
- Setup of a Continuous Integration system that checks building and runs QA code in a wide range of GNU/Linux distributions (ArchLinux, CentOS, Debian, Fedora, OpenSUSE, Ubuntu) and releases. See https://gitlab.com/gnss-sdr/gnss-sdr
- Setup of a Continuous Integration system that checks building and runs QA code in a wide range of GNU/Linux distributions (Arch Linux, CentOS, Debian, Fedora, OpenSUSE, Ubuntu) and releases. See https://gitlab.com/gnss-sdr/gnss-sdr
- Creation of multi-system processing blocks, drastically reducing code duplication and maintainability time.
- Automated code formatting with clang-format. This tool is widely available and easy to integrate into many code editors, and it also can be used from the command line. It cuts time spent on adhering to the project's code formatting style.
- Improvement in C++ usage: C-style casts have been replaced by C++ casts. C-style casts are difficult to search for. C++ casts provide compile time checking ability and express programmers' intent better, so they are safer and clearer.
- Improvement in C++ usage: The override special identifier is now used when overriding a virtual function. This helps the compiler to check for type changes in the base class, making the detection of errors easier.
- Improvement in C++ usage: A number of unused includes have been removed. Order of includes set to: local (in-source) headers, then library headers, then system headers. This helps to detect missing includes.
- Improvement in C++ usage: Enhanced const correctness. Misuses of those variables are detected by the compiler.
- Improved code with clang-tidy and generation of a compile_commands.json file containing the exact compiler calls for all translation units of the project in machine-readable form if clang-tidy is detected.
- Applied some style rules to CMake scripts.
- Minimal versions of dependencies identified and detected.
@ -83,13 +84,13 @@ Next release will have several improvements in different dimensions, addition of
- The software builds with C++11, C++14 and C++17 standards.
- The software can now be built using GCC >= 4.7.2 or LLVM/Clang >= 3.4.0 compilers on GNU/Linux, and with Clang/AppleClang on MacOS.
- The Ninja build system can be used in replacement of make.
- The volk_gnsssdr library can be built using Python 2.7 or Python 3.6.
- The volk_gnsssdr library can be built using Python 2.7+ or Python 3.6+.
- The volk_gnsssdr library is now ready for AArch64 NEON instructions.
- Ready for GNU Radio 3.8 C++ API (as per current master branch of GNU Radio upstream repository).
- Improved detection of required and optional dependencies in many GNU/Linux distributions and processor architectures.
- Improvement in C++ usage: The <ctime> library has been replaced by the more modern and portable <chrono> (except for the interaction with RTKLIB).
- Improvement in C++ usage: The <stdio.h> library has been replaced by the more modern and portable <fstream> for file handling.
- Improvement in C++ usage: C++ libraries preferred over C libraries (e.g., <cctype> instead of <ctype.h>, <cmath> instead of <math.h>).
- Fix compatibility with Boost 1.67 (closes Debian bug #911882 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911882)
- Fixes required by Debian packaging.
- Fixes required by Macports packaging.
- A downside in portability: BLAS and LAPACK libraries are now required even in ARM devices.
@ -100,7 +101,7 @@ Next release will have several improvements in different dimensions, addition of
### Improvements in Reliability:
- Introduced 3 new Input Filter implementations for pulsed and narrowband interference mitigation: `Pulse_Blanking_Filter`, `Notch_Filter` and `Notch_Filter_Lite`. Documented in https://gnss-sdr.org/docs/sp-blocks/input-filter/
- Improved flow graph stabiliy.
- Improved flow graph stability.
- Introduction of high-integrity C++ practices into the source code and included in the coding style guide. See https://gnss-sdr.org/coding-style/
- Fixed a number of defects detected by Coverity Scan.
- Improvement of QA code and addition of a number of new tests. Documented at https://gnss-sdr.org/docs/tutorials/testing-software-receiver-2/
@ -125,7 +126,12 @@ Next release will have several improvements in different dimensions, addition of
### Improvements in Testability:
- Several Unit Tests added. Documentation of testing concepts and available tests at https://gnss-sdr.org/docs/tutorials/testing-software-receiver/
- New extra unit test AcquisitionPerformanceTest checks the performance of Acquisition blocks.
- New extra unit test TrackingPullInTest checks acquisition to tracking transition.
- New extra unit test HybridObservablesTest checks the generation of observables.
- Improved system testing: position_test accepts a wide list of parameters and can be used with external files.
- Receiver channels can now be fixed to a given satellite.
- Testing integrated in a Continuous Reproducibility system (see above).
- Improved CTest support in volk_gnsssdr.
@ -141,6 +147,7 @@ Next release will have several improvements in different dimensions, addition of
- Added a changelog, a code of conduct, a contributing guide and a pull-request template in the source tree.
- Added colors to the commandline user interface.
- Updated manfiles.
- Updated examples of configuration files under the conf/ folder.
@ -149,7 +156,6 @@ See the definitions of concepts and metrics at https://gnss-sdr.org/design-force
## [0.0.9](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.9)
DOI: https://doi.org/10.5281/zenodo.291371

View File

@ -1,6 +1,6 @@
.\" Manpage for gnss\-sdr.
.\" Contact carles.fernandez@cttc.es to correct errors or typos.
.TH gnss\-sdr 1 "24 Feb 2018" "0.0.9" "gnss\-sdr man page"
.TH gnss\-sdr 1 "12 Dec 2018" "0.0.10" "gnss\-sdr man page"
.SH NAME
\fBgnss\-sdr\fR \- GNSS Software Defined Receiver.
.SH SYNOPSIS

View File

@ -15,15 +15,15 @@
<xs:complexType>
<xs:sequence>
<xs:element type="xs:byte" name="i_satellite_PRN"/>
<xs:element type="xs:float" name="d_TOW"/>
<xs:element type="xs:int" name="d_TOW"/>
<xs:element type="xs:float" name="d_Crs"/>
<xs:element type="xs:float" name="d_M_0"/>
<xs:element type="xs:float" name="d_Cuc"/>
<xs:element type="xs:float" name="d_e_eccentricity"/>
<xs:element type="xs:float" name="d_Cus"/>
<xs:element type="xs:float" name="d_Toe1"/>
<xs:element type="xs:float" name="d_Toe2"/>
<xs:element type="xs:float" name="d_Toc"/>
<xs:element type="xs:int" name="d_Toe1"/>
<xs:element type="xs:int" name="d_Toe2"/>
<xs:element type="xs:byte" name="d_Toc"/>
<xs:element type="xs:float" name="d_Cic"/>
<xs:element type="xs:float" name="d_OMEGA0"/>
<xs:element type="xs:float" name="d_Cis"/>

View File

@ -15,9 +15,9 @@
<xs:complexType>
<xs:sequence>
<xs:element type="xs:byte" name="i_satellite_PRN"/>
<xs:element type="xs:float" name="d_TOW"/>
<xs:element type="xs:float" name="d_IODE_SF2"/>
<xs:element type="xs:float" name="d_IODE_SF3"/>
<xs:element type="xs:int" name="d_TOW"/>
<xs:element type="xs:byte" name="d_IODE_SF2"/>
<xs:element type="xs:byte" name="d_IODE_SF3"/>
<xs:element type="xs:float" name="d_Crs"/>
<xs:element type="xs:float" name="d_Delta_n"/>
<xs:element type="xs:float" name="d_M_0"/>
@ -25,8 +25,8 @@
<xs:element type="xs:float" name="d_e_eccentricity"/>
<xs:element type="xs:float" name="d_Cus"/>
<xs:element type="xs:float" name="d_sqrt_A"/>
<xs:element type="xs:float" name="d_Toe"/>
<xs:element type="xs:float" name="d_Toc"/>
<xs:element type="xs:int" name="d_Toe"/>
<xs:element type="xs:int" name="d_Toc"/>
<xs:element type="xs:float" name="d_Cic"/>
<xs:element type="xs:float" name="d_OMEGA0"/>
<xs:element type="xs:float" name="d_Cis"/>
@ -41,7 +41,7 @@
<xs:element type="xs:byte" name="i_SV_accuracy"/>
<xs:element type="xs:byte" name="i_SV_health"/>
<xs:element type="xs:float" name="d_TGD"/>
<xs:element type="xs:float" name="d_IODC"/>
<xs:element type="xs:byte" name="d_IODC"/>
<xs:element type="xs:short" name="i_AODO"/>
<xs:element type="xs:byte" name="b_fit_interval_flag"/>
<xs:element type="xs:float" name="d_spare1"/>

View File

@ -12,10 +12,10 @@
<xs:sequence>
<xs:element type="xs:byte" name="first"/>
<xs:element name="second">
<xs:complexType mixed="true">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:byte" name="i_satellite_PRN"/>
<xs:element type="xs:byte" name="i_Toa"/>
<xs:element type="xs:int" name="i_Toa"/>
<xs:element type="xs:byte" name="i_WNa"/>
<xs:element type="xs:byte" name="i_IODa"/>
<xs:element type="xs:float" name="d_Delta_i"/>

View File

@ -1,4 +1,4 @@
<<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="boost_serialization">
<xs:complexType>
<xs:sequence>
@ -30,25 +30,25 @@
<xs:element type="xs:float" name="C_rs_3"/>
<xs:element type="xs:float" name="C_ic_4"/>
<xs:element type="xs:float" name="C_is_4"/>
<xs:element type="xs:float" name="t0e_1"/>
<xs:element type="xs:float" name="t0c_4"/>
<xs:element type="xs:int" name="t0e_1"/>
<xs:element type="xs:int" name="t0c_4"/>
<xs:element type="xs:float" name="af0_4"/>
<xs:element type="xs:float" name="af1_4"/>
<xs:element type="xs:float" name="af2_4"/>
<xs:element type="xs:float" name="WN_5"/>
<xs:element type="xs:float" name="TOW_5"/>
<xs:element type="xs:short" name="WN_5"/>
<xs:element type="xs:int" name="TOW_5"/>
<xs:element type="xs:float" name="Galileo_satClkDrift"/>
<xs:element type="xs:float" name="Galileo_dtr"/>
<xs:element type="xs:byte" name="flag_all_ephemeris"/>
<xs:element type="xs:byte" name="IOD_ephemeris"/>
<xs:element type="xs:byte" name="IOD_nav_1"/>
<xs:element type="xs:float" name="SISA_3"/>
<xs:element type="xs:byte" name="SISA_3"/>
<xs:element type="xs:byte" name="E5a_HS"/>
<xs:element type="xs:float" name="E5b_HS_5"/>
<xs:element type="xs:float" name="E1B_HS_5"/>
<xs:element type="xs:byte" name="E5b_HS_5"/>
<xs:element type="xs:byte" name="E1B_HS_5"/>
<xs:element type="xs:byte" name="E5a_DVS"/>
<xs:element type="xs:float" name="E5b_DVS_5"/>
<xs:element type="xs:float" name="E1B_DVS_5"/>
<xs:element type="xs:byte" name="E5b_DVS_5"/>
<xs:element type="xs:byte" name="E1B_DVS_5"/>
<xs:element type="xs:float" name="BGD_E1E5a_5"/>
<xs:element type="xs:float" name="BGD_E1E5b_5"/>
</xs:sequence>

View File

@ -13,8 +13,8 @@
<xs:element type="xs:byte" name="Region3_flag_5"/>
<xs:element type="xs:byte" name="Region4_flag_5"/>
<xs:element type="xs:byte" name="Region5_flag_5"/>
<xs:element type="xs:float" name="TOW_5"/>
<xs:element type="xs:float" name="WN_5"/>
<xs:element type="xs:int" name="TOW_5"/>
<xs:element type="xs:short" name="WN_5"/>
</xs:sequence>
<xs:attribute type="xs:byte" name="class_id"/>
<xs:attribute type="xs:byte" name="tracking_level"/>

View File

@ -7,12 +7,12 @@
<xs:sequence>
<xs:element type="xs:float" name="A0_6"/>
<xs:element type="xs:float" name="A1_6"/>
<xs:element type="xs:float" name="Delta_tLS_6"/>
<xs:element type="xs:float" name="t0t_6"/>
<xs:element type="xs:float" name="WNot_6"/>
<xs:element type="xs:float" name="WN_LSF_6"/>
<xs:element type="xs:float" name="DN_6"/>
<xs:element type="xs:float" name="Delta_tLSF_6"/>
<xs:element type="xs:byte" name="Delta_tLS_6"/>
<xs:element type="xs:int" name="t0t_6"/>
<xs:element type="xs:short" name="WNot_6"/>
<xs:element type="xs:short" name="WN_LSF_6"/>
<xs:element type="xs:byte" name="DN_6"/>
<xs:element type="xs:byte" name="Delta_tLSF_6"/>
<xs:element type="xs:byte" name="flag_utc_model"/>
</xs:sequence>
<xs:attribute type="xs:byte" name="class_id"/>

View File

@ -8,12 +8,12 @@
<xs:element type="xs:byte" name="valid"/>
<xs:element type="xs:float" name="d_A1"/>
<xs:element type="xs:float" name="d_A0"/>
<xs:element type="xs:float" name="d_t_OT"/>
<xs:element type="xs:int" name="d_t_OT"/>
<xs:element type="xs:short" name="i_WN_T"/>
<xs:element type="xs:float" name="d_DeltaT_LS"/>
<xs:element type="xs:byte" name="d_DeltaT_LS"/>
<xs:element type="xs:short" name="i_WN_LSF"/>
<xs:element type="xs:byte" name="i_DN"/>
<xs:element type="xs:float" name="d_DeltaT_LSF"/>
<xs:element type="xs:byte" name="d_DeltaT_LSF"/>
</xs:sequence>
<xs:attribute type="xs:byte" name="class_id"/>
<xs:attribute type="xs:byte" name="tracking_level"/>

View File

@ -30,11 +30,11 @@
#include "rtklib_pvt.h"
#include "pvt_conf.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include <boost/archive/xml_oarchive.hpp>
#include "pvt_conf.h"
#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>
#include <boost/serialization/map.hpp>
#include <glog/logging.h>
#if OLD_BOOST
@ -49,30 +49,10 @@ namespace bc = boost::integer;
using google::LogMessage;
bool RtklibPvt::get_latest_PVT(double* longitude_deg,
double* latitude_deg,
double* height_m,
double* ground_speed_kmh,
double* course_over_ground_deg,
time_t* UTC_time)
{
return pvt_->get_latest_PVT(longitude_deg,
latitude_deg,
height_m,
ground_speed_kmh,
course_over_ground_deg,
UTC_time);
}
void RtklibPvt::clear_ephemeris()
{
pvt_->clear_ephemeris();
}
RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
std::string role,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
unsigned int out_streams) : role_(std::move(role)),
in_streams_(in_streams),
out_streams_(out_streams)
{
@ -100,27 +80,27 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
// RINEX version
pvt_output_parameters.rinex_version = configuration->property(role + ".rinex_version", 3);
if (FLAGS_RINEX_version.compare("3.01") == 0)
if (FLAGS_RINEX_version == "3.01")
{
pvt_output_parameters.rinex_version = 3;
}
else if (FLAGS_RINEX_version.compare("3.02") == 0)
else if (FLAGS_RINEX_version == "3.02")
{
pvt_output_parameters.rinex_version = 3;
}
else if (FLAGS_RINEX_version.compare("3") == 0)
else if (FLAGS_RINEX_version == "3")
{
pvt_output_parameters.rinex_version = 3;
}
else if (FLAGS_RINEX_version.compare("2.11") == 0)
else if (FLAGS_RINEX_version == "2.11")
{
pvt_output_parameters.rinex_version = 2;
}
else if (FLAGS_RINEX_version.compare("2.10") == 0)
else if (FLAGS_RINEX_version == "2.10")
{
pvt_output_parameters.rinex_version = 2;
}
else if (FLAGS_RINEX_version.compare("2") == 0)
else if (FLAGS_RINEX_version == "2")
{
pvt_output_parameters.rinex_version = 2;
}
@ -234,17 +214,18 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0)) pvt_output_parameters.type_of_receiver = 31;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count != 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0)) pvt_output_parameters.type_of_receiver = 32; // L1+E1+L5+E5a
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0)) pvt_output_parameters.type_of_receiver = 33; // L1+E1+E5a
// RTKLIB PVT solver options
// Settings 1
int positioning_mode = -1;
std::string default_pos_mode("Single");
std::string positioning_mode_str = configuration->property(role + ".positioning_mode", default_pos_mode); // (PMODE_XXX) see src/algorithms/libs/rtklib/rtklib.h
if (positioning_mode_str.compare("Single") == 0) positioning_mode = PMODE_SINGLE;
if (positioning_mode_str.compare("Static") == 0) positioning_mode = PMODE_STATIC;
if (positioning_mode_str.compare("Kinematic") == 0) positioning_mode = PMODE_KINEMA;
if (positioning_mode_str.compare("PPP_Static") == 0) positioning_mode = PMODE_PPP_STATIC;
if (positioning_mode_str.compare("PPP_Kinematic") == 0) positioning_mode = PMODE_PPP_KINEMA;
if (positioning_mode_str == "Single") positioning_mode = PMODE_SINGLE;
if (positioning_mode_str == "Static") positioning_mode = PMODE_STATIC;
if (positioning_mode_str == "Kinematic") positioning_mode = PMODE_KINEMA;
if (positioning_mode_str == "PPP_Static") positioning_mode = PMODE_PPP_STATIC;
if (positioning_mode_str == "PPP_Kinematic") positioning_mode = PMODE_PPP_KINEMA;
if (positioning_mode == -1)
{
@ -289,12 +270,12 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
std::string default_iono_model("OFF");
std::string iono_model_str = configuration->property(role + ".iono_model", default_iono_model); /* (IONOOPT_XXX) see src/algorithms/libs/rtklib/rtklib.h */
int iono_model = -1;
if (iono_model_str.compare("OFF") == 0) iono_model = IONOOPT_OFF;
if (iono_model_str.compare("Broadcast") == 0) iono_model = IONOOPT_BRDC;
if (iono_model_str.compare("SBAS") == 0) iono_model = IONOOPT_SBAS;
if (iono_model_str.compare("Iono-Free-LC") == 0) iono_model = IONOOPT_IFLC;
if (iono_model_str.compare("Estimate_STEC") == 0) iono_model = IONOOPT_EST;
if (iono_model_str.compare("IONEX") == 0) iono_model = IONOOPT_TEC;
if (iono_model_str == "OFF") iono_model = IONOOPT_OFF;
if (iono_model_str == "Broadcast") iono_model = IONOOPT_BRDC;
if (iono_model_str == "SBAS") iono_model = IONOOPT_SBAS;
if (iono_model_str == "Iono-Free-LC") iono_model = IONOOPT_IFLC;
if (iono_model_str == "Estimate_STEC") iono_model = IONOOPT_EST;
if (iono_model_str == "IONEX") iono_model = IONOOPT_TEC;
if (iono_model == -1)
{
//warn user and set the default
@ -308,11 +289,11 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
std::string default_trop_model("OFF");
int trop_model = -1;
std::string trop_model_str = configuration->property(role + ".trop_model", default_trop_model); /* (TROPOPT_XXX) see src/algorithms/libs/rtklib/rtklib.h */
if (trop_model_str.compare("OFF") == 0) trop_model = TROPOPT_OFF;
if (trop_model_str.compare("Saastamoinen") == 0) trop_model = TROPOPT_SAAS;
if (trop_model_str.compare("SBAS") == 0) trop_model = TROPOPT_SBAS;
if (trop_model_str.compare("Estimate_ZTD") == 0) trop_model = TROPOPT_EST;
if (trop_model_str.compare("Estimate_ZTD_Grad") == 0) trop_model = TROPOPT_ESTG;
if (trop_model_str == "OFF") trop_model = TROPOPT_OFF;
if (trop_model_str == "Saastamoinen") trop_model = TROPOPT_SAAS;
if (trop_model_str == "SBAS") trop_model = TROPOPT_SBAS;
if (trop_model_str == "Estimate_ZTD") trop_model = TROPOPT_EST;
if (trop_model_str == "Estimate_ZTD_Grad") trop_model = TROPOPT_ESTG;
if (trop_model == -1)
{
//warn user and set the default
@ -357,11 +338,11 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
std::string default_gps_ar("Continuous");
std::string integer_ambiguity_resolution_gps_str = configuration->property(role + ".AR_GPS", default_gps_ar); /* Integer Ambiguity Resolution mode for GPS (0:off,1:continuous,2:instantaneous,3:fix and hold,4:ppp-ar) */
int integer_ambiguity_resolution_gps = -1;
if (integer_ambiguity_resolution_gps_str.compare("OFF") == 0) integer_ambiguity_resolution_gps = ARMODE_OFF;
if (integer_ambiguity_resolution_gps_str.compare("Continuous") == 0) integer_ambiguity_resolution_gps = ARMODE_CONT;
if (integer_ambiguity_resolution_gps_str.compare("Instantaneous") == 0) integer_ambiguity_resolution_gps = ARMODE_INST;
if (integer_ambiguity_resolution_gps_str.compare("Fix-and-Hold") == 0) integer_ambiguity_resolution_gps = ARMODE_FIXHOLD;
if (integer_ambiguity_resolution_gps_str.compare("PPP-AR") == 0) integer_ambiguity_resolution_gps = ARMODE_PPPAR;
if (integer_ambiguity_resolution_gps_str == "OFF") integer_ambiguity_resolution_gps = ARMODE_OFF;
if (integer_ambiguity_resolution_gps_str == "Continuous") integer_ambiguity_resolution_gps = ARMODE_CONT;
if (integer_ambiguity_resolution_gps_str == "Instantaneous") integer_ambiguity_resolution_gps = ARMODE_INST;
if (integer_ambiguity_resolution_gps_str == "Fix-and-Hold") integer_ambiguity_resolution_gps = ARMODE_FIXHOLD;
if (integer_ambiguity_resolution_gps_str == "PPP-AR") integer_ambiguity_resolution_gps = ARMODE_PPPAR;
if (integer_ambiguity_resolution_gps == -1)
{
//warn user and set the default
@ -391,7 +372,7 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
double min_ratio_to_fix_ambiguity = configuration->property(role + ".min_ratio_to_fix_ambiguity", 3.0); /* Set the integer ambiguity validation threshold for ratiotest,
which uses the ratio of squared residuals of the best integer vector to the secondbest vector. */
int min_lock_to_fix_ambiguity = configuration->property(role + ".min_lock_to_fix_ambiguity", 0); /* Set the minimum lock count to fix integer ambiguity.
int min_lock_to_fix_ambiguity = configuration->property(role + ".min_lock_to_fix_ambiguity", 0); /* Set the minimum lock count to fix integer ambiguity.FLAGS_RINEX_version.
If the lock count is less than the value, the ambiguity is excluded from the fixed integer vector. */
double min_elevation_to_fix_ambiguity = configuration->property(role + ".min_elevation_to_fix_ambiguity", 0.0); /* Set the minimum elevation (deg) to fix integer ambiguity.
@ -537,6 +518,28 @@ RtklibPvt::~RtklibPvt()
}
bool RtklibPvt::get_latest_PVT(double* longitude_deg,
double* latitude_deg,
double* height_m,
double* ground_speed_kmh,
double* course_over_ground_deg,
time_t* UTC_time)
{
return pvt_->get_latest_PVT(longitude_deg,
latitude_deg,
height_m,
ground_speed_kmh,
course_over_ground_deg,
UTC_time);
}
void RtklibPvt::clear_ephemeris()
{
pvt_->clear_ephemeris();
}
std::map<int, Gps_Ephemeris> RtklibPvt::get_gps_ephemeris() const
{
return pvt_->get_gps_ephemeris_map();

View File

@ -46,7 +46,7 @@ class RtklibPvt : public PvtInterface
{
public:
RtklibPvt(ConfigurationInterface* configuration,
std::string role,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -94,7 +94,7 @@ public:
private:
rtklib_pvt_cc_sptr pvt_;
rtk_t rtk;
rtk_t rtk{};
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;

View File

@ -29,13 +29,13 @@
*/
#include "rtklib_pvt_cc.h"
#include "display.h"
#include "galileo_almanac.h"
#include "galileo_almanac_helper.h"
#include "pvt_conf.h"
#include "display.h"
#include "gnss_sdr_create_directory.h"
#include <boost/archive/xml_oarchive.hpp>
#include "pvt_conf.h"
#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>
#include <boost/exception/all.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/serialization/map.hpp>
@ -43,9 +43,9 @@
#include <gnuradio/gr_complex.h>
#include <gnuradio/io_signature.h>
#include <algorithm>
#include <exception>
#include <iostream>
#include <map>
#include <exception>
#if OLD_BOOST
#include <boost/math/common_factor_rt.hpp>
namespace bc = boost::math;
@ -59,7 +59,7 @@ using google::LogMessage;
rtklib_pvt_cc_sptr rtklib_make_pvt_cc(uint32_t nchannels,
const Pvt_Conf& conf_,
rtk_t& rtk)
const rtk_t& rtk)
{
return rtklib_pvt_cc_sptr(new rtklib_pvt_cc(nchannels,
conf_,
@ -268,9 +268,9 @@ void rtklib_pvt_cc::clear_ephemeris()
rtklib_pvt_cc::rtklib_pvt_cc(uint32_t nchannels,
const Pvt_Conf& conf_,
rtk_t& rtk) : gr::sync_block("rtklib_pvt_cc",
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
gr::io_signature::make(0, 0, 0))
const rtk_t& rtk) : gr::sync_block("rtklib_pvt_cc",
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
gr::io_signature::make(0, 0, 0))
{
d_output_rate_ms = conf_.output_rate_ms;
d_display_rate_ms = conf_.display_rate_ms;
@ -492,7 +492,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(uint32_t nchannels,
{
xml_base_path = p.string();
}
if (xml_base_path.compare(".") != 0)
if (xml_base_path != ".")
{
std::cout << "XML files will be stored at " << xml_base_path << std::endl;
}
@ -514,7 +514,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(uint32_t nchannels,
if ((sysv_msqid = msgget(sysv_msg_key, msgflg)) == -1)
{
std::cout << "GNSS-SDR can not create message queues!" << std::endl;
throw new std::exception();
throw std::exception();
}
start = std::chrono::system_clock::now();
}
@ -858,7 +858,7 @@ bool rtklib_pvt_cc::send_sys_v_ttff_msg(ttff_msgbuf ttff)
}
bool rtklib_pvt_cc::save_gnss_synchro_map_xml(const std::string file_name)
bool rtklib_pvt_cc::save_gnss_synchro_map_xml(const std::string& file_name)
{
if (gnss_observables_map.empty() == false)
{
@ -877,15 +877,13 @@ bool rtklib_pvt_cc::save_gnss_synchro_map_xml(const std::string file_name)
}
return true;
}
else
{
LOG(WARNING) << "Failed to save gnss_synchro, map is empty";
return false;
}
LOG(WARNING) << "Failed to save gnss_synchro, map is empty";
return false;
}
bool rtklib_pvt_cc::load_gnss_synchro_map_xml(const std::string file_name)
bool rtklib_pvt_cc::load_gnss_synchro_map_xml(const std::string& file_name)
{
// load from xml (boost serialize)
std::ifstream ifs;
@ -925,10 +923,8 @@ bool rtklib_pvt_cc::get_latest_PVT(double* longitude_deg,
return true;
}
else
{
return false;
}
return false;
}
@ -959,7 +955,13 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::map<int, Galileo_Ephemeris>::const_iterator tmp_eph_iter_gal = d_pvt_solver->galileo_ephemeris_map.find(in[i][epoch].PRN);
std::map<int, Gps_CNAV_Ephemeris>::const_iterator tmp_eph_iter_cnav = d_pvt_solver->gps_cnav_ephemeris_map.find(in[i][epoch].PRN);
std::map<int, Glonass_Gnav_Ephemeris>::const_iterator tmp_eph_iter_glo_gnav = d_pvt_solver->glonass_gnav_ephemeris_map.find(in[i][epoch].PRN);
if (((tmp_eph_iter_gps->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal).compare("1C") == 0)) or ((tmp_eph_iter_cnav->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal).compare("2S") == 0)) or ((tmp_eph_iter_gal->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal).compare("1B") == 0)) or ((tmp_eph_iter_gal->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal).compare("5X") == 0)) or ((tmp_eph_iter_glo_gnav->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal).compare("1G") == 0)) or ((tmp_eph_iter_glo_gnav->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal).compare("2G") == 0)) or ((tmp_eph_iter_cnav->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal).compare("L5") == 0)))
if (((tmp_eph_iter_gps->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal) == "1C")) or
((tmp_eph_iter_cnav->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal) == "2S")) or
((tmp_eph_iter_gal->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal) == "1B")) or
((tmp_eph_iter_gal->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal) == "5X")) or
((tmp_eph_iter_glo_gnav->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal) == "1G")) or
((tmp_eph_iter_glo_gnav->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal) == "2G")) or
((tmp_eph_iter_cnav->second.i_satellite_PRN == in[i][epoch].PRN) and (std::string(in[i][epoch].Signal) == "L5")))
{
// store valid observables in a map.
gnss_observables_map.insert(std::pair<int, Gnss_Synchro>(i, in[i][epoch]));
@ -1015,7 +1017,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
if (gnss_observables_map.empty() == false)
{
double current_RX_time = gnss_observables_map.begin()->second.RX_time;
uint32_t current_RX_time_ms = static_cast<uint32_t>(current_RX_time * 1000.0);
auto current_RX_time_ms = static_cast<uint32_t>(current_RX_time * 1000.0);
if (current_RX_time_ms % d_output_rate_ms == 0)
{
flag_compute_pvt_output = true;
@ -1408,6 +1410,16 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
b_rinex_header_written = true; // do not write header anymore
}
break;
case 33: // L1+E1+E5a
if ((gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend()) and
(galileo_ephemeris_iter != d_pvt_solver->galileo_ephemeris_map.cend()))
{
std::string gal_signal("1B 5X");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
b_rinex_header_written = true; // do not write header anymore
}
break;
default:
break;
}
@ -1488,6 +1500,9 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
case 32: // L1+E1+L5+E5a
rp->log_rinex_nav(rp->navMixFile, d_pvt_solver->gps_ephemeris_map, d_pvt_solver->galileo_ephemeris_map);
break;
case 33: // L1+E1+E5a
rp->log_rinex_nav(rp->navMixFile, d_pvt_solver->gps_ephemeris_map, d_pvt_solver->galileo_ephemeris_map);
break;
default:
break;
}
@ -1782,6 +1797,20 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
b_rinex_header_updated = true; // do not write header anymore
}
break;
case 33: // L1+E1+E5a
if ((gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_pvt_solver->galileo_ephemeris_map.cend()))
{
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map);
}
if (!b_rinex_header_updated and (d_pvt_solver->gps_utc_model.d_A0 != 0) and (d_pvt_solver->galileo_utc_model.A0_6 != 0))
{
rp->update_obs_header(rp->obsFile, d_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model);
b_rinex_header_updated = true; // do not write header anymore
}
break;
default:
break;
}
}
}
@ -1893,7 +1922,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gps_channel == 0)
{
if (system.compare("G") == 0)
if (system == "G")
{
// This is a channel with valid GPS signal
gps_eph_iter = d_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -1905,7 +1934,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (gal_channel == 0)
{
if (system.compare("E") == 0)
if (system == "E")
{
gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gal_eph_iter != d_pvt_solver->galileo_ephemeris_map.cend())
@ -1934,18 +1963,49 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
}
if (flag_write_RTCM_MSM_output == true)
if (flag_write_RTCM_MSM_output and d_rtcm_MSM_rate_ms != 0)
{
std::map<int, Gnss_Synchro>::const_iterator gnss_observables_iter;
std::map<int, Galileo_Ephemeris>::const_iterator gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.cbegin();
std::map<int, Gps_CNAV_Ephemeris>::const_iterator gps_cnav_eph_iter = d_pvt_solver->gps_cnav_ephemeris_map.cbegin();
if (gps_cnav_eph_iter != d_pvt_solver->gps_cnav_ephemeris_map.cend())
int gal_channel = 0;
int gps_channel = 0;
for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++)
{
d_rtcm_printer->Print_Rtcm_MSM(7, {}, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
std::string system(&gnss_observables_iter->second.System, 1);
if (gps_channel == 0)
{
if (system == "G")
{
// This is a channel with valid GPS signal
gps_cnav_eph_iter = d_pvt_solver->gps_cnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gps_cnav_eph_iter != d_pvt_solver->gps_cnav_ephemeris_map.cend())
{
gps_channel = 1;
}
}
}
if (gal_channel == 0)
{
if (system == "E")
{
gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gal_eph_iter != d_pvt_solver->galileo_ephemeris_map.cend())
{
gal_channel = 1;
}
}
}
}
if (gal_eph_iter != d_pvt_solver->galileo_ephemeris_map.cend())
if (gal_eph_iter != d_pvt_solver->galileo_ephemeris_map.cend() and (d_rtcm_MT1097_rate_ms != 0))
{
d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
if (gps_cnav_eph_iter != d_pvt_solver->gps_cnav_ephemeris_map.cend() and (d_rtcm_MT1077_rate_ms != 0))
{
d_rtcm_printer->Print_Rtcm_MSM(7, {}, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
}
break;
case 14:
@ -2013,7 +2073,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gps_channel == 0)
{
if (system.compare("G") == 0)
if (system == "G")
{
// This is a channel with valid GPS signal
gps_eph_iter = d_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -2025,7 +2085,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (glo_channel == 0)
{
if (system.compare("R") == 0)
if (system == "R")
{
glonass_gnav_eph_iter = d_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (glonass_gnav_eph_iter != d_pvt_solver->glonass_gnav_ephemeris_map.cend())
@ -2073,7 +2133,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gal_channel == 0)
{
if (system.compare("E") == 0)
if (system == "E")
{
// This is a channel with valid GPS signal
gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -2085,7 +2145,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (glo_channel == 0)
{
if (system.compare("R") == 0)
if (system == "R")
{
glonass_gnav_eph_iter = d_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (glonass_gnav_eph_iter != d_pvt_solver->glonass_gnav_ephemeris_map.cend())
@ -2132,7 +2192,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gps_channel == 0)
{
if (system.compare("G") == 0)
if (system == "G")
{
// This is a channel with valid GPS signal
gps_eph_iter = d_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -2144,7 +2204,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (glo_channel == 0)
{
if (system.compare("R") == 0)
if (system == "R")
{
glonass_gnav_eph_iter = d_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (glonass_gnav_eph_iter != d_pvt_solver->glonass_gnav_ephemeris_map.cend())
@ -2191,7 +2251,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gal_channel == 0)
{
if (system.compare("E") == 0)
if (system == "E")
{
// This is a channel with valid GPS signal
gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -2203,7 +2263,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (glo_channel == 0)
{
if (system.compare("R") == 0)
if (system == "R")
{
glonass_gnav_eph_iter = d_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (glonass_gnav_eph_iter != d_pvt_solver->glonass_gnav_ephemeris_map.cend())
@ -2250,7 +2310,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gal_channel == 0)
{
if (system.compare("E") == 0)
if (system == "E")
{
// This is a channel with valid GPS signal
gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -2262,7 +2322,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (gps_channel == 0)
{
if (system.compare("G") == 0)
if (system == "G")
{
gps_eph_iter = d_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gps_eph_iter != d_pvt_solver->gps_ephemeris_map.cend())
@ -2395,7 +2455,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gps_channel == 0)
{
if (system.compare("G") == 0)
if (system == "G")
{
// This is a channel with valid GPS signal
gps_eph_iter = d_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -2407,7 +2467,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (gal_channel == 0)
{
if (system.compare("E") == 0)
if (system == "E")
{
gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gal_eph_iter != d_pvt_solver->galileo_ephemeris_map.cend())
@ -2439,7 +2499,25 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (d_rtcm_MSM_rate_ms != 0)
{
std::map<int, Gnss_Synchro>::const_iterator gnss_observables_iter;
std::map<int, Galileo_Ephemeris>::const_iterator gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.cbegin();
int gal_channel = 0;
for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++)
{
std::string system(&gnss_observables_iter->second.System, 1);
if (gal_channel == 0)
{
if (system == "E")
{
gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gal_eph_iter != d_pvt_solver->galileo_ephemeris_map.cend())
{
gal_channel = 1;
}
}
}
}
if (gal_eph_iter != d_pvt_solver->galileo_ephemeris_map.cend() and (d_rtcm_MT1097_rate_ms != 0))
{
d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
@ -2513,7 +2591,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gps_channel == 0)
{
if (system.compare("G") == 0)
if (system == "G")
{
// This is a channel with valid GPS signal
gps_eph_iter = d_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -2525,7 +2603,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (glo_channel == 0)
{
if (system.compare("R") == 0)
if (system == "R")
{
glonass_gnav_eph_iter = d_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (glonass_gnav_eph_iter != d_pvt_solver->glonass_gnav_ephemeris_map.cend())
@ -2573,7 +2651,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gal_channel == 0)
{
if (system.compare("E") == 0)
if (system == "E")
{
// This is a channel with valid GPS signal
gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -2585,7 +2663,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (glo_channel == 0)
{
if (system.compare("R") == 0)
if (system == "R")
{
glonass_gnav_eph_iter = d_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (glonass_gnav_eph_iter != d_pvt_solver->glonass_gnav_ephemeris_map.cend())
@ -2633,7 +2711,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gps_channel == 0)
{
if (system.compare("G") == 0)
if (system == "G")
{
// This is a channel with valid GPS signal
gps_eph_iter = d_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -2645,7 +2723,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (glo_channel == 0)
{
if (system.compare("R") == 0)
if (system == "R")
{
glonass_gnav_eph_iter = d_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (glonass_gnav_eph_iter != d_pvt_solver->glonass_gnav_ephemeris_map.cend())
@ -2694,7 +2772,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gal_channel == 0)
{
if (system.compare("E") == 0)
if (system == "E")
{
// This is a channel with valid GPS signal
gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -2706,7 +2784,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (glo_channel == 0)
{
if (system.compare("R") == 0)
if (system == "R")
{
glonass_gnav_eph_iter = d_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (glonass_gnav_eph_iter != d_pvt_solver->glonass_gnav_ephemeris_map.cend())
@ -2754,7 +2832,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string system(&gnss_observables_iter->second.System, 1);
if (gps_channel == 0)
{
if (system.compare("G") == 0)
if (system == "G")
{
// This is a channel with valid GPS signal
gps_eph_iter = d_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -2766,7 +2844,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
}
if (gal_channel == 0)
{
if (system.compare("E") == 0)
if (system == "E")
{
gal_eph_iter = d_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gal_eph_iter != d_pvt_solver->galileo_ephemeris_map.cend())

View File

@ -31,26 +31,26 @@
#ifndef GNSS_SDR_RTKLIB_PVT_CC_H
#define GNSS_SDR_RTKLIB_PVT_CC_H
#include "gps_ephemeris.h"
#include "nmea_printer.h"
#include "kml_printer.h"
#include "gpx_printer.h"
#include "geojson_printer.h"
#include "gps_ephemeris.h"
#include "gpx_printer.h"
#include "kml_printer.h"
#include "nmea_printer.h"
#include "pvt_conf.h"
#include "rinex_printer.h"
#include "rtcm_printer.h"
#include "pvt_conf.h"
#include "rtklib_solver.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <gnuradio/sync_block.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <chrono>
#include <cstdint>
#include <fstream>
#include <utility>
#include <string>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/types.h>
#include <utility>
class rtklib_pvt_cc;
@ -59,7 +59,7 @@ typedef boost::shared_ptr<rtklib_pvt_cc> rtklib_pvt_cc_sptr;
rtklib_pvt_cc_sptr rtklib_make_pvt_cc(uint32_t n_channels,
const Pvt_Conf& conf_,
rtk_t& rtk);
const rtk_t& rtk);
/*!
* \brief This class implements a block that computes the PVT solution using the RTKLIB integrated library
@ -69,7 +69,7 @@ class rtklib_pvt_cc : public gr::sync_block
private:
friend rtklib_pvt_cc_sptr rtklib_make_pvt_cc(uint32_t nchannels,
const Pvt_Conf& conf_,
rtk_t& rtk);
const rtk_t& rtk);
void msg_handler_telemetry(pmt::pmt_t msg);
@ -131,9 +131,9 @@ private:
bool send_sys_v_ttff_msg(ttff_msgbuf ttff);
std::chrono::time_point<std::chrono::system_clock> start, end;
bool save_gnss_synchro_map_xml(const std::string file_name); //debug helper function
bool save_gnss_synchro_map_xml(const std::string& file_name); //debug helper function
bool load_gnss_synchro_map_xml(const std::string file_name); //debug helper function
bool load_gnss_synchro_map_xml(const std::string& file_name); //debug helper function
bool d_xml_storage;
std::string xml_base_path;
@ -147,7 +147,7 @@ private:
public:
rtklib_pvt_cc(uint32_t nchannels,
const Pvt_Conf& conf_,
rtk_t& rtk);
const rtk_t& rtk);
/*!
* \brief Get latest set of ephemeris from PVT block

View File

@ -80,8 +80,7 @@ else()
)
endif()
target_link_libraries(
pvt_lib
target_link_libraries(pvt_lib
rtklib_lib
gnss_sdr_flags
gnss_sp_libs

View File

@ -68,7 +68,7 @@ GeoJSON_Printer::GeoJSON_Printer(const std::string& base_path)
{
geojson_base_path = p.string();
}
if (geojson_base_path.compare(".") != 0)
if (geojson_base_path != ".")
{
std::cout << "GeoJSON files will be stored at " << geojson_base_path << std::endl;
}
@ -83,7 +83,7 @@ GeoJSON_Printer::~GeoJSON_Printer()
}
bool GeoJSON_Printer::set_headers(std::string filename, bool time_tag_name)
bool GeoJSON_Printer::set_headers(const std::string& filename, bool time_tag_name)
{
boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time();
tm timeinfo = boost::posix_time::to_tm(pt);
@ -140,28 +140,24 @@ bool GeoJSON_Printer::set_headers(std::string filename, bool time_tag_name)
DLOG(INFO) << "GeoJSON printer writing on " << filename.c_str();
// Set iostream numeric format and precision
geojson_file.setf(geojson_file.fixed, geojson_file.floatfield);
geojson_file.setf(geojson_file.std::ofstream::fixed, geojson_file.std::ofstream::floatfield);
geojson_file << std::setprecision(14);
// Writing the header
geojson_file << "{" << std::endl;
geojson_file << " \"type\": \"Feature\"," << std::endl;
geojson_file << R"( "type": "Feature",)" << std::endl;
geojson_file << " \"properties\": {" << std::endl;
geojson_file << " \"name\": \"Locations generated by GNSS-SDR\" " << std::endl;
geojson_file << R"( "name": "Locations generated by GNSS-SDR" )" << std::endl;
geojson_file << " }," << std::endl;
geojson_file << " \"geometry\": {" << std::endl;
geojson_file << " \"type\": \"MultiPoint\"," << std::endl;
geojson_file << R"( "type": "MultiPoint",)" << std::endl;
geojson_file << " \"coordinates\": [" << std::endl;
return true;
}
else
{
std::cout << "File " << filename_ << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
std::cout << "File " << filename_ << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
@ -171,7 +167,7 @@ bool GeoJSON_Printer::print_position(const std::shared_ptr<Pvt_Solution>& positi
double longitude;
double height;
std::shared_ptr<Pvt_Solution> position_ = position;
const std::shared_ptr<Pvt_Solution>& position_ = position;
if (print_average_values == false)
{
@ -200,10 +196,7 @@ bool GeoJSON_Printer::print_position(const std::shared_ptr<Pvt_Solution>& positi
}
return true;
}
else
{
return false;
}
return false;
}
@ -222,11 +215,7 @@ bool GeoJSON_Printer::close_file()
{
if (remove(filename_.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
}
return true;
}
else
{
return false;
}
return false;
}

View File

@ -55,7 +55,7 @@ private:
public:
GeoJSON_Printer(const std::string& base_path = ".");
~GeoJSON_Printer();
bool set_headers(std::string filename, bool time_tag_name = true);
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Pvt_Solution>& position, bool print_average_values);
bool close_file();
};

View File

@ -70,7 +70,7 @@ Gpx_Printer::Gpx_Printer(const std::string& base_path)
{
gpx_base_path = p.string();
}
if (gpx_base_path.compare(".") != 0)
if (gpx_base_path != ".")
{
std::cout << "GPX files will be stored at " << gpx_base_path << std::endl;
}
@ -79,7 +79,7 @@ Gpx_Printer::Gpx_Printer(const std::string& base_path)
}
bool Gpx_Printer::set_headers(std::string filename, bool time_tag_name)
bool Gpx_Printer::set_headers(const std::string& filename, bool time_tag_name)
{
boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time();
tm timeinfo = boost::posix_time::to_tm(pt);
@ -134,10 +134,10 @@ bool Gpx_Printer::set_headers(std::string filename, bool time_tag_name)
{
DLOG(INFO) << "GPX printer writing on " << filename.c_str();
// Set iostream numeric format and precision
gpx_file.setf(gpx_file.fixed, gpx_file.floatfield);
gpx_file.setf(gpx_file.std::ofstream::fixed, gpx_file.std::ofstream::floatfield);
gpx_file << std::setprecision(14);
gpx_file << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl
<< "<gpx version=\"1.1\" creator=\"GNSS-SDR\"" << std::endl
gpx_file << R"(<?xml version="1.0" encoding="UTF-8"?>)" << std::endl
<< R"(<gpx version="1.1" creator="GNSS-SDR")" << std::endl
<< indent << "xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v2 http://www.garmin.com/xmlschemas/TrackPointExtensionv2.xsd\"" << std::endl
<< indent << "xmlns=\"http://www.topografix.com/GPX/1/1\"" << std::endl
<< indent << "xmlns:gpxx=\"http://www.garmin.com/xmlschemas/GpxExtensions/v3\"" << std::endl
@ -149,11 +149,8 @@ bool Gpx_Printer::set_headers(std::string filename, bool time_tag_name)
<< indent << indent << "<trkseg>" << std::endl;
return true;
}
else
{
std::cout << "File " << gpx_filename << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
std::cout << "File " << gpx_filename << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
@ -164,7 +161,7 @@ bool Gpx_Printer::print_position(const std::shared_ptr<rtklib_solver>& position,
double height;
positions_printed = true;
std::shared_ptr<rtklib_solver> position_ = position;
const std::shared_ptr<rtklib_solver>& position_ = position;
double speed_over_ground = position_->get_speed_over_ground(); // expressed in m/s
double course_over_ground = position_->get_course_over_ground(); // expressed in deg
@ -201,10 +198,7 @@ bool Gpx_Printer::print_position(const std::shared_ptr<rtklib_solver>& position,
<< "</gpxtpx:TrackPointExtension></extensions></trkpt>" << std::endl;
return true;
}
else
{
return false;
}
return false;
}
@ -218,10 +212,7 @@ bool Gpx_Printer::close_file()
gpx_file.close();
return true;
}
else
{
return false;
}
return false;
}

View File

@ -57,7 +57,7 @@ private:
public:
Gpx_Printer(const std::string& base_path = ".");
~Gpx_Printer();
bool set_headers(std::string filename, bool time_tag_name = true);
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<rtklib_solver>& position, bool print_average_values);
bool close_file();
};

View File

@ -30,11 +30,12 @@
*/
#include "hybrid_ls_pvt.h"
#include "Galileo_E1.h"
#include "GPS_L1_CA.h"
#include "GPS_L2C.h"
#include "Galileo_E1.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h>
#include <utility>
using google::LogMessage;
@ -43,7 +44,7 @@ hybrid_ls_pvt::hybrid_ls_pvt(int nchannels, std::string dump_filename, bool flag
{
// init empty ephemeris for all the available GNSS channels
d_nchannels = nchannels;
d_dump_filename = dump_filename;
d_dump_filename = std::move(dump_filename);
d_flag_dump_enabled = flag_dump_to_file;
d_galileo_current_time = 0;
count_valid_position = 0;
@ -173,7 +174,7 @@ bool hybrid_ls_pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
{
// 1 GPS - find the ephemeris for the current GPS SV observation. The SV PRN ID is the map key
std::string sig_(gnss_observables_iter->second.Signal);
if (sig_.compare("1C") == 0)
if (sig_ == "1C")
{
gps_ephemeris_iter = gps_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gps_ephemeris_iter != gps_ephemeris_map.end())
@ -228,7 +229,7 @@ bool hybrid_ls_pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
DLOG(INFO) << "No ephemeris data for SV " << gnss_observables_iter->first;
}
}
if (sig_.compare("2S") == 0)
if (sig_ == "2S")
{
gps_cnav_ephemeris_iter = gps_cnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gps_cnav_ephemeris_iter != gps_cnav_ephemeris_map.end())
@ -333,7 +334,7 @@ bool hybrid_ls_pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
}
// get time string Gregorian calendar
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>(utc * 1000.0));
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>(utc * 1000.0)); // NOLINT(google-runtime-int)
// 22 August 1999 00:00 last Galileo start GST epoch (ICD sec 5.1.2)
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
this->set_position_UTC_time(p_time);

View File

@ -32,12 +32,12 @@
#ifndef GNSS_SDR_HYBRID_LS_PVT_H_
#define GNSS_SDR_HYBRID_LS_PVT_H_
#include "ls_pvt.h"
#include "galileo_navigation_message.h"
#include "gps_navigation_message.h"
#include "gps_cnav_navigation_message.h"
#include "galileo_almanac.h"
#include "galileo_navigation_message.h"
#include "gnss_synchro.h"
#include "gps_cnav_navigation_message.h"
#include "gps_navigation_message.h"
#include "ls_pvt.h"
#include "rtklib_rtkcmn.h"
#include <fstream>
#include <map>

View File

@ -70,7 +70,7 @@ Kml_Printer::Kml_Printer(const std::string& base_path)
{
kml_base_path = p.string();
}
if (kml_base_path.compare(".") != 0)
if (kml_base_path != ".")
{
std::cout << "KML files will be stored at " << kml_base_path << std::endl;
}
@ -87,7 +87,7 @@ Kml_Printer::Kml_Printer(const std::string& base_path)
}
bool Kml_Printer::set_headers(std::string filename, bool time_tag_name)
bool Kml_Printer::set_headers(const std::string& filename, bool time_tag_name)
{
boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time();
tm timeinfo = boost::posix_time::to_tm(pt);
@ -143,14 +143,14 @@ bool Kml_Printer::set_headers(std::string filename, bool time_tag_name)
{
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.std::ofstream::fixed, kml_file.std::ofstream::floatfield);
kml_file << std::setprecision(14);
tmp_file.setf(tmp_file.fixed, tmp_file.floatfield);
tmp_file.setf(tmp_file.std::ofstream::fixed, tmp_file.std::ofstream::floatfield);
tmp_file << std::setprecision(14);
kml_file << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl
<< "<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gx=\"http://www.google.com/kml/ext/2.2\">" << std::endl
kml_file << R"(<?xml version="1.0" encoding="UTF-8"?>)" << std::endl
<< R"(<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">)" << std::endl
<< indent << "<Document>" << std::endl
<< indent << indent << "<name>GNSS Track</name>" << std::endl
<< indent << indent << "<description><![CDATA[" << std::endl
@ -206,11 +206,8 @@ bool Kml_Printer::set_headers(std::string filename, bool time_tag_name)
return true;
}
else
{
std::cout << "File " << kml_filename << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
std::cout << "File " << kml_filename << " cannot be saved. Wrong permissions?" << std::endl;
return false;
}
@ -222,7 +219,7 @@ bool Kml_Printer::print_position(const std::shared_ptr<rtklib_solver>& position,
positions_printed = true;
std::shared_ptr<rtklib_solver> position_ = position;
const std::shared_ptr<rtklib_solver>& position_ = position;
double speed_over_ground = position_->get_speed_over_ground(); // expressed in m/s
double course_over_ground = position_->get_course_over_ground(); // expressed in deg
@ -282,10 +279,7 @@ bool Kml_Printer::print_position(const std::shared_ptr<rtklib_solver>& position,
return true;
}
else
{
return false;
}
return false;
}
@ -319,10 +313,7 @@ bool Kml_Printer::close_file()
return true;
}
else
{
return false;
}
return false;
}

View File

@ -60,7 +60,7 @@ private:
public:
Kml_Printer(const std::string& base_path = std::string("."));
~Kml_Printer();
bool set_headers(std::string filename, bool time_tag_name = true);
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<rtklib_solver>& position, bool print_average_values);
bool close_file();
};

View File

@ -44,6 +44,7 @@ Ls_Pvt::Ls_Pvt() : Pvt_Solution()
{
}
arma::vec Ls_Pvt::bancroftPos(const arma::mat& satpos, const arma::vec& obs)
{
// BANCROFT Calculation of preliminary coordinates for a GPS receiver based on pseudoranges
@ -233,9 +234,9 @@ arma::vec Ls_Pvt::leastSquarePos(const arma::mat& satpos, const arma::vec& obs,
Rot_X = Ls_Pvt::rotateSatellite(traveltime, X.col(i)); //armadillo
//--- Find DOA and range of satellites
double* azim = 0;
double* elev = 0;
double* dist = 0;
double* azim = nullptr;
double* elev = nullptr;
double* dist = nullptr;
topocent(azim, elev, dist, pos.subvec(0, 2), Rot_X - pos.subvec(0, 2));
if (traveltime < 0.1 && nmbOfSatellites > 3)

View File

@ -1,5 +1,5 @@
/*!
* \file kml_printer.cc
* \file nmea_printer.cc
* \brief Implementation of a NMEA 2.1 printer for GNSS-SDR
* This class provides a implementation of a subset of the NMEA-0183 standard for interfacing
* marine electronic devices as defined by the National Marine Electronics Association (NMEA).
@ -48,7 +48,7 @@
using google::LogMessage;
Nmea_Printer::Nmea_Printer(std::string filename, bool flag_nmea_output_file, bool flag_nmea_tty_port, std::string nmea_dump_devname, const std::string& base_path)
Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_file, bool flag_nmea_tty_port, std::string nmea_dump_devname, const std::string& base_path)
{
nmea_base_path = base_path;
d_flag_nmea_output_file = flag_nmea_output_file;
@ -79,7 +79,7 @@ Nmea_Printer::Nmea_Printer(std::string filename, bool flag_nmea_output_file, boo
nmea_base_path = p.string();
}
if ((nmea_base_path.compare(".") != 0) and (d_flag_nmea_output_file == true))
if ((nmea_base_path != ".") and (d_flag_nmea_output_file == true))
{
std::cout << "NMEA files will be stored at " << nmea_base_path << std::endl;
}
@ -99,10 +99,10 @@ Nmea_Printer::Nmea_Printer(std::string filename, bool flag_nmea_output_file, boo
}
}
nmea_devname = nmea_dump_devname;
nmea_devname = std::move(nmea_dump_devname);
if (flag_nmea_tty_port == true)
{
nmea_dev_descriptor = init_serial(nmea_devname.c_str());
nmea_dev_descriptor = init_serial(nmea_devname);
if (nmea_dev_descriptor != -1)
{
DLOG(INFO) << "NMEA printer writing on " << nmea_devname.c_str();
@ -126,20 +126,22 @@ Nmea_Printer::~Nmea_Printer()
}
int Nmea_Printer::init_serial(std::string serial_device)
int Nmea_Printer::init_serial(const std::string& serial_device)
{
/*!
* Opens the serial device and sets the default baud rate for a NMEA transmission (9600,8,N,1)
*/
int fd = 0;
struct termios options;
struct termios options
{
};
int64_t BAUD;
int64_t DATABITS;
int64_t STOPBITS;
int64_t PARITYON;
int64_t PARITY;
fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY | O_CLOEXEC);
if (fd == -1) return fd; // failed to open TTY port
if (fcntl(fd, F_SETFL, 0) == -1) LOG(INFO) << "Error enabling direct I/O"; // clear all flags on descriptor, enable direct I/O
@ -246,9 +248,9 @@ char Nmea_Printer::checkSum(std::string sentence)
{
char check = 0;
// iterate over the string, XOR each byte with the total sum:
for (unsigned int c = 0; c < sentence.length(); c++)
for (char c : sentence)
{
check = char(check ^ sentence.at(c));
check = char(check ^ c);
}
// return the result
return check;

View File

@ -53,12 +53,12 @@ public:
/*!
* \brief Default constructor.
*/
Nmea_Printer(std::string filename, bool flag_nmea_output_file, bool flag_nmea_tty_port, std::string nmea_dump_filename, const std::string& base_path = ".");
Nmea_Printer(const std::string& filename, bool flag_nmea_output_file, bool flag_nmea_tty_port, std::string nmea_dump_devname, const std::string& base_path = ".");
/*!
* \brief Print NMEA PVT and satellite info to the initialized device
*/
bool Print_Nmea_Line(const std::shared_ptr<rtklib_solver>& position, bool print_average_values);
bool Print_Nmea_Line(const std::shared_ptr<rtklib_solver>& pvt_data, bool print_average_values);
/*!
* \brief Default destructor.
@ -72,7 +72,7 @@ private:
std::string nmea_devname;
int nmea_dev_descriptor; // NMEA serial device descriptor (i.e. COM port)
std::shared_ptr<rtklib_solver> d_PVT_data;
int init_serial(std::string serial_device); //serial port control
int init_serial(const std::string& serial_device); //serial port control
void close_serial();
std::string get_GPGGA(); // fix data
std::string get_GPGSV(); // satellite data

View File

@ -33,8 +33,8 @@
#include <cstddef>
#include <cstdint>
#include <string>
#include <map>
#include <string>
class Pvt_Conf
{

View File

@ -188,7 +188,7 @@ int Pvt_Solution::tropo(double *ddr_m, double sinel, double hsta_km, double p_mb
double b;
double rtop;
while (1)
while (true)
{
rtop = pow((a_e + htop), 2) - pow((a_e + hsta_km), 2) * (1 - pow(sinel, 2));

View File

@ -33,9 +33,9 @@
#define GNSS_SDR_PVT_SOLUTION_H_
#include <armadillo>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <deque>
#include <armadillo>
const unsigned int PVT_MAX_CHANNELS = 90;
const unsigned int PVT_MAX_PRN = 127; // 126 is SBAS

File diff suppressed because it is too large Load Diff

View File

@ -51,21 +51,21 @@
#ifndef GNSS_SDR_RINEX_PRINTER_H_
#define GNSS_SDR_RINEX_PRINTER_H_
#include "gps_navigation_message.h"
#include "gps_cnav_navigation_message.h"
#include "galileo_navigation_message.h"
#include "glonass_gnav_navigation_message.h"
#include "GLONASS_L1_L2_CA.h"
#include "GPS_L1_CA.h"
#include "Galileo_E1.h"
#include "GLONASS_L1_L2_CA.h"
#include "galileo_navigation_message.h"
#include "glonass_gnav_navigation_message.h"
#include "gnss_synchro.h"
#include "gps_cnav_navigation_message.h"
#include "gps_navigation_message.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <cstdint>
#include <string>
#include <fstream>
#include <sstream> // for stringstream
#include <iomanip> // for setprecision
#include <map>
#include <sstream> // for stringstream
#include <string>
class Sbas_Raw_Msg;
@ -146,52 +146,52 @@ public:
/*!
* \brief Generates the GPS L2 Observation data header
*/
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph, const double d_TOW_first_observation, const std::string gps_bands = "2S");
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph, const double d_TOW_first_observation, const std::string& gps_bands = "2S");
/*!
* \brief Generates the dual frequency GPS L1 & L2/L5 Observation data header
*/
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph, const Gps_CNAV_Ephemeris& eph_cnav, const double d_TOW_first_observation, const std::string gps_bands = "1C 2S");
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph, const Gps_CNAV_Ephemeris& eph_cnav, const double d_TOW_first_observation, const std::string& gps_bands = "1C 2S");
/*!
* \brief Generates the Galileo Observation data header. Example: bands("1B"), bands("1B 5X"), bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& eph, const double d_TOW_first_observation, const std::string bands = "1B");
void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& eph, const double d_TOW_first_observation, const std::string& bands = "1B");
/*!
* \brief Generates the Mixed (GPS/Galileo) Observation data header. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string galileo_bands = "1B");
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& galileo_bands = "1B");
/*!
* \brief Generates the Mixed (GPS/Galileo) Observation data header. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string gps_bands = "1C 2S", const std::string galileo_bands = "1B");
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& gps_bands = "1C 2S", const std::string& galileo_bands = "1B");
/*!
* \brief Generates the Mixed (GPS/Galileo) Observation data header. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string gps_bands = "2S", const std::string galileo_bands = "1B");
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& eph_cnav, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation, const std::string& gps_bands = "2S", const std::string& galileo_bands = "1B");
/*!
* \brief Generates the GLONASS GNAV Observation data header. Example: bands("1C"), bands("1C 2C"), bands("2C"), ... Default: "1C".
*/
void rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double d_TOW_first_observation, const std::string bands = "1G");
void rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double d_TOW_first_observation, const std::string& bands = "1G");
/*!
* \brief Generates the Mixed (GPS L1 C/A /GLONASS) Observation data header. Example: galileo_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string glo_bands = "1C");
void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& glo_bands = "1C");
/*!
* \brief Generates the Mixed (Galileo/GLONASS) Observation data header. Example: galileo_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& galileo_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string galileo_bands = "1B", const std::string glo_bands = "1C");
void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& galileo_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& galileo_bands = "1B", const std::string& glo_bands = "1C");
/*!
* \brief Generates the Mixed (GPS L2C/GLONASS) Observation data header. Example: galileo_bands("1G")... Default: "1G".
*/
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& gps_cnav_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string glo_bands = "1G");
void rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris& gps_cnav_eph, const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const double d_TOW_first_observation, const std::string& glo_bands = "1G");
/*!
* \brief Generates the SBAS raw data header
@ -297,7 +297,7 @@ public:
/*!
* \brief Writes Galileo observables into the RINEX file. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string galileo_bands = "1B");
void log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string& galileo_bands = "1B");
/*!
* \brief Writes Mixed GPS / Galileo observables into the RINEX file
@ -317,7 +317,7 @@ public:
/*!
* \brief Writes GLONASS GNAV observables into the RINEX file. Example: glonass_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
*/
void log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string glonass_bands = "1C");
void log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables, const std::string& glonass_bands = "1C");
/*!
* \brief Writes Mixed GPS L1 C/A - GLONASS observables into the RINEX file
@ -406,7 +406,7 @@ private:
* "RINEX_FILE_TYPE_SBAS" - SBAS broadcast data file.
* "RINEX_FILE_TYPE_CLK" - Clock file.
*/
std::string createFilename(std::string type);
std::string createFilename(const std::string& type);
/*
* Generates the data for the PGM / RUN BY / DATE line
@ -547,7 +547,7 @@ private:
*/
inline double asDouble(const std::string& s)
{
return strtod(s.c_str(), 0);
return strtod(s.c_str(), nullptr);
}
@ -560,7 +560,7 @@ private:
*/
inline int64_t asInt(const std::string& s)
{
return strtol(s.c_str(), 0, 10);
return strtol(s.c_str(), nullptr, 10);
}
@ -796,7 +796,7 @@ inline std::string Rinex_Printer::asFixWidthString(const int x, const int width,
inline int64_t asInt(const std::string& s)
{
return strtol(s.c_str(), 0, 10);
return strtol(s.c_str(), nullptr, 10);
}

View File

@ -37,15 +37,17 @@
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <glog/logging.h>
#include <cstdint>
#include <fcntl.h> // for O_RDWR
#include <iomanip>
#include <fcntl.h> // for O_RDWR
#include <termios.h> // for tcgetattr
#include <utility>
using google::LogMessage;
Rtcm_Printer::Rtcm_Printer(std::string filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, std::string rtcm_dump_devname, bool time_tag_name, const std::string& base_path)
Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, const std::string& rtcm_dump_devname, bool time_tag_name, const std::string& base_path)
{
boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time();
tm timeinfo = boost::posix_time::to_tm(pt);
@ -77,7 +79,7 @@ Rtcm_Printer::Rtcm_Printer(std::string filename, bool flag_rtcm_file_dump, bool
{
rtcm_base_path = p.string();
}
if (rtcm_base_path.compare(".") != 0)
if (rtcm_base_path != ".")
{
std::cout << "RTCM binary file will be stored at " << rtcm_base_path << std::endl;
}
@ -141,7 +143,7 @@ Rtcm_Printer::Rtcm_Printer(std::string filename, bool flag_rtcm_file_dump, bool
}
}
rtcm_devname = rtcm_dump_devname;
rtcm_devname = std::move(rtcm_dump_devname);
if (flag_rtcm_tty_port == true)
{
rtcm_dev_descriptor = init_serial(rtcm_devname.c_str());
@ -186,7 +188,7 @@ Rtcm_Printer::~Rtcm_Printer()
}
if (rtcm_file_descriptor.is_open())
{
long pos;
int64_t pos;
pos = rtcm_file_descriptor.tellp();
rtcm_file_descriptor.close();
if (pos == 0)
@ -337,20 +339,20 @@ bool Rtcm_Printer::Print_Rtcm_MSM(uint32_t msm_number, const Gps_Ephemeris& gps_
}
int Rtcm_Printer::init_serial(std::string serial_device)
int Rtcm_Printer::init_serial(const std::string& serial_device)
{
/*
* Opens the serial device and sets the default baud rate for a RTCM transmission (9600,8,N,1)
*/
int32_t fd = 0;
struct termios options;
long BAUD;
long DATABITS;
long STOPBITS;
long PARITYON;
long PARITY;
int64_t BAUD;
int64_t DATABITS;
int64_t STOPBITS;
int64_t PARITYON;
int64_t PARITY;
fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY | O_CLOEXEC);
if (fd == -1) return fd; // failed to open TTY port
if (fcntl(fd, F_SETFL, 0) == -1) LOG(INFO) << "Error enabling direct I/O"; // clear all flags on descriptor, enable direct I/O

View File

@ -48,7 +48,7 @@ public:
/*!
* \brief Default constructor.
*/
Rtcm_Printer(std::string filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, std::string rtcm_dump_filename, bool time_tag_name = true, const std::string& base_path = ".");
Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, const std::string& rtcm_dump_filename, bool time_tag_name = true, const std::string& base_path = ".");
/*!
* \brief Default destructor.
@ -148,8 +148,8 @@ private:
std::string rtcm_devname;
uint16_t port;
uint16_t station_id;
int32_t rtcm_dev_descriptor; // RTCM serial device descriptor (i.e. COM port)
int32_t init_serial(std::string serial_device); //serial port control
int32_t rtcm_dev_descriptor; // RTCM serial device descriptor (i.e. COM port)
int32_t init_serial(const std::string& serial_device); //serial port control
void close_serial();
std::shared_ptr<Rtcm> rtcm;
bool Print_Message(const std::string& message);

View File

@ -52,33 +52,34 @@
* -----------------------------------------------------------------------*/
#include "rtklib_solver.h"
#include "rtklib_conversions.h"
#include "rtklib_solution.h"
#include "GLONASS_L1_L2_CA.h"
#include "GPS_L1_CA.h"
#include "Galileo_E1.h"
#include "GLONASS_L1_L2_CA.h"
#include <matio.h>
#include "rtklib_conversions.h"
#include "rtklib_solution.h"
#include <glog/logging.h>
#include <matio.h>
#include <utility>
using google::LogMessage;
rtklib_solver::rtklib_solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, rtk_t &rtk)
rtklib_solver::rtklib_solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t &rtk)
{
// init empty ephemeris for all the available GNSS channels
d_nchannels = nchannels;
d_dump_filename = dump_filename;
d_dump_filename = std::move(dump_filename);
d_flag_dump_enabled = flag_dump_to_file;
d_flag_dump_mat_enabled = flag_dump_to_mat;
count_valid_position = 0;
this->set_averaging_flag(false);
rtk_ = rtk;
for (unsigned int i = 0; i < 4; i++) dop_[i] = 0.0;
for (double &i : dop_) i = 0.0;
pvt_sol = {{0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, '0', '0', '0', 0, 0, 0};
ssat_t ssat0 = {0, 0, {0.0}, {0.0}, {0.0}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {}, {}, {}, {}, 0.0, 0.0, 0.0, 0.0, {{{0, 0}}, {{0, 0}}}, {{}, {}}};
for (unsigned int i = 0; i < MAXSAT; i++)
for (auto &i : pvt_ssat)
{
pvt_ssat[i] = ssat0;
i = ssat0;
}
// ############# ENABLE DATA FILE LOG #################
if (d_flag_dump_enabled == true)
@ -137,34 +138,34 @@ bool rtklib_solver::save_matfile()
return false;
}
uint32_t *TOW_at_current_symbol_ms = new uint32_t[num_epoch];
uint32_t *week = new uint32_t[num_epoch];
double *RX_time = new double[num_epoch];
double *user_clk_offset = new double[num_epoch];
double *pos_x = new double[num_epoch];
double *pos_y = new double[num_epoch];
double *pos_z = new double[num_epoch];
double *vel_x = new double[num_epoch];
double *vel_y = new double[num_epoch];
double *vel_z = new double[num_epoch];
double *cov_xx = new double[num_epoch];
double *cov_yy = new double[num_epoch];
double *cov_zz = new double[num_epoch];
double *cov_xy = new double[num_epoch];
double *cov_yz = new double[num_epoch];
double *cov_zx = new double[num_epoch];
double *latitude = new double[num_epoch];
double *longitude = new double[num_epoch];
double *height = new double[num_epoch];
uint8_t *valid_sats = new uint8_t[num_epoch];
uint8_t *solution_status = new uint8_t[num_epoch];
uint8_t *solution_type = new uint8_t[num_epoch];
float *AR_ratio_factor = new float[num_epoch];
float *AR_ratio_threshold = new float[num_epoch];
double *gdop = new double[num_epoch];
double *pdop = new double[num_epoch];
double *hdop = new double[num_epoch];
double *vdop = new double[num_epoch];
auto *TOW_at_current_symbol_ms = new uint32_t[num_epoch];
auto *week = new uint32_t[num_epoch];
auto *RX_time = new double[num_epoch];
auto *user_clk_offset = new double[num_epoch];
auto *pos_x = new double[num_epoch];
auto *pos_y = new double[num_epoch];
auto *pos_z = new double[num_epoch];
auto *vel_x = new double[num_epoch];
auto *vel_y = new double[num_epoch];
auto *vel_z = new double[num_epoch];
auto *cov_xx = new double[num_epoch];
auto *cov_yy = new double[num_epoch];
auto *cov_zz = new double[num_epoch];
auto *cov_xy = new double[num_epoch];
auto *cov_yz = new double[num_epoch];
auto *cov_zx = new double[num_epoch];
auto *latitude = new double[num_epoch];
auto *longitude = new double[num_epoch];
auto *height = new double[num_epoch];
auto *valid_sats = new uint8_t[num_epoch];
auto *solution_status = new uint8_t[num_epoch];
auto *solution_type = new uint8_t[num_epoch];
auto *AR_ratio_factor = new float[num_epoch];
auto *AR_ratio_threshold = new float[num_epoch];
auto *gdop = new double[num_epoch];
auto *pdop = new double[num_epoch];
auto *hdop = new double[num_epoch];
auto *vdop = new double[num_epoch];
try
{
@ -245,8 +246,8 @@ bool rtklib_solver::save_matfile()
std::string filename = dump_filename;
filename.erase(filename.length() - 4, 4);
filename.append(".mat");
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != NULL)
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_UINT32, MAT_T_UINT32, 2, dims, TOW_at_current_symbol_ms, 0);
@ -473,11 +474,11 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
case 'G':
{
std::string sig_(gnss_observables_iter->second.Signal);
if (sig_.compare("1C") == 0)
if (sig_ == "1C")
{
band1 = true;
}
if (sig_.compare("2S") == 0)
if (sig_ == "2S")
{
band2 = true;
}
@ -500,7 +501,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{
std::string sig_(gnss_observables_iter->second.Signal);
// Galileo E1
if (sig_.compare("1B") == 0)
if (sig_ == "1B")
{
// 1 Gal - find the ephemeris for the current GALILEO SV observation. The SV PRN ID is the map key
galileo_ephemeris_iter = galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -523,7 +524,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
}
// Galileo E5
if (sig_.compare("5X") == 0)
if (sig_ == "5X")
{
// 1 Gal - find the ephemeris for the current GALILEO SV observation. The SV PRN ID is the map key
galileo_ephemeris_iter = galileo_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -548,7 +549,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second);
// convert observation from GNSS-SDR class to RTKLIB structure
unsigned char default_code_ = static_cast<unsigned char>(CODE_NONE);
auto default_code_ = static_cast<unsigned char>(CODE_NONE);
obsd_t newobs = {{0, 0}, '0', '0', {}, {},
{default_code_, default_code_, default_code_},
{}, {0.0, 0.0, 0.0}, {}};
@ -571,7 +572,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// GPS L1
// 1 GPS - find the ephemeris for the current GPS SV observation. The SV PRN ID is the map key
std::string sig_(gnss_observables_iter->second.Signal);
if (sig_.compare("1C") == 0)
if (sig_ == "1C")
{
gps_ephemeris_iter = gps_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gps_ephemeris_iter != gps_ephemeris_map.cend())
@ -592,7 +593,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
}
}
// GPS L2 (todo: solve NAV/CNAV clash)
if ((sig_.compare("2S") == 0) and (gps_dual_band == false))
if ((sig_ == "2S") and (gps_dual_band == false))
{
gps_cnav_ephemeris_iter = gps_cnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gps_cnav_ephemeris_iter != gps_cnav_ephemeris_map.cend())
@ -624,7 +625,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second);
// convert observation from GNSS-SDR class to RTKLIB structure
unsigned char default_code_ = static_cast<unsigned char>(CODE_NONE);
auto default_code_ = static_cast<unsigned char>(CODE_NONE);
obsd_t newobs = {{0, 0}, '0', '0', {}, {},
{default_code_, default_code_, default_code_},
{}, {0.0, 0.0, 0.0}, {}};
@ -641,7 +642,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
}
}
// GPS L5
if (sig_.compare("L5") == 0)
if (sig_ == "L5")
{
gps_cnav_ephemeris_iter = gps_cnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
if (gps_cnav_ephemeris_iter != gps_cnav_ephemeris_map.cend())
@ -671,7 +672,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second);
// convert observation from GNSS-SDR class to RTKLIB structure
unsigned char default_code_ = static_cast<unsigned char>(CODE_NONE);
auto default_code_ = static_cast<unsigned char>(CODE_NONE);
obsd_t newobs = {{0, 0}, '0', '0', {}, {},
{default_code_, default_code_, default_code_},
{}, {0.0, 0.0, 0.0}, {}};
@ -693,7 +694,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{
std::string sig_(gnss_observables_iter->second.Signal);
// GLONASS GNAV L1
if (sig_.compare("1G") == 0)
if (sig_ == "1G")
{
// 1 Glo - find the ephemeris for the current GLONASS SV observation. The SV Slot Number (PRN ID) is the map key
glonass_gnav_ephemeris_iter = glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -715,7 +716,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
}
}
// GLONASS GNAV L2
if (sig_.compare("2G") == 0)
if (sig_ == "2G")
{
// 1 GLONASS - find the ephemeris for the current GLONASS SV observation. The SV PRN ID is the map key
glonass_gnav_ephemeris_iter = glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN);
@ -775,11 +776,11 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
nav_data.n = valid_obs;
nav_data.ng = glo_valid_obs;
for (int i = 0; i < MAXSAT; i++)
for (auto &i : nav_data.lam)
{
nav_data.lam[i][0] = SPEED_OF_LIGHT / FREQ1; // L1/E1
nav_data.lam[i][1] = SPEED_OF_LIGHT / FREQ2; // L2
nav_data.lam[i][2] = SPEED_OF_LIGHT / FREQ5; // L5/E5
i[0] = SPEED_OF_LIGHT / FREQ1; // L1/E1
i[1] = SPEED_OF_LIGHT / FREQ2; // L2
i[2] = SPEED_OF_LIGHT / FREQ5; // L5/E5
}
result = rtkpos(&rtk_, obs_data, valid_obs + glo_valid_obs, &nav_data);
@ -809,17 +810,17 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
std::vector<double> azel;
azel.reserve(used_sats * 2);
unsigned int index_aux = 0;
for (unsigned int i = 0; i < MAXSAT; i++)
for (auto &i : rtk_.ssat)
{
if (rtk_.ssat[i].vs == 1)
if (i.vs == 1)
{
azel[2 * index_aux] = rtk_.ssat[i].azel[0];
azel[2 * index_aux + 1] = rtk_.ssat[i].azel[1];
azel[2 * index_aux] = i.azel[0];
azel[2 * index_aux + 1] = i.azel[1];
index_aux++;
}
}
if (index_aux > 0) dops(index_aux, azel.data(), 0.0, dop_);
if (index_aux > 0) dops(index_aux, azel.data(), 0.0, dop_.data());
this->set_valid_position(true);
arma::vec rx_position_and_time(4);
rx_position_and_time(0) = pvt_sol.rr[0]; // [m]
@ -866,7 +867,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
gtime_t rtklib_time = gpst2time(adjgpsweek(nav_data.eph[0].week), gnss_observables_map.begin()->second.RX_time);
gtime_t rtklib_utc_time = gpst2utc(rtklib_time);
p_time = boost::posix_time::from_time_t(rtklib_utc_time.time);
p_time += boost::posix_time::microseconds(static_cast<long>(round(rtklib_utc_time.sec * 1e6)));
p_time += boost::posix_time::microseconds(static_cast<long>(round(rtklib_utc_time.sec * 1e6))); // NOLINT(google-runtime-int)
this->set_position_UTC_time(p_time);
cart2geo(static_cast<double>(rx_position_and_time(0)), static_cast<double>(rx_position_and_time(1)), static_cast<double>(rx_position_and_time(2)), 4);

View File

@ -55,14 +55,15 @@
#define GNSS_SDR_RTKLIB_SOLVER_H_
#include "rtklib_rtkpos.h"
#include "galileo_navigation_message.h"
#include "gps_navigation_message.h"
#include "gps_cnav_navigation_message.h"
#include "glonass_gnav_navigation_message.h"
#include "galileo_almanac.h"
#include "galileo_navigation_message.h"
#include "glonass_gnav_navigation_message.h"
#include "gnss_synchro.h"
#include "gps_cnav_navigation_message.h"
#include "gps_navigation_message.h"
#include "pvt_solution.h"
#include "rtklib_rtkpos.h"
#include <array>
#include <fstream>
#include <map>
#include <string>
@ -82,12 +83,12 @@ private:
bool d_flag_dump_enabled;
bool d_flag_dump_mat_enabled;
int d_nchannels; // Number of available channels for positioning
double dop_[4];
std::array<double, 4> dop_;
public:
sol_t pvt_sol;
ssat_t pvt_ssat[MAXSAT];
rtklib_solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, rtk_t& rtk);
rtklib_solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t& rtk);
~rtklib_solver();
bool get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_map, bool flag_averaging);
@ -99,7 +100,7 @@ public:
std::map<int, Galileo_Ephemeris> galileo_ephemeris_map; //!< Map storing new Galileo_Ephemeris
std::map<int, Gps_Ephemeris> gps_ephemeris_map; //!< Map storing new GPS_Ephemeris
std::map<int, Gps_CNAV_Ephemeris> gps_cnav_ephemeris_map; //!< Map storing new GPS_CNAV_Ephemeris
std::map<int, Glonass_Gnav_Ephemeris> glonass_gnav_ephemeris_map; //!< Map storing new GLONASS GNAV Ephmeris
std::map<int, Glonass_Gnav_Ephemeris> glonass_gnav_ephemeris_map; //!< Map storing new GLONASS GNAV Ephemeris
Galileo_Utc_Model galileo_utc_model;
Galileo_Iono galileo_iono;

View File

@ -30,22 +30,23 @@
*/
#include "galileo_e1_pcps_8ms_ambiguous_acquisition.h"
#include <boost/lexical_cast.hpp>
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include "galileo_e1_signal_processing.h"
#include "Galileo_E1.h"
#include "configuration_interface.h"
#include "galileo_e1_signal_processing.h"
#include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GalileoE1Pcps8msAmbiguousAcquisition::stop_acquisition()
{
}
GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
@ -56,7 +57,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
item_type_ = configuration_->property(role + ".item_type",
default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
dump_ = configuration_->property(role + ".dump", false);
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
@ -86,7 +87,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
code_ = new gr_complex[vector_length_];
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = galileo_pcps_8ms_make_acquisition_cc(sampled_ms_, max_dwells_,
@ -107,7 +108,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -125,10 +126,15 @@ GalileoE1Pcps8msAmbiguousAcquisition::~GalileoE1Pcps8msAmbiguousAcquisition()
}
void GalileoE1Pcps8msAmbiguousAcquisition::stop_acquisition()
{
}
void GalileoE1Pcps8msAmbiguousAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_channel(channel_);
}
@ -137,7 +143,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_channel(unsigned int channel)
void GalileoE1Pcps8msAmbiguousAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + boost::lexical_cast<std::string>(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
if (pfa == 0.0) pfa = configuration_->property(role_ + ".pfa", 0.0);
@ -152,7 +158,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_threshold(float threshold)
DLOG(INFO) << "Channel " << channel_ << " Threshold = " << threshold_;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_threshold(threshold_);
}
@ -163,7 +169,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_doppler_max(unsigned int doppler_
{
doppler_max_ = doppler_max;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_max(doppler_max_);
}
@ -173,7 +179,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_doppler_max(unsigned int doppler_
void GalileoE1Pcps8msAmbiguousAcquisition::set_doppler_step(unsigned int doppler_step)
{
doppler_step_ = doppler_step;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_step(doppler_step_);
}
@ -184,7 +190,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_gnss_synchro(
Gnss_Synchro* gnss_synchro)
{
gnss_synchro_ = gnss_synchro;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
}
@ -193,14 +199,11 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_gnss_synchro(
signed int GalileoE1Pcps8msAmbiguousAcquisition::mag()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -213,12 +216,12 @@ void GalileoE1Pcps8msAmbiguousAcquisition::init()
void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
bool cboc = configuration_->property(
"Acquisition" + boost::lexical_cast<std::string>(channel_) + ".cboc", false);
"Acquisition" + std::to_string(channel_) + ".cboc", false);
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
@ -238,7 +241,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code()
void GalileoE1Pcps8msAmbiguousAcquisition::reset()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_active(true);
}
@ -257,9 +260,9 @@ float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -267,7 +270,7 @@ float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
void GalileoE1Pcps8msAmbiguousAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
}
@ -276,7 +279,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::connect(gr::top_block_sptr top_block)
void GalileoE1Pcps8msAmbiguousAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
}

View File

@ -32,9 +32,9 @@
#ifndef GNSS_SDR_GALILEO_E1_PCPS_8MS_AMBIGUOUS_ACQUISITION_H_
#define GNSS_SDR_GALILEO_E1_PCPS_8MS_AMBIGUOUS_ACQUISITION_H_
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "galileo_pcps_8ms_acquisition_cc.h"
#include "gnss_synchro.h"
#include <gnuradio/blocks/stream_to_vector.h>
#include <string>
@ -48,7 +48,8 @@ class GalileoE1Pcps8msAmbiguousAcquisition : public AcquisitionInterface
{
public:
GalileoE1Pcps8msAmbiguousAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GalileoE1Pcps8msAmbiguousAcquisition();
@ -130,6 +131,9 @@ public:
void set_state(int state __attribute__((unused))) override{};
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
galileo_pcps_8ms_acquisition_cc_sptr acquisition_cc_;
@ -144,7 +148,7 @@ private:
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::complex<float>* code_;

View File

@ -30,27 +30,26 @@
*/
#include "galileo_e1_pcps_ambiguous_acquisition.h"
#include "Galileo_E1.h"
#include "acq_conf.h"
#include "configuration_interface.h"
#include "galileo_e1_signal_processing.h"
#include "Galileo_E1.h"
#include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include <boost/lexical_cast.hpp>
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GalileoE1PcpsAmbiguousAcquisition::stop_acquisition()
{
}
GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
Acq_Conf acq_parameters;
configuration_ = configuration;
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./acquisition.mat";
@ -59,43 +58,69 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.fs_in = fs_in_;
acq_parameters.samples_per_chip = static_cast<unsigned int>(ceil((1.0 / Galileo_E1_CODE_CHIP_RATE_HZ) * static_cast<float>(acq_parameters.fs_in)));
acq_parameters_.fs_in = fs_in_;
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
acq_parameters.doppler_max = doppler_max_;
acq_parameters.ms_per_code = 4;
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", acq_parameters.ms_per_code);
acq_parameters.sampled_ms = sampled_ms_;
if ((acq_parameters.sampled_ms % acq_parameters.ms_per_code) != 0)
acq_parameters_.doppler_max = doppler_max_;
acq_parameters_.ms_per_code = 4;
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", acq_parameters_.ms_per_code);
acq_parameters_.sampled_ms = sampled_ms_;
if ((acq_parameters_.sampled_ms % acq_parameters_.ms_per_code) != 0)
{
LOG(WARNING) << "Parameter coherent_integration_time_ms should be a multiple of 4. Setting it to 4";
acq_parameters.sampled_ms = acq_parameters.ms_per_code;
acq_parameters_.sampled_ms = acq_parameters_.ms_per_code;
}
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
acq_parameters.bit_transition_flag = bit_transition_flag_;
acq_parameters_.bit_transition_flag = bit_transition_flag_;
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
acq_parameters_.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
acquire_pilot_ = configuration_->property(role + ".acquire_pilot", false); //will be true in future versions
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
acq_parameters.max_dwells = max_dwells_;
acq_parameters_.max_dwells = max_dwells_;
dump_ = configuration_->property(role + ".dump", false);
acq_parameters.dump = dump_;
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
acq_parameters_.dump = dump_;
acq_parameters_.dump_channel = configuration_->property(role + ".dump_channel", 0);
blocking_ = configuration_->property(role + ".blocking", true);
acq_parameters.blocking = blocking_;
acq_parameters_.blocking = blocking_;
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
acq_parameters.dump_filename = dump_filename_;
//--- Find number of samples per spreading code (4 ms) -----------------
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS)));
acq_parameters_.dump_filename = dump_filename_;
float samples_per_ms = static_cast<float>(fs_in_) * 0.001;
acq_parameters.samples_per_ms = samples_per_ms;
acq_parameters.samples_per_code = acq_parameters.samples_per_ms * static_cast<float>(Galileo_E1_CODE_PERIOD_MS);
vector_length_ = sampled_ms_ * samples_per_ms;
acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false);
if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex")
{
LOG(WARNING) << "Galileo E1 acqisition disabled the automatic resampler feature because its item_type is not set to gr_complex";
acq_parameters_.use_automatic_resampler = false;
}
if (acq_parameters_.use_automatic_resampler)
{
if (acq_parameters_.fs_in > Galileo_E1_OPT_ACQ_FS_HZ)
{
acq_parameters_.resampler_ratio = floor(static_cast<float>(acq_parameters_.fs_in) / Galileo_E1_OPT_ACQ_FS_HZ);
uint32_t decimation = acq_parameters_.fs_in / Galileo_E1_OPT_ACQ_FS_HZ;
while (acq_parameters_.fs_in % decimation > 0)
{
decimation--;
};
acq_parameters_.resampler_ratio = decimation;
acq_parameters_.resampled_fs = acq_parameters_.fs_in / static_cast<int>(acq_parameters_.resampler_ratio);
}
//--- Find number of samples per spreading code (4 ms) -----------------
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS)));
acq_parameters_.samples_per_ms = static_cast<float>(acq_parameters_.resampled_fs) * 0.001;
acq_parameters_.samples_per_chip = static_cast<unsigned int>(ceil((1.0 / Galileo_E1_CODE_CHIP_RATE_HZ) * static_cast<float>(acq_parameters_.resampled_fs)));
}
else
{
//--- Find number of samples per spreading code (4 ms) -----------------
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS)));
acq_parameters_.samples_per_ms = static_cast<float>(fs_in_) * 0.001;
acq_parameters_.samples_per_chip = static_cast<unsigned int>(ceil((1.0 / Galileo_E1_CODE_CHIP_RATE_HZ) * static_cast<float>(acq_parameters_.fs_in)));
}
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(Galileo_E1_CODE_PERIOD_MS);
vector_length_ = sampled_ms_ * acq_parameters_.samples_per_ms;
if (bit_transition_flag_)
{
vector_length_ *= 2;
@ -103,7 +128,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
code_ = new gr_complex[vector_length_];
if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
item_size_ = sizeof(lv_16sc_t);
}
@ -111,15 +136,15 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
{
item_size_ = sizeof(gr_complex);
}
acq_parameters.it_size = item_size_;
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
acquisition_ = pcps_make_acquisition(acq_parameters);
acq_parameters_.it_size = item_size_;
acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false);
acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
acquisition_ = pcps_make_acquisition(acq_parameters_);
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
float_to_complex_ = gr::blocks::float_to_complex::make();
@ -128,7 +153,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -146,6 +171,11 @@ GalileoE1PcpsAmbiguousAcquisition::~GalileoE1PcpsAmbiguousAcquisition()
}
void GalileoE1PcpsAmbiguousAcquisition::stop_acquisition()
{
}
void GalileoE1PcpsAmbiguousAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
@ -155,7 +185,7 @@ void GalileoE1PcpsAmbiguousAcquisition::set_channel(unsigned int channel)
void GalileoE1PcpsAmbiguousAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + boost::lexical_cast<std::string>(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
if (pfa == 0.0) pfa = configuration_->property(role_ + ".pfa", 0.0);
@ -214,21 +244,37 @@ void GalileoE1PcpsAmbiguousAcquisition::init()
void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
{
bool cboc = configuration_->property(
"Acquisition" + boost::lexical_cast<std::string>(channel_) + ".cboc", false);
"Acquisition" + std::to_string(channel_) + ".cboc", false);
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
if (acquire_pilot_ == true)
{
//set local signal generator to Galileo E1 pilot component (1C)
char pilot_signal[3] = "1C";
galileo_e1_code_gen_complex_sampled(code, pilot_signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
if (acq_parameters_.use_automatic_resampler)
{
galileo_e1_code_gen_complex_sampled(code, pilot_signal,
cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false);
}
else
{
galileo_e1_code_gen_complex_sampled(code, pilot_signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
}
}
else
{
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
if (acq_parameters_.use_automatic_resampler)
{
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false);
}
else
{
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
}
}
@ -267,9 +313,9 @@ float GalileoE1PcpsAmbiguousAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -277,15 +323,15 @@ float GalileoE1PcpsAmbiguousAcquisition::calculate_threshold(float pfa)
void GalileoE1PcpsAmbiguousAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to connect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
// Since a byte-based acq implementation is not available,
// we just convert cshorts to gr_complex
@ -302,15 +348,15 @@ void GalileoE1PcpsAmbiguousAcquisition::connect(gr::top_block_sptr top_block)
void GalileoE1PcpsAmbiguousAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to disconnect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
top_block->disconnect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->disconnect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
@ -325,23 +371,21 @@ void GalileoE1PcpsAmbiguousAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_left_block()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_;
}
else if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
return acquisition_;
}
else if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
return cbyte_to_float_x2_;
}
else
{
LOG(WARNING) << item_type_ << " unknown acquisition item type";
return nullptr;
}
LOG(WARNING) << item_type_ << " unknown acquisition item type";
return nullptr;
}
@ -349,3 +393,8 @@ gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_right_block()
{
return acquisition_;
}
void GalileoE1PcpsAmbiguousAcquisition::set_resampler_latency(uint32_t latency_samples)
{
acquisition_->set_resampler_latency(latency_samples);
}

View File

@ -32,10 +32,11 @@
#ifndef GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_
#define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_
#include "acq_conf.h"
#include "acquisition_interface.h"
#include "complex_byte_to_float_x2.h"
#include "gnss_synchro.h"
#include "pcps_acquisition.h"
#include "complex_byte_to_float_x2.h"
#include <gnuradio/blocks/float_to_complex.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <string>
@ -51,7 +52,8 @@ class GalileoE1PcpsAmbiguousAcquisition : public AcquisitionInterface
{
public:
GalileoE1PcpsAmbiguousAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GalileoE1PcpsAmbiguousAcquisition();
@ -136,8 +138,16 @@ public:
*/
void stop_acquisition() override;
/*!
* \brief Sets the resampler latency to account it in the acquisition code delay estimation
*/
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
Acq_Conf acq_parameters_;
pcps_acquisition_sptr acquisition_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
@ -154,7 +164,7 @@ private:
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
bool blocking_;
std::string dump_filename_;

View File

@ -30,9 +30,9 @@
*/
#include "galileo_e1_pcps_ambiguous_acquisition_fpga.h"
#include "Galileo_E1.h"
#include "configuration_interface.h"
#include "galileo_e1_signal_processing.h"
#include "Galileo_E1.h"
#include "gnss_sdr_flags.h"
#include <boost/lexical_cast.hpp>
#include <boost/math/distributions/exponential.hpp>
@ -41,13 +41,14 @@
using google::LogMessage;
void GalileoE1PcpsAmbiguousAcquisitionFpga::stop_acquisition()
{
}
GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
//printf("top acq constructor start\n");
pcpsconf_fpga_t acq_parameters;
@ -61,8 +62,8 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
// item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
int64_t fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
float downsampling_factor = configuration_->property(role + ".downsampling_factor", 4.0);
acq_parameters.downsampling_factor = downsampling_factor;
@ -77,7 +78,6 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
//printf("fs_in post downsampling = %ld\n", fs_in);
acq_parameters.fs_in = fs_in;
//if_ = configuration_->property(role + ".if", 0);
//acq_parameters.freq = if_;
@ -105,7 +105,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
// dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
// acq_parameters.dump_filename = dump_filename_;
//--- Find number of samples per spreading code (4 ms) -----------------
unsigned int code_length = static_cast<unsigned int>(std::round(static_cast<double>(fs_in) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS)));
auto code_length = static_cast<unsigned int>(std::round(static_cast<double>(fs_in) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS)));
//acq_parameters.samples_per_code = code_length_;
//int samples_per_ms = static_cast<int>(std::round(static_cast<double>(fs_in_) * 0.001));
//acq_parameters.samples_per_ms = samples_per_ms;
@ -140,9 +140,9 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
// compute all the GALILEO E1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
std::complex<float>* code = new std::complex<float>[nsamples_total]; // buffer for the local code
gr_complex* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_all_fft_codes_ = new lv_16sc_t[nsamples_total * Galileo_E1_NUMBER_OF_CODES]; // memory containing all the possible fft codes for PRN 0 to 32
float max; // temporary maxima search
@ -151,7 +151,6 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
for (unsigned int PRN = 1; PRN <= Galileo_E1_NUMBER_OF_CODES; PRN++)
{
//code_ = new gr_complex[vector_length_];
bool cboc = false; // cboc is set to 0 when using the FPGA
@ -330,7 +329,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
channel_ = 0;
//threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
//printf("top acq constructor end\n");
}
@ -344,6 +343,11 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::~GalileoE1PcpsAmbiguousAcquisitionFpga()
}
void GalileoE1PcpsAmbiguousAcquisitionFpga::stop_acquisition()
{
}
void GalileoE1PcpsAmbiguousAcquisitionFpga::set_channel(unsigned int channel)
{
//printf("top acq set channel start\n");

View File

@ -33,11 +33,11 @@
#define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H_
#include "acquisition_interface.h"
#include "complex_byte_to_float_x2.h"
#include "gnss_synchro.h"
#include "pcps_acquisition_fpga.h"
#include "complex_byte_to_float_x2.h"
#include <gnuradio/blocks/stream_to_vector.h>
#include <gnuradio/blocks/float_to_complex.h>
#include <gnuradio/blocks/stream_to_vector.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <string>
@ -52,7 +52,8 @@ class GalileoE1PcpsAmbiguousAcquisitionFpga : public AcquisitionInterface
{
public:
GalileoE1PcpsAmbiguousAcquisitionFpga(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GalileoE1PcpsAmbiguousAcquisitionFpga();
@ -162,6 +163,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
//pcps_acquisition_sptr acquisition_;

View File

@ -30,23 +30,23 @@
*/
#include "galileo_e1_pcps_cccwsr_ambiguous_acquisition.h"
#include <boost/lexical_cast.hpp>
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include "galileo_e1_signal_processing.h"
#include "Galileo_E1.h"
#include "configuration_interface.h"
#include "galileo_e1_signal_processing.h"
#include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GalileoE1PcpsCccwsrAmbiguousAcquisition::stop_acquisition()
{
}
GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
@ -56,7 +56,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
dump_ = configuration_->property(role + ".dump", false);
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
@ -88,7 +88,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
code_data_ = new gr_complex[vector_length_];
code_pilot_ = new gr_complex[vector_length_];
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = pcps_cccwsr_make_acquisition_cc(sampled_ms_, max_dwells_,
@ -109,7 +109,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -128,10 +128,15 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::~GalileoE1PcpsCccwsrAmbiguousAcquisitio
}
void GalileoE1PcpsCccwsrAmbiguousAcquisition::stop_acquisition()
{
}
void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_channel(channel_);
}
@ -140,7 +145,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_channel(unsigned int channel)
void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_threshold(float threshold)
{
// float pfa = configuration_->property(role_+ boost::lexical_cast<std::string>(channel_) + ".pfa", 0.0);
// float pfa = configuration_->property(role_+ std::to_string(channel_) + ".pfa", 0.0);
// if(pfa==0.0) pfa = configuration_->property(role_+".pfa", 0.0);
@ -157,7 +162,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_threshold(float threshold)
DLOG(INFO) << "Channel " << channel_ << " Threshold = " << threshold_;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_threshold(threshold_);
}
@ -168,7 +173,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_doppler_max(unsigned int doppl
{
doppler_max_ = doppler_max;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_max(doppler_max_);
}
@ -178,7 +183,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_doppler_max(unsigned int doppl
void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_doppler_step(unsigned int doppler_step)
{
doppler_step_ = doppler_step;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_step(doppler_step_);
}
@ -188,7 +193,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_gnss_synchro(
Gnss_Synchro* gnss_synchro)
{
gnss_synchro_ = gnss_synchro;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
}
@ -197,14 +202,11 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_gnss_synchro(
signed int GalileoE1PcpsCccwsrAmbiguousAcquisition::mag()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -217,10 +219,10 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::init()
void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_local_code()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
bool cboc = configuration_->property(
"Acquisition" + boost::lexical_cast<std::string>(channel_) + ".cboc", false);
"Acquisition" + std::to_string(channel_) + ".cboc", false);
char signal[3];
@ -241,7 +243,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_local_code()
void GalileoE1PcpsCccwsrAmbiguousAcquisition::reset()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_active(true);
}
@ -264,7 +266,7 @@ float GalileoE1PcpsCccwsrAmbiguousAcquisition::calculate_threshold(float pfa)
void GalileoE1PcpsCccwsrAmbiguousAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
}
@ -273,7 +275,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::connect(gr::top_block_sptr top_blo
void GalileoE1PcpsCccwsrAmbiguousAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
}

View File

@ -32,8 +32,8 @@
#ifndef GNSS_SDR_GALILEO_E1_PCPS_CCCWSR_AMBIGUOUS_ACQUISITION_H_
#define GNSS_SDR_GALILEO_E1_PCPS_CCCWSR_AMBIGUOUS_ACQUISITION_H_
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "gnss_synchro.h"
#include "pcps_cccwsr_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h>
#include <string>
@ -48,7 +48,8 @@ class GalileoE1PcpsCccwsrAmbiguousAcquisition : public AcquisitionInterface
{
public:
GalileoE1PcpsCccwsrAmbiguousAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GalileoE1PcpsCccwsrAmbiguousAcquisition();
@ -130,6 +131,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
pcps_cccwsr_acquisition_cc_sptr acquisition_cc_;
@ -145,7 +148,7 @@ private:
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::complex<float>* code_data_;

View File

@ -30,23 +30,23 @@
*/
#include "galileo_e1_pcps_quicksync_ambiguous_acquisition.h"
#include <boost/lexical_cast.hpp>
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include "galileo_e1_signal_processing.h"
#include "Galileo_E1.h"
#include "configuration_interface.h"
#include "galileo_e1_signal_processing.h"
#include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::stop_acquisition()
{
}
GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
@ -57,7 +57,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
item_type_ = configuration_->property(role + ".item_type",
default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
dump_ = configuration_->property(role + ".dump", false);
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
@ -119,7 +119,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
<< ", Folding factor: " << folding_factor_
<< ", Sampled ms: " << sampled_ms_
<< ", Code Length: " << code_length_;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = pcps_quicksync_make_acquisition_cc(folding_factor_,
@ -142,7 +142,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -160,10 +160,15 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::~GalileoE1PcpsQuickSyncAmbiguousAcqu
}
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::stop_acquisition()
{
}
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_channel(channel_);
}
@ -172,7 +177,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_channel(unsigned int channe
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + boost::lexical_cast<std::string>(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
if (pfa == 0.0) pfa = configuration_->property(role_ + ".pfa", 0.0);
@ -187,7 +192,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_threshold(float threshold)
DLOG(INFO) << "Channel " << channel_ << " Threshold = " << threshold_;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_threshold(threshold_);
}
@ -198,7 +203,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_doppler_max(unsigned int do
{
doppler_max_ = doppler_max;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_max(doppler_max_);
}
@ -208,7 +213,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_doppler_max(unsigned int do
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_doppler_step(unsigned int doppler_step)
{
doppler_step_ = doppler_step;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_step(doppler_step_);
}
@ -218,7 +223,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_gnss_synchro(
Gnss_Synchro* gnss_synchro)
{
gnss_synchro_ = gnss_synchro;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
}
@ -228,14 +233,11 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_gnss_synchro(
signed int
GalileoE1PcpsQuickSyncAmbiguousAcquisition::mag()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -248,12 +250,12 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::init()
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
bool cboc = configuration_->property(
"Acquisition" + boost::lexical_cast<std::string>(channel_) + ".cboc", false);
"Acquisition" + std::to_string(channel_) + ".cboc", false);
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
@ -269,14 +271,14 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code()
acquisition_cc_->set_local_code(code_);
delete[] code;
code = NULL;
code = nullptr;
}
}
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::reset()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_active(true);
}
@ -284,7 +286,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::reset()
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_state(int state)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_state(state);
}
@ -306,7 +308,7 @@ float GalileoE1PcpsQuickSyncAmbiguousAcquisition::calculate_threshold(float pfa)
double val = pow(1.0 - pfa, exponent);
double lambda = static_cast<double>(code_length_) / static_cast<double>(folding_factor_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -314,7 +316,7 @@ float GalileoE1PcpsQuickSyncAmbiguousAcquisition::calculate_threshold(float pfa)
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
}
@ -323,7 +325,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::connect(gr::top_block_sptr top_
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
}

View File

@ -32,8 +32,8 @@
#ifndef GNSS_SDR_GALILEO_E1_PCPS_QUICKSYNC_AMBIGUOUS_ACQUISITION_H_
#define GNSS_SDR_GALILEO_E1_PCPS_QUICKSYNC_AMBIGUOUS_ACQUISITION_H_
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "gnss_synchro.h"
#include "pcps_quicksync_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h>
#include <string>
@ -49,7 +49,8 @@ class GalileoE1PcpsQuickSyncAmbiguousAcquisition : public AcquisitionInterface
{
public:
GalileoE1PcpsQuickSyncAmbiguousAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GalileoE1PcpsQuickSyncAmbiguousAcquisition();
@ -134,6 +135,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
pcps_quicksync_acquisition_cc_sptr acquisition_cc_;
@ -150,7 +153,7 @@ private:
unsigned int sampled_ms_;
unsigned int max_dwells_;
unsigned int folding_factor_;
long fs_in_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::complex<float>* code_;

View File

@ -30,23 +30,23 @@
*/
#include "galileo_e1_pcps_tong_ambiguous_acquisition.h"
#include <boost/lexical_cast.hpp>
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include "galileo_e1_signal_processing.h"
#include "Galileo_E1.h"
#include "configuration_interface.h"
#include "galileo_e1_signal_processing.h"
#include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GalileoE1PcpsTongAmbiguousAcquisition::stop_acquisition()
{
}
GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
@ -57,7 +57,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
item_type_ = configuration_->property(role + ".item_type",
default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
dump_ = configuration_->property(role + ".dump", false);
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
@ -90,7 +90,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
code_ = new gr_complex[vector_length_];
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = pcps_tong_make_acquisition_cc(sampled_ms_, doppler_max_,
@ -112,7 +112,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -130,10 +130,15 @@ GalileoE1PcpsTongAmbiguousAcquisition::~GalileoE1PcpsTongAmbiguousAcquisition()
}
void GalileoE1PcpsTongAmbiguousAcquisition::stop_acquisition()
{
}
void GalileoE1PcpsTongAmbiguousAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_channel(channel_);
}
@ -142,7 +147,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_channel(unsigned int channel)
void GalileoE1PcpsTongAmbiguousAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + boost::lexical_cast<std::string>(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
if (pfa == 0.0) pfa = configuration_->property(role_ + ".pfa", 0.0);
@ -157,7 +162,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_threshold(float threshold)
DLOG(INFO) << "Channel " << channel_ << " Threshold = " << threshold_;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_threshold(threshold_);
}
@ -168,7 +173,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_doppler_max(unsigned int doppler
{
doppler_max_ = doppler_max;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_max(doppler_max_);
}
@ -178,7 +183,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_doppler_max(unsigned int doppler
void GalileoE1PcpsTongAmbiguousAcquisition::set_doppler_step(unsigned int doppler_step)
{
doppler_step_ = doppler_step;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_step(doppler_step_);
}
@ -189,7 +194,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_gnss_synchro(
Gnss_Synchro* gnss_synchro)
{
gnss_synchro_ = gnss_synchro;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
}
@ -198,14 +203,11 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_gnss_synchro(
signed int GalileoE1PcpsTongAmbiguousAcquisition::mag()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -218,12 +220,12 @@ void GalileoE1PcpsTongAmbiguousAcquisition::init()
void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
bool cboc = configuration_->property(
"Acquisition" + boost::lexical_cast<std::string>(channel_) + ".cboc", false);
"Acquisition" + std::to_string(channel_) + ".cboc", false);
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
@ -243,7 +245,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code()
void GalileoE1PcpsTongAmbiguousAcquisition::reset()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_active(true);
}
@ -268,9 +270,9 @@ float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -278,7 +280,7 @@ float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa)
void GalileoE1PcpsTongAmbiguousAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
}
@ -287,7 +289,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::connect(gr::top_block_sptr top_block
void GalileoE1PcpsTongAmbiguousAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
}

View File

@ -32,8 +32,8 @@
#ifndef GNSS_SDR_GALILEO_E1_PCPS_TONG_AMBIGUOUS_ACQUISITION_H_
#define GNSS_SDR_GALILEO_E1_PCPS_TONG_AMBIGUOUS_ACQUISITION_H_
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "gnss_synchro.h"
#include "pcps_tong_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h>
#include <string>
@ -48,7 +48,8 @@ class GalileoE1PcpsTongAmbiguousAcquisition : public AcquisitionInterface
{
public:
GalileoE1PcpsTongAmbiguousAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GalileoE1PcpsTongAmbiguousAcquisition();
@ -133,6 +134,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
pcps_tong_acquisition_cc_sptr acquisition_cc_;
@ -149,7 +152,7 @@ private:
unsigned int tong_init_val_;
unsigned int tong_max_val_;
unsigned int tong_max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::complex<float>* code_;

View File

@ -36,23 +36,23 @@
*/
#include "galileo_e5a_noncoherent_iq_acquisition_caf.h"
#include <boost/lexical_cast.hpp>
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include "galileo_e5_signal_processing.h"
#include "Galileo_E5a.h"
#include "configuration_interface.h"
#include "galileo_e5_signal_processing.h"
#include "gnss_sdr_flags.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GalileoE5aNoncoherentIQAcquisitionCaf::stop_acquisition()
{
}
GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
@ -62,7 +62,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
dump_ = configuration_->property(role + ".dump", false);
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
@ -101,7 +101,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
{
both_signal_components = true;
}
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(sampled_ms_, max_dwells_,
@ -117,7 +117,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -136,10 +136,15 @@ GalileoE5aNoncoherentIQAcquisitionCaf::~GalileoE5aNoncoherentIQAcquisitionCaf()
}
void GalileoE5aNoncoherentIQAcquisitionCaf::stop_acquisition()
{
}
void GalileoE5aNoncoherentIQAcquisitionCaf::set_channel(unsigned int channel)
{
channel_ = channel;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_channel(channel_);
}
@ -148,7 +153,7 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_channel(unsigned int channel)
void GalileoE5aNoncoherentIQAcquisitionCaf::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + boost::lexical_cast<std::string>(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
if (pfa == 0.0) pfa = configuration_->property(role_ + ".pfa", 0.0);
@ -163,7 +168,7 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_threshold(float threshold)
DLOG(INFO) << "Channel " << channel_ << " Threshold = " << threshold_;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_threshold(threshold_);
}
@ -174,7 +179,7 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_doppler_max(unsigned int doppler
{
doppler_max_ = doppler_max;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_max(doppler_max_);
}
@ -184,7 +189,7 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_doppler_max(unsigned int doppler
void GalileoE5aNoncoherentIQAcquisitionCaf::set_doppler_step(unsigned int doppler_step)
{
doppler_step_ = doppler_step;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_step(doppler_step_);
}
@ -195,7 +200,7 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_gnss_synchro(
Gnss_Synchro* gnss_synchro)
{
gnss_synchro_ = gnss_synchro;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
}
@ -204,14 +209,11 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_gnss_synchro(
signed int GalileoE5aNoncoherentIQAcquisitionCaf::mag()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -224,10 +226,10 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::init()
void GalileoE5aNoncoherentIQAcquisitionCaf::set_local_code()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
std::complex<float>* codeI = new std::complex<float>[code_length_];
std::complex<float>* codeQ = new std::complex<float>[code_length_];
auto* codeI = new std::complex<float>[code_length_];
auto* codeQ = new std::complex<float>[code_length_];
if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X')
{
@ -281,7 +283,7 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_local_code()
void GalileoE5aNoncoherentIQAcquisitionCaf::reset()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_active(true);
}
@ -300,9 +302,9 @@ float GalileoE5aNoncoherentIQAcquisitionCaf::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}

View File

@ -38,9 +38,9 @@
#ifndef GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_H_
#define GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_H_
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "galileo_e5a_noncoherent_iq_acquisition_caf_cc.h"
#include "gnss_synchro.h"
#include <string>
class ConfigurationInterface;
@ -49,7 +49,8 @@ class GalileoE5aNoncoherentIQAcquisitionCaf : public AcquisitionInterface
{
public:
GalileoE5aNoncoherentIQAcquisitionCaf(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GalileoE5aNoncoherentIQAcquisitionCaf();
@ -136,6 +137,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr acquisition_cc_;
@ -150,7 +153,7 @@ private:
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
int Zero_padding;

View File

@ -29,12 +29,11 @@
*/
#include "galileo_e5a_pcps_acquisition.h"
#include "Galileo_E5a.h"
#include "acq_conf.h"
#include "configuration_interface.h"
#include "galileo_e5_signal_processing.h"
#include "Galileo_E5a.h"
#include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include <boost/lexical_cast.hpp>
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr_complex.h>
@ -42,14 +41,14 @@
using google::LogMessage;
void GalileoE5aPcpsAcquisition::stop_acquisition()
{
}
GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
Acq_Conf acq_parameters = Acq_Conf();
configuration_ = configuration;
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./acquisition.mat";
@ -58,10 +57,9 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.fs_in = fs_in_;
acq_parameters.samples_per_chip = static_cast<unsigned int>(ceil((1.0 / Galileo_E5a_CODE_CHIP_RATE_HZ) * static_cast<float>(acq_parameters.fs_in)));
acq_parameters_.fs_in = fs_in_;
acq_pilot_ = configuration_->property(role + ".acquire_pilot", false);
acq_iq_ = configuration_->property(role + ".acquire_iq", false);
if (acq_iq_)
@ -69,33 +67,69 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
acq_pilot_ = false;
}
dump_ = configuration_->property(role + ".dump", false);
acq_parameters.dump = dump_;
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
acq_parameters_.dump = dump_;
acq_parameters_.dump_channel = configuration_->property(role + ".dump_channel", 0);
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
acq_parameters.doppler_max = doppler_max_;
acq_parameters_.doppler_max = doppler_max_;
sampled_ms_ = 1;
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
acq_parameters.max_dwells = max_dwells_;
acq_parameters_.max_dwells = max_dwells_;
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
acq_parameters.dump_filename = dump_filename_;
acq_parameters_.dump_filename = dump_filename_;
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
acq_parameters.bit_transition_flag = bit_transition_flag_;
acq_parameters_.bit_transition_flag = bit_transition_flag_;
use_CFAR_ = configuration_->property(role + ".use_CFAR_algorithm", false);
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_;
acq_parameters_.use_CFAR_algorithm_flag = use_CFAR_;
blocking_ = configuration_->property(role + ".blocking", true);
acq_parameters.blocking = blocking_;
acq_parameters_.blocking = blocking_;
acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false);
if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex")
{
LOG(WARNING) << "Galileo E5a acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex";
acq_parameters_.use_automatic_resampler = false;
}
if (acq_parameters_.use_automatic_resampler)
{
if (acq_parameters_.fs_in > Galileo_E5a_OPT_ACQ_FS_HZ)
{
acq_parameters_.resampler_ratio = floor(static_cast<float>(acq_parameters_.fs_in) / Galileo_E5a_OPT_ACQ_FS_HZ);
uint32_t decimation = acq_parameters_.fs_in / Galileo_E5a_OPT_ACQ_FS_HZ;
while (acq_parameters_.fs_in % decimation > 0)
{
decimation--;
};
acq_parameters_.resampler_ratio = decimation;
acq_parameters_.resampled_fs = acq_parameters_.fs_in / static_cast<int>(acq_parameters_.resampler_ratio);
}
//--- Find number of samples per spreading code -------------------------
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (Galileo_E5a_CODE_CHIP_RATE_HZ / Galileo_E5a_CODE_LENGTH_CHIPS)));
acq_parameters_.samples_per_ms = static_cast<float>(acq_parameters_.resampled_fs) * 0.001;
acq_parameters_.samples_per_chip = static_cast<unsigned int>(ceil((1.0 / Galileo_E5a_CODE_CHIP_RATE_HZ) * static_cast<float>(acq_parameters_.resampled_fs)));
}
else
{
acq_parameters_.resampled_fs = fs_in_;
//--- Find number of samples per spreading code -------------------------
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (Galileo_E5a_CODE_CHIP_RATE_HZ / Galileo_E5a_CODE_LENGTH_CHIPS)));
acq_parameters_.samples_per_ms = static_cast<float>(fs_in_) * 0.001;
acq_parameters_.samples_per_chip = static_cast<unsigned int>(ceil((1.0 / Galileo_E5a_CODE_CHIP_RATE_HZ) * static_cast<float>(acq_parameters_.fs_in)));
}
//--- Find number of samples per spreading code (1ms)-------------------------
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast<double>(Galileo_E5a_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * sampled_ms_;
code_ = new gr_complex[vector_length_];
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
item_size_ = sizeof(lv_16sc_t);
}
@ -104,21 +138,20 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
item_size_ = sizeof(gr_complex);
LOG(WARNING) << item_type_ << " unknown acquisition item type";
}
acq_parameters.it_size = item_size_;
acq_parameters.samples_per_ms = static_cast<float>(fs_in_) * 0.001;
acq_parameters.sampled_ms = sampled_ms_;
acq_parameters.ms_per_code = 1;
acq_parameters.samples_per_code = acq_parameters.samples_per_ms * static_cast<float>(GALILEO_E5a_CODE_PERIOD_MS);
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
acquisition_ = pcps_make_acquisition(acq_parameters);
acq_parameters_.it_size = item_size_;
acq_parameters_.sampled_ms = sampled_ms_;
acq_parameters_.ms_per_code = 1;
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GALILEO_E5a_CODE_PERIOD_MS);
acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false);
acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
acquisition_ = pcps_make_acquisition(acq_parameters_);
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -136,6 +169,11 @@ GalileoE5aPcpsAcquisition::~GalileoE5aPcpsAcquisition()
}
void GalileoE5aPcpsAcquisition::stop_acquisition()
{
}
void GalileoE5aPcpsAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
@ -145,7 +183,7 @@ void GalileoE5aPcpsAcquisition::set_channel(unsigned int channel)
void GalileoE5aPcpsAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + boost::lexical_cast<std::string>(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
if (pfa == 0.0)
{
@ -203,7 +241,7 @@ void GalileoE5aPcpsAcquisition::init()
void GalileoE5aPcpsAcquisition::set_local_code()
{
gr_complex* code = new gr_complex[code_length_];
auto* code = new gr_complex[code_length_];
char signal_[3];
if (acq_iq_)
@ -219,7 +257,14 @@ void GalileoE5aPcpsAcquisition::set_local_code()
strcpy(signal_, "5I");
}
galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, fs_in_, 0);
if (acq_parameters_.use_automatic_resampler)
{
galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0);
}
else
{
galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, fs_in_, 0);
}
for (unsigned int i = 0; i < sampled_ms_; i++)
{
@ -248,9 +293,9 @@ float GalileoE5aPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -264,11 +309,11 @@ void GalileoE5aPcpsAcquisition::set_state(int state)
void GalileoE5aPcpsAcquisition::connect(gr::top_block_sptr top_block __attribute__((unused)))
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to connect
}
@ -281,11 +326,11 @@ void GalileoE5aPcpsAcquisition::connect(gr::top_block_sptr top_block __attribute
void GalileoE5aPcpsAcquisition::disconnect(gr::top_block_sptr top_block __attribute__((unused)))
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to disconnect
}
@ -306,3 +351,8 @@ gr::basic_block_sptr GalileoE5aPcpsAcquisition::get_right_block()
{
return acquisition_;
}
void GalileoE5aPcpsAcquisition::set_resampler_latency(uint32_t latency_samples)
{
acquisition_->set_resampler_latency(latency_samples);
}

View File

@ -43,7 +43,8 @@ class GalileoE5aPcpsAcquisition : public AcquisitionInterface
{
public:
GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GalileoE5aPcpsAcquisition();
@ -127,13 +128,19 @@ public:
*/
void stop_acquisition() override;
/*!
* \brief Sets the resampler latency to account it in the acquisition code delay estimation
*/
void set_resampler_latency(uint32_t latency_samples) override;
private:
float calculate_threshold(float pfa);
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
Acq_Conf acq_parameters_;
size_t item_size_;
std::string item_type_;
@ -157,7 +164,7 @@ private:
unsigned int in_streams_;
unsigned int out_streams_;
long fs_in_;
int64_t fs_in_;
float threshold_;

View File

@ -29,11 +29,10 @@
*/
#include "galileo_e5a_pcps_acquisition_fpga.h"
#include "Galileo_E5a.h"
#include "configuration_interface.h"
#include "galileo_e5_signal_processing.h"
#include "Galileo_E5a.h"
#include "gnss_sdr_flags.h"
#include <boost/lexical_cast.hpp>
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr_complex.h>
@ -41,12 +40,13 @@
using google::LogMessage;
void GalileoE5aPcpsAcquisitionFpga::stop_acquisition()
{
}
GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
//printf("creating the E5A acquisition");
pcpsconf_fpga_t acq_parameters;
@ -58,8 +58,9 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
//item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 12500000);
long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000);
int64_t fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
float downsampling_factor = configuration_->property(role + ".downsampling_factor", 1.0);
acq_parameters.downsampling_factor = downsampling_factor;
@ -97,7 +98,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
acq_pilot_ = false;
}
unsigned int code_length = static_cast<unsigned int>(std::round(static_cast<double>(fs_in) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast<double>(Galileo_E5a_CODE_LENGTH_CHIPS)));
auto code_length = static_cast<unsigned int>(std::round(static_cast<double>(fs_in) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast<double>(Galileo_E5a_CODE_LENGTH_CHIPS)));
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f((float)code_length*2));
@ -122,9 +123,9 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
// compute all the GALILEO E5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
std::complex<float>* code = new std::complex<float>[nsamples_total]; // buffer for the local code
gr_complex* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_all_fft_codes_ = new lv_16sc_t[nsamples_total * Galileo_E5a_NUMBER_OF_CODES]; // memory containing all the possible fft codes for PRN 0 to 32
float max; // temporary maxima search
@ -166,7 +167,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
// fill in zero padding
for (int s = 2*code_length; s < nsamples_total; s++)
{
code[s] = std::complex<float>(static_cast<float>(0, 0));
code[s] = std::complex<float>(0.0, 0.0);
//code[s] = 0;
}
@ -239,7 +240,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
channel_ = 0;
//threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
//printf("creating the E5A acquisition end");
}
@ -251,6 +252,11 @@ GalileoE5aPcpsAcquisitionFpga::~GalileoE5aPcpsAcquisitionFpga()
}
void GalileoE5aPcpsAcquisitionFpga::stop_acquisition()
{
}
void GalileoE5aPcpsAcquisitionFpga::set_channel(unsigned int channel)
{
channel_ = channel;
@ -261,7 +267,7 @@ void GalileoE5aPcpsAcquisitionFpga::set_channel(unsigned int channel)
void GalileoE5aPcpsAcquisitionFpga::set_threshold(float threshold)
{
// float pfa = configuration_->property(role_ + boost::lexical_cast<std::string>(channel_) + ".pfa", 0.0);
// float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
//
// if (pfa == 0.0)
// {

View File

@ -45,7 +45,8 @@ class GalileoE5aPcpsAcquisitionFpga : public AcquisitionInterface
{
public:
GalileoE5aPcpsAcquisitionFpga(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GalileoE5aPcpsAcquisitionFpga();
@ -150,6 +151,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
//float calculate_threshold(float pfa);
@ -181,7 +184,7 @@ private:
unsigned int in_streams_;
unsigned int out_streams_;
long fs_in_;
int64_t fs_in_;
float threshold_;

View File

@ -32,24 +32,25 @@
*/
#include "glonass_l1_ca_pcps_acquisition.h"
#include "GLONASS_L1_L2_CA.h"
#include "acq_conf.h"
#include "configuration_interface.h"
#include "glonass_l1_signal_processing.h"
#include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include "GLONASS_L1_L2_CA.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GlonassL1CaPcpsAcquisition::stop_acquisition()
{
}
GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
Acq_Conf acq_parameters = Acq_Conf();
configuration_ = configuration;
@ -60,7 +61,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.fs_in = fs_in_;
acq_parameters.samples_per_chip = static_cast<unsigned int>(ceil(GLONASS_L1_CA_CHIP_PERIOD * static_cast<float>(acq_parameters.fs_in)));
@ -94,7 +95,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
code_ = new gr_complex[vector_length_];
if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
item_size_ = sizeof(lv_16sc_t);
}
@ -114,7 +115,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
acquisition_ = pcps_make_acquisition(acq_parameters);
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
float_to_complex_ = gr::blocks::float_to_complex::make();
@ -123,7 +124,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -141,6 +142,11 @@ GlonassL1CaPcpsAcquisition::~GlonassL1CaPcpsAcquisition()
}
void GlonassL1CaPcpsAcquisition::stop_acquisition()
{
}
void GlonassL1CaPcpsAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
@ -207,7 +213,7 @@ void GlonassL1CaPcpsAcquisition::init()
void GlonassL1CaPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
glonass_l1_ca_code_gen_complex_sampled(code, /* gnss_synchro_->PRN,*/ fs_in_, 0);
@ -251,9 +257,9 @@ float GlonassL1CaPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = static_cast<double>(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -261,15 +267,15 @@ float GlonassL1CaPcpsAcquisition::calculate_threshold(float pfa)
void GlonassL1CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to connect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
top_block->connect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->connect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
@ -284,15 +290,15 @@ void GlonassL1CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
void GlonassL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to disconnect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
// Since a byte-based acq implementation is not available,
// we just convert cshorts to gr_complex
@ -309,23 +315,21 @@ void GlonassL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GlonassL1CaPcpsAcquisition::get_left_block()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_;
}
else if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
return acquisition_;
}
else if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
return cbyte_to_float_x2_;
}
else
{
LOG(WARNING) << item_type_ << " unknown acquisition item type";
return nullptr;
}
LOG(WARNING) << item_type_ << " unknown acquisition item type";
return nullptr;
}

View File

@ -35,9 +35,9 @@
#define GNSS_SDR_GLONASS_L1_CA_PCPS_ACQUISITION_H_
#include "acquisition_interface.h"
#include "complex_byte_to_float_x2.h"
#include "gnss_synchro.h"
#include "pcps_acquisition.h"
#include "complex_byte_to_float_x2.h"
#include <gnuradio/blocks/float_to_complex.h>
#include <string>
@ -51,7 +51,8 @@ class GlonassL1CaPcpsAcquisition : public AcquisitionInterface
{
public:
GlonassL1CaPcpsAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GlonassL1CaPcpsAcquisition();
@ -136,6 +137,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
@ -153,7 +156,7 @@ private:
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
bool blocking_;
std::string dump_filename_;

View File

@ -31,24 +31,25 @@
*/
#include "glonass_l2_ca_pcps_acquisition.h"
#include "GLONASS_L1_L2_CA.h"
#include "acq_conf.h"
#include "configuration_interface.h"
#include "glonass_l2_signal_processing.h"
#include "GLONASS_L1_L2_CA.h"
#include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GlonassL2CaPcpsAcquisition::stop_acquisition()
{
}
GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
Acq_Conf acq_parameters = Acq_Conf();
configuration_ = configuration;
@ -59,7 +60,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.fs_in = fs_in_;
acq_parameters.samples_per_chip = static_cast<unsigned int>(ceil(GLONASS_L2_CA_CHIP_PERIOD * static_cast<float>(acq_parameters.fs_in)));
@ -93,7 +94,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
code_ = new gr_complex[vector_length_];
if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
item_size_ = sizeof(lv_16sc_t);
}
@ -113,7 +114,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
acquisition_ = pcps_make_acquisition(acq_parameters);
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
float_to_complex_ = gr::blocks::float_to_complex::make();
@ -122,7 +123,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -140,6 +141,11 @@ GlonassL2CaPcpsAcquisition::~GlonassL2CaPcpsAcquisition()
}
void GlonassL2CaPcpsAcquisition::stop_acquisition()
{
}
void GlonassL2CaPcpsAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
@ -206,7 +212,7 @@ void GlonassL2CaPcpsAcquisition::init()
void GlonassL2CaPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
glonass_l2_ca_code_gen_complex_sampled(code, /* gnss_synchro_->PRN,*/ fs_in_, 0);
@ -250,9 +256,9 @@ float GlonassL2CaPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = static_cast<double>(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -260,15 +266,15 @@ float GlonassL2CaPcpsAcquisition::calculate_threshold(float pfa)
void GlonassL2CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to connect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
// Since a byte-based acq implementation is not available,
// we just convert cshorts to gr_complex
@ -285,15 +291,15 @@ void GlonassL2CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
void GlonassL2CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to disconnect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
top_block->disconnect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->disconnect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
@ -308,23 +314,21 @@ void GlonassL2CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GlonassL2CaPcpsAcquisition::get_left_block()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_;
}
else if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
return acquisition_;
}
else if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
return cbyte_to_float_x2_;
}
else
{
LOG(WARNING) << item_type_ << " unknown acquisition item type";
return nullptr;
}
LOG(WARNING) << item_type_ << " unknown acquisition item type";
return nullptr;
}

View File

@ -34,9 +34,9 @@
#define GNSS_SDR_GLONASS_L2_CA_PCPS_ACQUISITION_H_
#include "acquisition_interface.h"
#include "complex_byte_to_float_x2.h"
#include "gnss_synchro.h"
#include "pcps_acquisition.h"
#include "complex_byte_to_float_x2.h"
#include <gnuradio/blocks/float_to_complex.h>
#include <string>
@ -50,7 +50,8 @@ class GlonassL2CaPcpsAcquisition : public AcquisitionInterface
{
public:
GlonassL2CaPcpsAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GlonassL2CaPcpsAcquisition();
@ -135,6 +136,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
@ -152,7 +155,7 @@ private:
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
bool blocking_;
std::string dump_filename_;

View File

@ -34,26 +34,26 @@
*/
#include "gps_l1_ca_pcps_acquisition.h"
#include "configuration_interface.h"
#include "gps_sdr_signal_processing.h"
#include "GPS_L1_CA.h"
#include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gps_sdr_signal_processing.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GpsL1CaPcpsAcquisition::stop_acquisition()
{
}
GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
Acq_Conf acq_parameters = Acq_Conf();
configuration_ = configuration;
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./acquisition.mat";
@ -61,41 +61,69 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
DLOG(INFO) << "role " << role;
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.fs_in = fs_in_;
acq_parameters.samples_per_chip = static_cast<unsigned int>(ceil(GPS_L1_CA_CHIP_PERIOD * static_cast<float>(acq_parameters.fs_in)));
acq_parameters_.fs_in = fs_in_;
dump_ = configuration_->property(role + ".dump", false);
acq_parameters.dump = dump_;
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
acq_parameters_.dump = dump_;
acq_parameters_.dump_channel = configuration_->property(role + ".dump_channel", 0);
blocking_ = configuration_->property(role + ".blocking", true);
acq_parameters.blocking = blocking_;
acq_parameters_.blocking = blocking_;
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
acq_parameters.doppler_max = doppler_max_;
acq_parameters_.doppler_max = doppler_max_;
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
acq_parameters.sampled_ms = sampled_ms_;
acq_parameters.ms_per_code = 1;
acq_parameters_.sampled_ms = sampled_ms_;
acq_parameters_.ms_per_code = 1;
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
acq_parameters.bit_transition_flag = bit_transition_flag_;
acq_parameters_.bit_transition_flag = bit_transition_flag_;
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
acq_parameters_.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
acq_parameters.max_dwells = max_dwells_;
acq_parameters_.max_dwells = max_dwells_;
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
acq_parameters.dump_filename = dump_filename_;
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
//--- Find number of samples per spreading code -------------------------
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
acq_parameters.samples_per_ms = static_cast<float>(fs_in_) * 0.001;
acq_parameters.samples_per_code = acq_parameters.samples_per_ms * static_cast<float>(GPS_L1_CA_CODE_PERIOD * 1000.0);
acq_parameters_.dump_filename = dump_filename_;
acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false);
acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false);
if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex")
{
LOG(WARNING) << "GPS L1 CA acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex";
acq_parameters_.use_automatic_resampler = false;
}
if (acq_parameters_.use_automatic_resampler)
{
if (acq_parameters_.fs_in > GPS_L1_CA_OPT_ACQ_FS_HZ)
{
acq_parameters_.resampler_ratio = floor(static_cast<float>(acq_parameters_.fs_in) / GPS_L1_CA_OPT_ACQ_FS_HZ);
uint32_t decimation = acq_parameters_.fs_in / GPS_L1_CA_OPT_ACQ_FS_HZ;
while (acq_parameters_.fs_in % decimation > 0)
{
decimation--;
};
acq_parameters_.resampler_ratio = decimation;
acq_parameters_.resampled_fs = acq_parameters_.fs_in / static_cast<int>(acq_parameters_.resampler_ratio);
}
//--- Find number of samples per spreading code -------------------------
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
acq_parameters_.samples_per_ms = static_cast<float>(acq_parameters_.resampled_fs) * 0.001;
acq_parameters_.samples_per_chip = static_cast<unsigned int>(ceil(GPS_L1_CA_CHIP_PERIOD * static_cast<float>(acq_parameters_.resampled_fs)));
}
else
{
acq_parameters_.resampled_fs = fs_in_;
//--- Find number of samples per spreading code -------------------------
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
acq_parameters_.samples_per_ms = static_cast<float>(fs_in_) * 0.001;
acq_parameters_.samples_per_chip = static_cast<unsigned int>(ceil(GPS_L1_CA_CHIP_PERIOD * static_cast<float>(acq_parameters_.fs_in)));
}
vector_length_ = std::floor(acq_parameters.sampled_ms * acq_parameters.samples_per_ms) * (acq_parameters.bit_transition_flag ? 2 : 1);
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L1_CA_CODE_PERIOD * 1000.0);
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
code_ = new gr_complex[vector_length_];
if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
item_size_ = sizeof(lv_16sc_t);
}
@ -104,12 +132,12 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
item_size_ = sizeof(gr_complex);
}
acq_parameters.it_size = item_size_;
acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
acquisition_ = pcps_make_acquisition(acq_parameters);
acq_parameters_.it_size = item_size_;
acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
acquisition_ = pcps_make_acquisition(acq_parameters_);
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
float_to_complex_ = gr::blocks::float_to_complex::make();
@ -118,7 +146,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -136,6 +164,11 @@ GpsL1CaPcpsAcquisition::~GpsL1CaPcpsAcquisition()
}
void GpsL1CaPcpsAcquisition::stop_acquisition()
{
}
void GpsL1CaPcpsAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
@ -200,10 +233,16 @@ void GpsL1CaPcpsAcquisition::init()
void GpsL1CaPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
auto* code = new std::complex<float>[code_length_];
if (acq_parameters_.use_automatic_resampler)
{
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0);
}
else
{
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
}
for (unsigned int i = 0; i < sampled_ms_; i++)
{
memcpy(&(code_[i * code_length_]), code,
@ -239,9 +278,9 @@ float GpsL1CaPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -249,15 +288,15 @@ float GpsL1CaPcpsAcquisition::calculate_threshold(float pfa)
void GpsL1CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to connect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
// Since a byte-based acq implementation is not available,
// we just convert cshorts to gr_complex
@ -274,15 +313,15 @@ void GpsL1CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
void GpsL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to disconnect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
top_block->disconnect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->disconnect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
@ -297,23 +336,21 @@ void GpsL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_left_block()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_;
}
else if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
return acquisition_;
}
else if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
return cbyte_to_float_x2_;
}
else
{
LOG(WARNING) << item_type_ << " unknown acquisition item type";
return nullptr;
}
LOG(WARNING) << item_type_ << " unknown acquisition item type";
return nullptr;
}
@ -321,3 +358,8 @@ gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_right_block()
{
return acquisition_;
}
void GpsL1CaPcpsAcquisition::set_resampler_latency(uint32_t latency_samples)
{
acquisition_->set_resampler_latency(latency_samples);
}

View File

@ -36,10 +36,11 @@
#ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_
#define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_
#include "acq_conf.h"
#include "acquisition_interface.h"
#include "complex_byte_to_float_x2.h"
#include "gnss_synchro.h"
#include "pcps_acquisition.h"
#include "complex_byte_to_float_x2.h"
#include <gnuradio/blocks/float_to_complex.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <string>
@ -55,7 +56,8 @@ class GpsL1CaPcpsAcquisition : public AcquisitionInterface
{
public:
GpsL1CaPcpsAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GpsL1CaPcpsAcquisition();
@ -140,9 +142,17 @@ public:
*/
void stop_acquisition() override;
/*!
* \brief Sets the resampler latency to account it in the acquisition code delay estimation
*/
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
Acq_Conf acq_parameters_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
@ -157,7 +167,7 @@ private:
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
bool blocking_;
std::string dump_filename_;

View File

@ -33,22 +33,23 @@
*/
#include "gps_l1_ca_pcps_acquisition_fine_doppler.h"
#include "gps_sdr_signal_processing.h"
#include "GPS_L1_CA.h"
#include "acq_conf.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include "gps_sdr_signal_processing.h"
#include <glog/logging.h>
using google::LogMessage;
void GpsL1CaPcpsAcquisitionFineDoppler::stop_acquisition()
{
}
GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./acquisition.mat";
@ -57,7 +58,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
Acq_Conf acq_parameters = Acq_Conf();
item_type_ = configuration->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.fs_in = fs_in_;
acq_parameters.samples_per_chip = static_cast<unsigned int>(ceil(GPS_L1_CA_CHIP_PERIOD * static_cast<float>(acq_parameters.fs_in)));
@ -80,7 +81,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
acq_parameters.samples_per_ms = vector_length_;
code_ = new gr_complex[vector_length_];
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = pcps_make_acquisition_fine_doppler_cc(acq_parameters);
@ -94,7 +95,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -112,6 +113,11 @@ GpsL1CaPcpsAcquisitionFineDoppler::~GpsL1CaPcpsAcquisitionFineDoppler()
}
void GpsL1CaPcpsAcquisitionFineDoppler::stop_acquisition()
{
}
void GpsL1CaPcpsAcquisitionFineDoppler::set_channel(unsigned int channel)
{
channel_ = channel;

View File

@ -34,8 +34,8 @@
#ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FINE_DOPPLER_H_
#define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FINE_DOPPLER_H_
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "gnss_synchro.h"
#include "pcps_acquisition_fine_doppler_cc.h"
#include <string>
@ -49,7 +49,8 @@ class GpsL1CaPcpsAcquisitionFineDoppler : public AcquisitionInterface
{
public:
GpsL1CaPcpsAcquisitionFineDoppler(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GpsL1CaPcpsAcquisitionFineDoppler();
@ -131,6 +132,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
pcps_acquisition_fine_doppler_cc_sptr acquisition_cc_;
size_t item_size_;
@ -142,7 +145,7 @@ private:
unsigned int doppler_step_;
unsigned int sampled_ms_;
int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::complex<float>* code_;

View File

@ -34,13 +34,13 @@
* -------------------------------------------------------------------------
*/
#include "gps_l1_ca_pcps_acquisition_fpga.h"
#include "GPS_L1_CA.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gps_l1_ca_pcps_acquisition_fpga.h"
#include "gps_sdr_signal_processing.h"
#include "GPS_L1_CA.h"
#include <gnuradio/fft/fft.h>
#include <glog/logging.h>
#include <gnuradio/fft/fft.h>
#include <new>
@ -48,13 +48,14 @@
using google::LogMessage;
void GpsL1CaPcpsAcquisitionFpga::stop_acquisition()
{
}
GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
configuration_ = configuration;
@ -62,12 +63,13 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
DLOG(INFO) << "role " << role;
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
float downsampling_factor = configuration_->property(role + ".downsampling_factor", 4.0);
printf("downsampling_factor = %f\n", downsampling_factor);
acq_parameters.downsampling_factor = downsampling_factor;
//fs_in = fs_in/2.0; // downampling filter
//printf("fs_in pre downsampling = %ld\n", fs_in);
@ -82,7 +84,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
acq_parameters.doppler_max = doppler_max_;
unsigned int sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 4);
acq_parameters.sampled_ms = sampled_ms;
unsigned int code_length = static_cast<unsigned int>(std::round(static_cast<double>(fs_in) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
auto code_length = static_cast<unsigned int>(std::round(static_cast<double>(fs_in) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
acq_parameters.code_length = code_length;
//printf("acq adapter code_length = %d\n", code_length);
// The FPGA can only use FFT lengths that are a power of two.
@ -104,10 +106,10 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
//printf("excludelimit = %d\n", (int) acq_parameters.excludelimit);
// compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT
auto* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT
// allocate memory to compute all the PRNs and compute all the possible codes
std::complex<float>* code = new std::complex<float>[nsamples_total]; // buffer for the local code
gr_complex* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32
float max; // temporary maxima search
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
@ -123,7 +125,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
// fill in zero padding
for (int s = 2*code_length; s < nsamples_total; s++)
{
code[s] = std::complex<float>(static_cast<float>(0, 0));
code[s] = std::complex<float>(0.0, 0.0);
//code[s] = 0;
}
@ -198,7 +200,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
channel_ = 0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
}
@ -208,6 +210,11 @@ GpsL1CaPcpsAcquisitionFpga::~GpsL1CaPcpsAcquisitionFpga()
}
void GpsL1CaPcpsAcquisitionFpga::stop_acquisition()
{
}
void GpsL1CaPcpsAcquisitionFpga::set_channel(unsigned int channel)
{
channel_ = channel;

View File

@ -53,7 +53,8 @@ class GpsL1CaPcpsAcquisitionFpga : public AcquisitionInterface
{
public:
GpsL1CaPcpsAcquisitionFpga(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GpsL1CaPcpsAcquisitionFpga();
@ -159,6 +160,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
pcps_acquisition_fpga_sptr acquisition_fpga_;

View File

@ -33,22 +33,23 @@
*/
#include "gps_l1_ca_pcps_assisted_acquisition.h"
#include <glog/logging.h>
#include "gps_sdr_signal_processing.h"
#include "GPS_L1_CA.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gps_sdr_signal_processing.h"
#include <glog/logging.h>
using google::LogMessage;
void GpsL1CaPcpsAssistedAcquisition::stop_acquisition()
{
}
GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./data/acquisition.dat";
@ -56,7 +57,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
DLOG(INFO) << "role " << role;
item_type_ = configuration->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
dump_ = configuration->property(role + ".dump", false);
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
@ -71,7 +72,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
code_ = new gr_complex[vector_length_];
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = pcps_make_assisted_acquisition_cc(max_dwells_, sampled_ms_,
@ -87,7 +88,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -105,6 +106,11 @@ GpsL1CaPcpsAssistedAcquisition::~GpsL1CaPcpsAssistedAcquisition()
}
void GpsL1CaPcpsAssistedAcquisition::stop_acquisition()
{
}
void GpsL1CaPcpsAssistedAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;

View File

@ -34,8 +34,8 @@
#ifndef GNSS_SDR_GPS_L1_CA_PCPS_ASSISTED_ACQUISITION_H_
#define GNSS_SDR_GPS_L1_CA_PCPS_ASSISTED_ACQUISITION_H_
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "gnss_synchro.h"
#include "pcps_assisted_acquisition_cc.h"
#include <string>
@ -49,7 +49,8 @@ class GpsL1CaPcpsAssistedAcquisition : public AcquisitionInterface
{
public:
GpsL1CaPcpsAssistedAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GpsL1CaPcpsAssistedAcquisition();
@ -127,6 +128,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
pcps_assisted_acquisition_cc_sptr acquisition_cc_;
size_t item_size_;
@ -140,7 +143,7 @@ private:
int doppler_min_;
unsigned int sampled_ms_;
int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::complex<float>* code_;

View File

@ -30,23 +30,24 @@
*/
#include "gps_l1_ca_pcps_opencl_acquisition.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include "gps_sdr_signal_processing.h"
#include "GPS_L1_CA.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gps_sdr_signal_processing.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GpsL1CaPcpsOpenClAcquisition::stop_acquisition()
{
}
GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
@ -57,7 +58,7 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
item_type_ = configuration_->property(role + ".item_type",
default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
dump_ = configuration_->property(role + ".dump", false);
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
@ -85,7 +86,7 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
code_ = new gr_complex[vector_length_];
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = pcps_make_opencl_acquisition_cc(sampled_ms_, max_dwells_,
@ -106,7 +107,7 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -124,10 +125,15 @@ GpsL1CaPcpsOpenClAcquisition::~GpsL1CaPcpsOpenClAcquisition()
}
void GpsL1CaPcpsOpenClAcquisition::stop_acquisition()
{
}
void GpsL1CaPcpsOpenClAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_channel(channel_);
}
@ -136,7 +142,7 @@ void GpsL1CaPcpsOpenClAcquisition::set_channel(unsigned int channel)
void GpsL1CaPcpsOpenClAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + boost::lexical_cast<std::string>(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
if (pfa == 0.0)
{
@ -153,7 +159,7 @@ void GpsL1CaPcpsOpenClAcquisition::set_threshold(float threshold)
DLOG(INFO) << "Channel " << channel_ << " Threshold = " << threshold_;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_threshold(threshold_);
}
@ -163,7 +169,7 @@ void GpsL1CaPcpsOpenClAcquisition::set_threshold(float threshold)
void GpsL1CaPcpsOpenClAcquisition::set_doppler_max(unsigned int doppler_max)
{
doppler_max_ = doppler_max;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_max(doppler_max_);
}
@ -173,7 +179,7 @@ void GpsL1CaPcpsOpenClAcquisition::set_doppler_max(unsigned int doppler_max)
void GpsL1CaPcpsOpenClAcquisition::set_doppler_step(unsigned int doppler_step)
{
doppler_step_ = doppler_step;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_step(doppler_step_);
}
@ -183,7 +189,7 @@ void GpsL1CaPcpsOpenClAcquisition::set_doppler_step(unsigned int doppler_step)
void GpsL1CaPcpsOpenClAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
{
gnss_synchro_ = gnss_synchro;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
}
@ -192,7 +198,7 @@ void GpsL1CaPcpsOpenClAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
signed int GpsL1CaPcpsOpenClAcquisition::mag()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_cc_->mag();
}
@ -212,9 +218,9 @@ void GpsL1CaPcpsOpenClAcquisition::init()
void GpsL1CaPcpsOpenClAcquisition::set_local_code()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
@ -233,7 +239,7 @@ void GpsL1CaPcpsOpenClAcquisition::set_local_code()
void GpsL1CaPcpsOpenClAcquisition::reset()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_active(true);
}
@ -255,9 +261,9 @@ float GpsL1CaPcpsOpenClAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -265,7 +271,7 @@ float GpsL1CaPcpsOpenClAcquisition::calculate_threshold(float pfa)
void GpsL1CaPcpsOpenClAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
}
@ -274,7 +280,7 @@ void GpsL1CaPcpsOpenClAcquisition::connect(gr::top_block_sptr top_block)
void GpsL1CaPcpsOpenClAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
}

View File

@ -32,8 +32,8 @@
#ifndef GNSS_SDR_GPS_L1_CA_PCPS_OPENCL_ACQUISITION_H_
#define GNSS_SDR_GPS_L1_CA_PCPS_OPENCL_ACQUISITION_H_
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "gnss_synchro.h"
#include "pcps_opencl_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h>
#include <string>
@ -48,7 +48,8 @@ class GpsL1CaPcpsOpenClAcquisition : public AcquisitionInterface
{
public:
GpsL1CaPcpsOpenClAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GpsL1CaPcpsOpenClAcquisition();
@ -129,6 +130,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
pcps_opencl_acquisition_cc_sptr acquisition_cc_;
@ -144,7 +147,7 @@ private:
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::complex<float>* code_;

View File

@ -31,23 +31,24 @@
*/
#include "gps_l1_ca_pcps_quicksync_acquisition.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include "gps_sdr_signal_processing.h"
#include "GPS_L1_CA.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gps_sdr_signal_processing.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GpsL1CaPcpsQuickSyncAcquisition::stop_acquisition()
{
}
GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
@ -56,7 +57,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
DLOG(INFO) << "role " << role;
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
dump_ = configuration_->property(role + ".dump", false);
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
@ -67,7 +68,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
code_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
/*Calculate the folding factor value based on the calculations*/
unsigned int temp = static_cast<unsigned int>(ceil(sqrt(log2(code_length_))));
auto temp = static_cast<unsigned int>(ceil(sqrt(log2(code_length_))));
folding_factor_ = configuration_->property(role + ".folding_factor", temp);
if (sampled_ms_ % folding_factor_ != 0)
@ -112,7 +113,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
<< ", Sampled ms: " << sampled_ms_
<< ", Code Length: " << code_length_;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = pcps_quicksync_make_acquisition_cc(folding_factor_,
@ -135,7 +136,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -153,10 +154,15 @@ GpsL1CaPcpsQuickSyncAcquisition::~GpsL1CaPcpsQuickSyncAcquisition()
}
void GpsL1CaPcpsQuickSyncAcquisition::stop_acquisition()
{
}
void GpsL1CaPcpsQuickSyncAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_channel(channel_);
}
@ -165,9 +171,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_channel(unsigned int channel)
void GpsL1CaPcpsQuickSyncAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ +
boost::lexical_cast<std::string>(channel_) + ".pfa",
0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
if (pfa == 0.0)
{
@ -184,7 +188,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_threshold(float threshold)
DLOG(INFO) << "Channel " << channel_ << " Threshold = " << threshold_;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_threshold(threshold_);
}
@ -194,7 +198,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_threshold(float threshold)
void GpsL1CaPcpsQuickSyncAcquisition::set_doppler_max(unsigned int doppler_max)
{
doppler_max_ = doppler_max;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_max(doppler_max_);
}
@ -204,7 +208,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_doppler_max(unsigned int doppler_max)
void GpsL1CaPcpsQuickSyncAcquisition::set_doppler_step(unsigned int doppler_step)
{
doppler_step_ = doppler_step;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_step(doppler_step_);
}
@ -214,7 +218,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_doppler_step(unsigned int doppler_step
void GpsL1CaPcpsQuickSyncAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
{
gnss_synchro_ = gnss_synchro;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
}
@ -223,14 +227,11 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchr
signed int GpsL1CaPcpsQuickSyncAcquisition::mag()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -243,13 +244,12 @@ void GpsL1CaPcpsQuickSyncAcquisition::init()
void GpsL1CaPcpsQuickSyncAcquisition::set_local_code()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
std::complex<float>* code = new std::complex<float>[code_length_]();
auto* code = new std::complex<float>[code_length_]();
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
for (unsigned int i = 0; i < (sampled_ms_ / folding_factor_); i++)
{
memcpy(&(code_[i * code_length_]), code,
@ -266,7 +266,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_local_code()
void GpsL1CaPcpsQuickSyncAcquisition::reset()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_active(true);
}
@ -275,7 +275,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::reset()
void GpsL1CaPcpsQuickSyncAcquisition::set_state(int state)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_state(state);
}
@ -296,7 +296,7 @@ float GpsL1CaPcpsQuickSyncAcquisition::calculate_threshold(float pfa)
double val = pow(1.0 - pfa, exponent);
double lambda = static_cast<double>(code_length_) / static_cast<double>(folding_factor_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -304,7 +304,7 @@ float GpsL1CaPcpsQuickSyncAcquisition::calculate_threshold(float pfa)
void GpsL1CaPcpsQuickSyncAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
}
@ -313,7 +313,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::connect(gr::top_block_sptr top_block)
void GpsL1CaPcpsQuickSyncAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
}

View File

@ -33,10 +33,10 @@
#ifndef GNSS_SDR_GPS_L1_CA_PCPS_QUICKSYNC_ACQUISITION_H_
#define GNSS_SDR_GPS_L1_CA_PCPS_QUICKSYNC_ACQUISITION_H_
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "pcps_quicksync_acquisition_cc.h"
#include "configuration_interface.h"
#include "gnss_synchro.h"
#include "pcps_quicksync_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h>
#include <string>
@ -50,7 +50,8 @@ class GpsL1CaPcpsQuickSyncAcquisition : public AcquisitionInterface
{
public:
GpsL1CaPcpsQuickSyncAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GpsL1CaPcpsQuickSyncAcquisition();
@ -135,6 +136,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
pcps_quicksync_acquisition_cc_sptr acquisition_cc_;
@ -151,7 +154,7 @@ private:
unsigned int sampled_ms_;
unsigned int max_dwells_;
unsigned int folding_factor_;
long fs_in_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::complex<float>* code_;

View File

@ -30,23 +30,24 @@
*/
#include "gps_l1_ca_pcps_tong_acquisition.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include "gps_sdr_signal_processing.h"
#include "GPS_L1_CA.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gps_sdr_signal_processing.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GpsL1CaPcpsTongAcquisition::stop_acquisition()
{
}
GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
@ -56,7 +57,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
dump_ = configuration_->property(role + ".dump", false);
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
@ -76,7 +77,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
code_ = new gr_complex[vector_length_];
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
acquisition_cc_ = pcps_tong_make_acquisition_cc(sampled_ms_, doppler_max_, fs_in_,
@ -97,7 +98,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -115,10 +116,15 @@ GpsL1CaPcpsTongAcquisition::~GpsL1CaPcpsTongAcquisition()
}
void GpsL1CaPcpsTongAcquisition::stop_acquisition()
{
}
void GpsL1CaPcpsTongAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_channel(channel_);
}
@ -127,7 +133,7 @@ void GpsL1CaPcpsTongAcquisition::set_channel(unsigned int channel)
void GpsL1CaPcpsTongAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + boost::lexical_cast<std::string>(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
if (pfa == 0.0)
{
@ -144,7 +150,7 @@ void GpsL1CaPcpsTongAcquisition::set_threshold(float threshold)
DLOG(INFO) << "Channel " << channel_ << " Threshold = " << threshold_;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_threshold(threshold_);
}
@ -154,7 +160,7 @@ void GpsL1CaPcpsTongAcquisition::set_threshold(float threshold)
void GpsL1CaPcpsTongAcquisition::set_doppler_max(unsigned int doppler_max)
{
doppler_max_ = doppler_max;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_max(doppler_max_);
}
@ -164,7 +170,7 @@ void GpsL1CaPcpsTongAcquisition::set_doppler_max(unsigned int doppler_max)
void GpsL1CaPcpsTongAcquisition::set_doppler_step(unsigned int doppler_step)
{
doppler_step_ = doppler_step;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_doppler_step(doppler_step_);
}
@ -174,7 +180,7 @@ void GpsL1CaPcpsTongAcquisition::set_doppler_step(unsigned int doppler_step)
void GpsL1CaPcpsTongAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
{
gnss_synchro_ = gnss_synchro;
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
}
@ -183,14 +189,11 @@ void GpsL1CaPcpsTongAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
signed int GpsL1CaPcpsTongAcquisition::mag()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_cc_->mag();
}
else
{
return 0;
}
return 0;
}
@ -202,9 +205,9 @@ void GpsL1CaPcpsTongAcquisition::init()
void GpsL1CaPcpsTongAcquisition::set_local_code()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
@ -223,7 +226,7 @@ void GpsL1CaPcpsTongAcquisition::set_local_code()
void GpsL1CaPcpsTongAcquisition::reset()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_active(true);
}
@ -232,7 +235,7 @@ void GpsL1CaPcpsTongAcquisition::reset()
void GpsL1CaPcpsTongAcquisition::set_state(int state)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
acquisition_cc_->set_state(state);
}
@ -253,9 +256,9 @@ float GpsL1CaPcpsTongAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -263,7 +266,7 @@ float GpsL1CaPcpsTongAcquisition::calculate_threshold(float pfa)
void GpsL1CaPcpsTongAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
}
@ -272,7 +275,7 @@ void GpsL1CaPcpsTongAcquisition::connect(gr::top_block_sptr top_block)
void GpsL1CaPcpsTongAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
}

View File

@ -32,10 +32,10 @@
#ifndef GNSS_SDR_GPS_L1_CA_TONG_ACQUISITION_H_
#define GNSS_SDR_GPS_L1_CA_TONG_ACQUISITION_H_
#include "gnss_synchro.h"
#include "acquisition_interface.h"
#include "pcps_tong_acquisition_cc.h"
#include "configuration_interface.h"
#include "gnss_synchro.h"
#include "pcps_tong_acquisition_cc.h"
#include <gnuradio/blocks/stream_to_vector.h>
#include <string>
@ -49,7 +49,8 @@ class GpsL1CaPcpsTongAcquisition : public AcquisitionInterface
{
public:
GpsL1CaPcpsTongAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GpsL1CaPcpsTongAcquisition();
@ -134,6 +135,8 @@ public:
*/
void stop_acquisition() override;
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
pcps_tong_acquisition_cc_sptr acquisition_cc_;
@ -150,7 +153,7 @@ private:
unsigned int tong_init_val_;
unsigned int tong_max_val_;
unsigned int tong_max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::complex<float>* code_;

View File

@ -32,26 +32,26 @@
*/
#include "gps_l2_m_pcps_acquisition.h"
#include "configuration_interface.h"
#include "gps_l2c_signal.h"
#include "GPS_L2C.h"
#include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gps_l2c_signal.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
using google::LogMessage;
void GpsL2MPcpsAcquisition::stop_acquisition()
{
}
GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
Acq_Conf acq_parameters = Acq_Conf();
configuration_ = configuration;
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./acquisition.mat";
@ -59,45 +59,76 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
LOG(INFO) << "role " << role;
item_type_ = configuration_->property(role + ".item_type", default_item_type);
//float pfa = configuration_->property(role + ".pfa", 0.0);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.fs_in = fs_in_;
acq_parameters.samples_per_chip = static_cast<unsigned int>(ceil((1.0 / GPS_L2_M_CODE_RATE_HZ) * static_cast<float>(acq_parameters.fs_in)));
acq_parameters_.fs_in = fs_in_;
dump_ = configuration_->property(role + ".dump", false);
acq_parameters.dump = dump_;
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
acq_parameters_.dump = dump_;
acq_parameters_.dump_channel = configuration_->property(role + ".dump_channel", 0);
blocking_ = configuration_->property(role + ".blocking", true);
acq_parameters.blocking = blocking_;
acq_parameters_.blocking = blocking_;
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
acq_parameters.doppler_max = doppler_max_;
acq_parameters_.doppler_max = doppler_max_;
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
acq_parameters.bit_transition_flag = bit_transition_flag_;
acq_parameters_.bit_transition_flag = bit_transition_flag_;
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
acq_parameters_.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
acq_parameters.max_dwells = max_dwells_;
acq_parameters_.max_dwells = max_dwells_;
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
acq_parameters.dump_filename = dump_filename_;
//--- Find number of samples per spreading code -------------------------
acq_parameters.samples_per_ms = static_cast<float>(fs_in_) * 0.001;
acq_parameters.ms_per_code = 20;
acq_parameters.sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", acq_parameters.ms_per_code);
if ((acq_parameters.sampled_ms % acq_parameters.ms_per_code) != 0)
acq_parameters_.dump_filename = dump_filename_;
acq_parameters_.ms_per_code = 20;
acq_parameters_.sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", acq_parameters_.ms_per_code);
if ((acq_parameters_.sampled_ms % acq_parameters_.ms_per_code) != 0)
{
LOG(WARNING) << "Parameter coherent_integration_time_ms should be a multiple of 20. Setting it to 20";
acq_parameters.sampled_ms = acq_parameters.ms_per_code;
acq_parameters_.sampled_ms = acq_parameters_.ms_per_code;
}
code_length_ = acq_parameters.ms_per_code * acq_parameters.samples_per_ms;
acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false);
acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false);
if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex")
{
LOG(WARNING) << "GPS L2CM acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex";
acq_parameters_.use_automatic_resampler = false;
}
if (acq_parameters_.use_automatic_resampler)
{
if (acq_parameters_.fs_in > GPS_L2C_OPT_ACQ_FS_HZ)
{
acq_parameters_.resampler_ratio = floor(static_cast<float>(acq_parameters_.fs_in) / GPS_L2C_OPT_ACQ_FS_HZ);
uint32_t decimation = acq_parameters_.fs_in / GPS_L2C_OPT_ACQ_FS_HZ;
while (acq_parameters_.fs_in % decimation > 0)
{
decimation--;
};
acq_parameters_.resampler_ratio = decimation;
acq_parameters_.resampled_fs = acq_parameters_.fs_in / static_cast<int>(acq_parameters_.resampler_ratio);
}
vector_length_ = acq_parameters.sampled_ms * acq_parameters.samples_per_ms * (acq_parameters.bit_transition_flag ? 2 : 1);
//--- Find number of samples per spreading code -------------------------
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GPS_L2_M_CODE_RATE_HZ / GPS_L2_M_CODE_LENGTH_CHIPS)));
acq_parameters_.samples_per_ms = static_cast<float>(acq_parameters_.resampled_fs) * 0.001;
acq_parameters_.samples_per_chip = static_cast<unsigned int>(ceil((1.0 / GPS_L2_M_CODE_RATE_HZ) * static_cast<float>(acq_parameters_.resampled_fs)));
}
else
{
acq_parameters_.resampled_fs = fs_in_;
//--- Find number of samples per spreading code -------------------------
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (GPS_L2_M_CODE_RATE_HZ / GPS_L2_M_CODE_LENGTH_CHIPS)));
acq_parameters_.samples_per_ms = static_cast<float>(fs_in_) * 0.001;
acq_parameters_.samples_per_chip = static_cast<unsigned int>(ceil((1.0 / GPS_L2_M_CODE_RATE_HZ) * static_cast<float>(acq_parameters_.fs_in)));
}
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L2_M_PERIOD * 1000.0);
vector_length_ = acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms * (acq_parameters_.bit_transition_flag ? 2 : 1);
code_ = new gr_complex[vector_length_];
if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
item_size_ = sizeof(lv_16sc_t);
}
@ -106,17 +137,11 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
item_size_ = sizeof(gr_complex);
}
acq_parameters.samples_per_code = acq_parameters.samples_per_ms * static_cast<float>(GPS_L2_M_PERIOD * 1000.0);
acq_parameters.it_size = item_size_;
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
acquisition_ = pcps_make_acquisition(acq_parameters);
acq_parameters_.it_size = item_size_;
acquisition_ = pcps_make_acquisition(acq_parameters_);
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
float_to_complex_ = gr::blocks::float_to_complex::make();
@ -125,8 +150,8 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
num_codes_ = acq_parameters.sampled_ms / acq_parameters.ms_per_code;
gnss_synchro_ = nullptr;
num_codes_ = acq_parameters_.sampled_ms / acq_parameters_.ms_per_code;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -144,6 +169,11 @@ GpsL2MPcpsAcquisition::~GpsL2MPcpsAcquisition()
}
void GpsL2MPcpsAcquisition::stop_acquisition()
{
}
void GpsL2MPcpsAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
@ -153,7 +183,7 @@ void GpsL2MPcpsAcquisition::set_channel(unsigned int channel)
void GpsL2MPcpsAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + boost::lexical_cast<std::string>(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
if (pfa == 0.0)
{
@ -215,9 +245,18 @@ void GpsL2MPcpsAcquisition::init()
void GpsL2MPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
if (acq_parameters_.use_automatic_resampler)
{
gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs);
}
else
{
gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_);
}
gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_);
for (unsigned int i = 0; i < num_codes_; i++)
{
@ -253,9 +292,9 @@ float GpsL2MPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1.0 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_);
auto lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -263,15 +302,15 @@ float GpsL2MPcpsAcquisition::calculate_threshold(float pfa)
void GpsL2MPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to connect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
// Since a byte-based acq implementation is not available,
// we just convert cshorts to gr_complex
@ -288,15 +327,15 @@ void GpsL2MPcpsAcquisition::connect(gr::top_block_sptr top_block)
void GpsL2MPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to disconnect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
top_block->disconnect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->disconnect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
@ -311,23 +350,21 @@ void GpsL2MPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GpsL2MPcpsAcquisition::get_left_block()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_;
}
else if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
return acquisition_;
}
else if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
return cbyte_to_float_x2_;
}
else
{
LOG(WARNING) << item_type_ << " unknown acquisition item type";
return nullptr;
}
LOG(WARNING) << item_type_ << " unknown acquisition item type";
return nullptr;
}
@ -335,3 +372,7 @@ gr::basic_block_sptr GpsL2MPcpsAcquisition::get_right_block()
{
return acquisition_;
}
void GpsL2MPcpsAcquisition::set_resampler_latency(uint32_t latency_samples)
{
acquisition_->set_resampler_latency(latency_samples);
}

View File

@ -35,9 +35,9 @@
#define GNSS_SDR_GPS_L2_M_PCPS_ACQUISITION_H_
#include "acquisition_interface.h"
#include "complex_byte_to_float_x2.h"
#include "gnss_synchro.h"
#include "pcps_acquisition.h"
#include "complex_byte_to_float_x2.h"
#include <gnuradio/blocks/float_to_complex.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <string>
@ -53,7 +53,8 @@ class GpsL2MPcpsAcquisition : public AcquisitionInterface
{
public:
GpsL2MPcpsAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~GpsL2MPcpsAcquisition();
@ -138,9 +139,17 @@ public:
*/
void stop_acquisition() override;
/*!
* \brief Sets the resampler latency to account it in the acquisition code delay estimation
*/
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
Acq_Conf acq_parameters_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
@ -154,7 +163,7 @@ private:
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
bool blocking_;
std::string dump_filename_;

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