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

Merge branch 'piyush0411-Acquisition-fixed' of https://github.com/carlesfernandez/gnss-sdr into Acquisition

This commit is contained in:
piyush0411 2020-07-13 01:24:08 +05:30
commit 349d8f2043
571 changed files with 11374 additions and 10672 deletions

View File

@ -53,7 +53,7 @@ IncludeBlocks: Merge
IncludeCategories:
- Regex: '^.*.h"'
Priority: 1
- Regex: '^.*(boost|gflags|glog|gnsssdr|gnuradio|gpstk|gsl|gtest|pmt|uhd|volk)/'
- Regex: '^.*(benchmark|boost|gflags|glog|gnsssdr|gnuradio|gpstk|gsl|gtest|pmt|uhd|volk)/'
Priority: 2
- Regex: '^.*(armadillo|iio|matio|pugixml)'
Priority: 2

View File

@ -55,6 +55,7 @@ Leonardo Tonetto tonetto.dev@gmail.com Contributor
Mara Branzanti mara.branzanti@gmail.com Contributor
Marc Molina marc.molina.pena@gmail.com Contributor
Marc Sales marcsales92@gmail.com Contributor
Rodrigo Muñoz rodrigo.munoz@proteinlab.cl Contributor
Carlos Paniego carpanie@hotmail.com Artwork
# SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -14,7 +14,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build, it is bad practice.\nTry 'cd build && cmake ..' instead.")
endif()
cmake_minimum_required(VERSION 2.8.12...3.17)
cmake_minimum_required(VERSION 2.8.12...3.18)
project(gnss-sdr CXX C)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
@ -112,6 +112,10 @@ if(ENABLE_FPGA)
set(ENABLE_INSTALL_TESTS ON)
endif()
option(ENABLE_BENCHMARKS "Build code snippets benchmarks" OFF)
if(CMAKE_VERSION VERSION_LESS 3.5.1)
set(ENABLE_BENCHMARKS OFF)
endif()
################################################################################
@ -241,13 +245,17 @@ if((${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") AND (CMAKE_CXX_COMPILER_I
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Fix for Debug mode in macOS
# Fix for Debug and None modes in macOS
# without this, get get a runtime error
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fstandalone-debug HAVE_STANDALONE_DEBUG)
check_cxx_compiler_flag(-Og HAVE_OG_FLAG)
if(HAVE_STANDALONE_DEBUG AND HAVE_OG_FLAG)
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g -fstandalone-debug")
set(CMAKE_C_FLAGS_DEBUG "-Og -g -fstandalone-debug")
if(CMAKE_BUILD_TYPE STREQUAL "None")
add_compile_options(-Og -fstandalone-debug)
endif()
endif()
endif()
endif()
@ -320,6 +328,7 @@ set(GNSSSDR_GPSTK_LOCAL_VERSION "3.0.0")
set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.17")
set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.10")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.12.3")
set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.5.1")
if(CMAKE_VERSION VERSION_LESS "3.0.2")
set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.1") # Fix for CentOS 7
@ -881,6 +890,56 @@ check_cxx_source_compiles("
################################################################################
# Detect availability of std::plus without class specifier
################################################################################
unset(has_std_plus_void CACHE)
if(CMAKE_CXX_STANDARD VERSION_GREATER 11)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <functional>
int main()
{ [](float a=1, float b=0){return std::plus<>();}; };"
has_std_plus_void
)
endif()
################################################################################
# Detect availability of std::transform_reduce
################################################################################
unset(has_transform_reduce CACHE)
unset(has_transform_reduce_with_execution_policy CACHE)
if(CMAKE_CXX_STANDARD VERSION_GREATER 14)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <functional>
#include <numeric>
#include <vector>
int main()
{
std::vector<float> a(5);
std::vector<float> b(5);
auto c = std::transform_reduce(cbegin(a), cend(a), cbegin(b), 0, std::plus<>{}, std::multiplies<>{}); };"
has_transform_reduce
)
check_cxx_source_compiles("
#include <execution>
#include <functional>
#include <numeric>
#include <vector>
int main()
{
std::vector<float> a(5);
std::vector<float> b(5);
auto c = std::transform_reduce(std::execution::par, cbegin(a), cend(a), cbegin(b), 0, std::plus<>{}, std::multiplies<>{}); };"
has_transform_reduce_with_execution_policy
)
endif()
################################################################################
# VOLK - Vector-Optimized Library of Kernels
################################################################################
@ -1194,7 +1253,7 @@ if(NOT GFLAGS_FOUND)
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
${GFLAGS_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
BUILD_COMMAND ${GFLAGS_BUILD_COMMAND} ${PARALLEL_BUILD}
BUILD_COMMAND "${GFLAGS_BUILD_COMMAND} ${PARALLEL_BUILD}"
BUILD_BYPRODUCTS ${GFLAGS_BUILD_BYPRODUCTS}
UPDATE_COMMAND ""
PATCH_COMMAND ""
@ -1455,7 +1514,7 @@ ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure
-DCMAKE_PREFIX_PATH=${GFLAGS_PREFIX_PATH}
${GLOG_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
BUILD_COMMAND ${GLOG_MAKE_PROGRAM} ${PARALLEL_BUILD}
BUILD_COMMAND "${GLOG_MAKE_PROGRAM} ${PARALLEL_BUILD}"
BUILD_BYPRODUCTS ${GLOG_BUILD_BYPRODUCTS}
UPDATE_COMMAND ""
PATCH_COMMAND ""
@ -1521,7 +1580,14 @@ ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure
endif()
if(NOT ENABLE_LOG)
message(STATUS "Logging is not enabled")
message(STATUS "Internal logging is not enabled")
if(CMAKE_VERSION VERSION_GREATER 3.11.0)
target_compile_definitions(Glog::glog INTERFACE -DGOOGLE_STRIP_LOG=1)
else()
set_property(TARGET Glog::glog APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS GOOGLE_STRIP_LOG=1
)
endif()
endif()
@ -1717,7 +1783,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
${DARWIN_DISABLE_HDF5}
${ARMADILLO_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
BUILD_COMMAND ${ARMADILLO_BUILD_COMMAND} ${PARALLEL_BUILD}
BUILD_COMMAND "${ARMADILLO_BUILD_COMMAND} ${PARALLEL_BUILD}"
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/armadillo-${armadillo_RELEASE}/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX}
UPDATE_COMMAND ""
INSTALL_COMMAND ""
@ -2107,7 +2173,7 @@ if(NOT PUGIXML_FOUND)
-DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
UPDATE_COMMAND ""
PATCH_COMMAND ""
BUILD_COMMAND ${PUGIXML_BUILD_COMMAND} ${PARALLEL_BUILD}
BUILD_COMMAND "${PUGIXML_BUILD_COMMAND} ${PARALLEL_BUILD}"
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX}
INSTALL_COMMAND ""
)
@ -3045,6 +3111,7 @@ add_feature_info(ENABLE_SYSTEM_TESTING_EXTRA ENABLE_SYSTEM_TESTING_EXTRA "Enable
add_feature_info(ENABLE_OWN_GPSTK ENABLE_OWN_GPSTK "Forces the downloading and building of GPSTk for system tests.")
add_feature_info(ENABLE_GNSS_SIM_INSTALL ENABLE_GNSS_SIM_INSTALL "Enables downloading and building of gnss-sim.")
add_feature_info(ENABLE_INSTALL_TESTS ENABLE_INSTALL_TESTS "Install test binaries when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} install'.")
add_feature_info(ENABLE_BENCHMARKS ENABLE_BENCHMARKS "Enables building of code snippet benchmarks.")
message(STATUS "")
message(STATUS "***************************************")

View File

@ -135,8 +135,6 @@ endif()
#Functions
include(CheckFunctionExists)
set(OLD_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARIES})
check_function_exists("pcap_breakloop" HAVE_PCAP_BREAKLOOP)
@ -149,8 +147,6 @@ check_function_exists("pcap_lib_version" HAVE_PCAP_LIB_VERSION)
check_function_exists("pcap_list_datalinks" HAVE_PCAP_LIST_DATALINKS)
check_function_exists("pcap_open_dead" HAVE_PCAP_OPEN_DEAD)
check_function_exists("pcap_set_datalink" HAVE_PCAP_SET_DATALINK)
set(CMAKE_REQUIRED_INCLUDES ${OLD_CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PCAP DEFAULT_MSG PCAP_INCLUDE_DIRS PCAP_LIBRARIES)

View File

@ -38,8 +38,8 @@ list(APPEND AVAIL_BUILDTYPES
# checks the value set in the cmake interface against the list of
# known build types in AVAIL_BUILDTYPES. If the build type is found,
# the function exits immediately. If nothing is found by the end of
# checking all available build types, we exit with an error and list
# the available build types.
# checking all available build types, we exit with a soft warning, listing
# the available build types, and setting the build type to None.
########################################################################
function(GNSSSDR_CHECK_BUILD_TYPE settype)
string(TOUPPER ${settype} _settype)
@ -49,8 +49,10 @@ function(GNSSSDR_CHECK_BUILD_TYPE settype)
return() # found it; exit cleanly
endif()
endforeach()
# Build type not found; error out
message(FATAL_ERROR "Build type '${settype}' not valid, must be one of: ${AVAIL_BUILDTYPES}")
# Build type not found; warn out at set it to None
message(STATUS "Warning: Build type '${settype}' not valid, must be one of: ${AVAIL_BUILDTYPES}.")
message(STATUS "Setting the build type to 'None'")
set(CMAKE_BUILD_TYPE "None" PARENT_SCOPE)
endfunction()

View File

@ -14,6 +14,7 @@
;######### GLOBAL OPTIONS ##################
;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second].
GNSS-SDR.internal_fs_sps=4000000
GNSS-SDR.Galileo_banned_prns=14,18
;######### SIGNAL_SOURCE CONFIG ############

View File

@ -12,6 +12,7 @@
;######### GLOBAL OPTIONS ##################
;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second].
GNSS-SDR.internal_fs_sps=5000000
GNSS-SDR.Galileo_banned_prns=14,18
;######### SUPL RRLP GPS assistance configuration #####

View File

@ -8,27 +8,37 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc
)
<!-- prettier-ignore-end -->
## Unreleased
## [Unreleased](https://github.com/gnss-sdr/gnss-sdr/tree/next)
### Improvements in Efficiency:
- Faster internal handling of `Gnss_Synchro` objects by reducing the amount of
copying via adding `noexcept` move constructor and move assignment operators,
so the move semantics are also used in STL containers.
- All `std::endl` have been replaced by the `'\n'` character, since there is no
need to always flush the stream.
- Performed a stack reordering of class members that seems to offer
statistically better performance in some processor architectures and/or
compilers.
- Add building option `ENABLE_STRIP` to generate stripped binaries (that is,
without debugging symbols), smaller in size and potentially providing better
performance than non-stripped counterparts. Only for GCC in Release build
mode. Set to `OFF` by default.
- Add building option `ENABLE_BENCHMARKS`, which activates the building of
benchmarks for some code snippets, making it easier to developers to benchmark
different implementations for the same purpose. Set to `OFF` by default.
### Improvements in Maintainability:
- The software can now be built against the GNU Radio 3.9 API that uses C++11
smart pointers instead of Boost smart pointers.
- Improved usage of smart pointers to better express ownership of resources.
- Add definition of `std::make_unique` for buildings with C++11, and make use of
it along the source code.
- Private members in headers have been sorted by type and size, minimizing
padding space in the stack and making the files more readable for humans.
- The software can now be built against the GNU Radio 3.9 API that uses standard
library's smart pointers instead of Boost's. Minimum GNU Radio required
version still remains at 3.7.3.
- The software can now be built against Boost <= 1.73 (minimum version: 1.53).
- Removed python six module as a dependency if using Python 3.x.
- Improved usage of smart pointers to better express ownership.
- Add definition of std::make_unique for buidings with C++11, and make use of it
along the source code.
- Fixed building with GCC 10 (gcc-10 and above flipped a default from `-fcommon`
to `-fno-common`, causing an error due to multiple defined lambda functions).
- Fixed warnings risen by GCC 10 and Clang 10.
@ -41,15 +51,22 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc
### Improvements in Portability:
- The software can now be cross-compiled on Petalinux environments.
- Removed python six module as a dependency if using Python 3.x.
- Make use of `std::span` if the compiler supports it, and use gsl-lite as a
fallback. The latter has been updated to version
[0.37.0](https://github.com/gsl-lite/gsl-lite/releases/tag/0.37.0).
- Improved finding of libgfortran in openSUSE and Fedora distributions.
- Allow a random name for the build type. If not recognized, it is set to
`None`. This allows packaging in some distributions that pass an arbitrary
name as the build type (e.g., Gentoo) to avoid unexpected compiler flags. The
building option `ENABLE_PACKAGING` must set to `ON` when packaging.
- Do not stop the receiver if SysV message queues cannot be created.
### Improvements in Reliability:
- Fixed a bug in GLONASS GNAV CRC computation.
- Fixed a possible buffer overflow in the generation of RTCM messages.
- Fixed a bug that could cause a random crash on receiver stopping.
### Improvements in Reproducibility:
@ -66,9 +83,24 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc
generated binaries is maintained if the building is done from any source tree
subfolder (for instance, `gnss-sdr/build`): in that case, binaries are stored
in the source tree (under `gnss-sdr/install`).
- Updated version of the Contributor Covenant to version 2.0.
- Defined new `GNSS-SDR.GPS_banned_prns`, `GNSS-SDR.Galileo_banned_prns`,
`GNSS-SDR.Glonass_banned_prns` and `GNSS-SDR.Beidou_banned_prns` configuration
parameters. The user can specify lists of satellites that will not be
processed (e.g., `GNSS-SDR.Galileo_banned_prns=14,18` since Galileo E14 and
E18 satellites are not usable for PVT). Satellites on those lists will never
be assigned to a processing channel.
- Added a Matlab script to quantize the input signal with a given number of bits
per sample.
- Fixed the building option `-DENABLE_LOG=OFF`, which strips internal logging
from the binary and can help to reduce its size and ultimately to speed up the
receiver. In binaries with enabled logging, it still can be disabled by
passing the command line flag `--minloglevel=3` to `gnss-sdr`. This can be
relevant in embedded devices with scarce storage capabilities.
- Fixed a bug in the Signal Sources configuration that made the number of
samples parameter ignored when too large (that is, when set larger than
2^31-1). Now the `samples` parameter accepts values up to 2^64-1, that is,
18,446,744,073,709,551,615 samples.
- Updated version of the Contributor Covenant to version 2.0.
&nbsp;

View File

@ -54,8 +54,8 @@ The goal is to write efficient and truly reusable code, easy to read and maintai
in a variety of hardware platforms and operating systems. In that sense, the challenge consists of defining a gentle balance within level
of abstraction and performance. GNSS-SDR runs in a personal computer and provides interfaces through USB and Ethernet
buses to a variety of either commercially available or custom-made RF front-ends, adapting the processing algorithms to different sampling frequencies, intermediate
frequencies and sample resolutions. This makes possible rapid prototyping of specific receivers intended, for instance, to geodetic applications,
observation of the ionospheric impact on navigation signals, GNSS reflectometry, signal quality monitoring, or carrier-phase based navigation techniques.
frequencies and sample resolutions. This makes possible rapid prototyping of specific receivers intended, for instance, to geodetic applications,
observation of the ionospheric impact on navigation signals, GNSS reflectometry, signal quality monitoring, or carrier-phase based navigation techniques.
\image html overview.png
\image latex overview.png "Overview" width=12cm
@ -70,7 +70,7 @@ This includes all current and future <a href="https://www.ettus.com/">Ettus Rese
As outputs, it provides:
\li Dump of intermediate signals (configurable by the user)
\li The processing is logged at a system temporary folder (usually, <tt>/tmp</tt>)
\li The processing is logged at a system temporary folder (usually, <tt>/tmp</tt>)
\li Observables in form of RINEX file (experimental)
\li Navigation message data in form of RINEX file
\li Position, Velocity and Time solution in KML format and NMEA
@ -81,17 +81,20 @@ As outputs, it provides:
In principle, GNSS-SDR can be built in any Unix-like system. In practice, it depends on being able to install all the required dependencies. See the <a href="https://gnss-sdr.org/build-and-install/" target="_blank">building guide</a> page for details about the project's
dependencies and build process. Mainly, it consists on installing <a href="https://www.gnuradio.org/" target="_blank">GNU Radio</a> plus some few more libraries:
\li <a href="http://arma.sourceforge.net/" target="_blank">Armadillo</a>, a C++ linear algebra library,
\li <a href="https://www.boost.org/" target="_blank">Boost</a>, a set of free peer-reviewed portable C++ source libraries,
\li <a href="https://github.com/gflags/gflags" target="_blank">Gflags</a>, a library that implements commandline flags processing,
\li <a href="https://github.com/google/glog" target="_blank">Glog</a>, a library that implements application-level logging,
\li <a href="http://arma.sourceforge.net/" target="_blank">Armadillo</a>, a C++ linear algebra library,
\li <a href="https://github.com/tbeu/matio" target="_blank">Matio</a>, a MATLAB MAT File I/O Library.
\li <a href="https://pugixml.org/" target="_blank">PugiXML</a>, a light-weight, simple and fast XML parser for C++ with XPath support.
\li <a href="https://developers.google.com/protocol-buffers" target="_blank">Protocol Buffers</a>, a language-neutral, platform-neutral extensible mechanism for serializing structured data.
\li <a href="https://www.makotemplates.org/" target="_blank">Mako</a>, a template library written in Python.
\li <a href="https://pypi.org/project/six/" target="_blank">Six</a>, a Python 2 and 3 compatibility library.
\li <a href="https://github.com/google/googletest" target="_blank">Googletest</a>, Google's framework for writing C++ tests (requires definition of the GTEST_DIR variable),
\li <a href="https://github.com/google/googletest" target="_blank">Googletest</a>, Google's framework for writing C++ tests,
\li <a href="https://www.makotemplates.org/" target="_blank">Mako</a>, a template library written in Python,
\li <a href="https://github.com/tbeu/matio" target="_blank">Matio</a>, a MATLAB MAT File I/O Library,
\li <a href="https://developers.google.com/protocol-buffers" target="_blank">Protocol Buffers</a>, a language-neutral, platform-neutral extensible mechanism for serializing structured data,
\li <a href="https://pugixml.org/" target="_blank">PugiXML</a>, a light-weight, simple and fast XML parser for C++ with XPath support,
\li <a href="https://www.libvolk.org" target="_blank">Volk</a>, a Vector-Optimized Library of Kernels which provides an abstraction of optimized math routines targeting several SIMD processors,
and, optionally,
\li GNU Radio modules for hardware interface (<a href="https://github.com/gnuradio/gnuradio/tree/master/gr-uhd" target="_blank">gr-uhd</a>, <a href="http://git.osmocom.org/gr-osmosdr" target="_blank">gr-osmosdr</a>, <a href="https://github.com/analogdevicesinc/gr-iio" target="_blank">gr-iio</a>),
\li <a href="https://github.com/google/benchmark" target="_blank">Benchmark</a>, a library to benchmark code snippets,
\li <a href="https://github.com/gperftools/gperftools" target="_blank">Gperftools</a>, which provides fast, multi-threaded malloc() and performance analysis tools.
After all dependencies are installed, clone the GNSS-SDR repository:
@ -135,7 +138,7 @@ This will create a folder named gnss-sdr with the following structure:
You are now ready to build GNSS-SDR by using <a href="https://cmake.org/" target="_blank">CMake</a> as building tool:
\verbatim
$ cd gnss-sdr/build
$ cmake ../
$ cmake ..
$ make
\endverbatim
@ -179,7 +182,7 @@ a RF front-end and you need to attain real time. If working with a file (and thu
the internals of the receiver, as well as more fine-grained logging. This can be done by building the Debug version, by doing:
\verbatim
$ cd gnss-sdr/build
$ cmake -DCMAKE_BUILD_TYPE=Debug ../
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ make
$ sudo make install
\endverbatim
@ -188,7 +191,7 @@ $ sudo make install
If you checked out GNSS-SDR some days ago, it is possible that some developer had updated files at the Git repository. You can update your local copy by doing:
\verbatim
$ git checkout next
$ git pull origin next
$ git pull https://github.com/gnss-sdr/gnss-sdr next
\endverbatim
Before rebuiling the source code, it is safe (and recommended) to remove the remainders of old builds:
\verbatim
@ -318,10 +321,10 @@ Relevant parameters of those samples are the intermediate frequency (or baseband
specified by the user in the configuration file.
This module also performs bit-depth adaptation, since most of the existing RF front-ends provide samples quantized with 2 or 3 bits, while operations inside
the processor are performed on 32- or 64-bit words, depending on its architecture. Although there are implementations of the most intensive computational
processes (mainly correlation) that take advantage of specific data types and architectures for the sake of
efficiency, the approach is processor-specific and hardly portable. We suggest to keep signal samples in standard data types and letting the compiler
select the best library version (implemented using SIMD or any other processor-specific technology) of the required routines for a given processor.
the processor are performed on 32- or 64-bit words, depending on its architecture. Although there are implementations of the most intensive computational
processes (mainly correlation) that take advantage of specific data types and architectures for the sake of
efficiency, the approach is processor-specific and hardly portable. We suggest to keep signal samples in standard data types and letting the compiler
select the best library version (implemented using SIMD or any other processor-specific technology) of the required routines for a given processor.
Example: FileSignalSource
@ -352,16 +355,16 @@ SignalSource.subdevice=B:0 ; UHD subdevice specification (for USRP1 use A:0 or B
Other examples are available at <tt>gnss-sdr/conf</tt>.
\subsection signal_conditioner Signal Conditioner
The signal conditioner is in charge of resampling the signal and delivering a reference sample rate to the downstream processing blocks, acting as
a facade between the signal source and the synchronization channels, providing a simplified interface to the input signal.
In case of multiband front-ends, this module would be in charge of providing a separated data stream for each band.
\subsection signal_conditioner Signal Conditioner
The signal conditioner is in charge of resampling the signal and delivering a reference sample rate to the downstream processing blocks, acting as
a facade between the signal source and the synchronization channels, providing a simplified interface to the input signal.
In case of multiband front-ends, this module would be in charge of providing a separated data stream for each band.
\subsection channel Channel
A channel encapsulates all signal processing devoted to a single satellite. Thus, it is a large composite object which encapsulates the \ref acquisition,
\ref tracking and \ref decoding modules. As a composite object, it can be treated as a single entity, meaning that it can be easily replicated. Since the number of
channels is selectable by the user in the configuration file, this approach helps improving the scalability and maintainability of the receiver.
\ref tracking and \ref decoding modules. As a composite object, it can be treated as a single entity, meaning that it can be easily replicated. Since the number of
channels is selectable by the user in the configuration file, this approach helps improving the scalability and maintainability of the receiver.
This module is also in charge of managing the interplay between acquisition and tracking. Acquisition can be initialized in several ways, depending on
the prior information available (called cold start when the receiver has no information about its position nor the satellites almanac; warm start when
@ -375,25 +378,25 @@ The abstract class ChannelInterface represents an interface to a channel GNSS bl
\subsubsection acquisition Acquisition
The first task of a GNSS receiver is to detect the presence or absence of in-view satellites. This is done by the acquisition system process, which also provides a coarse estimation of two signal parameters: the frequency shift
with respect to the nominal IF frequency, and a delay term which allows the receiver to create a local code aligned with the incoming code.
with respect to the nominal IF frequency, and a delay term which allows the receiver to create a local code aligned with the incoming code.
AcquisitionInterface is the common interface for all the acquisition algorithms and their corresponding implementations. Algorithms' interface, that may vary
depending on the use of information external to the receiver, such as in Assisted GNSS, is defined in classes referred to as <i>adapters</i>.
These adapters wrap the GNU Radio blocks interface into a compatible interface expected by AcquisitionInterface. This allows the use of existing GNU Radio blocks
derived from <tt>gr::block</tt>, and ensures that newly developed implementations will also be reusable in other GNU Radio-based applications.
Moreover, it adds still another layer of abstraction, since each given acquisition algorithm can have different implementations (for instance using
different numerical libraries). In such a way, implementations can be continuously improved without having any impact neither on the algorithm interface nor the general acquisition interface.
different numerical libraries). In such a way, implementations can be continuously improved without having any impact neither on the algorithm interface nor the general acquisition interface.
Check GpsL1CaPcpsAcquisition and GalileoE1PcpsAmbiguousAcquisition for examples of adapters from a Parallel Code Phase Search (PCPS) acquisition block, and
pcps_acquisition_cc for an example of a block implementation. The source code of all the available acquisition algorithms is located at:
pcps_acquisition_cc for an example of a block implementation. The source code of all the available acquisition algorithms is located at:
\verbatim
\verbatim
|-gnss-sdr
|---src
|-----algorithms
|-------acquisition
|---------adapters <- Adapters of the processing blocks to an AcquisitionInterface
|---------gnuradio_blocks <- Signal processing blocks implementation
\endverbatim
\endverbatim
The user can select a given implementation for the algorithm to be used in each receiver channel, as well as their parameters, in the configuration file:
\verbatim
@ -422,8 +425,8 @@ Acquisition_1C.doppler_step=250
\subsubsection tracking Tracking
When a satellite is declared present, the parameters estimated by the acquisition module are then fed to the receiver tracking module, which represents the
second stage of the signal processing unit, aiming to perform a local search for accurate estimates of code delay and carrier phase, and following their eventual
variations.
second stage of the signal processing unit, aiming to perform a local search for accurate estimates of code delay and carrier phase, and following their eventual
variations.
Again, a class hierarchy consisting of a TrackingInterface class and subclasses implementing algorithms provides a way of testing different approaches,
with full access to their parameters. Check GpsL1CaDllPllTracking or GalileoE1DllPllVemlTracking for examples of adapters, and Gps_L1_Ca_Dll_Pll_Tracking_cc for an example
@ -494,8 +497,8 @@ See the \ref reference_docs for more information about the signal format.
\subsection observables Observables
GNSS systems provide different kinds of observations. The most commonly used are the code observations, also called pseudoranges. The <i>pseudo</i> comes from
the fact that on the receiver side the clock error is unknown and thus the measurement is not a pure range observation. High accuracy applications also use the
carrier phase observations, which are based on measuring the difference between the carrier phase transmitted by the GNSS satellites and the phase of the carrier
generated in the receiver. Both observables are computed from the outputs of the tracking module and the decoding of the navigation message.
carrier phase observations, which are based on measuring the difference between the carrier phase transmitted by the GNSS satellites and the phase of the carrier
generated in the receiver. Both observables are computed from the outputs of the tracking module and the decoding of the navigation message.
This module collects all the data provided by every tracked channel, aligns all received data into a coherent set, and computes the observables.
The common interface is ObservablesInterface.
@ -514,8 +517,8 @@ Observables.dump_filename=./observables.dat
\subsection pvt Computation of Position, Velocity and Time
Although data processing for obtaining high-accuracy PVT solutions is out of the scope of GNSS-SDR, we provide a module that can compute a simple least square
solution and leaves room for more sophisticated positioning methods. The integration with libraries and software tools that are able to deal with multi-constellation
data such as <a href="https://github.com/SGL-UT/GPSTk" target="_blank">GPSTk</a> or <a href="https://gage.upc.edu/gLAB/" target="_blank">gLAB</a> appears as a viable solution for high performance, completely customizable GNSS receivers.
solution and leaves room for more sophisticated positioning methods. The integration with libraries and software tools that are able to deal with multi-constellation
data such as <a href="https://github.com/SGL-UT/GPSTk" target="_blank">GPSTk</a> or <a href="https://gage.upc.edu/gLAB/" target="_blank">gLAB</a> appears as a viable solution for high performance, completely customizable GNSS receivers.
The common interface is PvtInterface. For instance, in order to use the implementation RTKLIB_PVT, add to the configuration file:
\verbatim

View File

@ -41,7 +41,7 @@
<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:byte" name="SISA_3"/>
@ -53,6 +53,7 @@
<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:element type="xs:byte" name="flag_all_ephemeris"/>
</xs:sequence>
<xs:attribute type="xs:byte" name="class_id" use="optional"/>
<xs:attribute type="xs:byte" name="tracking_level" use="optional"/>

View File

@ -10,13 +10,13 @@
<xs:element type="xs:float" name="ai0_5"/>
<xs:element type="xs:float" name="ai1_5"/>
<xs:element type="xs:float" name="ai2_5"/>
<xs:element type="xs:int" name="TOW_5"/>
<xs:element type="xs:short" name="WN_5"/>
<xs:element type="xs:byte" name="Region1_flag_5"/>
<xs:element type="xs:byte" name="Region2_flag_5"/>
<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: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,7 +7,6 @@
<xs:element name="GNSS-SDR_utc_model">
<xs:complexType>
<xs:sequence>
<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:int" name="d_t_OT"/>
@ -16,6 +15,7 @@
<xs:element type="xs:short" name="i_WN_LSF"/>
<xs:element type="xs:byte" name="i_DN"/>
<xs:element type="xs:byte" name="d_DeltaT_LSF"/>
<xs:element type="xs:byte" name="valid"/>
</xs:sequence>
<xs:attribute type="xs:byte" name="class_id"/>
<xs:attribute type="xs:byte" name="tracking_level"/>

View File

@ -39,7 +39,7 @@ namespace bc = boost::integer;
#endif
Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -48,10 +48,10 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
{
Pvt_Conf pvt_output_parameters = Pvt_Conf();
// dump parameters
std::string default_dump_filename = "./pvt.dat";
std::string default_nmea_dump_filename = "./nmea_pvt.nmea";
std::string default_nmea_dump_devname = "/dev/tty1";
std::string default_rtcm_dump_devname = "/dev/pts/1";
const std::string default_dump_filename("./pvt.dat");
const std::string default_nmea_dump_filename("./nmea_pvt.nmea");
const std::string default_nmea_dump_devname("/dev/tty1");
const std::string default_rtcm_dump_devname("/dev/pts/1");
DLOG(INFO) << "role " << role;
pvt_output_parameters.dump = configuration->property(role + ".dump", false);
pvt_output_parameters.dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
@ -73,27 +73,11 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
// RINEX version
pvt_output_parameters.rinex_version = configuration->property(role + ".rinex_version", 3);
if (FLAGS_RINEX_version == "3.01")
if (FLAGS_RINEX_version == "3.01" || FLAGS_RINEX_version == "3.02" || FLAGS_RINEX_version == "3")
{
pvt_output_parameters.rinex_version = 3;
}
else if (FLAGS_RINEX_version == "3.02")
{
pvt_output_parameters.rinex_version = 3;
}
else if (FLAGS_RINEX_version == "3")
{
pvt_output_parameters.rinex_version = 3;
}
else if (FLAGS_RINEX_version == "2.11")
{
pvt_output_parameters.rinex_version = 2;
}
else if (FLAGS_RINEX_version == "2.10")
{
pvt_output_parameters.rinex_version = 2;
}
else if (FLAGS_RINEX_version == "2")
else if (FLAGS_RINEX_version == "2.10" || FLAGS_RINEX_version == "2.11" || FLAGS_RINEX_version == "2")
{
pvt_output_parameters.rinex_version = 2;
}
@ -418,10 +402,10 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
if (positioning_mode == -1)
{
// warn user and set the default
std::cout << "WARNING: Bad specification of positioning mode." << std::endl;
std::cout << "positioning_mode possible values: Single / Static / Kinematic / PPP_Static / PPP_Kinematic" << std::endl;
std::cout << "positioning_mode specified value: " << positioning_mode_str << std::endl;
std::cout << "Setting positioning_mode to Single" << std::endl;
std::cout << "WARNING: Bad specification of positioning mode.\n";
std::cout << "positioning_mode possible values: Single / Static / Kinematic / PPP_Static / PPP_Kinematic\n";
std::cout << "positioning_mode specified value: " << positioning_mode_str << '\n';
std::cout << "Setting positioning_mode to Single\n";
positioning_mode = PMODE_SINGLE;
}
@ -497,10 +481,10 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
if (iono_model == -1)
{
// warn user and set the default
std::cout << "WARNING: Bad specification of ionospheric model." << std::endl;
std::cout << "iono_model possible values: OFF / Broadcast / SBAS / Iono-Free-LC / Estimate_STEC / IONEX" << std::endl;
std::cout << "iono_model specified value: " << iono_model_str << std::endl;
std::cout << "Setting iono_model to OFF" << std::endl;
std::cout << "WARNING: Bad specification of ionospheric model.\n";
std::cout << "iono_model possible values: OFF / Broadcast / SBAS / Iono-Free-LC / Estimate_STEC / IONEX\n";
std::cout << "iono_model specified value: " << iono_model_str << '\n';
std::cout << "Setting iono_model to OFF\n";
iono_model = IONOOPT_OFF; /* 0: ionosphere option: correction off */
}
@ -530,10 +514,10 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
if (trop_model == -1)
{
// warn user and set the default
std::cout << "WARNING: Bad specification of tropospheric model." << std::endl;
std::cout << "trop_model possible values: OFF / Saastamoinen / SBAS / Estimate_ZTD / Estimate_ZTD_Grad" << std::endl;
std::cout << "trop_model specified value: " << trop_model_str << std::endl;
std::cout << "Setting trop_model to OFF" << std::endl;
std::cout << "WARNING: Bad specification of tropospheric model.\n";
std::cout << "trop_model possible values: OFF / Saastamoinen / SBAS / Estimate_ZTD / Estimate_ZTD_Grad\n";
std::cout << "trop_model specified value: " << trop_model_str << '\n';
std::cout << "Setting trop_model to OFF\n";
trop_model = TROPOPT_OFF;
}
@ -608,10 +592,10 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
if (integer_ambiguity_resolution_gps == -1)
{
// warn user and set the default
std::cout << "WARNING: Bad specification of GPS ambiguity resolution method." << std::endl;
std::cout << "AR_GPS possible values: OFF / Continuous / Instantaneous / Fix-and-Hold / PPP-AR" << std::endl;
std::cout << "AR_GPS specified value: " << integer_ambiguity_resolution_gps_str << std::endl;
std::cout << "Setting AR_GPS to OFF" << std::endl;
std::cout << "WARNING: Bad specification of GPS ambiguity resolution method.\n";
std::cout << "AR_GPS possible values: OFF / Continuous / Instantaneous / Fix-and-Hold / PPP-AR\n";
std::cout << "AR_GPS specified value: " << integer_ambiguity_resolution_gps_str << '\n';
std::cout << "Setting AR_GPS to OFF\n";
integer_ambiguity_resolution_gps = ARMODE_OFF;
}
@ -795,6 +779,7 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
Rtklib_Pvt::~Rtklib_Pvt()
{
DLOG(INFO) << "PVT adapter destructor called.";
rtkfree(&rtk);
}

View File

@ -21,6 +21,7 @@
#ifndef GNSS_SDR_RTKLIB_PVT_H
#define GNSS_SDR_RTKLIB_PVT_H
#include "gnss_synchro.h"
#include "pvt_interface.h" // for PvtInterface
#include "rtklib.h" // for rtk_t
#include "rtklib_pvt_gs.h" // for rtklib_pvt_gs_sptr
@ -43,7 +44,7 @@ class Gps_Ephemeris;
class Rtklib_Pvt : public PvtInterface
{
public:
Rtklib_Pvt(ConfigurationInterface* configuration,
Rtklib_Pvt(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -77,10 +78,10 @@ public:
return;
}
//! All blocks must have an item_size() function implementation. Returns sizeof(gr_complex)
//! All blocks must have an item_size() function implementation
inline size_t item_size() override
{
return sizeof(gr_complex);
return sizeof(Gnss_Synchro);
}
bool get_latest_PVT(double* longitude_deg,

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,6 @@
#include <memory> // for shared_ptr, unique_ptr
#include <string> // for string
#include <sys/types.h> // for key_t
#include <utility> // for pair
#include <vector> // for vector
#if GNURADIO_USES_STD_POINTERS
#else
@ -135,7 +134,54 @@ private:
void msg_handler_telemetry(const pmt::pmt_t& msg);
enum StringValue
void initialize_and_apply_carrier_phase_offset();
void apply_rx_clock_offset(std::map<int, Gnss_Synchro>& observables_map,
double rx_clock_offset_s);
std::map<int, Gnss_Synchro> interpolate_observables(const std::map<int, Gnss_Synchro>& observables_map_t0,
const std::map<int, Gnss_Synchro>& observables_map_t1,
double rx_time_s);
inline std::time_t convert_to_time_t(const boost::posix_time::ptime pt) const
{
return (pt - boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1))).total_seconds();
}
std::vector<std::string> split_string(const std::string& s, char delim) const;
typedef struct
{
long mtype; // NOLINT(google-runtime-int) required by SysV queue messaging
double ttff;
} d_ttff_msgbuf;
bool send_sys_v_ttff_msg(d_ttff_msgbuf ttff);
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
std::shared_ptr<Rtklib_Solver> d_internal_pvt_solver;
std::shared_ptr<Rtklib_Solver> d_user_pvt_solver;
std::unique_ptr<Rinex_Printer> d_rp;
std::unique_ptr<Kml_Printer> d_kml_dump;
std::unique_ptr<Gpx_Printer> d_gpx_dump;
std::unique_ptr<Nmea_Printer> d_nmea_printer;
std::unique_ptr<GeoJSON_Printer> d_geojson_printer;
std::unique_ptr<Rtcm_Printer> d_rtcm_printer;
std::unique_ptr<Monitor_Pvt_Udp_Sink> d_udp_sink_ptr;
std::chrono::time_point<std::chrono::system_clock> d_start;
std::chrono::time_point<std::chrono::system_clock> d_end;
std::string d_dump_filename;
std::string d_xml_base_path;
std::string d_local_time_str;
std::vector<bool> d_channel_initialized;
std::vector<double> d_initial_carrier_phase_offset_estimation_rads;
enum StringValue_
{
evGPS_1C,
evGPS_2S,
@ -149,26 +195,20 @@ private:
evBDS_B2,
evBDS_B3
};
std::map<std::string, StringValue_> d_mapStringValues;
std::map<int, Gnss_Synchro> d_gnss_observables_map;
std::map<int, Gnss_Synchro> d_gnss_observables_map_t0;
std::map<int, Gnss_Synchro> d_gnss_observables_map_t1;
std::map<std::string, StringValue> mapStringValues_;
boost::posix_time::time_duration d_utc_diff_time;
void apply_rx_clock_offset(std::map<int, Gnss_Synchro>& observables_map,
double rx_clock_offset_s);
std::map<int, Gnss_Synchro> interpolate_observables(std::map<int, Gnss_Synchro>& observables_map_t0,
std::map<int, Gnss_Synchro>& observables_map_t1,
double rx_time_s);
bool d_dump;
bool d_dump_mat;
bool b_rinex_output_enabled;
bool b_rinex_header_written;
bool b_rinex_header_updated;
double d_rinex_version;
int32_t d_rinexobs_rate_ms;
double d_rx_time;
bool b_rtcm_writing_started;
bool b_rtcm_enabled;
key_t d_sysv_msg_key;
int d_sysv_msqid;
int32_t d_rinexobs_rate_ms;
int32_t d_rtcm_MT1045_rate_ms; // Galileo Broadcast Ephemeris
int32_t d_rtcm_MT1019_rate_ms; // GPS Broadcast Ephemeris (orbits)
int32_t d_rtcm_MT1020_rate_ms; // GLONASS Broadcast Ephemeris (orbits)
@ -176,79 +216,36 @@ private:
int32_t d_rtcm_MT1087_rate_ms; // GLONASS MSM7. The type 7 Multiple Signal Message format for the Russian GLONASS system
int32_t d_rtcm_MT1097_rate_ms; // Galileo MSM7. The type 7 Multiple Signal Message format for Europes Galileo system
int32_t d_rtcm_MSM_rate_ms;
int32_t d_kml_rate_ms;
int32_t d_gpx_rate_ms;
int32_t d_geojson_rate_ms;
int32_t d_nmea_rate_ms;
int32_t d_last_status_print_seg; // for status printer
uint32_t d_nchannels;
std::string d_dump_filename;
int32_t d_output_rate_ms;
int32_t d_display_rate_ms;
int32_t d_report_rate_ms;
int32_t d_max_obs_block_rx_clock_offset_ms;
std::unique_ptr<Rinex_Printer> rp;
std::unique_ptr<Kml_Printer> d_kml_dump;
std::unique_ptr<Gpx_Printer> d_gpx_dump;
std::unique_ptr<Nmea_Printer> d_nmea_printer;
std::unique_ptr<GeoJSON_Printer> d_geojson_printer;
std::unique_ptr<Rtcm_Printer> d_rtcm_printer;
double d_rx_time;
uint32_t d_nchannels;
uint32_t d_type_of_rx;
bool d_dump;
bool d_dump_mat;
bool d_rinex_output_enabled;
bool d_rinex_header_written;
bool d_rinex_header_updated;
bool d_geojson_output_enabled;
bool d_gpx_output_enabled;
bool d_kml_output_enabled;
bool d_nmea_output_file_enabled;
std::shared_ptr<Rtklib_Solver> d_internal_pvt_solver;
std::shared_ptr<Rtklib_Solver> d_user_pvt_solver;
int32_t max_obs_block_rx_clock_offset_ms;
bool d_first_fix;
bool d_xml_storage;
bool d_flag_monitor_pvt_enabled;
bool d_show_local_time_zone;
bool d_waiting_obs_block_rx_clock_offset_correction_msg;
bool d_enable_rx_clock_correction;
std::map<int, Gnss_Synchro> gnss_observables_map;
std::map<int, Gnss_Synchro> gnss_observables_map_t0;
std::map<int, Gnss_Synchro> gnss_observables_map_t1;
std::vector<double> initial_carrier_phase_offset_estimation_rads;
std::vector<bool> channel_initialized;
uint32_t type_of_rx;
bool first_fix;
key_t sysv_msg_key;
int sysv_msqid;
typedef struct
{
long mtype; // NOLINT(google-runtime-int) required by SysV queue messaging
double ttff;
} ttff_msgbuf;
bool send_sys_v_ttff_msg(ttff_msgbuf ttff);
std::chrono::time_point<std::chrono::system_clock> start, end;
void initialize_and_apply_carrier_phase_offset();
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 d_xml_storage;
std::string xml_base_path;
inline std::time_t convert_to_time_t(const boost::posix_time::ptime pt) const
{
return (pt - boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1))).total_seconds();
}
bool flag_monitor_pvt_enabled;
std::unique_ptr<Monitor_Pvt_Udp_Sink> udp_sink_ptr;
std::vector<std::string> split_string(const std::string& s, char delim) const;
bool d_show_local_time_zone;
std::string d_local_time_str;
boost::posix_time::time_duration d_utc_diff_time;
bool d_rtcm_writing_started;
bool d_rtcm_enabled;
};
#endif // GNSS_SDR_RTKLIB_PVT_GS_H

View File

@ -65,7 +65,7 @@ GeoJSON_Printer::GeoJSON_Printer(const std::string& base_path)
{
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
std::cout << "Could not create the " << new_folder << " folder.\n";
geojson_base_path = full_path.string();
}
}
@ -78,7 +78,7 @@ GeoJSON_Printer::GeoJSON_Printer(const std::string& base_path)
}
if (geojson_base_path != ".")
{
std::cout << "GeoJSON files will be stored at " << geojson_base_path << std::endl;
std::cout << "GeoJSON files will be stored at " << geojson_base_path << '\n';
}
geojson_base_path = geojson_base_path + fs::path::preferred_separator;
@ -87,6 +87,7 @@ GeoJSON_Printer::GeoJSON_Printer(const std::string& base_path)
GeoJSON_Printer::~GeoJSON_Printer()
{
DLOG(INFO) << "GeoJSON printer destructor called.";
try
{
GeoJSON_Printer::close_file();
@ -159,19 +160,19 @@ bool GeoJSON_Printer::set_headers(const std::string& filename, bool time_tag_nam
geojson_file << std::setprecision(14);
// Writing the header
geojson_file << "{" << std::endl;
geojson_file << R"( "type": "Feature",)" << std::endl;
geojson_file << " \"properties\": {" << std::endl;
geojson_file << R"( "name": "Locations generated by GNSS-SDR" )" << std::endl;
geojson_file << " }," << std::endl;
geojson_file << " \"geometry\": {" << std::endl;
geojson_file << R"( "type": "MultiPoint",)" << std::endl;
geojson_file << " \"coordinates\": [" << std::endl;
geojson_file << "{\n";
geojson_file << R"( "type": "Feature",)" << '\n';
geojson_file << " \"properties\": {\n";
geojson_file << R"( "name": "Locations generated by GNSS-SDR" )" << '\n';
geojson_file << " },\n";
geojson_file << " \"geometry\": {\n";
geojson_file << R"( "type": "MultiPoint",)" << '\n';
geojson_file << " \"coordinates\": [\n";
return true;
}
std::cout << "File " << filename_ << " cannot be saved. Wrong permissions?" << std::endl;
std::cout << "File " << filename_ << " cannot be saved. Wrong permissions?\n";
return false;
}
@ -204,7 +205,7 @@ bool GeoJSON_Printer::print_position(const Pvt_Solution* position, bool print_av
}
else
{
geojson_file << "," << std::endl;
geojson_file << ",\n";
geojson_file << " [" << longitude << ", " << latitude << ", " << height << "]";
}
return true;
@ -217,10 +218,10 @@ bool GeoJSON_Printer::close_file()
{
if (geojson_file.is_open())
{
geojson_file << std::endl;
geojson_file << " ]" << std::endl;
geojson_file << " }" << std::endl;
geojson_file << "}" << std::endl;
geojson_file << '\n';
geojson_file << " ]\n";
geojson_file << " }\n";
geojson_file << "}\n";
geojson_file.close();
// if nothing is written, erase the file

View File

@ -24,7 +24,6 @@
#include <fstream>
#include <memory>
#include <string>
class Pvt_Solution;
@ -45,9 +44,9 @@ public:
private:
std::ofstream geojson_file;
bool first_pos;
std::string filename_;
std::string geojson_base_path;
bool first_pos;
};
#endif

View File

@ -67,7 +67,7 @@ Gpx_Printer::Gpx_Printer(const std::string& base_path)
{
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
std::cout << "Could not create the " << new_folder << " folder.\n";
gpx_base_path = full_path.string();
}
}
@ -80,7 +80,7 @@ Gpx_Printer::Gpx_Printer(const std::string& base_path)
}
if (gpx_base_path != ".")
{
std::cout << "GPX files will be stored at " << gpx_base_path << std::endl;
std::cout << "GPX files will be stored at " << gpx_base_path << '\n';
}
gpx_base_path = gpx_base_path + fs::path::preferred_separator;
@ -144,20 +144,20 @@ bool Gpx_Printer::set_headers(const std::string& filename, bool time_tag_name)
// Set iostream numeric format and precision
gpx_file.setf(gpx_file.std::ofstream::fixed, gpx_file.std::ofstream::floatfield);
gpx_file << std::setprecision(14);
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
<< indent << "xmlns:gpxtpx=\"http://www.garmin.com/xmlschemas/TrackPointExtension/v2\"" << std::endl
<< indent << "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" << std::endl
<< indent << "<trk>" << std::endl
<< indent << indent << "<name>Position fixes computed by GNSS-SDR v" << GNSS_SDR_VERSION << "</name>" << std::endl
<< indent << indent << "<desc>GNSS-SDR position log generated at " << pt << " (local time)</desc>" << std::endl
<< indent << indent << "<trkseg>" << std::endl;
gpx_file << R"(<?xml version="1.0" encoding="UTF-8"?>)" << '\n'
<< R"(<gpx version="1.1" creator="GNSS-SDR")" << '\n'
<< 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\"" << '\n'
<< indent << "xmlns=\"http://www.topografix.com/GPX/1/1\"" << '\n'
<< indent << "xmlns:gpxx=\"http://www.garmin.com/xmlschemas/GpxExtensions/v3\"" << '\n'
<< indent << "xmlns:gpxtpx=\"http://www.garmin.com/xmlschemas/TrackPointExtension/v2\"" << '\n'
<< indent << "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" << '\n'
<< indent << "<trk>" << '\n'
<< indent << indent << "<name>Position fixes computed by GNSS-SDR v" << GNSS_SDR_VERSION << "</name>" << '\n'
<< indent << indent << "<desc>GNSS-SDR position log generated at " << pt << " (local time)</desc>" << '\n'
<< indent << indent << "<trkseg>\n";
return true;
}
std::cout << "File " << gpx_filename << " cannot be saved. Wrong permissions?" << std::endl;
std::cout << "File " << gpx_filename << " cannot be saved. Wrong permissions?\n";
return false;
}
@ -205,7 +205,7 @@ bool Gpx_Printer::print_position(const Pvt_Solution* position, bool print_averag
<< "<extensions><gpxtpx:TrackPointExtension>"
<< "<gpxtpx:speed>" << speed_over_ground << "</gpxtpx:speed>"
<< "<gpxtpx:course>" << course_over_ground << "</gpxtpx:course>"
<< "</gpxtpx:TrackPointExtension></extensions></trkpt>" << std::endl;
<< "</gpxtpx:TrackPointExtension></extensions></trkpt>\n";
return true;
}
return false;
@ -216,8 +216,8 @@ bool Gpx_Printer::close_file()
{
if (gpx_file.is_open())
{
gpx_file << indent << indent << "</trkseg>" << std::endl
<< indent << "</trk>" << std::endl
gpx_file << indent << indent << "</trkseg>" << '\n'
<< indent << "</trk>" << '\n'
<< "</gpx>";
gpx_file.close();
return true;
@ -228,6 +228,7 @@ bool Gpx_Printer::close_file()
Gpx_Printer::~Gpx_Printer()
{
DLOG(INFO) << "GPX printer destructor called.";
try
{
close_file();

View File

@ -24,7 +24,6 @@
#include <fstream>
#include <memory>
#include <string>
class Pvt_Solution;
@ -45,10 +44,10 @@ public:
private:
std::ofstream gpx_file;
bool positions_printed;
std::string gpx_filename;
std::string indent;
std::string gpx_base_path;
bool positions_printed;
};
#endif

View File

@ -119,7 +119,7 @@ bool Hybrid_Ls_Pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
// COMMON RX TIME PVT ALGORITHM
double Rx_time = hybrid_current_time;
double Tx_time = Rx_time - gnss_observables_iter->second.Pseudorange_m / GALILEO_C_M_S;
double Tx_time = Rx_time - gnss_observables_iter->second.Pseudorange_m / SPEED_OF_LIGHT_M_S;
// 2- compute the clock drift using the clock model (broadcast) for this SV
SV_clock_bias_s = galileo_ephemeris_iter->second.sv_clock_drift(Tx_time);
@ -136,7 +136,7 @@ bool Hybrid_Ls_Pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
// 4- fill the observations vector with the corrected observables
obs.resize(valid_obs + 1, 1);
obs(valid_obs) = gnss_observables_iter->second.Pseudorange_m + SV_clock_bias_s * GALILEO_C_M_S - this->get_time_offset_s() * GALILEO_C_M_S;
obs(valid_obs) = gnss_observables_iter->second.Pseudorange_m + SV_clock_bias_s * SPEED_OF_LIGHT_M_S - this->get_time_offset_s() * SPEED_OF_LIGHT_M_S;
Galileo_week_number = galileo_ephemeris_iter->second.WN_5; // for GST
GST = galileo_ephemeris_iter->second.Galileo_System_Time(Galileo_week_number, hybrid_current_time);
@ -174,7 +174,7 @@ bool Hybrid_Ls_Pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
// COMMON RX TIME PVT ALGORITHM MODIFICATION (Like RINEX files)
// first estimate of transmit time
double Rx_time = hybrid_current_time;
double Tx_time = Rx_time - gnss_observables_iter->second.Pseudorange_m / GPS_C_M_S;
double Tx_time = Rx_time - gnss_observables_iter->second.Pseudorange_m / SPEED_OF_LIGHT_M_S;
// 2- compute the clock drift using the clock model (broadcast) for this SV, not including relativistic effect
SV_clock_bias_s = gps_ephemeris_iter->second.sv_clock_drift(Tx_time); //- gps_ephemeris_iter->second.d_TGD;
@ -194,10 +194,10 @@ bool Hybrid_Ls_Pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
// See IS-GPS-200K section 20.3.3.3.3.2
double sqrt_Gamma = GPS_L1_FREQ_HZ / GPS_L2_FREQ_HZ;
double Gamma = sqrt_Gamma * sqrt_Gamma;
double P1_P2 = (1.0 - Gamma) * (gps_ephemeris_iter->second.d_TGD * GPS_C_M_S);
double P1_P2 = (1.0 - Gamma) * (gps_ephemeris_iter->second.d_TGD * SPEED_OF_LIGHT_M_S);
double Code_bias_m = P1_P2 / (1.0 - Gamma);
obs.resize(valid_obs + 1, 1);
obs(valid_obs) = gnss_observables_iter->second.Pseudorange_m + dtr * GPS_C_M_S - Code_bias_m - this->get_time_offset_s() * GPS_C_M_S;
obs(valid_obs) = gnss_observables_iter->second.Pseudorange_m + dtr * SPEED_OF_LIGHT_M_S - Code_bias_m - this->get_time_offset_s() * SPEED_OF_LIGHT_M_S;
// SV ECEF DEBUG OUTPUT
LOG(INFO) << "(new)ECEF GPS L1 CA satellite SV ID=" << gps_ephemeris_iter->second.i_satellite_PRN
@ -229,14 +229,14 @@ bool Hybrid_Ls_Pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
// COMMON RX TIME PVT ALGORITHM MODIFICATION (Like RINEX files)
// first estimate of transmit time
double Rx_time = hybrid_current_time;
double Tx_time = Rx_time - gnss_observables_iter->second.Pseudorange_m / GPS_C_M_S;
double Tx_time = Rx_time - gnss_observables_iter->second.Pseudorange_m / SPEED_OF_LIGHT_M_S;
// 2- compute the clock drift using the clock model (broadcast) for this SV
SV_clock_bias_s = gps_cnav_ephemeris_iter->second.sv_clock_drift(Tx_time);
// 3- compute the current ECEF position for this SV using corrected TX time
TX_time_corrected_s = Tx_time - SV_clock_bias_s;
// std::cout<<"TX time["<<gps_cnav_ephemeris_iter->second.i_satellite_PRN<<"]="<<TX_time_corrected_s<<std::endl;
// std::cout<<"TX time["<<gps_cnav_ephemeris_iter->second.i_satellite_PRN<<"]="<<TX_time_corrected_s<< '\n';
double dtr = gps_cnav_ephemeris_iter->second.satellitePosition(TX_time_corrected_s);
// store satellite positions in a matrix
@ -247,7 +247,7 @@ bool Hybrid_Ls_Pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
// 4- fill the observations vector with the corrected observables
obs.resize(valid_obs + 1, 1);
obs(valid_obs) = gnss_observables_iter->second.Pseudorange_m + dtr * GPS_C_M_S + SV_clock_bias_s * GPS_C_M_S;
obs(valid_obs) = gnss_observables_iter->second.Pseudorange_m + dtr * SPEED_OF_LIGHT_M_S + SV_clock_bias_s * SPEED_OF_LIGHT_M_S;
GPS_week = gps_cnav_ephemeris_iter->second.i_GPS_week;
GPS_week = GPS_week % 1024; // Necessary due to the increase of WN bits in CNAV message (10 in GPS NAV and 13 in CNAV)
@ -296,18 +296,18 @@ bool Hybrid_Ls_Pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
// execute Bancroft's algorithm to estimate initial receiver position and time
DLOG(INFO) << " Executing Bancroft algorithm...";
rx_position_and_time = bancroftPos(satpos.t(), obs);
this->set_rx_pos(rx_position_and_time.rows(0, 2)); // save ECEF position for the next iteration
this->set_time_offset_s(rx_position_and_time(3) / GPS_C_M_S); // save time for the next iteration [meters]->[seconds]
this->set_rx_pos(rx_position_and_time.rows(0, 2)); // save ECEF position for the next iteration
this->set_time_offset_s(rx_position_and_time(3) / SPEED_OF_LIGHT_M_S); // save time for the next iteration [meters]->[seconds]
}
// Execute WLS using previous position as the initialization point
rx_position_and_time = leastSquarePos(satpos, obs, W);
this->set_rx_pos(rx_position_and_time.rows(0, 2)); // save ECEF position for the next iteration
this->set_time_offset_s(this->get_time_offset_s() + rx_position_and_time(3) / GPS_C_M_S); // accumulate the rx time error for the next iteration [meters]->[seconds]
this->set_rx_pos(rx_position_and_time.rows(0, 2)); // save ECEF position for the next iteration
this->set_time_offset_s(this->get_time_offset_s() + rx_position_and_time(3) / SPEED_OF_LIGHT_M_S); // accumulate the rx time error for the next iteration [meters]->[seconds]
DLOG(INFO) << "Hybrid Position at TOW=" << hybrid_current_time << " in ECEF (X,Y,Z,t[meters]) = " << rx_position_and_time;
DLOG(INFO) << "Accumulated rx clock error=" << this->get_time_offset_s() << " clock error for this iteration=" << rx_position_and_time(3) / GPS_C_M_S << " [s]";
DLOG(INFO) << "Accumulated rx clock error=" << this->get_time_offset_s() << " clock error for this iteration=" << rx_position_and_time(3) / SPEED_OF_LIGHT_M_S << " [s]";
// Compute GST and Gregorian time
if (GST != 0.0)

View File

@ -69,7 +69,7 @@ Kml_Printer::Kml_Printer(const std::string& base_path)
{
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
std::cout << "Could not create the " << new_folder << " folder.\n";
kml_base_path = full_path.string();
}
}
@ -82,7 +82,7 @@ Kml_Printer::Kml_Printer(const std::string& base_path)
}
if (kml_base_path != ".")
{
std::cout << "KML files will be stored at " << kml_base_path << std::endl;
std::cout << "KML files will be stored at " << kml_base_path << '\n';
}
kml_base_path = kml_base_path + fs::path::preferred_separator;
@ -92,7 +92,7 @@ Kml_Printer::Kml_Printer(const std::string& base_path)
int fd = mkstemp(tmp_filename_);
if (fd == -1)
{
std::cerr << "Error in KML printer: failed to create temporary file" << std::endl;
std::cerr << "Error in KML printer: failed to create temporary file\n";
}
else
{
@ -169,64 +169,64 @@ bool Kml_Printer::set_headers(const std::string& filename, bool time_tag_name)
tmp_file.setf(tmp_file.std::ofstream::fixed, tmp_file.std::ofstream::floatfield);
tmp_file << std::setprecision(14);
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
<< indent << indent << indent << "<table>" << std::endl
<< indent << indent << indent << indent << "<tr><td>GNSS-SDR Receiver position log file created at " << pt << "</td></tr>" << std::endl
<< indent << indent << indent << indent << "<tr><td>https://gnss-sdr.org/</td></tr>" << std::endl
<< indent << indent << indent << "</table>" << std::endl
<< indent << indent << "]]></description>" << std::endl
<< indent << indent << "<!-- Normal track style -->" << std::endl
<< indent << indent << "<Style id=\"track_n\">" << std::endl
<< indent << indent << indent << "<IconStyle>" << std::endl
<< indent << indent << indent << indent << "<color>ff00ffff</color>" << std::endl
<< indent << indent << indent << indent << "<scale>0.3</scale>" << std::endl
<< indent << indent << indent << indent << "<Icon>" << std::endl
<< indent << indent << indent << indent << indent << "<href>http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png</href>" << std::endl
<< indent << indent << indent << indent << "</Icon>" << std::endl
<< indent << indent << indent << "</IconStyle>" << std::endl
<< indent << indent << indent << "<LabelStyle>" << std::endl
<< indent << indent << indent << indent << "<scale>0</scale>" << std::endl
<< indent << indent << indent << "</LabelStyle>" << std::endl
<< indent << indent << "</Style>" << std::endl
<< indent << indent << "<!-- Highlighted track style -->" << std::endl
<< indent << indent << "<Style id=\"track_h\">" << std::endl
<< indent << indent << indent << "<IconStyle>" << std::endl
<< indent << indent << indent << indent << "<color>ff00ffff</color>" << std::endl
<< indent << indent << indent << indent << "<scale>1</scale>" << std::endl
<< indent << indent << indent << indent << "<Icon>" << std::endl
<< indent << indent << indent << indent << indent << "<href>http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png</href>" << std::endl
<< indent << indent << indent << indent << "</Icon>" << std::endl
<< indent << indent << indent << "</IconStyle>" << std::endl
<< indent << indent << "</Style>" << std::endl
<< indent << indent << "<StyleMap id=\"track\">" << std::endl
<< indent << indent << indent << "<Pair>" << std::endl
<< indent << indent << indent << indent << "<key>normal</key>" << std::endl
<< indent << indent << indent << indent << "<styleUrl>#track_n</styleUrl>" << std::endl
<< indent << indent << indent << "</Pair>" << std::endl
<< indent << indent << indent << "<Pair>" << std::endl
<< indent << indent << indent << indent << "<key>highlight</key>" << std::endl
<< indent << indent << indent << indent << "<styleUrl>#track_h</styleUrl>" << std::endl
<< indent << indent << indent << "</Pair>" << std::endl
<< indent << indent << "</StyleMap>" << std::endl
<< indent << indent << "<Style id=\"yellowLineGreenPoly\">" << std::endl
<< indent << indent << indent << "<LineStyle>" << std::endl
<< indent << indent << indent << indent << "<color>7f00ffff</color>" << std::endl
<< indent << indent << indent << indent << "<width>1</width>" << std::endl
<< indent << indent << indent << "</LineStyle>" << std::endl
<< indent << indent << indent << "<PolyStyle>" << std::endl
<< indent << indent << indent << indent << "<color>7f00ff00</color>" << std::endl
<< indent << indent << indent << "</PolyStyle>" << std::endl
<< indent << indent << "</Style>" << std::endl
<< indent << indent << "<Folder>" << std::endl
<< indent << indent << indent << "<name>Points</name>" << std::endl;
kml_file << R"(<?xml version="1.0" encoding="UTF-8"?>)" << '\n'
<< R"(<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">)" << '\n'
<< indent << "<Document>" << '\n'
<< indent << indent << "<name>GNSS Track</name>" << '\n'
<< indent << indent << "<description><![CDATA[" << '\n'
<< indent << indent << indent << "<table>" << '\n'
<< indent << indent << indent << indent << "<tr><td>GNSS-SDR Receiver position log file created at " << pt << "</td></tr>" << '\n'
<< indent << indent << indent << indent << "<tr><td>https://gnss-sdr.org/</td></tr>" << '\n'
<< indent << indent << indent << "</table>" << '\n'
<< indent << indent << "]]></description>" << '\n'
<< indent << indent << "<!-- Normal track style -->" << '\n'
<< indent << indent << "<Style id=\"track_n\">" << '\n'
<< indent << indent << indent << "<IconStyle>" << '\n'
<< indent << indent << indent << indent << "<color>ff00ffff</color>" << '\n'
<< indent << indent << indent << indent << "<scale>0.3</scale>" << '\n'
<< indent << indent << indent << indent << "<Icon>" << '\n'
<< indent << indent << indent << indent << indent << "<href>http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png</href>" << '\n'
<< indent << indent << indent << indent << "</Icon>" << '\n'
<< indent << indent << indent << "</IconStyle>" << '\n'
<< indent << indent << indent << "<LabelStyle>" << '\n'
<< indent << indent << indent << indent << "<scale>0</scale>" << '\n'
<< indent << indent << indent << "</LabelStyle>" << '\n'
<< indent << indent << "</Style>" << '\n'
<< indent << indent << "<!-- Highlighted track style -->" << '\n'
<< indent << indent << "<Style id=\"track_h\">" << '\n'
<< indent << indent << indent << "<IconStyle>" << '\n'
<< indent << indent << indent << indent << "<color>ff00ffff</color>" << '\n'
<< indent << indent << indent << indent << "<scale>1</scale>" << '\n'
<< indent << indent << indent << indent << "<Icon>" << '\n'
<< indent << indent << indent << indent << indent << "<href>http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png</href>" << '\n'
<< indent << indent << indent << indent << "</Icon>" << '\n'
<< indent << indent << indent << "</IconStyle>" << '\n'
<< indent << indent << "</Style>" << '\n'
<< indent << indent << "<StyleMap id=\"track\">" << '\n'
<< indent << indent << indent << "<Pair>" << '\n'
<< indent << indent << indent << indent << "<key>normal</key>" << '\n'
<< indent << indent << indent << indent << "<styleUrl>#track_n</styleUrl>" << '\n'
<< indent << indent << indent << "</Pair>" << '\n'
<< indent << indent << indent << "<Pair>" << '\n'
<< indent << indent << indent << indent << "<key>highlight</key>" << '\n'
<< indent << indent << indent << indent << "<styleUrl>#track_h</styleUrl>" << '\n'
<< indent << indent << indent << "</Pair>" << '\n'
<< indent << indent << "</StyleMap>" << '\n'
<< indent << indent << "<Style id=\"yellowLineGreenPoly\">" << '\n'
<< indent << indent << indent << "<LineStyle>" << '\n'
<< indent << indent << indent << indent << "<color>7f00ffff</color>" << '\n'
<< indent << indent << indent << indent << "<width>1</width>" << '\n'
<< indent << indent << indent << "</LineStyle>" << '\n'
<< indent << indent << indent << "<PolyStyle>" << '\n'
<< indent << indent << indent << indent << "<color>7f00ff00</color>" << '\n'
<< indent << indent << indent << "</PolyStyle>" << '\n'
<< indent << indent << "</Style>" << '\n'
<< indent << indent << "<Folder>" << '\n'
<< indent << indent << indent << "<name>Points</name>\n";
return true;
}
std::cout << "File " << kml_filename << " cannot be saved. Wrong permissions?" << std::endl;
std::cout << "File " << kml_filename << " cannot be saved. Wrong permissions?\n";
return false;
}
@ -269,34 +269,34 @@ bool Kml_Printer::print_position(const Pvt_Solution* position, bool print_averag
if (kml_file.is_open() && tmp_file.is_open())
{
point_id++;
kml_file << indent << indent << indent << "<Placemark>" << std::endl
<< indent << indent << indent << indent << "<name>" << point_id << "</name>" << std::endl
<< indent << indent << indent << indent << "<snippet/>" << std::endl
<< indent << indent << indent << indent << "<description><![CDATA[" << std::endl
<< indent << indent << indent << indent << indent << "<table>" << std::endl
<< indent << indent << indent << indent << indent << indent << "<tr><td>Time:</td><td>" << utc_time << "</td></tr>" << std::endl
<< indent << indent << indent << indent << indent << indent << "<tr><td>Longitude:</td><td>" << longitude << "</td><td>deg</td></tr>" << std::endl
<< indent << indent << indent << indent << indent << indent << "<tr><td>Latitude:</td><td>" << latitude << "</td><td>deg</td></tr>" << std::endl
<< indent << indent << indent << indent << indent << indent << "<tr><td>Altitude:</td><td>" << height << "</td><td>m</td></tr>" << std::endl
<< indent << indent << indent << indent << indent << indent << "<tr><td>Speed:</td><td>" << speed_over_ground << "</td><td>m/s</td></tr>" << std::endl
<< indent << indent << indent << indent << indent << indent << "<tr><td>Course:</td><td>" << course_over_ground << "</td><td>deg</td></tr>" << std::endl
<< indent << indent << indent << indent << indent << indent << "<tr><td>HDOP:</td><td>" << hdop << "</td></tr>" << std::endl
<< indent << indent << indent << indent << indent << indent << "<tr><td>VDOP:</td><td>" << vdop << "</td></tr>" << std::endl
<< indent << indent << indent << indent << indent << indent << "<tr><td>PDOP:</td><td>" << pdop << "</td></tr>" << std::endl
<< indent << indent << indent << indent << indent << "</table>" << std::endl
<< indent << indent << indent << indent << "]]></description>" << std::endl
<< indent << indent << indent << indent << "<TimeStamp>" << std::endl
<< indent << indent << indent << indent << indent << "<when>" << utc_time << "</when>" << std::endl
<< indent << indent << indent << indent << "</TimeStamp>" << std::endl
<< indent << indent << indent << indent << "<styleUrl>#track</styleUrl>" << std::endl
<< indent << indent << indent << indent << "<Point>" << std::endl
<< indent << indent << indent << indent << indent << "<altitudeMode>absolute</altitudeMode>" << std::endl
<< indent << indent << indent << indent << indent << "<coordinates>" << longitude << "," << latitude << "," << height << "</coordinates>" << std::endl
<< indent << indent << indent << indent << "</Point>" << std::endl
<< indent << indent << indent << "</Placemark>" << std::endl;
kml_file << indent << indent << indent << "<Placemark>" << '\n'
<< indent << indent << indent << indent << "<name>" << point_id << "</name>" << '\n'
<< indent << indent << indent << indent << "<snippet/>" << '\n'
<< indent << indent << indent << indent << "<description><![CDATA[" << '\n'
<< indent << indent << indent << indent << indent << "<table>" << '\n'
<< indent << indent << indent << indent << indent << indent << "<tr><td>Time:</td><td>" << utc_time << "</td></tr>" << '\n'
<< indent << indent << indent << indent << indent << indent << "<tr><td>Longitude:</td><td>" << longitude << "</td><td>deg</td></tr>" << '\n'
<< indent << indent << indent << indent << indent << indent << "<tr><td>Latitude:</td><td>" << latitude << "</td><td>deg</td></tr>" << '\n'
<< indent << indent << indent << indent << indent << indent << "<tr><td>Altitude:</td><td>" << height << "</td><td>m</td></tr>" << '\n'
<< indent << indent << indent << indent << indent << indent << "<tr><td>Speed:</td><td>" << speed_over_ground << "</td><td>m/s</td></tr>" << '\n'
<< indent << indent << indent << indent << indent << indent << "<tr><td>Course:</td><td>" << course_over_ground << "</td><td>deg</td></tr>" << '\n'
<< indent << indent << indent << indent << indent << indent << "<tr><td>HDOP:</td><td>" << hdop << "</td></tr>" << '\n'
<< indent << indent << indent << indent << indent << indent << "<tr><td>VDOP:</td><td>" << vdop << "</td></tr>" << '\n'
<< indent << indent << indent << indent << indent << indent << "<tr><td>PDOP:</td><td>" << pdop << "</td></tr>" << '\n'
<< indent << indent << indent << indent << indent << "</table>" << '\n'
<< indent << indent << indent << indent << "]]></description>" << '\n'
<< indent << indent << indent << indent << "<TimeStamp>" << '\n'
<< indent << indent << indent << indent << indent << "<when>" << utc_time << "</when>" << '\n'
<< indent << indent << indent << indent << "</TimeStamp>" << '\n'
<< indent << indent << indent << indent << "<styleUrl>#track</styleUrl>" << '\n'
<< indent << indent << indent << indent << "<Point>" << '\n'
<< indent << indent << indent << indent << indent << "<altitudeMode>absolute</altitudeMode>" << '\n'
<< indent << indent << indent << indent << indent << "<coordinates>" << longitude << "," << latitude << "," << height << "</coordinates>" << '\n'
<< indent << indent << indent << indent << "</Point>" << '\n'
<< indent << indent << indent << "</Placemark>\n";
tmp_file << indent << indent << indent << indent << indent
<< longitude << "," << latitude << "," << height << std::endl;
<< longitude << "," << latitude << "," << height << '\n';
return true;
}
@ -311,23 +311,23 @@ bool Kml_Printer::close_file()
tmp_file.close();
kml_file << indent << indent << "</Folder>"
<< indent << indent << "<Placemark>" << std::endl
<< indent << indent << indent << "<name>Path</name>" << std::endl
<< indent << indent << indent << "<styleUrl>#yellowLineGreenPoly</styleUrl>" << std::endl
<< indent << indent << indent << "<LineString>" << std::endl
<< indent << indent << indent << indent << "<extrude>0</extrude>" << std::endl
<< indent << indent << indent << indent << "<tessellate>1</tessellate>" << std::endl
<< indent << indent << indent << indent << "<altitudeMode>absolute</altitudeMode>" << std::endl
<< indent << indent << indent << indent << "<coordinates>" << std::endl;
<< indent << indent << "<Placemark>" << '\n'
<< indent << indent << indent << "<name>Path</name>" << '\n'
<< indent << indent << indent << "<styleUrl>#yellowLineGreenPoly</styleUrl>" << '\n'
<< indent << indent << indent << "<LineString>" << '\n'
<< indent << indent << indent << indent << "<extrude>0</extrude>" << '\n'
<< indent << indent << indent << indent << "<tessellate>1</tessellate>" << '\n'
<< indent << indent << indent << indent << "<altitudeMode>absolute</altitudeMode>" << '\n'
<< indent << indent << indent << indent << "<coordinates>\n";
// Copy the contents of tmp_file into kml_file
std::ifstream src(tmp_file_str, std::ios::binary);
kml_file << src.rdbuf();
kml_file << indent << indent << indent << indent << "</coordinates>" << std::endl
<< indent << indent << indent << "</LineString>" << std::endl
<< indent << indent << "</Placemark>" << std::endl
<< indent << "</Document>" << std::endl
kml_file << indent << indent << indent << indent << "</coordinates>" << '\n'
<< indent << indent << indent << "</LineString>" << '\n'
<< indent << indent << "</Placemark>" << '\n'
<< indent << "</Document>" << '\n'
<< "</kml>";
kml_file.close();
@ -340,6 +340,7 @@ bool Kml_Printer::close_file()
Kml_Printer::~Kml_Printer()
{
DLOG(INFO) << "KML printer destructor called.";
try
{
close_file();

View File

@ -23,7 +23,6 @@
#define GNSS_SDR_KML_PRINTER_H
#include <fstream> // for ofstream
#include <memory> // for shared_ptr
#include <string>
class Pvt_Solution;
@ -45,12 +44,12 @@ public:
private:
std::ofstream kml_file;
std::ofstream tmp_file;
bool positions_printed;
std::string kml_filename;
std::string kml_base_path;
std::string tmp_file_str;
unsigned int point_id;
std::string indent;
unsigned int point_id;
bool positions_printed;
};
#endif

View File

@ -75,7 +75,7 @@ arma::vec Ls_Pvt::bancroftPos(const arma::mat& satpos, const arma::vec& obs)
{
int z = B(i, 2);
double rho = (x - pos(0)) * (x - pos(0)) + (y - pos(1)) * (y - pos(1)) + (z - pos(2)) * (z - pos(2));
traveltime = sqrt(rho) / GPS_C_M_S;
traveltime = sqrt(rho) / SPEED_OF_LIGHT_M_S;
}
double angle = traveltime * 7.292115147e-5;
double cosa = cos(angle);
@ -208,7 +208,7 @@ arma::vec Ls_Pvt::leastSquarePos(const arma::mat& satpos, const arma::vec& obs,
(X(1, i) - pos(1)) +
(X(2, i) - pos(2)) *
(X(2, i) - pos(2));
traveltime = sqrt(rho2) / GPS_C_M_S;
traveltime = sqrt(rho2) / SPEED_OF_LIGHT_M_S;
// --- Correct satellite position (do to earth rotation) -------
Rot_X = Ls_Pvt::rotateSatellite(traveltime, X.col(i)); // armadillo
@ -232,7 +232,7 @@ arma::vec Ls_Pvt::leastSquarePos(const arma::mat& satpos, const arma::vec& obs,
else
{
// --- Find delay due to troposphere (in meters)
Ls_Pvt::tropo(&trop, sin(*elev * GPS_PI / 180.0), h / 1000.0, 1013.0, 293.0, 50.0, 0.0, 0.0, 0.0);
Ls_Pvt::tropo(&trop, sin(*elev * GNSS_PI / 180.0), h / 1000.0, 1013.0, 293.0, 50.0, 0.0, 0.0, 0.0);
if (trop > 5.0)
{
trop = 0.0; // check for erratic values
@ -263,9 +263,9 @@ arma::vec Ls_Pvt::leastSquarePos(const arma::mat& satpos, const arma::vec& obs,
}
// check the consistency of the PVT solution
if (((fabs(pos(3)) * 1000.0) / GPS_C_M_S) > GPS_STARTOFFSET_MS * 2)
if (((fabs(pos(3)) * 1000.0) / SPEED_OF_LIGHT_M_S) > GPS_STARTOFFSET_MS * 2)
{
LOG(WARNING) << "Receiver time offset out of range! Estimated RX Time error [s]:" << pos(3) / GPS_C_M_S;
LOG(WARNING) << "Receiver time offset out of range! Estimated RX Time error [s]:" << pos(3) / SPEED_OF_LIGHT_M_S;
throw std::runtime_error("Receiver time offset out of range!");
}
return pos;

View File

@ -22,7 +22,6 @@
#include <boost/archive/binary_oarchive.hpp>
#include <iostream>
#include <sstream>
#include <utility>
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context}
@ -41,20 +40,19 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addre
}
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(std::shared_ptr<Monitor_Pvt> monitor_pvt)
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt* monitor_pvt)
{
monitor_pvt_ = std::move(monitor_pvt);
std::string outbound_data;
if (use_protobuf == false)
{
std::ostringstream archive_stream;
boost::archive::binary_oarchive oa{archive_stream};
oa << *monitor_pvt_.get();
oa << *monitor_pvt;
outbound_data = archive_stream.str();
}
else
{
outbound_data = serdes.createProtobuffer(monitor_pvt_);
outbound_data = serdes.createProtobuffer(monitor_pvt);
}
for (const auto& endpoint : endpoints)

View File

@ -38,15 +38,14 @@ class Monitor_Pvt_Udp_Sink
{
public:
Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled);
bool write_monitor_pvt(std::shared_ptr<Monitor_Pvt> monitor_pvt);
bool write_monitor_pvt(const Monitor_Pvt* monitor_pvt);
private:
Serdes_Monitor_Pvt serdes;
b_io_context io_context;
boost::asio::ip::udp::socket socket;
boost::system::error_code error;
std::vector<boost::asio::ip::udp::endpoint> endpoints;
Serdes_Monitor_Pvt serdes;
std::shared_ptr<Monitor_Pvt> monitor_pvt_;
boost::system::error_code error;
bool use_protobuf;
};

View File

@ -73,7 +73,7 @@ Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_fi
{
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
std::cout << "Could not create the " << new_folder << " folder.\n";
nmea_base_path = full_path.string();
}
}
@ -87,7 +87,7 @@ Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_fi
if ((nmea_base_path != ".") and (d_flag_nmea_output_file == true))
{
std::cout << "NMEA files will be stored at " << nmea_base_path << std::endl;
std::cout << "NMEA files will be stored at " << nmea_base_path << '\n';
}
nmea_base_path = nmea_base_path + fs::path::preferred_separator;
@ -101,7 +101,7 @@ Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_fi
}
else
{
std::cout << "File " << nmea_filename << " cannot be saved. Wrong permissions?" << std::endl;
std::cout << "File " << nmea_filename << " cannot be saved. Wrong permissions?\n";
}
}
@ -125,6 +125,7 @@ Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_fi
Nmea_Printer::~Nmea_Printer()
{
DLOG(INFO) << "NMEA printer destructor called.";
auto pos = nmea_file_descriptor.tellp();
try
{
@ -378,15 +379,10 @@ std::string Nmea_Printer::get_UTC_NMEA_time(boost::posix_time::ptime d_position_
std::stringstream sentence_str;
boost::posix_time::time_duration td = d_position_UTC_time.time_of_day();
int utc_hours;
int utc_mins;
int utc_seconds;
int utc_milliseconds;
utc_hours = td.hours();
utc_mins = td.minutes();
utc_seconds = td.seconds();
utc_milliseconds = td.total_milliseconds() - td.total_seconds() * 1000;
int utc_hours = td.hours();
int utc_mins = td.minutes();
int utc_seconds = td.seconds();
auto utc_milliseconds = static_cast<int>(td.total_milliseconds() - td.total_seconds() * 1000);
if (utc_hours < 10)
{

View File

@ -46,23 +46,17 @@ public:
*/
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 Rtklib_Solver* pvt_data, bool print_average_values);
/*!
* \brief Default destructor.
*/
~Nmea_Printer();
/*!
* \brief Print NMEA PVT and satellite info to the initialized device
*/
bool Print_Nmea_Line(const Rtklib_Solver* pvt_data, bool print_average_values);
private:
std::string nmea_filename; // String with the NMEA log filename
std::string nmea_base_path;
std::ofstream nmea_file_descriptor; // Output file stream for NMEA log file
std::string nmea_devname;
int nmea_dev_descriptor; // NMEA serial device descriptor (i.e. COM port)
const Rtklib_Solver* d_PVT_data;
int init_serial(const std::string& serial_device); // serial port control
void close_serial();
std::string get_GPGGA(); // fix data
@ -73,6 +67,17 @@ private:
std::string longitude_to_hm(double longitude);
std::string latitude_to_hm(double lat);
char checkSum(const std::string& sentence);
const Rtklib_Solver* d_PVT_data;
std::ofstream nmea_file_descriptor; // Output file stream for NMEA log file
std::string nmea_filename; // String with the NMEA log filename
std::string nmea_base_path;
std::string nmea_devname;
int nmea_dev_descriptor; // NMEA serial device descriptor (i.e. COM port)
bool print_avg_pos;
bool d_flag_nmea_output_file;
};

View File

@ -27,44 +27,15 @@
class Pvt_Conf
{
public:
uint32_t type_of_receiver;
int32_t output_rate_ms;
int32_t display_rate_ms;
int32_t kml_rate_ms;
int32_t gpx_rate_ms;
int32_t geojson_rate_ms;
int32_t nmea_rate_ms;
Pvt_Conf();
int32_t rinex_version;
int32_t rinexobs_rate_ms;
std::string rinex_name;
std::map<int, int> rtcm_msg_rate_ms;
bool dump;
bool dump_mat;
std::string rinex_name;
std::string dump_filename;
bool flag_nmea_tty_port;
std::string nmea_dump_filename;
std::string nmea_dump_devname;
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 output_enabled;
bool rinex_output_enabled;
bool gpx_output_enabled;
bool geojson_output_enabled;
bool nmea_output_file_enabled;
bool kml_output_enabled;
bool xml_output_enabled;
bool rtcm_output_file_enabled;
int32_t max_obs_block_rx_clock_offset_ms;
std::string output_path;
std::string rinex_output_path;
std::string gpx_output_path;
@ -73,17 +44,41 @@ public:
std::string kml_output_path;
std::string xml_output_path;
std::string rtcm_output_file_path;
bool monitor_enabled;
bool protobuf_enabled;
std::string udp_addresses;
uint32_t type_of_receiver;
int32_t output_rate_ms;
int32_t display_rate_ms;
int32_t kml_rate_ms;
int32_t gpx_rate_ms;
int32_t geojson_rate_ms;
int32_t nmea_rate_ms;
int32_t rinex_version;
int32_t rinexobs_rate_ms;
int32_t max_obs_block_rx_clock_offset_ms;
int udp_port;
uint16_t rtcm_tcp_port;
uint16_t rtcm_station_id;
bool flag_nmea_tty_port;
bool flag_rtcm_server;
bool flag_rtcm_tty_port;
bool output_enabled;
bool rinex_output_enabled;
bool gpx_output_enabled;
bool geojson_output_enabled;
bool nmea_output_file_enabled;
bool kml_output_enabled;
bool xml_output_enabled;
bool rtcm_output_file_enabled;
bool monitor_enabled;
bool protobuf_enabled;
bool enable_rx_clock_correction;
bool show_local_time_zone;
bool pre_2009_file;
Pvt_Conf();
bool dump;
bool dump_mat;
};
#endif

View File

@ -63,7 +63,7 @@ arma::vec Pvt_Solution::rotateSatellite(double const traveltime, const arma::vec
// -- Find rotation angle --------------------------------------------------
double omegatau;
omegatau = OMEGA_EARTH_DOT * traveltime;
omegatau = GNSS_OMEGA_EARTH_DOT * traveltime;
// -- Build a rotation matrix ----------------------------------------------
arma::mat R3 = {{cos(omegatau), sin(omegatau), 0.0},
@ -116,8 +116,8 @@ int Pvt_Solution::cart2geo(double X, double Y, double Z, int elipsoid_selection)
}
}
while (std::abs(h - oldh) > 1.0e-12);
d_latitude_d = phi * 180.0 / GPS_PI;
d_longitude_d = lambda * 180.0 / GPS_PI;
d_latitude_d = phi * 180.0 / GNSS_PI;
d_longitude_d = lambda * 180.0 / GNSS_PI;
d_height_m = h;
// todo: refactor this class. Mix of duplicated functions, use either RTKLIB geodetic functions or geofunctions.h
return 0;

View File

@ -132,6 +132,14 @@ public:
protected:
bool d_pre_2009_file; // Flag to correct week rollover in post processing mode for signals older than 2009
private:
arma::vec d_rx_pos;
arma::vec d_rx_vel;
boost::posix_time::ptime d_position_UTC_time;
std::deque<double> d_hist_latitude_d;
std::deque<double> d_hist_longitude_d;
std::deque<double> d_hist_height_m;
double d_rx_dt_s; // RX time offset [s]
double d_rx_clock_drift_ppm; // RX clock drift [ppm]
@ -145,19 +153,11 @@ private:
double d_avg_longitude_d; // Averaged longitude in degrees
double d_avg_height_m; // Averaged height [m]
bool b_valid_position;
std::deque<double> d_hist_latitude_d;
std::deque<double> d_hist_longitude_d;
std::deque<double> d_hist_height_m;
bool d_flag_averaging;
int d_averaging_depth; // Length of averaging window
arma::vec d_rx_pos;
arma::vec d_rx_vel;
boost::posix_time::ptime d_position_UTC_time;
int d_valid_observations;
bool b_valid_position;
bool d_flag_averaging;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -440,10 +440,6 @@ public:
void set_pre_2009_file(bool pre_2009_file);
private:
int version; // RINEX version (2 for 2.10/2.11 and 3 for 3.01)
int numberTypesObservations; // Number of available types of observable in the system. Should be public?
bool pre_2009_file_;
/*
* Generation of RINEX signal strength indicators
*/
@ -477,8 +473,6 @@ private:
*/
void lengthCheck(const std::string& line);
double fake_cnav_iode;
/*
* If the string is bigger than length, truncate it from the right.
* otherwise, add pad characters to its right.
@ -653,6 +647,11 @@ private:
inline std::string asString(const X x);
inline std::string asFixWidthString(const int x, const int width, char fill_digit);
double fake_cnav_iode;
int version; // RINEX version (2 for 2.10/2.11 and 3 for 3.01)
int numberTypesObservations; // Number of available types of observable in the system. Should be public?
bool pre_2009_file_;
};

View File

@ -23,6 +23,9 @@
#include "GPS_L2C.h"
#include "Galileo_E1.h"
#include "Galileo_E5a.h"
#include "Galileo_E5b.h"
#include "Galileo_FNAV.h"
#include "Galileo_INAV.h"
#include <boost/algorithm/string.hpp> // for to_upper_copy
#include <boost/crc.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
@ -49,6 +52,7 @@ Rtcm::Rtcm(uint16_t port)
Rtcm::~Rtcm()
{
DLOG(INFO) << "RTCM object destructor called.";
if (server_is_running)
{
try
@ -74,7 +78,7 @@ Rtcm::~Rtcm()
// *****************************************************************************************************
void Rtcm::run_server()
{
std::cout << "Starting a TCP/IP server of RTCM messages on port " << RTCM_port << std::endl;
std::cout << "Starting a TCP/IP server of RTCM messages on port " << RTCM_port << '\n';
try
{
tq = std::thread([&] { std::make_shared<Queue_Reader>(io_context, rtcm_message_queue, RTCM_port)->do_read_queue(); });
@ -96,7 +100,7 @@ void Rtcm::stop_service()
void Rtcm::stop_server()
{
std::cout << "Stopping TCP/IP server on port " << RTCM_port << std::endl;
std::cout << "Stopping TCP/IP server on port " << RTCM_port << '\n';
Rtcm::stop_service();
servers.front().close_server();
rtcm_message_queue->push("Goodbye"); // this terminates tq
@ -1895,7 +1899,7 @@ int32_t Rtcm::read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& gl
glonass_gnav_eph.d_B_n = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
index += 1;
glonass_gnav_eph.d_P_2 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
glonass_gnav_eph.d_P_2 = static_cast<bool>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
index += 1;
glonass_gnav_eph.d_t_b = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 7))) * 15 * 60.0;
@ -1929,7 +1933,7 @@ int32_t Rtcm::read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& gl
glonass_gnav_eph.d_AZn = static_cast<double>(Rtcm::bin_to_sint(message_bin.substr(index, 5))) * TWO_N30;
index += 5;
glonass_gnav_eph.d_P_3 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
glonass_gnav_eph.d_P_3 = static_cast<bool>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
index += 1;
glonass_gnav_eph.d_gamma_n = static_cast<double>(Rtcm::bin_to_sint(message_bin.substr(index, 11))) * TWO_N30;
@ -1938,7 +1942,7 @@ int32_t Rtcm::read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& gl
glonass_gnav_eph.d_P = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 2)));
index += 2;
glonass_gnav_eph.d_l3rd_n = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
glonass_gnav_eph.d_l3rd_n = static_cast<bool>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
index += 1;
glonass_gnav_eph.d_tau_n = static_cast<double>(Rtcm::bin_to_sint(message_bin.substr(index, 22))) * TWO_N30;
@ -1950,7 +1954,7 @@ int32_t Rtcm::read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& gl
glonass_gnav_eph.d_E_n = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 5)));
index += 5;
glonass_gnav_eph.d_P_4 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
glonass_gnav_eph.d_P_4 = static_cast<bool>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
index += 1;
glonass_gnav_eph.d_F_T = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 4)));
@ -2006,12 +2010,7 @@ std::string Rtcm::print_MT1029(uint32_t ref_id, const Gps_Ephemeris& gps_eph, do
std::string text_binary;
for (char c : message)
{
if (isgraph(c))
{
i++;
first = true;
}
else if (c == ' ')
if (isgraph(c) || c == ' ')
{
i++;
first = true;
@ -3438,7 +3437,7 @@ uint32_t Rtcm::lock_time(const Gps_Ephemeris& eph, double obs_time, const Gnss_S
boost::posix_time::time_duration lock_duration = current_time - Rtcm::gps_L1_last_lock_time[65 - gnss_synchro.PRN];
lock_time_in_seconds = static_cast<uint32_t>(lock_duration.total_seconds());
// Debug:
// std::cout << "lock time PRN " << gnss_synchro.PRN << ": " << lock_time_in_seconds << " current time: " << current_time << std::endl;
// std::cout << "lock time PRN " << gnss_synchro.PRN << ": " << lock_time_in_seconds << " current time: " << current_time << '\n';
return lock_time_in_seconds;
}
@ -3807,11 +3806,11 @@ int32_t Rtcm::set_DF011(const Gnss_Synchro& gnss_synchro)
int32_t Rtcm::set_DF012(const Gnss_Synchro& gnss_synchro)
{
const double lambda = GPS_C_M_S / GPS_L1_FREQ_HZ;
const double lambda = SPEED_OF_LIGHT_M_S / GPS_L1_FREQ_HZ;
double ambiguity = std::floor(gnss_synchro.Pseudorange_m / 299792.458);
double gps_L1_pseudorange = std::round((gnss_synchro.Pseudorange_m - ambiguity * 299792.458) / 0.02);
double gps_L1_pseudorange_c = gps_L1_pseudorange * 0.02 + ambiguity * 299792.458;
double L1_phaserange_c = gnss_synchro.Carrier_phase_rads / GPS_TWO_PI;
double L1_phaserange_c = gnss_synchro.Carrier_phase_rads / TWO_PI;
double L1_phaserange_c_r = std::fmod(L1_phaserange_c - gps_L1_pseudorange_c / lambda + 1500.0, 3000.0) - 1500.0;
auto gps_L1_phaserange_minus_L1_pseudorange = static_cast<int64_t>(std::round(L1_phaserange_c_r * lambda / 0.0005));
DF012 = std::bitset<20>(gps_L1_phaserange_minus_L1_pseudorange);
@ -3869,12 +3868,12 @@ int32_t Rtcm::set_DF017(const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro&
int32_t Rtcm::set_DF018(const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro& gnss_synchroL2)
{
const double lambda2 = GPS_C_M_S / GPS_L2_FREQ_HZ;
const double lambda2 = SPEED_OF_LIGHT_M_S / GPS_L2_FREQ_HZ;
int32_t l2_phaserange_minus_l1_pseudorange = 0xFFF80000;
double ambiguity = std::floor(gnss_synchroL1.Pseudorange_m / 299792.458);
double gps_L1_pseudorange = std::round((gnss_synchroL1.Pseudorange_m - ambiguity * 299792.458) / 0.02);
double gps_L1_pseudorange_c = gps_L1_pseudorange * 0.02 + ambiguity * 299792.458;
double L2_phaserange_c = gnss_synchroL2.Carrier_phase_rads / GPS_TWO_PI;
double L2_phaserange_c = gnss_synchroL2.Carrier_phase_rads / TWO_PI;
double L1_phaserange_c_r = std::fmod(L2_phaserange_c - gps_L1_pseudorange_c / lambda2 + 1500.0, 3000.0) - 1500.0;
if (std::fabs(L1_phaserange_c_r * lambda2) <= 262.1435)
@ -4099,11 +4098,11 @@ int32_t Rtcm::set_DF041(const Gnss_Synchro& gnss_synchro)
int32_t Rtcm::set_DF042(const Gnss_Synchro& gnss_synchro)
{
const double lambda = GLONASS_C_M_S / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
const double lambda = SPEED_OF_LIGHT_M_S / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
double ambiguity = std::floor(gnss_synchro.Pseudorange_m / 599584.92);
double glonass_L1_pseudorange = std::round((gnss_synchro.Pseudorange_m - ambiguity * 599584.92) / 0.02);
double glonass_L1_pseudorange_c = glonass_L1_pseudorange * 0.02 + ambiguity * 299792.458;
double L1_phaserange_c = gnss_synchro.Carrier_phase_rads / GLONASS_TWO_PI;
double L1_phaserange_c = gnss_synchro.Carrier_phase_rads / TWO_PI;
double L1_phaserange_c_r = std::fmod(L1_phaserange_c - glonass_L1_pseudorange_c / lambda + 1500.0, 3000.0) - 1500.0;
auto glonass_L1_phaserange_minus_L1_pseudorange = static_cast<int64_t>(std::round(L1_phaserange_c_r * lambda / 0.0005));
DF042 = std::bitset<20>(glonass_L1_phaserange_minus_L1_pseudorange);
@ -4162,12 +4161,12 @@ int32_t Rtcm::set_DF047(const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro&
// TODO Need to consider frequency channel in this fields
int32_t Rtcm::set_DF048(const Gnss_Synchro& gnss_synchroL1, const Gnss_Synchro& gnss_synchroL2)
{
const double lambda2 = GLONASS_C_M_S / GLONASS_L2_CA_FREQ_HZ;
const double lambda2 = SPEED_OF_LIGHT_M_S / GLONASS_L2_CA_FREQ_HZ;
int32_t l2_phaserange_minus_l1_pseudorange = 0xFFF80000;
double ambiguity = std::floor(gnss_synchroL1.Pseudorange_m / 599584.92);
double glonass_L1_pseudorange = std::round((gnss_synchroL1.Pseudorange_m - ambiguity * 599584.92) / 0.02);
double glonass_L1_pseudorange_c = glonass_L1_pseudorange * 0.02 + ambiguity * 599584.92;
double L2_phaserange_c = gnss_synchroL2.Carrier_phase_rads / GLONASS_TWO_PI;
double L2_phaserange_c = gnss_synchroL2.Carrier_phase_rads / TWO_PI;
double L1_phaserange_c_r = std::fmod(L2_phaserange_c - glonass_L1_pseudorange_c / lambda2 + 1500.0, 3000.0) - 1500.0;
if (std::fabs(L1_phaserange_c_r * lambda2) <= 262.1435)
@ -4528,14 +4527,14 @@ int32_t Rtcm::set_DF107(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
int32_t Rtcm::set_DF108(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
{
DF108 = std::bitset<1>(glonass_gnav_eph.d_B_n);
DF108 = std::bitset<1>(static_cast<bool>(glonass_gnav_eph.d_B_n));
return 0;
}
int32_t Rtcm::set_DF109(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
{
DF109 = std::bitset<1>(glonass_gnav_eph.d_P_2);
DF109 = std::bitset<1>(static_cast<bool>(glonass_gnav_eph.d_P_2));
return 0;
}
@ -5283,16 +5282,12 @@ std::string Rtcm::set_DF396(const std::map<int32_t, Gnss_Synchro>& observables)
int32_t Rtcm::set_DF397(const Gnss_Synchro& gnss_synchro)
{
double meters_to_miliseconds = GPS_C_M_S * 0.001;
double meters_to_miliseconds = SPEED_OF_LIGHT_M_S * 0.001;
double rough_range_s = std::round(gnss_synchro.Pseudorange_m / meters_to_miliseconds / TWO_N10) * meters_to_miliseconds * TWO_N10;
uint32_t int_ms = 0;
if (rough_range_s == 0.0)
{
int_ms = 255;
}
else if ((rough_range_s < 0.0) || (rough_range_s > meters_to_miliseconds * 255.0))
if (rough_range_s == 0.0 || ((rough_range_s < 0.0) || (rough_range_s > meters_to_miliseconds * 255.0)))
{
int_ms = 255;
}
@ -5308,7 +5303,7 @@ int32_t Rtcm::set_DF397(const Gnss_Synchro& gnss_synchro)
int32_t Rtcm::set_DF398(const Gnss_Synchro& gnss_synchro)
{
double meters_to_miliseconds = GPS_C_M_S * 0.001;
double meters_to_miliseconds = SPEED_OF_LIGHT_M_S * 0.001;
double rough_range_m = std::round(gnss_synchro.Pseudorange_m / meters_to_miliseconds / TWO_N10) * meters_to_miliseconds * TWO_N10;
uint32_t rr_mod_ms;
if ((rough_range_m <= 0.0) || (rough_range_m > meters_to_miliseconds * 255.0))
@ -5332,23 +5327,23 @@ int32_t Rtcm::set_DF399(const Gnss_Synchro& gnss_synchro)
if (sig == "1C")
{
lambda = GPS_C_M_S / GPS_L1_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GPS_L1_FREQ_HZ;
}
if (sig == "2S")
{
lambda = GPS_C_M_S / GPS_L2_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GPS_L2_FREQ_HZ;
}
if (sig == "5X")
{
lambda = GPS_C_M_S / GALILEO_E5A_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5A_FREQ_HZ;
}
if (sig == "1B")
{
lambda = GPS_C_M_S / GALILEO_E1_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E1_FREQ_HZ;
}
if (sig == "7X")
{
lambda = GPS_C_M_S / 1.207140e9; // Galileo_E1b_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5B_FREQ_HZ;
}
double rough_phase_range_rate_ms = std::round(-gnss_synchro.Carrier_Doppler_hz * lambda);
@ -5368,18 +5363,14 @@ int32_t Rtcm::set_DF399(const Gnss_Synchro& gnss_synchro)
int32_t Rtcm::set_DF400(const Gnss_Synchro& gnss_synchro)
{
double meters_to_miliseconds = GPS_C_M_S * 0.001;
double meters_to_miliseconds = SPEED_OF_LIGHT_M_S * 0.001;
double rough_range_m = std::round(gnss_synchro.Pseudorange_m / meters_to_miliseconds / TWO_N10) * meters_to_miliseconds * TWO_N10;
double psrng_s;
int32_t fine_pseudorange;
psrng_s = gnss_synchro.Pseudorange_m - rough_range_m;
if (psrng_s == 0)
{
fine_pseudorange = -16384;
}
else if (std::fabs(psrng_s) > 292.7)
if (psrng_s == 0 || (std::fabs(psrng_s) > 292.7))
{
fine_pseudorange = -16384; // 4000h: invalid value
}
@ -5395,7 +5386,7 @@ int32_t Rtcm::set_DF400(const Gnss_Synchro& gnss_synchro)
int32_t Rtcm::set_DF401(const Gnss_Synchro& gnss_synchro)
{
double meters_to_miliseconds = GPS_C_M_S * 0.001;
double meters_to_miliseconds = SPEED_OF_LIGHT_M_S * 0.001;
double rough_range_m = std::round(gnss_synchro.Pseudorange_m / meters_to_miliseconds / TWO_N10) * meters_to_miliseconds * TWO_N10;
double phrng_m;
int64_t fine_phaserange;
@ -5407,50 +5398,46 @@ int32_t Rtcm::set_DF401(const Gnss_Synchro& gnss_synchro)
if ((sig == "1C") && (sys == "G"))
{
lambda = GPS_C_M_S / GPS_L1_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GPS_L1_FREQ_HZ;
}
if ((sig == "2S") && (sys == "G"))
{
lambda = GPS_C_M_S / GPS_L2_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GPS_L2_FREQ_HZ;
}
if ((sig == "5X") && (sys == "E"))
{
lambda = GPS_C_M_S / GALILEO_E5A_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5A_FREQ_HZ;
}
if ((sig == "1B") && (sys == "E"))
{
lambda = GPS_C_M_S / GALILEO_E1_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E1_FREQ_HZ;
}
if ((sig == "7X") && (sys == "E"))
{
lambda = GPS_C_M_S / 1.207140e9; // Galileo_E1b_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5B_FREQ_HZ;
}
if ((sig == "1C") && (sys == "R"))
{
lambda = GLONASS_C_M_S / ((GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN))));
lambda = SPEED_OF_LIGHT_M_S / ((GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN))));
}
if ((sig == "2C") && (sys == "R"))
{
// TODO Need to add slot number and freq number to gnss_syncro
lambda = GLONASS_C_M_S / (GLONASS_L2_CA_FREQ_HZ);
lambda = SPEED_OF_LIGHT_M_S / (GLONASS_L2_CA_FREQ_HZ);
}
phrng_m = (gnss_synchro.Carrier_phase_rads / GPS_TWO_PI) * lambda - rough_range_m;
phrng_m = (gnss_synchro.Carrier_phase_rads / TWO_PI) * lambda - rough_range_m;
/* Subtract phase - pseudorange integer cycle offset */
/* TODO: check LLI! */
double cp = gnss_synchro.Carrier_phase_rads / GPS_TWO_PI; // ?
double cp = gnss_synchro.Carrier_phase_rads / TWO_PI; // ?
if (std::fabs(phrng_m - cp) > 1171.0)
{
cp = std::round(phrng_m / lambda) * lambda;
}
phrng_m -= cp;
if (phrng_m == 0.0)
{
fine_phaserange = -2097152;
}
else if (std::fabs(phrng_m) > 1171.0)
if (phrng_m == 0.0 || (std::fabs(phrng_m) > 1171.0))
{
fine_phaserange = -2097152;
}
@ -5483,11 +5470,7 @@ int32_t Rtcm::set_DF402(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& e
{
lock_time_period_s = Rtcm::lock_time(ephFNAV, obs_time, gnss_synchro);
}
if ((sig_ == "1C") && (sys == "R"))
{
lock_time_period_s = Rtcm::lock_time(ephGNAV, obs_time, gnss_synchro);
}
if ((sig_ == "2C") && (sys == "R"))
if (((sig_ == "1C") && (sys == "R")) || ((sig_ == "2C") && (sys == "R")))
{
lock_time_period_s = Rtcm::lock_time(ephGNAV, obs_time, gnss_synchro);
}
@ -5516,41 +5499,37 @@ int32_t Rtcm::set_DF404(const Gnss_Synchro& gnss_synchro)
if ((sig_ == "1C") && (sys_ == "G"))
{
lambda = GPS_C_M_S / GPS_L1_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GPS_L1_FREQ_HZ;
}
if ((sig_ == "2S") && (sys_ == "G"))
{
lambda = GPS_C_M_S / GPS_L2_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GPS_L2_FREQ_HZ;
}
if ((sig_ == "5X") && (sys_ == "E"))
{
lambda = GPS_C_M_S / GALILEO_E5A_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5A_FREQ_HZ;
}
if ((sig_ == "1B") && (sys_ == "E"))
{
lambda = GPS_C_M_S / GALILEO_E1_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E1_FREQ_HZ;
}
if ((sig_ == "7X") && (sys_ == "E"))
{
lambda = GPS_C_M_S / 1.207140e9; // Galileo_E1b_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5B_FREQ_HZ;
}
if ((sig_ == "1C") && (sys_ == "R"))
{
lambda = GLONASS_C_M_S / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
lambda = SPEED_OF_LIGHT_M_S / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
}
if ((sig_ == "2C") && (sys_ == "R"))
{
// TODO Need to add slot number and freq number to gnss syncro
lambda = GLONASS_C_M_S / (GLONASS_L2_CA_FREQ_HZ);
lambda = SPEED_OF_LIGHT_M_S / (GLONASS_L2_CA_FREQ_HZ);
}
double rough_phase_range_rate = std::round(-gnss_synchro.Carrier_Doppler_hz * lambda);
double phrr = (-gnss_synchro.Carrier_Doppler_hz * lambda - rough_phase_range_rate);
if (phrr == 0.0)
{
fine_phaserange_rate = -16384;
}
else if (std::fabs(phrr) > 1.6384)
if (phrr == 0.0 || (std::fabs(phrr) > 1.6384))
{
fine_phaserange_rate = -16384;
}
@ -5566,18 +5545,14 @@ int32_t Rtcm::set_DF404(const Gnss_Synchro& gnss_synchro)
int32_t Rtcm::set_DF405(const Gnss_Synchro& gnss_synchro)
{
double meters_to_miliseconds = GPS_C_M_S * 0.001;
double meters_to_miliseconds = SPEED_OF_LIGHT_M_S * 0.001;
double rough_range_m = std::round(gnss_synchro.Pseudorange_m / meters_to_miliseconds / TWO_N10) * meters_to_miliseconds * TWO_N10;
double psrng_s;
int64_t fine_pseudorange;
psrng_s = gnss_synchro.Pseudorange_m - rough_range_m;
if (psrng_s == 0.0)
{
fine_pseudorange = -524288;
}
else if (std::fabs(psrng_s) > 292.7)
if (psrng_s == 0.0 || (std::fabs(psrng_s) > 292.7))
{
fine_pseudorange = -524288;
}
@ -5593,7 +5568,7 @@ int32_t Rtcm::set_DF405(const Gnss_Synchro& gnss_synchro)
int32_t Rtcm::set_DF406(const Gnss_Synchro& gnss_synchro)
{
int64_t fine_phaserange_ex;
double meters_to_miliseconds = GPS_C_M_S * 0.001;
double meters_to_miliseconds = SPEED_OF_LIGHT_M_S * 0.001;
double rough_range_m = std::round(gnss_synchro.Pseudorange_m / meters_to_miliseconds / TWO_N10) * meters_to_miliseconds * TWO_N10;
double phrng_m;
double lambda = 0.0;
@ -5603,49 +5578,45 @@ int32_t Rtcm::set_DF406(const Gnss_Synchro& gnss_synchro)
if ((sig_ == "1C") && (sys_ == "G"))
{
lambda = GPS_C_M_S / GPS_L1_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GPS_L1_FREQ_HZ;
}
if ((sig_ == "2S") && (sys_ == "G"))
{
lambda = GPS_C_M_S / GPS_L2_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GPS_L2_FREQ_HZ;
}
if ((sig_ == "5X") && (sys_ == "E"))
{
lambda = GPS_C_M_S / GALILEO_E5A_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5A_FREQ_HZ;
}
if ((sig_ == "1B") && (sys_ == "E"))
{
lambda = GPS_C_M_S / GALILEO_E1_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E1_FREQ_HZ;
}
if ((sig_ == "7X") && (sys_ == "E"))
{
lambda = GPS_C_M_S / 1.207140e9; // Galileo_E1b_FREQ_HZ;
lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5B_FREQ_HZ;
}
if ((sig_ == "1C") && (sys_ == "R"))
{
lambda = GLONASS_C_M_S / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
lambda = SPEED_OF_LIGHT_M_S / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
}
if ((sig_ == "2C") && (sys_ == "R"))
{
// TODO Need to add slot number and freq number to gnss syncro
lambda = GLONASS_C_M_S / (GLONASS_L2_CA_FREQ_HZ);
lambda = SPEED_OF_LIGHT_M_S / (GLONASS_L2_CA_FREQ_HZ);
}
phrng_m = (gnss_synchro.Carrier_phase_rads / GPS_TWO_PI) * lambda - rough_range_m;
phrng_m = (gnss_synchro.Carrier_phase_rads / TWO_PI) * lambda - rough_range_m;
/* Subtract phase - pseudorange integer cycle offset */
/* TODO: check LLI! */
double cp = gnss_synchro.Carrier_phase_rads / GPS_TWO_PI; // ?
double cp = gnss_synchro.Carrier_phase_rads / TWO_PI; // ?
if (std::fabs(phrng_m - cp) > 1171.0)
{
cp = std::round(phrng_m / lambda) * lambda;
}
phrng_m -= cp;
if (phrng_m == 0.0)
{
fine_phaserange_ex = -8388608;
}
else if (std::fabs(phrng_m) > 1171.0)
if (phrng_m == 0.0 || (std::fabs(phrng_m) > 1171.0))
{
fine_phaserange_ex = -8388608;
}

View File

@ -688,7 +688,7 @@ private:
}
else
{
std::cout << "Closing connection with RTCM client" << std::endl;
std::cout << "Closing connection with RTCM client\n";
room_.leave(shared_from_this());
}
});
@ -705,12 +705,12 @@ private:
room_.deliver(read_msg_);
// std::cout << "Delivered message (session): ";
// std::cout.write(read_msg_.body(), read_msg_.body_length());
// std::cout << std::endl;
// std::cout << '\n';
do_read_message_header();
}
else
{
std::cout << "Closing connection with RTCM client" << std::endl;
std::cout << "Closing connection with RTCM client\n";
room_.leave(shared_from_this());
}
});
@ -732,7 +732,7 @@ private:
}
else
{
std::cout << "Closing connection with RTCM client" << std::endl;
std::cout << "Closing connection with RTCM client\n";
room_.leave(shared_from_this());
}
});
@ -786,7 +786,7 @@ private:
}
else
{
std::cout << "Server is down." << std::endl;
std::cout << "Server is down.\n";
}
});
}
@ -802,7 +802,7 @@ private:
}
else
{
std::cout << "Error in client" << std::endl;
std::cout << "Error in client\n";
socket_.close();
}
});
@ -900,25 +900,25 @@ private:
{
if (first_client)
{
std::cout << "The TCP/IP server of RTCM messages is up and running. Accepting connections ..." << std::endl;
std::cout << "The TCP/IP server of RTCM messages is up and running. Accepting connections ...\n";
first_client = false;
}
else
{
std::cout << "Starting RTCM TCP/IP server session..." << std::endl;
std::cout << "Starting RTCM TCP/IP server session...\n";
boost::system::error_code ec2;
boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(ec2);
if (ec2)
{
// Error creating remote_endpoint
std::cout << "Error getting remote IP address, closing session." << std::endl;
std::cout << "Error getting remote IP address, closing session.\n";
LOG(INFO) << "Error getting remote IP address";
start_session = false;
}
else
{
std::string remote_addr = endpoint.address().to_string();
std::cout << "Serving client from " << remote_addr << std::endl;
std::cout << "Serving client from " << remote_addr << '\n';
LOG(INFO) << "Serving client from " << remote_addr;
}
}
@ -929,7 +929,7 @@ private:
}
else
{
std::cout << "Error when invoking a RTCM session. " << ec << std::endl;
std::cout << "Error when invoking a RTCM session. " << ec << '\n';
}
start_session = true;
do_accept();

View File

@ -24,6 +24,7 @@
#include "galileo_ephemeris.h"
#include "glonass_gnav_ephemeris.h"
#include "glonass_gnav_utc_model.h"
#include "gnss_sdr_make_unique.h"
#include "gnss_synchro.h"
#include "gps_cnav_ephemeris.h"
#include "gps_ephemeris.h"
@ -78,7 +79,7 @@ Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump
{
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
std::cout << "Could not create the " << new_folder << " folder.\n";
rtcm_base_path = full_path.string();
}
}
@ -91,7 +92,7 @@ Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump
}
if (rtcm_base_path != ".")
{
std::cout << "RTCM binary file will be stored at " << rtcm_base_path << std::endl;
std::cout << "RTCM binary file will be stored at " << rtcm_base_path << '\n';
}
rtcm_base_path = rtcm_base_path + fs::path::preferred_separator;
@ -149,7 +150,7 @@ Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump
}
else
{
std::cout << "File " << rtcm_filename << "cannot be saved. Wrong permissions?" << std::endl;
std::cout << "File " << rtcm_filename << "cannot be saved. Wrong permissions?\n";
}
}
@ -170,7 +171,7 @@ Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump
port = rtcm_tcp_port;
station_id = rtcm_station_id;
rtcm = std::make_shared<Rtcm>(port);
rtcm = std::make_unique<Rtcm>(port);
if (flag_rtcm_server)
{
@ -181,6 +182,7 @@ Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump
Rtcm_Printer::~Rtcm_Printer()
{
DLOG(INFO) << "RTCM printer destructor called.";
if (rtcm->is_server_running())
{
try
@ -428,7 +430,7 @@ bool Rtcm_Printer::Print_Message(const std::string& message)
{
try
{
rtcm_file_descriptor << message << std::endl;
rtcm_file_descriptor << message << '\n';
}
catch (const std::exception& ex)
{
@ -443,7 +445,7 @@ bool Rtcm_Printer::Print_Message(const std::string& message)
if (write(rtcm_dev_descriptor, message.c_str(), message.length()) == -1)
{
DLOG(INFO) << "RTCM printer cannot write on serial device " << rtcm_devname.c_str();
std::cout << "RTCM printer cannot write on serial device " << rtcm_devname.c_str() << std::endl;
std::cout << "RTCM printer cannot write on serial device " << rtcm_devname.c_str() << '\n';
return false;
}
}

View File

@ -146,17 +146,18 @@ public:
uint32_t lock_time(const Glonass_Gnav_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
private:
std::string rtcm_filename; // String with the RTCM log filename
std::string rtcm_base_path;
std::ofstream rtcm_file_descriptor; // Output file stream for RTCM log file
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(const std::string& serial_device); // serial port control
void close_serial();
std::shared_ptr<Rtcm> rtcm;
bool Print_Message(const std::string& message);
std::unique_ptr<Rtcm> rtcm;
std::ofstream rtcm_file_descriptor; // Output file stream for RTCM log file
std::string rtcm_filename; // String with the RTCM log filename
std::string rtcm_base_path;
std::string rtcm_devname;
int32_t rtcm_dev_descriptor; // RTCM serial device descriptor (i.e. COM port)
uint16_t port;
uint16_t station_id;
bool d_rtcm_file_dump;
};

View File

@ -98,6 +98,7 @@ Rtklib_Solver::Rtklib_Solver(int nchannels, const std::string &dump_filename, bo
Rtklib_Solver::~Rtklib_Solver()
{
DLOG(INFO) << "Rtklib_Solver destructor called.";
if (d_dump_file.is_open() == true)
{
auto pos = d_dump_file.tellp();
@ -154,14 +155,14 @@ bool Rtklib_Solver::save_matfile()
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Problem opening dump file:" << e.what() << std::endl;
std::cerr << "Problem opening dump file:" << e.what() << '\n';
return false;
}
// count number of epochs and rewind
int64_t num_epoch = 0LL;
if (dump_file.is_open())
{
std::cout << "Generating .mat file for " << dump_filename << std::endl;
std::cout << "Generating .mat file for " << dump_filename << '\n';
size = dump_file.tellg();
num_epoch = static_cast<int64_t>(size) / static_cast<int64_t>(epoch_size_bytes);
dump_file.seekg(0, std::ios::beg);
@ -240,7 +241,7 @@ bool Rtklib_Solver::save_matfile()
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Problem reading dump file:" << e.what() << std::endl;
std::cerr << "Problem reading dump file:" << e.what() << '\n';
return false;
}
@ -889,7 +890,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
nav_data.utc_cmp[1] = beidou_dnav_utc_model.d_A1_UTC;
nav_data.utc_cmp[2] = 0.0; // ??
nav_data.utc_cmp[3] = 0.0; // ??
nav_data.leaps = beidou_dnav_utc_model.d_DeltaT_LS;
nav_data.leaps = beidou_dnav_utc_model.i_DeltaT_LS;
}
/* update carrier wave length using native function call in RTKlib */
@ -927,7 +928,7 @@ 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;
int index_aux = 0;
for (auto &i : rtk_.ssat)
{
if (i.vs == 1)
@ -958,7 +959,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{
// the receiver clock offset is expressed in [meters], so we convert it into [s]
// add also the clock offset from gps to galileo (pvt_sol.dtr[2])
rx_position_and_time(3) = pvt_sol.dtr[2] + pvt_sol.dtr[0] / GPS_C_M_S;
rx_position_and_time(3) = pvt_sol.dtr[2] + pvt_sol.dtr[0] / SPEED_OF_LIGHT_M_S;
}
this->set_rx_pos(rx_position_and_time.rows(0, 2)); // save ECEF position for the next iteration
@ -1058,7 +1059,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
this->set_rx_vel(rx_vel_enu);
double clock_drift_ppm = pvt_sol.dtr[5] / GPS_C_M_S * 1e6;
double clock_drift_ppm = pvt_sol.dtr[5] / SPEED_OF_LIGHT_M_S * 1e6;
this->set_clock_drift_ppm(clock_drift_ppm);
// User clock drift [ppm]

View File

@ -73,14 +73,15 @@ public:
bool get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_map, bool flag_averaging);
sol_t pvt_sol{};
std::array<ssat_t, MAXSAT> pvt_ssat{};
double get_hdop() const override;
double get_vdop() const override;
double get_pdop() const override;
double get_gdop() const override;
Monitor_Pvt get_monitor_pvt() const;
sol_t pvt_sol{};
std::array<ssat_t, MAXSAT> pvt_ssat{};
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
@ -106,16 +107,17 @@ public:
std::map<int, Beidou_Dnav_Almanac> beidou_dnav_almanac_map;
private:
rtk_t rtk_{};
Monitor_Pvt monitor_pvt{};
bool save_matfile();
std::array<obsd_t, MAXOBS> obs_data{};
std::array<double, 4> dop_{};
rtk_t rtk_{};
Monitor_Pvt monitor_pvt{};
std::string d_dump_filename;
std::ofstream d_dump_file;
int d_nchannels; // Number of available channels for positioning
bool d_flag_dump_enabled;
bool d_flag_dump_mat_enabled;
bool save_matfile();
};
#endif // GNSS_SDR_RTKLIB_SOLVER_H

View File

@ -71,7 +71,7 @@ public:
return *this;
}
inline std::string createProtobuffer(std::shared_ptr<Monitor_Pvt> monitor) //!< Serialization into a string
inline std::string createProtobuffer(const Monitor_Pvt* monitor) //!< Serialization into a string
{
monitor_.Clear();

View File

@ -40,16 +40,15 @@ namespace own = gsl;
BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
ConfigurationInterface* configuration,
const 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;
acq_parameters_.ms_per_code = 1;
acq_parameters_.SetFromConfiguration(configuration_, role, BEIDOU_B1I_CODE_RATE_CPS, 10e6);
acq_parameters_.SetFromConfiguration(configuration, role, BEIDOU_B1I_CODE_RATE_CPS, 10e6);
LOG(INFO) << "role " << role;
@ -58,14 +57,14 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
fs_in_ = acq_parameters_.fs_in;
item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size;
num_codes_ = acq_parameters_.sampled_ms;
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (BEIDOU_B1I_CODE_RATE_CPS / BEIDOU_B1I_CODE_LENGTH_CHIPS)));
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0));
code_ = std::vector<std::complex<float>>(vector_length_);
acquisition_ = pcps_make_acquisition(acq_parameters_);
@ -94,6 +93,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
void BeidouB1iPcpsAcquisition::stop_acquisition()
{
acquisition_->set_active(false);
}
@ -172,11 +172,7 @@ void BeidouB1iPcpsAcquisition::set_state(int state)
void BeidouB1iPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to connect
}
@ -197,11 +193,7 @@ void BeidouB1iPcpsAcquisition::connect(gr::top_block_sptr top_block)
void BeidouB1iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to disconnect
}
@ -220,11 +212,7 @@ void BeidouB1iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr BeidouB1iPcpsAcquisition::get_left_block()
{
if (item_type_ == "gr_complex")
{
return acquisition_;
}
if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -44,7 +44,7 @@ class ConfigurationInterface;
class BeidouB1iPcpsAcquisition : public AcquisitionInterface
{
public:
BeidouB1iPcpsAcquisition(ConfigurationInterface* configuration,
BeidouB1iPcpsAcquisition(const ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams,
unsigned int out_streams);
@ -149,25 +149,24 @@ public:
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
Acq_Conf acq_parameters_;
std::vector<std::complex<float>> code_;
std::weak_ptr<ChannelFsm> channel_fsm_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
Gnss_Synchro* gnss_synchro_;
Acq_Conf acq_parameters_;
std::string item_type_;
std::string role_;
std::string dump_filename_;
size_t item_size_;
int64_t fs_in_;
float threshold_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
int64_t fs_in_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int num_codes_;
unsigned int in_streams_;
unsigned int out_streams_;

View File

@ -38,16 +38,15 @@ namespace own = gsl;
using google::LogMessage;
BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
ConfigurationInterface* configuration,
const 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;
acq_parameters_.ms_per_code = 1;
acq_parameters_.SetFromConfiguration(configuration_, role, BEIDOU_B3I_CODE_RATE_CPS, 100e6);
acq_parameters_.SetFromConfiguration(configuration, role, BEIDOU_B3I_CODE_RATE_CPS, 100e6);
LOG(INFO) << "role " << role;
@ -56,14 +55,14 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in;
num_codes_ = acq_parameters_.sampled_ms;
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(fs_in_) / (BEIDOU_B3I_CODE_RATE_CPS / BEIDOU_B3I_CODE_LENGTH_CHIPS)));
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0));
code_ = std::vector<std::complex<float>>(vector_length_);
acquisition_ = pcps_make_acquisition(acq_parameters_);
@ -92,6 +91,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
void BeidouB3iPcpsAcquisition::stop_acquisition()
{
acquisition_->set_active(false);
}
@ -169,11 +169,7 @@ void BeidouB3iPcpsAcquisition::set_state(int state)
void BeidouB3iPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to connect
}
@ -194,11 +190,7 @@ void BeidouB3iPcpsAcquisition::connect(gr::top_block_sptr top_block)
void BeidouB3iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to disconnect
}
@ -217,11 +209,7 @@ void BeidouB3iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr BeidouB3iPcpsAcquisition::get_left_block()
{
if (item_type_ == "gr_complex")
{
return acquisition_;
}
if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -43,7 +43,7 @@ class ConfigurationInterface;
class BeidouB3iPcpsAcquisition : public AcquisitionInterface
{
public:
BeidouB3iPcpsAcquisition(ConfigurationInterface* configuration,
BeidouB3iPcpsAcquisition(const ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams,
unsigned int out_streams);
@ -148,25 +148,24 @@ public:
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
Acq_Conf acq_parameters_;
std::vector<std::complex<float>> code_;
std::weak_ptr<ChannelFsm> channel_fsm_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
Gnss_Synchro* gnss_synchro_;
Acq_Conf acq_parameters_;
std::string item_type_;
std::string role_;
std::string dump_filename_;
size_t item_size_;
int64_t fs_in_;
float threshold_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
int64_t fs_in_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int num_codes_;
unsigned int in_streams_;
unsigned int out_streams_;

View File

@ -36,7 +36,7 @@ namespace own = gsl;
#endif
GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -44,8 +44,8 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "../data/acquisition.dat";
const std::string default_item_type("gr_complex");
const std::string default_dump_filename("../data/acquisition.dat");
DLOG(INFO) << "role " << role;
@ -76,12 +76,12 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
default_dump_filename);
// -- Find number of samples per spreading code (4 ms) -----------------
code_length_ = round(
fs_in_ / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS));
code_length_ = static_cast<unsigned int>(round(
fs_in_ / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * static_cast<int>(sampled_ms_ / 4);
int samples_per_ms = code_length_ / 4;
auto samples_per_ms = static_cast<int>(code_length_) / 4;
code_ = std::vector<std::complex<float>>(vector_length_);
@ -121,16 +121,17 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
void GalileoE1Pcps8msAmbiguousAcquisition::stop_acquisition()
{
acquisition_cc_->set_active(false);
}
void GalileoE1Pcps8msAmbiguousAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", static_cast<float>(0.0));
if (pfa == 0.0)
{
pfa = configuration_->property(role_ + ".pfa", 0.0);
pfa = configuration_->property(role_ + ".pfa", static_cast<float>(0.0));
}
if (pfa == 0.0)
@ -238,7 +239,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::reset()
float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
{
unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{
frequency_bins++;
}

View File

@ -38,7 +38,7 @@ class ConfigurationInterface;
class GalileoE1Pcps8msAmbiguousAcquisition : public AcquisitionInterface
{
public:
GalileoE1Pcps8msAmbiguousAcquisition(ConfigurationInterface* configuration,
GalileoE1Pcps8msAmbiguousAcquisition(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -139,29 +139,30 @@ public:
private:
ConfigurationInterface* configuration_;
float calculate_threshold(float pfa);
const ConfigurationInterface* configuration_;
galileo_pcps_8ms_acquisition_cc_sptr acquisition_cc_;
gr::blocks::stream_to_vector::sptr stream_to_vector_;
size_t item_size_;
std::weak_ptr<ChannelFsm> channel_fsm_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
float calculate_threshold(float pfa);
bool dump_;
};
#endif // GNSS_SDR_GALILEO_E1_PCPS_8MS_AMBIGUOUS_ACQUISITION_H

View File

@ -37,7 +37,7 @@ namespace own = gsl;
#endif
GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -55,14 +55,14 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in;
acquire_pilot_ = configuration->property(role + ".acquire_pilot", false);
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS)));
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0));
code_ = std::vector<std::complex<float>>(vector_length_);
sampled_ms_ = acq_parameters_.sampled_ms;
@ -94,6 +94,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
void GalileoE1PcpsAmbiguousAcquisition::stop_acquisition()
{
acquisition_->set_active(false);
}
@ -213,11 +214,7 @@ void GalileoE1PcpsAmbiguousAcquisition::set_state(int state)
void GalileoE1PcpsAmbiguousAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to connect
}
@ -238,11 +235,7 @@ void GalileoE1PcpsAmbiguousAcquisition::connect(gr::top_block_sptr top_block)
void GalileoE1PcpsAmbiguousAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to disconnect
}
@ -261,11 +254,7 @@ void GalileoE1PcpsAmbiguousAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_left_block()
{
if (item_type_ == "gr_complex")
{
return acquisition_;
}
if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -41,7 +41,8 @@ class ConfigurationInterface;
class GalileoE1PcpsAmbiguousAcquisition : public AcquisitionInterface
{
public:
GalileoE1PcpsAmbiguousAcquisition(ConfigurationInterface* configuration,
GalileoE1PcpsAmbiguousAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -152,30 +153,30 @@ public:
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
Acq_Conf acq_parameters_;
pcps_acquisition_sptr acquisition_;
std::vector<std::complex<float>> code_;
std::weak_ptr<ChannelFsm> channel_fsm_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
Gnss_Synchro* gnss_synchro_;
const ConfigurationInterface* configuration_;
Acq_Conf acq_parameters_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
int doppler_center_;
unsigned int vector_length_;
unsigned int code_length_;
bool acquire_pilot_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
int doppler_center_;
unsigned int sampled_ms_;
int64_t fs_in_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
bool acquire_pilot_;
};
#endif // GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H

View File

@ -34,7 +34,7 @@
#include <complex> // for complex
GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -42,46 +42,45 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
configuration_ = configuration;
std::string default_dump_filename = "./data/acquisition.dat";
DLOG(INFO) << "role " << role;
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);
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);
acq_parameters.repeat_satellite = configuration_->property(role + ".repeat_satellite", false);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
uint32_t downsampling_factor = configuration_->property(role + ".downsampling_factor", 4);
uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 4);
acq_parameters.downsampling_factor = downsampling_factor;
fs_in = fs_in / downsampling_factor;
acq_parameters.fs_in = fs_in;
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
}
acq_parameters.doppler_max = doppler_max_;
acquire_pilot_ = configuration_->property(role + ".acquire_pilot", false); // could be true in future versions
acquire_pilot_ = configuration->property(role + ".acquire_pilot", false); // could be true in future versions
// Find number of samples per spreading code (4 ms)
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_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(static_cast<float>(code_length) * 2.0));
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 0);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
std::string default_device_name = "/dev/uio0";
std::string device_name = configuration_->property(role + ".devicename", default_device_name);
std::string device_name = configuration->property(role + ".devicename", default_device_name);
acq_parameters.device_name = device_name;
acq_parameters.samples_per_code = nsamples_total;
acq_parameters.excludelimit = static_cast<unsigned int>(1 + ceil((1.0 / GALILEO_E1_CODE_CHIP_RATE_CPS) * static_cast<float>(fs_in)));
@ -159,12 +158,12 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
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.max_num_acqs = configuration_->property(role + ".max_num_acqs", 2);
acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast<float>(125.0));
acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
// reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 13);
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);

View File

@ -42,7 +42,8 @@ public:
/*!
* \brief Constructor
*/
GalileoE1PcpsAmbiguousAcquisitionFpga(ConfigurationInterface* configuration,
GalileoE1PcpsAmbiguousAcquisitionFpga(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -185,20 +186,19 @@ private:
static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word
static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
ConfigurationInterface* configuration_;
pcps_acquisition_fpga_sptr acquisition_fpga_;
bool acquire_pilot_;
uint32_t channel_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
std::weak_ptr<ChannelFsm> channel_fsm_;
Gnss_Synchro* gnss_synchro_;
std::string dump_filename_;
std::string role_;
int32_t doppler_center_;
uint32_t channel_;
uint32_t doppler_max_;
uint32_t doppler_step_;
int32_t doppler_center_;
std::string dump_filename_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
bool acquire_pilot_;
};
#endif // GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H

View File

@ -28,7 +28,7 @@
GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -36,8 +36,8 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "../data/acquisition.dat";
const std::string default_item_type("gr_complex");
const std::string default_dump_filename("../data/acquisition.dat");
DLOG(INFO) << "role " << role;
@ -68,12 +68,12 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
// -- Find number of samples per spreading code (4 ms) -----------------
code_length_ = round(
fs_in_ / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS));
code_length_ = static_cast<unsigned int>(round(
fs_in_ / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * static_cast<int>(sampled_ms_ / 4);
int samples_per_ms = code_length_ / 4;
auto samples_per_ms = static_cast<int>(code_length_) / 4;
code_data_ = std::vector<std::complex<float>>(vector_length_);
code_pilot_ = std::vector<std::complex<float>>(vector_length_);
@ -114,6 +114,8 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
void GalileoE1PcpsCccwsrAmbiguousAcquisition::stop_acquisition()
{
acquisition_cc_->set_state(0);
acquisition_cc_->set_active(false);
}
@ -217,7 +219,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_state(int state)
float GalileoE1PcpsCccwsrAmbiguousAcquisition::calculate_threshold(float pfa)
{
if (pfa)
if (pfa > 0.0)
{ /* Not implemented*/
};
return 0.0;

View File

@ -38,7 +38,8 @@ class ConfigurationInterface;
class GalileoE1PcpsCccwsrAmbiguousAcquisition : public AcquisitionInterface
{
public:
GalileoE1PcpsCccwsrAmbiguousAcquisition(ConfigurationInterface* configuration,
GalileoE1PcpsCccwsrAmbiguousAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -138,30 +139,31 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
float calculate_threshold(float pfa);
const ConfigurationInterface* configuration_;
pcps_cccwsr_acquisition_cc_sptr acquisition_cc_;
gr::blocks::stream_to_vector::sptr stream_to_vector_;
size_t item_size_;
std::weak_ptr<ChannelFsm> channel_fsm_;
std::vector<std::complex<float>> code_data_;
std::vector<std::complex<float>> code_pilot_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
Gnss_Synchro* gnss_synchro_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::vector<std::complex<float>> code_data_;
std::vector<std::complex<float>> code_pilot_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
float calculate_threshold(float pfa);
bool dump_;
};
#endif // GNSS_SDR_GALILEO_E1_PCPS_CCCWSR_AMBIGUOUS_ACQUISITION_H

View File

@ -36,7 +36,7 @@ namespace own = gsl;
#endif
GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcquisition(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -44,8 +44,8 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "../data/acquisition.dat";
const std::string default_item_type("gr_complex");
const std::string default_dump_filename("../data/acquisition.dat");
DLOG(INFO) << "role " << role;
@ -63,10 +63,10 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 8);
/* --- Find number of samples per spreading code (4 ms) -----------------*/
code_length_ = round(
fs_in_ / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS));
code_length_ = static_cast<unsigned int>(round(
fs_in_ / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS)));
int samples_per_ms = round(code_length_ / 4.0);
auto samples_per_ms = static_cast<int>(round(code_length_ / 4.0));
/*Calculate the folding factor value based on the formula described in the paper.
This may be a bug, but acquisition also work by variying the folding factor at va-
@ -155,16 +155,18 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::stop_acquisition()
{
acquisition_cc_->set_state(0);
acquisition_cc_->set_active(false);
}
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", static_cast<float>(0.0));
if (pfa == 0.0)
{
pfa = configuration_->property(role_ + ".pfa", 0.0);
pfa = configuration_->property(role_ + ".pfa", static_cast<float>(0.0));
}
if (pfa == 0.0)
@ -281,7 +283,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_state(int state)
float GalileoE1PcpsQuickSyncAmbiguousAcquisition::calculate_threshold(float pfa)
{
unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{
frequency_bins++;
}

View File

@ -39,7 +39,8 @@ class ConfigurationInterface;
class GalileoE1PcpsQuickSyncAmbiguousAcquisition : public AcquisitionInterface
{
public:
GalileoE1PcpsQuickSyncAmbiguousAcquisition(ConfigurationInterface* configuration,
GalileoE1PcpsQuickSyncAmbiguousAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -141,31 +142,32 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
float calculate_threshold(float pfa);
const ConfigurationInterface* configuration_;
pcps_quicksync_acquisition_cc_sptr acquisition_cc_;
gr::blocks::stream_to_vector::sptr stream_to_vector_;
size_t item_size_;
std::weak_ptr<ChannelFsm> channel_fsm_;
std::vector<std::complex<float>> code_;
std::string item_type_;
std::string role_;
std::string dump_filename_;
Gnss_Synchro* gnss_synchro_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
unsigned int vector_length_;
unsigned int code_length_;
bool bit_transition_flag_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
unsigned int folding_factor_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
float calculate_threshold(float pfa);
bool bit_transition_flag_;
bool dump_;
};
#endif // GNSS_SDR_GALILEO_E1_PCPS_QUICKSYNC_AMBIGUOUS_ACQUISITION_H

View File

@ -36,7 +36,7 @@ namespace own = gsl;
#endif
GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -44,8 +44,8 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "../data/acquisition.dat";
const std::string default_item_type("gr_complex");
const std::string default_dump_filename("../data/acquisition.dat");
DLOG(INFO) << "role " << role;
@ -79,12 +79,12 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
// -- Find number of samples per spreading code (4 ms) -----------------
code_length_ = round(
fs_in_ / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS));
code_length_ = static_cast<unsigned int>(round(
fs_in_ / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * static_cast<int>(sampled_ms_ / 4);
int samples_per_ms = code_length_ / 4;
auto samples_per_ms = static_cast<int>(code_length_) / 4;
code_ = std::vector<std::complex<float>>(vector_length_);
@ -125,16 +125,18 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
void GalileoE1PcpsTongAmbiguousAcquisition::stop_acquisition()
{
acquisition_cc_->set_state(0);
acquisition_cc_->set_active(false);
}
void GalileoE1PcpsTongAmbiguousAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", static_cast<float>(0.0));
if (pfa == 0.0)
{
pfa = configuration_->property(role_ + ".pfa", 0.0);
pfa = configuration_->property(role_ + ".pfa", static_cast<float>(0.0));
}
if (pfa == 0.0)
@ -247,7 +249,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_state(int state)
float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa)
{
unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{
frequency_bins++;
}

View File

@ -38,7 +38,8 @@ class ConfigurationInterface;
class GalileoE1PcpsTongAmbiguousAcquisition : public AcquisitionInterface
{
public:
GalileoE1PcpsTongAmbiguousAcquisition(ConfigurationInterface* configuration,
GalileoE1PcpsTongAmbiguousAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -140,31 +141,31 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
float calculate_threshold(float pfa);
const ConfigurationInterface* configuration_;
pcps_tong_acquisition_cc_sptr acquisition_cc_;
gr::blocks::stream_to_vector::sptr stream_to_vector_;
size_t item_size_;
std::weak_ptr<ChannelFsm> channel_fsm_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int tong_init_val_;
unsigned int tong_max_val_;
unsigned int tong_max_dwells_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
float calculate_threshold(float pfa);
bool dump_;
};
#endif // GNSS_SDR_GALILEO_E1_PCPS_TONG_AMBIGUOUS_ACQUISITION_H

View File

@ -42,7 +42,7 @@ namespace own = gsl;
#endif
GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -50,8 +50,8 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "../data/acquisition.dat";
const std::string default_item_type("gr_complex");
const std::string default_dump_filename("../data/acquisition.dat");
DLOG(INFO) << "role " << role;
@ -72,13 +72,13 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
{
sampled_ms_ = 3;
DLOG(INFO) << "Coherent integration time should be 3 ms or less. Changing to 3ms ";
std::cout << "Too high coherent integration time. Changing to 3ms" << std::endl;
std::cout << "Too high coherent integration time. Changing to 3ms\n";
}
if (Zero_padding > 0)
{
sampled_ms_ = 2;
DLOG(INFO) << "Zero padding activated. Changing to 1ms code + 1ms zero padding ";
std::cout << "Zero padding activated. Changing to 1ms code + 1ms zero padding" << std::endl;
std::cout << "Zero padding activated. Changing to 1ms code + 1ms zero padding\n";
}
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
@ -86,7 +86,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
// -- Find number of samples per spreading code (1ms)-------------------------
code_length_ = round(static_cast<double>(fs_in_) / GALILEO_E5A_CODE_CHIP_RATE_CPS * static_cast<double>(GALILEO_E5A_CODE_LENGTH_CHIPS));
code_length_ = static_cast<int>(round(static_cast<double>(fs_in_) / GALILEO_E5A_CODE_CHIP_RATE_CPS * static_cast<double>(GALILEO_E5A_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * sampled_ms_;
@ -130,16 +130,18 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
void GalileoE5aNoncoherentIQAcquisitionCaf::stop_acquisition()
{
acquisition_cc_->set_state(0);
acquisition_cc_->set_active(false);
}
void GalileoE5aNoncoherentIQAcquisitionCaf::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", static_cast<float>(0.0));
if (pfa == 0.0)
{
pfa = configuration_->property(role_ + ".pfa", 0.0);
pfa = configuration_->property(role_ + ".pfa", static_cast<float>(0.0));
}
if (pfa == 0.0)
@ -196,7 +198,7 @@ signed int GalileoE5aNoncoherentIQAcquisitionCaf::mag()
{
if (item_type_ == "gr_complex")
{
return acquisition_cc_->mag();
return static_cast<signed int>(acquisition_cc_->mag());
}
return 0;
}
@ -274,7 +276,7 @@ float GalileoE5aNoncoherentIQAcquisitionCaf::calculate_threshold(float pfa)
{
// Calculate the threshold
unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{
frequency_bins++;
}

View File

@ -39,7 +39,7 @@ class ConfigurationInterface;
class GalileoE5aNoncoherentIQAcquisitionCaf : public AcquisitionInterface
{
public:
GalileoE5aNoncoherentIQAcquisitionCaf(ConfigurationInterface* configuration,
GalileoE5aNoncoherentIQAcquisitionCaf(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -144,33 +144,34 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
float calculate_threshold(float pfa);
const ConfigurationInterface* configuration_;
galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr acquisition_cc_;
size_t item_size_;
std::string item_type_;
unsigned int vector_length_;
unsigned int code_length_;
bool bit_transition_flag_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
std::vector<std::complex<float>> codeI_;
std::vector<std::complex<float>> codeQ_;
std::string item_type_;
std::string role_;
std::string dump_filename_;
Gnss_Synchro* gnss_synchro_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
int Zero_padding;
int CAF_window_hz_;
int code_length_;
unsigned int vector_length_;
unsigned int channel_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
int Zero_padding;
int CAF_window_hz_;
std::vector<std::complex<float>> codeI_;
std::vector<std::complex<float>> codeQ_;
bool both_signal_components;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
float calculate_threshold(float pfa);
bool bit_transition_flag_;
bool both_signal_components;
bool dump_;
};
#endif // GNSS_SDR_GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_H

View File

@ -35,16 +35,16 @@ namespace own = std;
namespace own = gsl;
#endif
GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration,
GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(
const 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;
acq_parameters_.ms_per_code = 1;
acq_parameters_.SetFromConfiguration(configuration_, role, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_OPT_ACQ_FS_SPS);
acq_parameters_.SetFromConfiguration(configuration, role, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_OPT_ACQ_FS_SPS);
DLOG(INFO) << "Role " << role;
@ -53,20 +53,20 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in;
acq_pilot_ = configuration_->property(role + ".acquire_pilot", false);
acq_iq_ = configuration_->property(role + ".acquire_iq", false);
acq_pilot_ = configuration->property(role + ".acquire_pilot", false);
acq_iq_ = configuration->property(role + ".acquire_iq", false);
if (acq_iq_)
{
acq_pilot_ = false;
}
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS)));
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0));
code_ = std::vector<std::complex<float>>(vector_length_);
sampled_ms_ = acq_parameters_.sampled_ms;
@ -93,6 +93,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
void GalileoE5aPcpsAcquisition::stop_acquisition()
{
acquisition_->set_active(false);
}
@ -197,11 +198,7 @@ void GalileoE5aPcpsAcquisition::set_state(int state)
void GalileoE5aPcpsAcquisition::connect(gr::top_block_sptr top_block __attribute__((unused)))
{
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to connect
}
@ -214,11 +211,7 @@ void GalileoE5aPcpsAcquisition::connect(gr::top_block_sptr top_block __attribute
void GalileoE5aPcpsAcquisition::disconnect(gr::top_block_sptr top_block __attribute__((unused)))
{
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to disconnect
}

View File

@ -33,7 +33,8 @@ class ConfigurationInterface;
class GalileoE5aPcpsAcquisition : public AcquisitionInterface
{
public:
GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration,
GalileoE5aPcpsAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -143,29 +144,28 @@ public:
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
std::vector<std::complex<float>> code_;
std::weak_ptr<ChannelFsm> channel_fsm_;
Gnss_Synchro* gnss_synchro_;
Acq_Conf acq_parameters_;
size_t item_size_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
bool acq_pilot_;
bool acq_iq_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
int doppler_center_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
unsigned int doppler_max_;
unsigned int doppler_step_;
int doppler_center_;
unsigned int sampled_ms_;
unsigned int in_streams_;
unsigned int out_streams_;
int64_t fs_in_;
float threshold_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
bool acq_pilot_;
bool acq_iq_;
};
#endif // GNSS_SDR_GALILEO_E5A_PCPS_ACQUISITION_H

View File

@ -33,7 +33,8 @@
#include <cmath> // for abs, pow, floor
#include <complex> // for complex
GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterface* configuration,
GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -41,32 +42,31 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
configuration_ = configuration;
std::string default_dump_filename = "../data/acquisition.dat";
const std::string default_dump_filename("../data/acquisition.dat");
DLOG(INFO) << "Role " << role;
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);
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);
acq_parameters.repeat_satellite = configuration_->property(role + ".repeat_satellite", false);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
uint32_t downsampling_factor = configuration_->property(role + ".downsampling_factor", 1);
uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 1);
acq_parameters.downsampling_factor = downsampling_factor;
fs_in = fs_in / downsampling_factor;
acq_parameters.fs_in = fs_in;
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
}
acq_parameters.doppler_max = doppler_max_;
acq_pilot_ = configuration_->property(role + ".acquire_pilot", false);
acq_iq_ = configuration_->property(role + ".acquire_iq", false);
acq_pilot_ = configuration->property(role + ".acquire_pilot", false);
acq_iq_ = configuration->property(role + ".acquire_iq", false);
if (acq_iq_)
{
acq_pilot_ = false;
@ -76,12 +76,12 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0));
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 1);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
std::string default_device_name = "/dev/uio0";
std::string device_name = configuration_->property(role + ".devicename", default_device_name);
std::string device_name = configuration->property(role + ".devicename", default_device_name);
acq_parameters.device_name = device_name;
acq_parameters.samples_per_code = nsamples_total;
@ -163,12 +163,12 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 13);
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13);
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.max_num_acqs = configuration_->property(role + ".max_num_acqs", 2);
acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast<float>(125.0));
acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
channel_ = 0;

View File

@ -42,7 +42,8 @@ public:
/*!
* \brief Constructor
*/
GalileoE5aPcpsAcquisitionFpga(ConfigurationInterface* configuration,
GalileoE5aPcpsAcquisitionFpga(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -192,22 +193,21 @@ private:
static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word
static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
ConfigurationInterface* configuration_;
pcps_acquisition_fpga_sptr acquisition_fpga_;
std::weak_ptr<ChannelFsm> channel_fsm_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
Gnss_Synchro* gnss_synchro_;
std::string role_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
bool acq_pilot_;
bool acq_iq_;
int32_t doppler_center_;
uint32_t channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
uint32_t doppler_max_;
uint32_t doppler_step_;
int32_t doppler_center_;
unsigned int in_streams_;
unsigned int out_streams_;
Gnss_Synchro* gnss_synchro_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
bool acq_pilot_;
bool acq_iq_;
};
#endif // GNSS_SDR_GALILEO_E5A_PCPS_ACQUISITION_FPGA_H

View File

@ -37,16 +37,15 @@ namespace own = std;
namespace own = gsl;
#endif
GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(ConfigurationInterface* configuration,
GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const 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;
acq_parameters_.ms_per_code = 1;
acq_parameters_.SetFromConfiguration(configuration_, role, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_OPT_ACQ_FS_SPS);
acq_parameters_.SetFromConfiguration(configuration, role, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_OPT_ACQ_FS_SPS);
DLOG(INFO) << "Role " << role;
@ -55,20 +54,20 @@ GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(ConfigurationInterface* con
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in;
acq_pilot_ = configuration_->property(role + ".acquire_pilot", false);
acq_iq_ = configuration_->property(role + ".acquire_iq", false);
acq_pilot_ = configuration->property(role + ".acquire_pilot", false);
acq_iq_ = configuration->property(role + ".acquire_iq", false);
if (acq_iq_)
{
acq_pilot_ = false;
}
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GALILEO_E5B_CODE_CHIP_RATE_CPS / GALILEO_E5B_CODE_LENGTH_CHIPS)));
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0F : 1.0F));
code_ = std::vector<std::complex<float>>(vector_length_);
sampled_ms_ = acq_parameters_.sampled_ms;
@ -197,11 +196,7 @@ void GalileoE5bPcpsAcquisition::set_state(int state)
void GalileoE5bPcpsAcquisition::connect(gr::top_block_sptr top_block __attribute__((unused)))
{
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_ == "cshort")
if ((item_type_ == "gr_complex") || (item_type_ == "cshort"))
{
// nothing to connect
}
@ -214,11 +209,7 @@ void GalileoE5bPcpsAcquisition::connect(gr::top_block_sptr top_block __attribute
void GalileoE5bPcpsAcquisition::disconnect(gr::top_block_sptr top_block __attribute__((unused)))
{
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_ == "cshort")
if ((item_type_ == "gr_complex") || (item_type_ == "cshort"))
{
// nothing to disconnect
}

View File

@ -38,7 +38,7 @@ public:
/*!
* \brief Constructor
*/
GalileoE5bPcpsAcquisition(ConfigurationInterface* configuration,
GalileoE5bPcpsAcquisition(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -176,7 +176,6 @@ public:
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
Acq_Conf acq_parameters_;
size_t item_size_;

View File

@ -33,7 +33,7 @@
#include <cmath> // for abs, pow, floor
#include <complex> // for complex
GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(ConfigurationInterface* configuration,
GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -41,32 +41,31 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(ConfigurationInterf
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
configuration_ = configuration;
std::string default_dump_filename = "../data/acquisition.dat";
DLOG(INFO) << "Role " << role;
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);
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);
acq_parameters.repeat_satellite = configuration_->property(role + ".repeat_satellite", false);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
uint32_t downsampling_factor = configuration_->property(role + ".downsampling_factor", 1);
uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 1);
acq_parameters.downsampling_factor = downsampling_factor;
fs_in = fs_in / downsampling_factor;
acq_parameters.fs_in = fs_in;
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
}
acq_parameters.doppler_max = doppler_max_;
acq_pilot_ = configuration_->property(role + ".acquire_pilot", false);
acq_iq_ = configuration_->property(role + ".acquire_iq", false);
acq_pilot_ = configuration->property(role + ".acquire_pilot", false);
acq_iq_ = configuration->property(role + ".acquire_iq", false);
if (acq_iq_)
{
acq_pilot_ = false;
@ -76,12 +75,12 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(ConfigurationInterf
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0));
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 1);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
std::string default_device_name = "/dev/uio0";
std::string device_name = configuration_->property(role + ".devicename", default_device_name);
std::string device_name = configuration->property(role + ".devicename", default_device_name);
acq_parameters.device_name = device_name;
acq_parameters.samples_per_code = nsamples_total;
@ -163,12 +162,12 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(ConfigurationInterf
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 13);
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13);
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.max_num_acqs = configuration_->property(role + ".max_num_acqs", 2);
acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast<float>(125.0));
acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
channel_ = 0;

View File

@ -42,7 +42,7 @@ public:
/*!
* \brief Constructor
*/
GalileoE5bPcpsAcquisitionFpga(ConfigurationInterface* configuration,
GalileoE5bPcpsAcquisitionFpga(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -192,7 +192,6 @@ private:
static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word
static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
ConfigurationInterface* configuration_;
pcps_acquisition_fpga_sptr acquisition_fpga_;
std::string item_type_;
std::string dump_filename_;

View File

@ -38,16 +38,15 @@ namespace own = gsl;
#endif
GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
ConfigurationInterface* configuration,
const 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;
acq_parameters_.ms_per_code = 1;
acq_parameters_.SetFromConfiguration(configuration_, role, GLONASS_L1_CA_CODE_RATE_CPS, 100e6);
acq_parameters_.SetFromConfiguration(configuration, role, GLONASS_L1_CA_CODE_RATE_CPS, 100e6);
DLOG(INFO) << "role " << role;
@ -56,13 +55,13 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in;
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GLONASS_L1_CA_CODE_RATE_CPS / GLONASS_L1_CA_CODE_LENGTH_CHIPS)));
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0));
code_ = std::vector<std::complex<float>>(vector_length_);
sampled_ms_ = acq_parameters_.sampled_ms;
@ -94,6 +93,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
void GlonassL1CaPcpsAcquisition::stop_acquisition()
{
acquisition_->set_active(false);
}
@ -173,11 +173,7 @@ void GlonassL1CaPcpsAcquisition::set_state(int state)
void GlonassL1CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to connect
}
@ -196,11 +192,7 @@ void GlonassL1CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
void GlonassL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to disconnect
}
@ -221,11 +213,7 @@ void GlonassL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GlonassL1CaPcpsAcquisition::get_left_block()
{
if (item_type_ == "gr_complex")
{
return acquisition_;
}
if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -42,7 +42,8 @@ class ConfigurationInterface;
class GlonassL1CaPcpsAcquisition : public AcquisitionInterface
{
public:
GlonassL1CaPcpsAcquisition(ConfigurationInterface* configuration,
GlonassL1CaPcpsAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -145,26 +146,25 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
Acq_Conf acq_parameters_;
pcps_acquisition_sptr acquisition_;
std::vector<std::complex<float>> code_;
std::weak_ptr<ChannelFsm> channel_fsm_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
Gnss_Synchro* gnss_synchro_;
Acq_Conf acq_parameters_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
int64_t fs_in_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -37,16 +37,15 @@ namespace own = gsl;
#endif
GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
ConfigurationInterface* configuration,
const 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;
acq_parameters_.ms_per_code = 1;
acq_parameters_.SetFromConfiguration(configuration_, role, GLONASS_L2_CA_CODE_RATE_CPS, 100e6);
acq_parameters_.SetFromConfiguration(configuration, role, GLONASS_L2_CA_CODE_RATE_CPS, 100e6);
DLOG(INFO) << "role " << role;
@ -55,13 +54,13 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in;
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GLONASS_L2_CA_CODE_RATE_CPS / GLONASS_L2_CA_CODE_LENGTH_CHIPS)));
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0));
code_ = std::vector<std::complex<float>>(vector_length_);
sampled_ms_ = acq_parameters_.sampled_ms;
@ -93,6 +92,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
void GlonassL2CaPcpsAcquisition::stop_acquisition()
{
acquisition_->set_active(false);
}
@ -172,11 +172,7 @@ void GlonassL2CaPcpsAcquisition::set_state(int state)
void GlonassL2CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to connect
}
@ -197,11 +193,7 @@ void GlonassL2CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
void GlonassL2CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to disconnect
}
@ -220,11 +212,7 @@ void GlonassL2CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GlonassL2CaPcpsAcquisition::get_left_block()
{
if (item_type_ == "gr_complex")
{
return acquisition_;
}
if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -41,7 +41,8 @@ class ConfigurationInterface;
class GlonassL2CaPcpsAcquisition : public AcquisitionInterface
{
public:
GlonassL2CaPcpsAcquisition(ConfigurationInterface* configuration,
GlonassL2CaPcpsAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -144,26 +145,25 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
Acq_Conf acq_parameters_;
pcps_acquisition_sptr acquisition_;
std::vector<std::complex<float>> code_;
std::weak_ptr<ChannelFsm> channel_fsm_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
Gnss_Synchro* gnss_synchro_;
Acq_Conf acq_parameters_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
int64_t fs_in_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -40,16 +40,15 @@ namespace own = gsl;
#endif
GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
ConfigurationInterface* configuration,
const 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;
acq_parameters_.ms_per_code = 1;
acq_parameters_.SetFromConfiguration(configuration_, role, GPS_L1_CA_CODE_RATE_CPS, GPS_L1_CA_OPT_ACQ_FS_SPS);
acq_parameters_.SetFromConfiguration(configuration, role, GPS_L1_CA_CODE_RATE_CPS, GPS_L1_CA_OPT_ACQ_FS_SPS);
DLOG(INFO) << "role " << role;
@ -59,12 +58,12 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
}
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size;
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)));
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0));
code_ = std::vector<std::complex<float>>(vector_length_);
sampled_ms_ = acq_parameters_.sampled_ms;
@ -96,6 +95,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
void GpsL1CaPcpsAcquisition::stop_acquisition()
{
acquisition_->set_active(false);
}
@ -187,11 +187,7 @@ void GpsL1CaPcpsAcquisition::set_state(int state)
void GpsL1CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to connect
}
@ -212,11 +208,7 @@ void GpsL1CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
void GpsL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to disconnect
}
@ -235,11 +227,7 @@ void GpsL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_left_block()
{
if (item_type_ == "gr_complex")
{
return acquisition_;
}
if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -45,7 +45,8 @@ class ConfigurationInterface;
class GpsL1CaPcpsAcquisition : public AcquisitionInterface
{
public:
GpsL1CaPcpsAcquisition(ConfigurationInterface* configuration,
GpsL1CaPcpsAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -156,26 +157,25 @@ public:
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
Acq_Conf acq_parameters_;
std::vector<std::complex<float>> code_;
std::weak_ptr<ChannelFsm> channel_fsm_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
Gnss_Synchro* gnss_synchro_;
Acq_Conf acq_parameters_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
size_t item_size_;
float threshold_;
int doppler_center_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
int doppler_center_;
unsigned int sampled_ms_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -31,14 +31,14 @@
GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
ConfigurationInterface* configuration,
const 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";
const std::string default_item_type("gr_complex");
std::string default_dump_filename = "./acquisition.mat";
DLOG(INFO) << "role " << role;
@ -67,8 +67,8 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
acq_parameters.blocking_on_standby = configuration->property(role + ".blocking_on_standby", false);
// -- Find number of samples per spreading code -------------------------
vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS));
acq_parameters.samples_per_ms = vector_length_;
vector_length_ = static_cast<unsigned int>(round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)));
acq_parameters.samples_per_ms = static_cast<float>(vector_length_);
code_ = std::vector<std::complex<float>>(vector_length_);
if (item_type_ == "gr_complex")
@ -100,6 +100,8 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
void GpsL1CaPcpsAcquisitionFineDoppler::stop_acquisition()
{
acquisition_cc_->set_state(0);
acquisition_cc_->set_active(false);
}
@ -112,7 +114,7 @@ void GpsL1CaPcpsAcquisitionFineDoppler::set_threshold(float threshold)
void GpsL1CaPcpsAcquisitionFineDoppler::set_doppler_max(unsigned int doppler_max)
{
doppler_max_ = doppler_max;
doppler_max_ = static_cast<int>(doppler_max);
acquisition_cc_->set_doppler_max(doppler_max_);
}
@ -133,7 +135,7 @@ void GpsL1CaPcpsAcquisitionFineDoppler::set_gnss_synchro(Gnss_Synchro* gnss_sync
signed int GpsL1CaPcpsAcquisitionFineDoppler::mag()
{
return acquisition_cc_->mag();
return static_cast<signed int>(acquisition_cc_->mag());
}

View File

@ -45,7 +45,7 @@ class ConfigurationInterface;
class GpsL1CaPcpsAcquisitionFineDoppler : public AcquisitionInterface
{
public:
GpsL1CaPcpsAcquisitionFineDoppler(ConfigurationInterface* configuration,
GpsL1CaPcpsAcquisitionFineDoppler(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -152,24 +152,24 @@ public:
private:
pcps_acquisition_fine_doppler_cc_sptr acquisition_cc_;
size_t item_size_;
std::string item_type_;
unsigned int vector_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
std::vector<std::complex<float>> code_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
Gnss_Synchro* gnss_synchro_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
int doppler_max_;
int max_dwells_;
unsigned int vector_length_;
unsigned int channel_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
int max_dwells_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
bool dump_;
};
#endif // GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FINE_DOPPLER_H

View File

@ -37,7 +37,7 @@
#include <complex> // for complex
GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -45,22 +45,21 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
configuration_ = configuration;
DLOG(INFO) << "role " << role;
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);
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);
acq_parameters.repeat_satellite = configuration_->property(role + ".repeat_satellite", false);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
uint32_t downsampling_factor = configuration_->property(role + ".downsampling_factor", 4);
uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 4);
acq_parameters.downsampling_factor = downsampling_factor;
fs_in = fs_in / downsampling_factor;
acq_parameters.fs_in = fs_in;
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
@ -69,12 +68,12 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_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(static_cast<float>(code_length) * 2.0));
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 0);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
std::string default_device_name = "/dev/uio0";
std::string device_name = configuration_->property(role + ".devicename", default_device_name);
std::string device_name = configuration->property(role + ".devicename", default_device_name);
acq_parameters.device_name = device_name;
acq_parameters.samples_per_code = nsamples_total;
acq_parameters.excludelimit = static_cast<unsigned int>(1 + ceil(GPS_L1_CA_CHIP_PERIOD_S * static_cast<float>(fs_in)));
@ -139,12 +138,12 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 10);
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 10);
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.max_num_acqs = configuration_->property(role + ".max_num_acqs", 2);
acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast<float>(125.0));
acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
channel_ = 0;

View File

@ -45,7 +45,7 @@ public:
/*!
* \brief Constructor
*/
GpsL1CaPcpsAcquisitionFpga(ConfigurationInterface* configuration,
GpsL1CaPcpsAcquisitionFpga(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -190,19 +190,17 @@ private:
static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word
static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
ConfigurationInterface* configuration_;
pcps_acquisition_fpga_sptr acquisition_fpga_;
uint32_t channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
uint32_t doppler_max_;
uint32_t doppler_step_;
int32_t doppler_center_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
Gnss_Synchro* gnss_synchro_;
std::string role_;
int32_t doppler_center_;
uint32_t channel_;
uint32_t doppler_max_;
uint32_t doppler_step_;
unsigned int in_streams_;
unsigned int out_streams_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
};
#endif // GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H

View File

@ -30,14 +30,14 @@
GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
ConfigurationInterface* configuration,
const 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";
const std::string default_item_type("gr_complex");
std::string default_dump_filename = "./data/acquisition.dat";
DLOG(INFO) << "role " << role;
@ -57,7 +57,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
// --- Find number of samples per spreading code -------------------------
vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS));
vector_length_ = static_cast<unsigned int>(round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)));
code_.reserve(vector_length_);
@ -92,6 +92,8 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
void GpsL1CaPcpsAssistedAcquisition::stop_acquisition()
{
acquisition_cc_->set_active(false);
acquisition_cc_->set_state(0);
}
@ -104,7 +106,7 @@ void GpsL1CaPcpsAssistedAcquisition::set_threshold(float threshold)
void GpsL1CaPcpsAssistedAcquisition::set_doppler_max(unsigned int doppler_max)
{
doppler_max_ = doppler_max;
doppler_max_ = static_cast<int>(doppler_max);
acquisition_cc_->set_doppler_max(doppler_max_);
}

View File

@ -38,7 +38,8 @@ class ConfigurationInterface;
class GpsL1CaPcpsAssistedAcquisition : public AcquisitionInterface
{
public:
GpsL1CaPcpsAssistedAcquisition(ConfigurationInterface* configuration,
GpsL1CaPcpsAssistedAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -135,25 +136,30 @@ public:
private:
pcps_assisted_acquisition_cc_sptr acquisition_cc_;
size_t item_size_;
std::string item_type_;
unsigned int vector_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
std::vector<std::complex<float>> code_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
Gnss_Synchro* gnss_synchro_;
size_t item_size_;
int64_t fs_in_;
float threshold_;
int doppler_max_;
unsigned int doppler_step_;
int doppler_min_;
unsigned int sampled_ms_;
int max_dwells_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int vector_length_;
unsigned int channel_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int in_streams_;
unsigned int out_streams_;
bool dump_;
};
#endif // GNSS_SDR_GPS_L1_CA_PCPS_ASSISTED_ACQUISITION_H

View File

@ -36,7 +36,7 @@ namespace own = gsl;
#endif
GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -44,40 +44,40 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
const std::string default_item_type("gr_complex");
std::string default_dump_filename = "./data/acquisition.dat";
DLOG(INFO) << "role " << role;
item_type_ = configuration_->property(role + ".item_type",
item_type_ = configuration->property(role + ".item_type",
default_item_type);
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);
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);
if (FLAGS_doppler_max != 0)
{
doppler_max_ = FLAGS_doppler_max;
}
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
sampled_ms_ = configuration->property(role + ".coherent_integration_time_ms", 1);
bit_transition_flag_ = configuration_->property("Acquisition.bit_transition_flag", false);
bit_transition_flag_ = configuration->property("Acquisition.bit_transition_flag", false);
if (!bit_transition_flag_)
{
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
max_dwells_ = configuration->property(role + ".max_dwells", 1);
}
else
{
max_dwells_ = 2;
}
dump_filename_ = configuration_->property(role + ".dump_filename",
dump_filename_ = configuration->property(role + ".dump_filename",
default_dump_filename);
// -- Find number of samples per spreading code -------------------------
code_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS));
code_length_ = static_cast<unsigned int>(round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * sampled_ms_;
@ -119,16 +119,18 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
void GpsL1CaPcpsOpenClAcquisition::stop_acquisition()
{
acquisition_cc_->set_active(false);
acquisition_cc_->set_state(0);
}
void GpsL1CaPcpsOpenClAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", static_cast<float>(0.0));
if (pfa == 0.0)
{
pfa = configuration_->property(role_ + ".pfa", 0.0);
pfa = configuration_->property(role_ + ".pfa", static_cast<float>(0.0));
}
if (pfa == 0.0)
{
@ -229,7 +231,7 @@ float GpsL1CaPcpsOpenClAcquisition::calculate_threshold(float pfa)
{
// Calculate the threshold
unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{
frequency_bins++;
}

View File

@ -38,7 +38,7 @@ class ConfigurationInterface;
class GpsL1CaPcpsOpenClAcquisition : public AcquisitionInterface
{
public:
GpsL1CaPcpsOpenClAcquisition(ConfigurationInterface* configuration,
GpsL1CaPcpsOpenClAcquisition(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -143,30 +143,34 @@ public:
}
private:
ConfigurationInterface* configuration_;
float calculate_threshold(float pfa);
const ConfigurationInterface* configuration_;
pcps_opencl_acquisition_cc_sptr acquisition_cc_;
gr::blocks::stream_to_vector::sptr stream_to_vector_;
size_t item_size_;
std::weak_ptr<ChannelFsm> channel_fsm_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
unsigned int vector_length_;
unsigned int code_length_;
bool bit_transition_flag_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
float calculate_threshold(float pfa);
bool bit_transition_flag_;
bool dump_;
};
#endif // GNSS_SDR_GPS_L1_CA_PCPS_OPENCL_ACQUISITION_H

View File

@ -37,7 +37,7 @@ namespace own = gsl;
#endif
GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -45,7 +45,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
const std::string default_item_type("gr_complex");
std::string default_dump_filename = "./data/acquisition.dat";
DLOG(INFO) << "role " << role;
@ -62,7 +62,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 4);
// -- Find number of samples per spreading code -------------------------
code_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS));
code_length_ = static_cast<unsigned int>(round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)));
/* Calculate the folding factor value based on the calculations */
auto temp = static_cast<unsigned int>(ceil(sqrt(log2(code_length_))));
@ -148,16 +148,18 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
void GpsL1CaPcpsQuickSyncAcquisition::stop_acquisition()
{
acquisition_cc_->set_state(0);
acquisition_cc_->set_active(false);
}
void GpsL1CaPcpsQuickSyncAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", static_cast<float>(0.0));
if (pfa == 0.0)
{
pfa = configuration_->property(role_ + ".pfa", 0.0);
pfa = configuration_->property(role_ + ".pfa", static_cast<float>(0.0));
}
if (pfa == 0.0)
{
@ -264,7 +266,7 @@ float GpsL1CaPcpsQuickSyncAcquisition::calculate_threshold(float pfa)
{
// Calculate the threshold
unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{
frequency_bins++;
}

View File

@ -40,7 +40,8 @@ class ConfigurationInterface;
class GpsL1CaPcpsQuickSyncAcquisition : public AcquisitionInterface
{
public:
GpsL1CaPcpsQuickSyncAcquisition(ConfigurationInterface* configuration,
GpsL1CaPcpsQuickSyncAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -143,31 +144,35 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
float calculate_threshold(float pfa);
const ConfigurationInterface* configuration_;
pcps_quicksync_acquisition_cc_sptr acquisition_cc_;
std::weak_ptr<ChannelFsm> channel_fsm_;
gr::blocks::stream_to_vector::sptr stream_to_vector_;
size_t item_size_;
std::vector<std::complex<float>> code_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
Gnss_Synchro* gnss_synchro_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
unsigned int vector_length_;
unsigned int code_length_;
bool bit_transition_flag_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
unsigned int folding_factor_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
float calculate_threshold(float pfa);
bool bit_transition_flag_;
bool dump_;
};
#endif // GNSS_SDR_GPS_L1_CA_PCPS_QUICKSYNC_ACQUISITION_H

View File

@ -36,7 +36,7 @@ namespace own = gsl;
#endif
GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -44,7 +44,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
out_streams_(out_streams)
{
configuration_ = configuration;
std::string default_item_type = "gr_complex";
const std::string default_item_type("gr_complex");
std::string default_dump_filename = "./data/acquisition.dat";
DLOG(INFO) << "role " << role;
@ -68,7 +68,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
// -- Find number of samples per spreading code -------------------------
code_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS));
code_length_ = static_cast<unsigned int>(round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * sampled_ms_;
@ -110,16 +110,18 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
void GpsL1CaPcpsTongAcquisition::stop_acquisition()
{
acquisition_cc_->set_state(0);
acquisition_cc_->set_active(false);
}
void GpsL1CaPcpsTongAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", static_cast<float>(0.0));
if (pfa == 0.0)
{
pfa = configuration_->property(role_ + ".pfa", 0.0);
pfa = configuration_->property(role_ + ".pfa", static_cast<float>(0.0));
}
if (pfa == 0.0)
{
@ -226,7 +228,7 @@ float GpsL1CaPcpsTongAcquisition::calculate_threshold(float pfa)
{
// Calculate the threshold
unsigned int frequency_bins = 0;
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += static_cast<int>(doppler_step_))
{
frequency_bins++;
}

View File

@ -39,7 +39,7 @@ class ConfigurationInterface;
class GpsL1CaPcpsTongAcquisition : public AcquisitionInterface
{
public:
GpsL1CaPcpsTongAcquisition(ConfigurationInterface* configuration,
GpsL1CaPcpsTongAcquisition(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -142,31 +142,32 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private:
ConfigurationInterface* configuration_;
float calculate_threshold(float pfa);
const ConfigurationInterface* configuration_;
pcps_tong_acquisition_cc_sptr acquisition_cc_;
gr::blocks::stream_to_vector::sptr stream_to_vector_;
size_t item_size_;
std::weak_ptr<ChannelFsm> channel_fsm_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
int64_t fs_in_;
size_t item_size_;
float threshold_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int tong_init_val_;
unsigned int tong_max_val_;
unsigned int tong_max_dwells_;
int64_t fs_in_;
bool dump_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
float calculate_threshold(float pfa);
bool dump_;
};
#endif // GNSS_SDR_GPS_L1_CA_TONG_ACQUISITION_H

View File

@ -38,16 +38,15 @@ namespace own = gsl;
#endif
GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
ConfigurationInterface* configuration,
const 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;
acq_parameters_.ms_per_code = 20;
acq_parameters_.SetFromConfiguration(configuration_, role, GPS_L2_M_CODE_RATE_CPS, GPS_L2C_OPT_ACQ_FS_SPS);
acq_parameters_.SetFromConfiguration(configuration, role, GPS_L2_M_CODE_RATE_CPS, GPS_L2C_OPT_ACQ_FS_SPS);
DLOG(INFO) << "Role " << role;
@ -56,13 +55,13 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
acq_parameters_.doppler_max = FLAGS_doppler_max;
}
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size;
fs_in_ = acq_parameters_.fs_in;
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GPS_L2_M_CODE_RATE_CPS / GPS_L2_M_CODE_LENGTH_CHIPS)));
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0));
code_ = std::vector<std::complex<float>>(vector_length_);
acquisition_ = pcps_make_acquisition(acq_parameters_);
@ -93,6 +92,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
void GpsL2MPcpsAcquisition::stop_acquisition()
{
acquisition_->set_active(false);
}
@ -187,11 +187,7 @@ void GpsL2MPcpsAcquisition::set_state(int state)
void GpsL2MPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to connect
}
@ -212,11 +208,7 @@ void GpsL2MPcpsAcquisition::connect(gr::top_block_sptr top_block)
void GpsL2MPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to disconnect
}
@ -235,11 +227,7 @@ void GpsL2MPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GpsL2MPcpsAcquisition::get_left_block()
{
if (item_type_ == "gr_complex")
{
return acquisition_;
}
if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -42,7 +42,8 @@ class ConfigurationInterface;
class GpsL2MPcpsAcquisition : public AcquisitionInterface
{
public:
GpsL2MPcpsAcquisition(ConfigurationInterface* configuration,
GpsL2MPcpsAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -153,26 +154,25 @@ public:
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
Acq_Conf acq_parameters_;
std::vector<std::complex<float>> code_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
std::weak_ptr<ChannelFsm> channel_fsm_;
Gnss_Synchro* gnss_synchro_;
Acq_Conf acq_parameters_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
size_t item_size_;
int64_t fs_in_;
float threshold_;
int doppler_center_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
int doppler_center_;
int64_t fs_in_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
unsigned int num_codes_;

View File

@ -37,7 +37,7 @@
#include <complex> // for complex
GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -45,16 +45,15 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
configuration_ = configuration;
std::string default_dump_filename = "./acquisition.mat";
LOG(INFO) << "role " << role;
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);
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.repeat_satellite = configuration_->property(role + ".repeat_satellite", false);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
@ -64,20 +63,20 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
}
acq_parameters.doppler_max = doppler_max_;
unsigned int code_length = std::round(static_cast<double>(fs_in_) / (GPS_L2_M_CODE_RATE_CPS / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS)));
auto code_length = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / (GPS_L2_M_CODE_RATE_CPS / static_cast<double>(GPS_L2_M_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(static_cast<float>(code_length)));
unsigned int nsamples_total = pow(2, nbits);
unsigned int select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 0);
unsigned int select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
std::string default_device_name = "/dev/uio0";
std::string device_name = configuration_->property(role + ".devicename", default_device_name);
std::string device_name = configuration->property(role + ".devicename", default_device_name);
acq_parameters.device_name = device_name;
acq_parameters.samples_per_code = nsamples_total;
acq_parameters.downsampling_factor = configuration_->property(role + ".downsampling_factor", 1.0);
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 14);
acq_parameters.downsampling_factor = configuration->property(role + ".downsampling_factor", 1.0);
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 14);
acq_parameters.excludelimit = static_cast<uint32_t>(std::round(static_cast<double>(fs_in_) / GPS_L2_M_CODE_RATE_CPS));
// compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time

View File

@ -41,7 +41,8 @@ class ConfigurationInterface;
class GpsL2MPcpsAcquisitionFpga : public AcquisitionInterface
{
public:
GpsL2MPcpsAcquisitionFpga(ConfigurationInterface* configuration,
GpsL2MPcpsAcquisitionFpga(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -151,21 +152,20 @@ private:
static const uint32_t SELECT_ALL_CODE_BITS = 0xFFFFFFFF; // Select a 20 bit word
static const uint32_t SHL_CODE_BITS = 65536; // shift left by 10 bits
ConfigurationInterface* configuration_;
pcps_acquisition_fpga_sptr acquisition_fpga_;
std::string item_type_;
unsigned int channel_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
std::weak_ptr<ChannelFsm> channel_fsm_;
Gnss_Synchro* gnss_synchro_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
int64_t fs_in_;
float threshold_;
unsigned int channel_;
unsigned int doppler_max_;
unsigned int doppler_step_;
int64_t fs_in_;
std::string dump_filename_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
};
#endif // GNSS_SDR_GPS_L2_M_PCPS_ACQUISITION_FPGA_H

View File

@ -37,16 +37,15 @@ namespace own = gsl;
#endif
GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
ConfigurationInterface* configuration,
const 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;
acq_parameters_.ms_per_code = 1;
acq_parameters_.SetFromConfiguration(configuration_, role, GPS_L5I_CODE_RATE_CPS, GPS_L5_OPT_ACQ_FS_SPS);
acq_parameters_.SetFromConfiguration(configuration, role, GPS_L5I_CODE_RATE_CPS, GPS_L5_OPT_ACQ_FS_SPS);
DLOG(INFO) << "role " << role;
@ -56,12 +55,12 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
}
doppler_max_ = acq_parameters_.doppler_max;
doppler_step_ = acq_parameters_.doppler_step;
doppler_step_ = static_cast<unsigned int>(acq_parameters_.doppler_step);
item_type_ = acq_parameters_.item_type;
item_size_ = acq_parameters_.it_size;
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GPS_L5I_CODE_RATE_CPS / GPS_L5I_CODE_LENGTH_CHIPS)));
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0 : 1.0));
code_ = std::vector<std::complex<float>>(vector_length_);
fs_in_ = acq_parameters_.fs_in;
@ -94,6 +93,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
void GpsL5iPcpsAcquisition::stop_acquisition()
{
acquisition_->set_active(false);
}
@ -188,11 +188,7 @@ void GpsL5iPcpsAcquisition::set_state(int state)
void GpsL5iPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to connect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to connect
}
@ -213,11 +209,7 @@ void GpsL5iPcpsAcquisition::connect(gr::top_block_sptr top_block)
void GpsL5iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_ == "gr_complex")
{
// nothing to disconnect
}
else if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
// nothing to disconnect
}
@ -236,11 +228,7 @@ void GpsL5iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr GpsL5iPcpsAcquisition::get_left_block()
{
if (item_type_ == "gr_complex")
{
return acquisition_;
}
if (item_type_ == "cshort")
if (item_type_ == "gr_complex" || item_type_ == "cshort")
{
return acquisition_;
}

View File

@ -42,7 +42,8 @@ class ConfigurationInterface;
class GpsL5iPcpsAcquisition : public AcquisitionInterface
{
public:
GpsL5iPcpsAcquisition(ConfigurationInterface* configuration,
GpsL5iPcpsAcquisition(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -153,29 +154,28 @@ public:
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
Acq_Conf acq_parameters_;
std::vector<std::complex<float>> code_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
std::weak_ptr<ChannelFsm> channel_fsm_;
Gnss_Synchro* gnss_synchro_;
Acq_Conf acq_parameters_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
size_t item_size_;
int64_t fs_in_;
float threshold_;
int doppler_center_;
unsigned int vector_length_;
unsigned int code_length_;
unsigned int channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
int doppler_center_;
int64_t fs_in_;
std::string dump_filename_;
std::vector<std::complex<float>> code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int num_codes_;
unsigned int in_streams_;
unsigned int out_streams_;
unsigned int num_codes_;
};
#endif // GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_H

View File

@ -37,7 +37,7 @@
#include <complex> // for complex
GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
ConfigurationInterface* configuration,
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
@ -45,18 +45,17 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
out_streams_(out_streams)
{
pcpsconf_fpga_t acq_parameters;
configuration_ = configuration;
std::string default_dump_filename = "./data/acquisition.dat";
LOG(INFO) << "role " << role;
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);
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);
acq_parameters.repeat_satellite = configuration_->property(role + ".repeat_satellite", false);
acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false);
DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite;
uint32_t downsampling_factor = configuration_->property(role + ".downsampling_factor", 1);
uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 1);
acq_parameters.downsampling_factor = downsampling_factor;
fs_in = fs_in / downsampling_factor;
@ -73,12 +72,12 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GPS_L5I_CODE_RATE_CPS / static_cast<double>(GPS_L5I_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(static_cast<float>(code_length) * 2.0));
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0F));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 1);
uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1);
acq_parameters.select_queue_Fpga = select_queue_Fpga;
std::string default_device_name = "/dev/uio0";
std::string device_name = configuration_->property(role + ".devicename", default_device_name);
std::string device_name = configuration->property(role + ".devicename", default_device_name);
acq_parameters.device_name = device_name;
acq_parameters.samples_per_code = nsamples_total;
@ -142,12 +141,12 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
// reference for the FPGA FFT-IFFT attenuation factor
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 13);
acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13);
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.max_num_acqs = configuration_->property(role + ".max_num_acqs", 2);
acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast<float>(125.0));
acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false);
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
channel_ = 0;

View File

@ -43,7 +43,8 @@ public:
/*!
* \brief Constructor
*/
GpsL5iPcpsAcquisitionFpga(ConfigurationInterface* configuration,
GpsL5iPcpsAcquisitionFpga(
const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
unsigned int out_streams);
@ -188,21 +189,21 @@ private:
static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word
static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
ConfigurationInterface* configuration_;
float calculate_threshold(float pfa);
pcps_acquisition_fpga_sptr acquisition_fpga_;
std::string item_type_;
uint32_t channel_;
std::weak_ptr<ChannelFsm> channel_fsm_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
Gnss_Synchro* gnss_synchro_;
std::string item_type_;
std::string dump_filename_;
std::string role_;
int32_t doppler_center_;
uint32_t channel_;
uint32_t doppler_max_;
uint32_t doppler_step_;
int32_t doppler_center_;
std::string dump_filename_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
float calculate_threshold(float pfa);
};
#endif // GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_FPGA_H

View File

@ -49,7 +49,7 @@ if(USE_CMAKE_TARGET_SOURCES)
PRIVATE
${ACQ_GR_BLOCKS_SOURCES}
PUBLIC
${ACQ_ADAPTER_HEADERS}
${ACQ_GR_BLOCKS_HEADERS}
)
else()
source_group(Headers FILES ${ACQ_GR_BLOCKS_HEADERS})

View File

@ -25,6 +25,8 @@
*/
#include "galileo_e5a_noncoherent_iq_acquisition_caf_cc.h"
#include "MATH_CONSTANTS.h"
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -77,7 +79,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
d_samples_per_code = samples_per_code;
d_max_dwells = max_dwells;
d_well_count = 0;
d_doppler_max = doppler_max;
d_doppler_max = static_cast<int>(doppler_max);
if (Zero_padding_ > 0)
{
d_sampled_ms = 1;
@ -86,7 +88,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
{
d_sampled_ms = sampled_ms;
}
d_fft_size = sampled_ms * d_samples_per_ms;
d_fft_size = static_cast<int>(sampled_ms) * d_samples_per_ms;
d_mag = 0;
d_input_power = 0.0;
d_num_doppler_bins = 0;
@ -118,10 +120,10 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
}
// Direct FFT
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
// For dumping samples into a file
d_dump = dump;
@ -223,12 +225,11 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::init()
d_gnss_synchro->Acq_samplestamp_samples = 0ULL;
d_mag = 0.0;
d_input_power = 0.0;
const double GALILEO_TWO_PI = 6.283185307179600;
// Count the number of bins
d_num_doppler_bins = 0;
for (int doppler = static_cast<int>(-d_doppler_max);
doppler <= static_cast<int>(d_doppler_max);
for (int doppler = -d_doppler_max;
doppler <= d_doppler_max;
doppler += d_doppler_step)
{
d_num_doppler_bins++;
@ -236,10 +237,10 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::init()
// Create the carrier Doppler wipeoff signals
d_grid_doppler_wipeoffs = std::vector<std::vector<gr_complex>>(d_num_doppler_bins, std::vector<gr_complex>(d_fft_size));
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
for (int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
int doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
float phase_step_rad = GALILEO_TWO_PI * doppler / static_cast<float>(d_fs_in);
int doppler = -d_doppler_max + d_doppler_step * doppler_index;
float phase_step_rad = static_cast<float>(TWO_PI) * static_cast<float>(doppler) / static_cast<float>(d_fs_in);
std::array<float, 1> _phase{};
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase.data(), d_fft_size);
}
@ -330,7 +331,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
case 1:
{
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); // Get the input samples pointer
unsigned int buff_increment;
int buff_increment;
if ((ninput_items[0] + d_buffer_count) <= d_fft_size)
{
buff_increment = ninput_items[0];
@ -341,7 +342,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
}
memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex) * buff_increment);
// If buffer will be full in next iteration
if (d_buffer_count >= (d_fft_size - d_gr_stream_buffer))
if (d_buffer_count >= static_cast<int>(d_fft_size - d_gr_stream_buffer))
{
d_state = 2;
}
@ -389,7 +390,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_input_power /= static_cast<float>(d_fft_size);
// 2- Doppler frequency search loop
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
for (int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
// doppler search steps
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
@ -469,7 +470,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{
d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];
}
for (unsigned int i = 0; i < d_fft_size; i++)
for (int i = 0; i < d_fft_size; i++)
{
d_magnitudeIA[i] += d_magnitudeQA[i];
}
@ -480,7 +481,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{
d_CAF_vector_Q[doppler_index] = d_magnitudeQB[indext_QB];
}
for (unsigned int i = 0; i < d_fft_size; i++)
for (int i = 0; i < d_fft_size; i++)
{
d_magnitudeIA[i] += d_magnitudeQB[i];
}
@ -504,7 +505,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{
d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];
}
for (unsigned int i = 0; i < d_fft_size; i++)
for (int i = 0; i < d_fft_size; i++)
{
d_magnitudeIB[i] += d_magnitudeQA[i];
}
@ -515,7 +516,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{
d_CAF_vector_Q[doppler_index] = d_magnitudeQB[indext_QB];
}
for (unsigned int i = 0; i < d_fft_size; i++)
for (int i = 0; i < d_fft_size; i++)
{
d_magnitudeIB[i] += d_magnitudeQB[i];
}
@ -538,7 +539,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];
}
// NON-Coherent integration of only 1 code
for (unsigned int i = 0; i < d_fft_size; i++)
for (int i = 0; i < d_fft_size; i++)
{
d_magnitudeIA[i] += d_magnitudeQA[i];
}
@ -596,7 +597,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_dump_file.close();
}
}
// std::cout << "d_mag " << d_mag << ".d_sample_counter " << d_sample_counter << ". acq delay " << d_gnss_synchro->Acq_delay_samples<< " indext "<< indext << std::endl;
// std::cout << "d_mag " << d_mag << ".d_sample_counter " << d_sample_counter << ". acq delay " << d_gnss_synchro->Acq_delay_samples<< " indext "<< indext << '\n';
// 6 OPTIONAL: CAF filter to avoid Doppler ambiguity in bit transition.
if (d_CAF_window_hz > 0)
{
@ -604,46 +605,46 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
std::array<float, 1> accum{};
CAF_bins_half = d_CAF_window_hz / (2 * d_doppler_step);
float weighting_factor;
weighting_factor = 0.5 / static_cast<float>(CAF_bins_half);
weighting_factor = 0.5F / static_cast<float>(CAF_bins_half);
// weighting_factor = 0;
// std::cout << "weighting_factor " << weighting_factor << std::endl;
// std::cout << "weighting_factor " << weighting_factor << '\n';
// Initialize first iterations
for (int doppler_index = 0; doppler_index < CAF_bins_half; doppler_index++)
{
d_CAF_vector[doppler_index] = 0;
for (int i = 0; i < CAF_bins_half + doppler_index + 1; i++)
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * static_cast<unsigned int>((doppler_index - i)));
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast<float>((doppler_index - i)));
}
d_CAF_vector[doppler_index] /= 1 + CAF_bins_half + doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * doppler_index * (doppler_index + 1) / 2; // triangles = [n*(n+1)/2]
d_CAF_vector[doppler_index] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half + doppler_index) - weighting_factor * static_cast<float>(CAF_bins_half) * ((static_cast<float>(CAF_bins_half) + 1.0F) / 2.0F) - weighting_factor * static_cast<float>(doppler_index) * (static_cast<float>(doppler_index) + 1.0F) / 2.0F); // triangles = [n*(n+1)/2]
if (d_both_signal_components)
{
accum[0] = 0;
for (int i = 0; i < CAF_bins_half + doppler_index + 1; i++)
{
accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast<unsigned int>(abs(doppler_index - i)));
accum[0] += static_cast<float>(d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast<float>(abs(doppler_index - i))));
}
accum[0] /= 1 + CAF_bins_half + doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * doppler_index * (doppler_index + 1) / 2; // triangles = [n*(n+1)/2]
accum[0] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half + doppler_index) - weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F - weighting_factor * static_cast<float>(doppler_index) * static_cast<float>(doppler_index + 1) / 2.0F); // triangles = [n*(n+1)/2]
d_CAF_vector[doppler_index] += accum[0];
}
}
// Body loop
for (unsigned int doppler_index = CAF_bins_half; doppler_index < d_num_doppler_bins - CAF_bins_half; doppler_index++)
for (int doppler_index = CAF_bins_half; doppler_index < d_num_doppler_bins - CAF_bins_half; doppler_index++)
{
d_CAF_vector[doppler_index] = 0;
for (int i = doppler_index - CAF_bins_half; i < static_cast<int>(doppler_index + CAF_bins_half + 1); i++)
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * static_cast<unsigned int>((doppler_index - i)));
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast<float>((doppler_index - i)));
}
d_CAF_vector[doppler_index] /= 1 + 2 * CAF_bins_half - 2 * weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2;
d_CAF_vector[doppler_index] /= static_cast<float>(1.0F + 2.0F * static_cast<float>(CAF_bins_half) - 2.0F * weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F);
if (d_both_signal_components)
{
accum[0] = 0;
for (int i = doppler_index - CAF_bins_half; i < static_cast<int>(doppler_index + CAF_bins_half + 1); i++)
{
accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast<unsigned int>((doppler_index - i)));
accum[0] += static_cast<float>(d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast<float>((doppler_index - i))));
}
accum[0] /= 1 + 2 * CAF_bins_half - 2 * weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2;
accum[0] /= static_cast<float>(1.0F + 2.0F * static_cast<float>(CAF_bins_half) - 2.0F * weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F);
d_CAF_vector[doppler_index] += accum[0];
}
}
@ -653,24 +654,24 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_CAF_vector[doppler_index] = 0;
for (int i = doppler_index - CAF_bins_half; i < static_cast<int>(d_num_doppler_bins); i++)
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * (abs(doppler_index - i)));
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast<float>(abs(doppler_index - i)));
}
d_CAF_vector[doppler_index] /= 1 + CAF_bins_half + (d_num_doppler_bins - doppler_index - 1) - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * (d_num_doppler_bins - doppler_index - 1) * (d_num_doppler_bins - doppler_index) / 2;
d_CAF_vector[doppler_index] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half) + static_cast<float>(d_num_doppler_bins - doppler_index - 1) - weighting_factor * static_cast<float>(CAF_bins_half) * (static_cast<float>(CAF_bins_half) + 1.0F) / 2.0F - weighting_factor * static_cast<float>(d_num_doppler_bins - doppler_index - 1) * static_cast<float>(d_num_doppler_bins - doppler_index) / 2.0F);
if (d_both_signal_components)
{
accum[0] = 0;
for (int i = doppler_index - CAF_bins_half; i < static_cast<int>(d_num_doppler_bins); i++)
{
accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * (abs(doppler_index - i)));
accum[0] += static_cast<float>(d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast<float>(abs(doppler_index - i))));
}
accum[0] /= 1 + CAF_bins_half + (d_num_doppler_bins - doppler_index - 1) - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * (d_num_doppler_bins - doppler_index - 1) * (d_num_doppler_bins - doppler_index) / 2;
accum[0] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half) + static_cast<float>(d_num_doppler_bins - doppler_index - 1) - weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1.0) / 2.0 - weighting_factor * static_cast<float>(d_num_doppler_bins - doppler_index - 1) * static_cast<float>(d_num_doppler_bins - doppler_index) / 2.0);
d_CAF_vector[doppler_index] += accum[0];
}
}
// Recompute the maximum doppler peak
volk_gnsssdr_32f_index_max_32u(&indext, d_CAF_vector.data(), d_num_doppler_bins);
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * indext;
doppler = -d_doppler_max + d_doppler_step * static_cast<int>(indext);
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
// Dump if required, appended at the end of the file
if (d_dump)

View File

@ -206,52 +206,60 @@ private:
float estimate_input_power(gr_complex* in);
std::weak_ptr<ChannelFsm> d_channel_fsm;
int64_t d_fs_in;
int d_samples_per_ms;
int d_sampled_ms;
int d_samples_per_code;
unsigned int d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
unsigned int d_doppler_max;
unsigned int d_doppler_step;
unsigned int d_max_dwells;
unsigned int d_well_count;
unsigned int d_fft_size;
uint64_t d_sample_counter;
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
unsigned int d_num_doppler_bins;
std::vector<gr_complex> d_fft_code_I_A;
std::vector<gr_complex> d_fft_code_I_B;
std::vector<gr_complex> d_fft_code_Q_A;
std::vector<gr_complex> d_fft_code_Q_B;
std::vector<gr_complex> d_inbuffer;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
unsigned int d_code_phase;
float d_doppler_freq;
float d_mag;
std::vector<float> d_magnitudeIA;
std::vector<float> d_magnitudeIB;
std::vector<float> d_magnitudeQA;
std::vector<float> d_magnitudeQB;
float d_input_power;
float d_test_statistics;
bool d_bit_transition_flag;
std::ofstream d_dump_file;
bool d_active;
int d_state;
bool d_dump;
bool d_both_signal_components;
int d_CAF_window_hz;
std::vector<float> d_CAF_vector;
std::vector<float> d_CAF_vector_I;
std::vector<float> d_CAF_vector_Q;
unsigned int d_channel;
std::string d_satellite_str;
std::string d_dump_filename;
unsigned int d_buffer_count;
std::ofstream d_dump_file;
Gnss_Synchro* d_gnss_synchro;
int64_t d_fs_in;
uint64_t d_sample_counter;
float d_threshold;
float d_doppler_freq;
float d_mag;
float d_input_power;
float d_test_statistics;
int d_state;
int d_samples_per_ms;
int d_samples_per_code;
int d_CAF_window_hz;
int d_buffer_count;
int d_doppler_resolution;
int d_doppler_max;
int d_doppler_step;
int d_fft_size;
int d_num_doppler_bins;
unsigned int d_gr_stream_buffer;
unsigned int d_channel;
unsigned int d_max_dwells;
unsigned int d_well_count;
unsigned int d_sampled_ms;
unsigned int d_code_phase;
bool d_bit_transition_flag;
bool d_active;
bool d_dump;
bool d_both_signal_components;
};
#endif // GNSS_SDR_GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H

View File

@ -19,6 +19,8 @@
*/
#include "galileo_pcps_8ms_acquisition_cc.h"
#include "MATH_CONSTANTS.h"
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -52,8 +54,8 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
int32_t samples_per_code,
bool dump,
const std::string &dump_filename) : gr::block("galileo_pcps_8ms_acquisition_cc",
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms))
gr::io_signature::make(1, 1, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)),
gr::io_signature::make(0, 0, static_cast<int>(sizeof(gr_complex) * sampled_ms * samples_per_ms)))
{
this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0ULL; // SAMPLE COUNTER
@ -76,10 +78,10 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
d_magnitude = std::vector<float>(d_fft_size, 0.0F);
// Direct FFT
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
// For dumping samples into a file
d_dump = dump;
@ -150,7 +152,7 @@ void galileo_pcps_8ms_acquisition_cc::init()
d_gnss_synchro->Acq_samplestamp_samples = 0ULL;
d_mag = 0.0;
d_input_power = 0.0;
const double GALILEO_TWO_PI = 6.283185307179600;
// Count the number of bins
d_num_doppler_bins = 0;
for (auto doppler = static_cast<int32_t>(-d_doppler_max);
@ -164,7 +166,7 @@ void galileo_pcps_8ms_acquisition_cc::init()
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
int32_t doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index;
float phase_step_rad = static_cast<float>(GALILEO_TWO_PI) * doppler / static_cast<float>(d_fs_in);
float phase_step_rad = static_cast<float>(TWO_PI) * doppler / static_cast<float>(d_fs_in);
std::array<float, 1> _phase{};
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase.data(), d_fft_size);
}

View File

@ -191,39 +191,45 @@ private:
int32_t doppler_shift,
int32_t doppler_offset);
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
std::vector<gr_complex> d_fft_code_A;
std::vector<gr_complex> d_fft_code_B;
std::vector<float> d_magnitude;
std::string d_satellite_str;
std::string d_dump_filename;
std::ofstream d_dump_file;
Gnss_Synchro* d_gnss_synchro;
int64_t d_fs_in;
uint64_t d_sample_counter;
float d_threshold;
float d_doppler_freq;
float d_mag;
float d_input_power;
float d_test_statistics;
int32_t d_state;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
uint32_t d_channel;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint64_t d_sample_counter;
std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
std::vector<gr_complex> d_fft_code_A;
std::vector<gr_complex> d_fft_code_B;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
std::vector<float> d_magnitude;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
bool d_active;
int32_t d_state;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
};
#endif // GNSS_SDR_PCPS_8MS_ACQUISITION_CC_H

View File

@ -23,10 +23,11 @@
*/
#include "pcps_acquisition.h"
#include "GLONASS_L1_L2_CA.h" // for GLONASS_TWO_PI
#include "GPS_L1_CA.h" // for GPS_TWO_PI
#include "GLONASS_L1_L2_CA.h" // for GLONASS_PRN
#include "MATH_CONSTANTS.h" // for TWO_PI
#include "gnss_frequencies.h"
#include "gnss_sdr_create_directory.h"
#include "gnss_sdr_make_unique.h"
#include "gnss_synchro.h"
#if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
@ -74,15 +75,15 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
{
this->message_port_register_out(pmt::mp("events"));
acq_parameters = conf_;
d_acq_parameters = conf_;
d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false;
d_positive_acq = 0;
d_state = 0;
d_doppler_bias = 0;
d_num_noncoherent_integrations_counter = 0U;
d_consumed_samples = acq_parameters.sampled_ms * acq_parameters.samples_per_ms * (acq_parameters.bit_transition_flag ? 2 : 1);
if (acq_parameters.sampled_ms == acq_parameters.ms_per_code)
d_consumed_samples = d_acq_parameters.sampled_ms * d_acq_parameters.samples_per_ms * (d_acq_parameters.bit_transition_flag ? 2.0 : 1.0);
if (d_acq_parameters.sampled_ms == d_acq_parameters.ms_per_code)
{
d_fft_size = d_consumed_samples;
}
@ -95,7 +96,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
d_input_power = 0.0;
d_num_doppler_bins = 0U;
d_threshold = 0.0;
d_doppler_step = acq_parameters.doppler_step;
d_doppler_step = d_acq_parameters.doppler_step;
d_doppler_center = 0U;
d_doppler_center_step_two = 0.0;
d_test_statistics = 0.0;
@ -119,10 +120,10 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
//
// We can avoid this by doing linear correlation, effectively doubling the
// size of the input buffer and padding the code with zeros.
// if (acq_parameters.bit_transition_flag)
// if (d_acq_parameters.bit_transition_flag)
// {
// d_fft_size = d_consumed_samples * 2;
// acq_parameters.max_dwells = 1; // Activation of acq_parameters.bit_transition_flag invalidates the value of acq_parameters.max_dwells
// d_acq_parameters.max_dwells = 1; // Activation of d_acq_parameters.bit_transition_flag invalidates the value of d_acq_parameters.max_dwells
// }
d_tmp_buffer = volk_gnsssdr::vector<float>(d_fft_size);
@ -130,10 +131,10 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
d_input_signal = volk_gnsssdr::vector<std::complex<float>>(d_fft_size);
// Direct FFT
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
d_gnss_synchro = nullptr;
d_worker_active = false;
@ -142,18 +143,18 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
{
d_data_buffer_sc = volk_gnsssdr::vector<lv_16sc_t>(d_consumed_samples);
}
grid_ = arma::fmat();
narrow_grid_ = arma::fmat();
d_grid = arma::fmat();
d_narrow_grid = arma::fmat();
d_step_two = false;
d_num_doppler_bins_step2 = acq_parameters.num_doppler_bins_step2;
d_num_doppler_bins_step2 = d_acq_parameters.num_doppler_bins_step2;
d_samplesPerChip = acq_parameters.samples_per_chip;
d_samplesPerChip = d_acq_parameters.samples_per_chip;
d_buffer_count = 0U;
d_use_CFAR_algorithm_flag = acq_parameters.use_CFAR_algorithm_flag;
d_use_CFAR_algorithm_flag = d_acq_parameters.use_CFAR_algorithm_flag;
d_dump_number = 0LL;
d_dump_channel = acq_parameters.dump_channel;
d_dump = acq_parameters.dump;
d_dump_filename = acq_parameters.dump_filename;
d_dump_channel = d_acq_parameters.dump_channel;
d_dump = d_acq_parameters.dump;
d_dump_filename = d_acq_parameters.dump_filename;
if (d_dump)
{
std::string dump_path;
@ -181,7 +182,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
// create directory
if (!gnss_sdr_create_directory(dump_path))
{
std::cerr << "GNSS-SDR cannot create dump file for the Acquisition block. Wrong permissions?" << std::endl;
std::cerr << "GNSS-SDR cannot create dump file for the Acquisition block. Wrong permissions?\n";
d_dump = false;
}
}
@ -191,7 +192,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
void pcps_acquisition::set_resampler_latency(uint32_t latency_samples)
{
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
acq_parameters.resampler_latency_samples = latency_samples;
d_acq_parameters.resampler_latency_samples = latency_samples;
}
@ -207,7 +208,7 @@ void pcps_acquisition::set_local_code(std::complex<float>* code)
// [ 0 0 0 ... 0 c_0 c_1 ... c_L]
// where c_i is the local code and there are L zeros and L chips
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
if (acq_parameters.bit_transition_flag)
if (d_acq_parameters.bit_transition_flag)
{
int32_t offset = d_fft_size / 2;
std::fill_n(d_fft_if->get_inbuf(), offset, gr_complex(0.0, 0.0));
@ -215,7 +216,7 @@ void pcps_acquisition::set_local_code(std::complex<float>* code)
}
else
{
if (acq_parameters.sampled_ms == acq_parameters.ms_per_code)
if (d_acq_parameters.sampled_ms == d_acq_parameters.ms_per_code)
{
memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex) * d_consumed_samples);
}
@ -239,13 +240,13 @@ bool pcps_acquisition::is_fdma()
if (strcmp(d_gnss_synchro->Signal, "1G") == 0)
{
d_doppler_bias = static_cast<int32_t>(DFRQ1_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN));
DLOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_doppler_bias << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
DLOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_doppler_bias << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << '\n';
return true;
}
if (strcmp(d_gnss_synchro->Signal, "2G") == 0)
{
d_doppler_bias += static_cast<int32_t>(DFRQ2_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN));
DLOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_doppler_bias << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
DLOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_doppler_bias << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << '\n';
return true;
}
return false;
@ -255,13 +256,13 @@ bool pcps_acquisition::is_fdma()
void pcps_acquisition::update_local_carrier(own::span<gr_complex> carrier_vector, float freq)
{
float phase_step_rad;
if (acq_parameters.use_automatic_resampler)
if (d_acq_parameters.use_automatic_resampler)
{
phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(acq_parameters.resampled_fs);
phase_step_rad = static_cast<float>(TWO_PI) * freq / static_cast<float>(d_acq_parameters.resampled_fs);
}
else
{
phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(acq_parameters.fs_in);
phase_step_rad = static_cast<float>(TWO_PI) * freq / static_cast<float>(d_acq_parameters.fs_in);
}
std::array<float, 1> _phase{};
volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase.data(), carrier_vector.size());
@ -281,14 +282,14 @@ void pcps_acquisition::init()
d_mag = 0.0;
d_input_power = 0.0;
d_num_doppler_bins = static_cast<uint32_t>(std::ceil(static_cast<double>(static_cast<int32_t>(acq_parameters.doppler_max) - static_cast<int32_t>(-acq_parameters.doppler_max)) / static_cast<double>(d_doppler_step)));
d_num_doppler_bins = static_cast<uint32_t>(std::ceil(static_cast<double>(static_cast<int32_t>(d_acq_parameters.doppler_max) - static_cast<int32_t>(-d_acq_parameters.doppler_max)) / static_cast<double>(d_doppler_step)));
// Create the carrier Doppler wipeoff signals
if (d_grid_doppler_wipeoffs.empty())
{
d_grid_doppler_wipeoffs = volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>>(d_num_doppler_bins, volk_gnsssdr::vector<std::complex<float>>(d_fft_size));
}
if (acq_parameters.make_2_steps && (d_grid_doppler_wipeoffs_step_two.empty()))
if (d_acq_parameters.make_2_steps && (d_grid_doppler_wipeoffs_step_two.empty()))
{
d_grid_doppler_wipeoffs_step_two = volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>>(d_num_doppler_bins_step2, volk_gnsssdr::vector<std::complex<float>>(d_fft_size));
}
@ -308,9 +309,9 @@ void pcps_acquisition::init()
if (d_dump)
{
uint32_t effective_fft_size = (acq_parameters.bit_transition_flag ? (d_fft_size / 2) : d_fft_size);
grid_ = arma::fmat(effective_fft_size, d_num_doppler_bins, arma::fill::zeros);
narrow_grid_ = arma::fmat(effective_fft_size, d_num_doppler_bins_step2, arma::fill::zeros);
uint32_t effective_fft_size = (d_acq_parameters.bit_transition_flag ? (d_fft_size / 2) : d_fft_size);
d_grid = arma::fmat(effective_fft_size, d_num_doppler_bins, arma::fill::zeros);
d_narrow_grid = arma::fmat(effective_fft_size, d_num_doppler_bins_step2, arma::fill::zeros);
}
}
@ -319,8 +320,8 @@ void pcps_acquisition::update_grid_doppler_wipeoffs()
{
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_center + d_doppler_step * doppler_index;
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_doppler_bias + doppler);
int32_t doppler = -static_cast<int32_t>(d_acq_parameters.doppler_max) + d_doppler_center + d_doppler_step * doppler_index;
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], static_cast<float>(d_doppler_bias + doppler));
}
}
@ -329,7 +330,7 @@ void pcps_acquisition::update_grid_doppler_wipeoffs_step2()
{
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++)
{
float doppler = (static_cast<float>(doppler_index) - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0))) * acq_parameters.doppler_step2;
float doppler = (static_cast<float>(doppler_index) - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0))) * d_acq_parameters.doppler_step2;
update_local_carrier(d_grid_doppler_wipeoffs_step_two[doppler_index], d_doppler_center_step_two + doppler);
}
}
@ -425,19 +426,19 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
mat_t* matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (matfp == nullptr)
{
std::cout << "Unable to create or open Acquisition dump file" << std::endl;
// acq_parameters.dump = false;
std::cout << "Unable to create or open Acquisition dump file\n";
// d_acq_parameters.dump = false;
}
else
{
std::array<size_t, 2> dims{static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_bins)};
matvar_t* matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), grid_.memptr(), 0);
matvar_t* matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), d_grid.memptr(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
dims[0] = static_cast<size_t>(1);
dims[1] = static_cast<size_t>(1);
matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &acq_parameters.doppler_max, 0);
matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_acq_parameters.doppler_max, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
@ -483,21 +484,21 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
if (acq_parameters.make_2_steps)
if (d_acq_parameters.make_2_steps)
{
dims[0] = static_cast<size_t>(effective_fft_size);
dims[1] = static_cast<size_t>(d_num_doppler_bins_step2);
matvar = Mat_VarCreate("acq_grid_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), narrow_grid_.memptr(), 0);
matvar = Mat_VarCreate("acq_grid_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), d_narrow_grid.memptr(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
dims[0] = static_cast<size_t>(1);
dims[1] = static_cast<size_t>(1);
matvar = Mat_VarCreate("doppler_step_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &acq_parameters.doppler_step2, 0);
matvar = Mat_VarCreate("doppler_step_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &d_acq_parameters.doppler_step2, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
aux = d_doppler_center_step_two - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0)) * acq_parameters.doppler_step2;
aux = d_doppler_center_step_two - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0)) * d_acq_parameters.doppler_step2;
matvar = Mat_VarCreate("doppler_grid_narrow_min", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar);
@ -514,7 +515,7 @@ float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int32_t&
uint32_t index_doppler = 0U;
uint32_t tmp_intex_t = 0U;
uint32_t index_time = 0U;
int32_t effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size);
int32_t effective_fft_size = (d_acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size);
// Find the correlation peak and the carrier frequency
for (uint32_t i = 0; i < num_doppler_bins; i++)
@ -530,13 +531,13 @@ float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int32_t&
indext = index_time;
if (!d_step_two)
{
int index_opp = (index_doppler + d_num_doppler_bins / 2) % d_num_doppler_bins;
d_input_power = std::accumulate(d_magnitude_grid[index_opp].data(), d_magnitude_grid[index_opp].data() + effective_fft_size, 0.0) / effective_fft_size / 2.0 / d_num_noncoherent_integrations_counter;
auto index_opp = (index_doppler + d_num_doppler_bins / 2) % d_num_doppler_bins;
d_input_power = static_cast<float>(std::accumulate(d_magnitude_grid[index_opp].data(), d_magnitude_grid[index_opp].data() + effective_fft_size, static_cast<float>(0.0)) / effective_fft_size / 2.0 / d_num_noncoherent_integrations_counter);
doppler = -static_cast<int32_t>(doppler_max) + d_doppler_center + doppler_step * static_cast<int32_t>(index_doppler);
}
else
{
doppler = static_cast<int32_t>(d_doppler_center_step_two + (static_cast<float>(index_doppler) - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0))) * acq_parameters.doppler_step2);
doppler = static_cast<int32_t>(d_doppler_center_step_two + (static_cast<float>(index_doppler) - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0))) * d_acq_parameters.doppler_step2);
}
return grid_maximum / d_input_power;
@ -573,7 +574,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
}
else
{
doppler = static_cast<int32_t>(d_doppler_center_step_two + (static_cast<float>(index_doppler) - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0))) * acq_parameters.doppler_step2);
doppler = static_cast<int32_t>(d_doppler_center_step_two + (static_cast<float>(index_doppler) - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0))) * d_acq_parameters.doppler_step2);
}
// Find 1 chip wide code phase exclude range around the peak
@ -619,7 +620,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
// Initialize acquisition algorithm
int32_t doppler = 0;
uint32_t indext = 0U;
int32_t effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size);
int32_t effective_fft_size = (d_acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size);
if (d_cshort)
{
volk_gnsssdr_16ic_convert_32fc(d_data_buffer.data(), d_data_buffer_sc.data(), d_consumed_samples);
@ -640,7 +641,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
DLOG(INFO) << "Channel: " << d_channel
<< " , doing acquisition of satellite: " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN
<< " ,sample stamp: " << samp_count << ", threshold: "
<< d_threshold << ", doppler_max: " << acq_parameters.doppler_max
<< d_threshold << ", doppler_max: " << d_acq_parameters.doppler_max
<< ", doppler_step: " << d_doppler_step
<< ", use_CFAR_algorithm_flag: " << (d_use_CFAR_algorithm_flag ? "true" : "false");
@ -665,7 +666,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
d_ifft->execute();
// Compute squared magnitude (and accumulate in case of non-coherent integration)
size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0);
size_t offset = (d_acq_parameters.bit_transition_flag ? effective_fft_size : 0);
if (d_num_noncoherent_integrations_counter == 1)
{
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index].data(), d_ifft->get_outbuf() + offset, effective_fft_size);
@ -678,30 +679,30 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
// Record results to file if required
if (d_dump and d_channel == d_dump_channel)
{
memcpy(grid_.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size);
memcpy(d_grid.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size);
}
}
// Compute the test statistic
if (d_use_CFAR_algorithm_flag)
{
d_test_statistics = max_to_input_power_statistic(indext, doppler, d_num_doppler_bins, acq_parameters.doppler_max, d_doppler_step);
d_test_statistics = max_to_input_power_statistic(indext, doppler, d_num_doppler_bins, d_acq_parameters.doppler_max, d_doppler_step);
}
else
{
d_test_statistics = first_vs_second_peak_statistic(indext, doppler, d_num_doppler_bins, acq_parameters.doppler_max, d_doppler_step);
d_test_statistics = first_vs_second_peak_statistic(indext, doppler, d_num_doppler_bins, d_acq_parameters.doppler_max, d_doppler_step);
}
if (acq_parameters.use_automatic_resampler)
if (d_acq_parameters.use_automatic_resampler)
{
// take into account the acquisition resampler ratio
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code)) * acq_parameters.resampler_ratio;
d_gnss_synchro->Acq_delay_samples -= static_cast<double>(acq_parameters.resampler_latency_samples); // account the resampler filter latency
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), d_acq_parameters.samples_per_code)) * d_acq_parameters.resampler_ratio;
d_gnss_synchro->Acq_delay_samples -= static_cast<double>(d_acq_parameters.resampler_latency_samples); // account the resampler filter latency
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast<double>(samp_count) * acq_parameters.resampler_ratio);
d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast<double>(samp_count) * d_acq_parameters.resampler_ratio);
}
else
{
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code));
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), d_acq_parameters.samples_per_code));
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
d_gnss_synchro->Acq_samplestamp_samples = samp_count;
}
@ -723,7 +724,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
// compute the inverse FFT
d_ifft->execute();
size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0);
size_t offset = (d_acq_parameters.bit_transition_flag ? effective_fft_size : 0);
if (d_num_noncoherent_integrations_counter == 1)
{
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index].data(), d_ifft->get_outbuf() + offset, effective_fft_size);
@ -736,44 +737,44 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
// Record results to file if required
if (d_dump and d_channel == d_dump_channel)
{
memcpy(narrow_grid_.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size);
memcpy(d_narrow_grid.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size);
}
}
// Compute the test statistic
if (d_use_CFAR_algorithm_flag)
{
d_test_statistics = max_to_input_power_statistic(indext, doppler, d_num_doppler_bins_step2, static_cast<int32_t>(d_doppler_center_step_two - (static_cast<float>(d_num_doppler_bins_step2) / 2.0) * acq_parameters.doppler_step2), acq_parameters.doppler_step2);
d_test_statistics = max_to_input_power_statistic(indext, doppler, d_num_doppler_bins_step2, static_cast<int32_t>(d_doppler_center_step_two - (static_cast<float>(d_num_doppler_bins_step2) / 2.0) * d_acq_parameters.doppler_step2), d_acq_parameters.doppler_step2);
}
else
{
d_test_statistics = first_vs_second_peak_statistic(indext, doppler, d_num_doppler_bins_step2, static_cast<int32_t>(d_doppler_center_step_two - (static_cast<float>(d_num_doppler_bins_step2) / 2.0) * acq_parameters.doppler_step2), acq_parameters.doppler_step2);
d_test_statistics = first_vs_second_peak_statistic(indext, doppler, d_num_doppler_bins_step2, static_cast<int32_t>(d_doppler_center_step_two - (static_cast<float>(d_num_doppler_bins_step2) / 2.0) * d_acq_parameters.doppler_step2), d_acq_parameters.doppler_step2);
}
if (acq_parameters.use_automatic_resampler)
if (d_acq_parameters.use_automatic_resampler)
{
// take into account the acquisition resampler ratio
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code)) * acq_parameters.resampler_ratio;
d_gnss_synchro->Acq_delay_samples -= static_cast<double>(acq_parameters.resampler_latency_samples); // account the resampler filter latency
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), d_acq_parameters.samples_per_code)) * d_acq_parameters.resampler_ratio;
d_gnss_synchro->Acq_delay_samples -= static_cast<double>(d_acq_parameters.resampler_latency_samples); // account the resampler filter latency
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast<double>(samp_count) * acq_parameters.resampler_ratio);
d_gnss_synchro->Acq_doppler_step = acq_parameters.doppler_step2;
d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast<double>(samp_count) * d_acq_parameters.resampler_ratio);
d_gnss_synchro->Acq_doppler_step = d_acq_parameters.doppler_step2;
}
else
{
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code));
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), d_acq_parameters.samples_per_code));
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
d_gnss_synchro->Acq_samplestamp_samples = samp_count;
d_gnss_synchro->Acq_doppler_step = acq_parameters.doppler_step2;
d_gnss_synchro->Acq_doppler_step = d_acq_parameters.doppler_step2;
}
}
lk.lock();
if (!acq_parameters.bit_transition_flag)
if (!d_acq_parameters.bit_transition_flag)
{
if (d_test_statistics > d_threshold)
{
d_active = false;
if (acq_parameters.make_2_steps)
if (d_acq_parameters.make_2_steps)
{
if (d_step_two)
{
@ -802,7 +803,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
d_state = 1;
}
if (d_num_noncoherent_integrations_counter == acq_parameters.max_dwells)
if (d_num_noncoherent_integrations_counter == d_acq_parameters.max_dwells)
{
if (d_state != 0)
{
@ -823,7 +824,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
d_active = false;
if (d_test_statistics > d_threshold)
{
if (acq_parameters.make_2_steps)
if (d_acq_parameters.make_2_steps)
{
if (d_step_two)
{
@ -859,7 +860,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
}
d_worker_active = false;
if ((d_num_noncoherent_integrations_counter == acq_parameters.max_dwells) or (d_positive_acq == 1))
if ((d_num_noncoherent_integrations_counter == d_acq_parameters.max_dwells) or (d_positive_acq == 1))
{
// Record results to file if required
if (d_dump and d_channel == d_dump_channel)
@ -883,19 +884,19 @@ bool pcps_acquisition::start()
void pcps_acquisition::calculate_threshold()
{
float pfa = (d_step_two ? acq_parameters.pfa2 : acq_parameters.pfa);
float pfa = (d_step_two ? d_acq_parameters.pfa2 : d_acq_parameters.pfa);
if (pfa <= 0.0)
{
return;
}
int effective_fft_size = (acq_parameters.bit_transition_flag ? (d_fft_size / 2) : d_fft_size);
auto effective_fft_size = static_cast<int>(d_acq_parameters.bit_transition_flag ? (d_fft_size / 2) : d_fft_size);
int num_doppler_bins = (d_step_two ? d_num_doppler_bins_step2 : d_num_doppler_bins);
int num_bins = effective_fft_size * num_doppler_bins;
d_threshold = 2.0 * boost::math::gamma_p_inv(2.0 * acq_parameters.max_dwells, std::pow(1.0 - pfa, 1.0 / static_cast<float>(num_bins)));
d_threshold = static_cast<float>(2.0 * boost::math::gamma_p_inv(2.0 * d_acq_parameters.max_dwells, std::pow(1.0 - pfa, 1.0 / static_cast<float>(num_bins))));
}
@ -917,7 +918,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
gr::thread::scoped_lock lk(d_setlock);
if (!d_active or d_worker_active)
{
if (!acq_parameters.blocking_on_standby)
if (!d_acq_parameters.blocking_on_standby)
{
d_sample_counter += static_cast<uint64_t>(ninput_items[0]);
consume_each(ninput_items[0]);
@ -944,7 +945,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
d_mag = 0.0;
d_state = 1;
d_buffer_count = 0U;
if (!acq_parameters.blocking_on_standby)
if (!d_acq_parameters.blocking_on_standby)
{
d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]);
@ -994,7 +995,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
case 2:
{
// Copy the data to the core and let it know that new data is available
if (acq_parameters.blocking)
if (d_acq_parameters.blocking)
{
lk.unlock();
acquisition_core(d_sample_counter);

View File

@ -97,6 +97,11 @@ class pcps_acquisition : public gr::block
public:
~pcps_acquisition() = default;
/*!
* \brief Initializes acquisition algorithm and reserves memory.
*/
void init();
/*!
* \brief Set acquisition/tracking common Gnss_Synchro object pointer
* to exchange synchronization data between acquisition and tracking blocks.
@ -108,6 +113,21 @@ public:
d_gnss_synchro = p_gnss_synchro;
}
/*!
* \brief Sets local code for PCPS acquisition algorithm.
* \param code - Pointer to the PRN code.
*/
void set_local_code(std::complex<float>* code);
/*!
* \brief If set to 1, ensures that acquisition starts at the
* first available sample.
* \param state - int=1 forces start of acquisition
*/
void set_state(int32_t state);
void set_resampler_latency(uint32_t latency_samples);
/*!
* \brief Returns the maximum peak of grid search.
*/
@ -116,17 +136,6 @@ public:
return d_mag;
}
/*!
* \brief Initializes acquisition algorithm and reserves memory.
*/
void init();
/*!
* \brief Sets local code for PCPS acquisition algorithm.
* \param code - Pointer to the PRN code.
*/
void set_local_code(std::complex<float>* code);
/*!
* \brief Starts acquisition algorithm, turning from standby mode to
* active mode
@ -138,13 +147,6 @@ public:
d_active = active;
}
/*!
* \brief If set to 1, ensures that acquisition starts at the
* first available sample.
* \param state - int=1 forces start of acquisition
*/
void set_state(int32_t state);
/*!
* \brief Set acquisition channel unique ID
* \param channel - receiver channel.
@ -180,7 +182,7 @@ public:
inline void set_doppler_max(uint32_t doppler_max)
{
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
acq_parameters.doppler_max = doppler_max;
d_acq_parameters.doppler_max = doppler_max;
}
/*!
@ -208,8 +210,6 @@ public:
}
}
void set_resampler_latency(uint32_t latency_samples);
/*!
* \brief Parallel Code Phase Search Acquisition signal processing.
*/
@ -220,49 +220,7 @@ public:
private:
friend pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_);
explicit pcps_acquisition(const Acq_Conf& conf_);
bool d_active;
bool d_worker_active;
bool d_cshort;
bool d_step_two;
bool d_use_CFAR_algorithm_flag;
bool d_dump;
int32_t d_state;
int32_t d_positive_acq;
uint32_t d_channel;
uint32_t d_samplesPerChip;
uint32_t d_doppler_step;
int32_t d_doppler_center;
int32_t d_doppler_bias;
uint32_t d_num_noncoherent_integrations_counter;
uint32_t d_fft_size;
uint32_t d_consumed_samples;
uint32_t d_num_doppler_bins;
uint32_t d_num_doppler_bins_step2;
uint32_t d_dump_channel;
uint32_t d_buffer_count;
uint64_t d_sample_counter;
int64_t d_dump_number;
float d_threshold;
float d_mag;
float d_input_power;
float d_test_statistics;
float d_doppler_center_step_two;
std::string d_dump_filename;
volk_gnsssdr::vector<volk_gnsssdr::vector<float>> d_magnitude_grid;
volk_gnsssdr::vector<float> d_tmp_buffer;
volk_gnsssdr::vector<std::complex<float>> d_input_signal;
volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>> d_grid_doppler_wipeoffs_step_two;
volk_gnsssdr::vector<std::complex<float>> d_fft_codes;
volk_gnsssdr::vector<std::complex<float>> d_data_buffer;
volk_gnsssdr::vector<lv_16sc_t> d_data_buffer_sc;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
std::weak_ptr<ChannelFsm> d_channel_fsm;
Acq_Conf acq_parameters;
Gnss_Synchro* d_gnss_synchro;
arma::fmat grid_;
arma::fmat narrow_grid_;
void update_local_carrier(own::span<gr_complex> carrier_vector, float freq);
void update_grid_doppler_wipeoffs();
void update_grid_doppler_wipeoffs_step2();
@ -275,6 +233,57 @@ private:
void calculate_threshold(void);
float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
float max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
volk_gnsssdr::vector<volk_gnsssdr::vector<float>> d_magnitude_grid;
volk_gnsssdr::vector<float> d_tmp_buffer;
volk_gnsssdr::vector<std::complex<float>> d_input_signal;
volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>> d_grid_doppler_wipeoffs_step_two;
volk_gnsssdr::vector<std::complex<float>> d_fft_codes;
volk_gnsssdr::vector<std::complex<float>> d_data_buffer;
volk_gnsssdr::vector<lv_16sc_t> d_data_buffer_sc;
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
std::weak_ptr<ChannelFsm> d_channel_fsm;
Acq_Conf d_acq_parameters;
Gnss_Synchro* d_gnss_synchro;
arma::fmat d_grid;
arma::fmat d_narrow_grid;
std::string d_dump_filename;
int64_t d_dump_number;
uint64_t d_sample_counter;
float d_threshold;
float d_mag;
float d_input_power;
float d_test_statistics;
float d_doppler_center_step_two;
int32_t d_state;
int32_t d_positive_acq;
int32_t d_doppler_center;
int32_t d_doppler_bias;
uint32_t d_channel;
uint32_t d_samplesPerChip;
uint32_t d_doppler_step;
uint32_t d_num_noncoherent_integrations_counter;
uint32_t d_fft_size;
uint32_t d_consumed_samples;
uint32_t d_num_doppler_bins;
uint32_t d_num_doppler_bins_step2;
uint32_t d_dump_channel;
uint32_t d_buffer_count;
bool d_active;
bool d_worker_active;
bool d_cshort;
bool d_step_two;
bool d_use_CFAR_algorithm_flag;
bool d_dump;
};
#endif // GNSS_SDR_PCPS_ACQUISITION_H

View File

@ -20,8 +20,9 @@
*/
#include "pcps_acquisition_fine_doppler_cc.h"
#include "GPS_L1_CA.h"
#include "GPS_L1_CA.h" // for GPS_L1_CA_CHIP_PERIOD_S
#include "gnss_sdr_create_directory.h"
#include "gnss_sdr_make_unique.h"
#include "gps_sdr_signal_processing.h"
#if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
@ -69,7 +70,7 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false;
d_fs_in = conf_.fs_in;
d_samples_per_ms = conf_.samples_per_ms;
d_samples_per_ms = static_cast<int>(conf_.samples_per_ms);
d_config_doppler_max = conf_.doppler_max;
d_fft_size = d_samples_per_ms;
// HS Acquisition
@ -80,10 +81,10 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
d_magnitude.reserve(d_fft_size);
d_10_ms_buffer.reserve(50 * d_samples_per_ms);
// Direct FFT
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
// For dumping samples into a file
d_dump = conf_.dump;
@ -116,7 +117,7 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
// create directory
if (!gnss_sdr_create_directory(dump_path))
{
std::cerr << "GNSS-SDR cannot create dump file for the Acquisition block. Wrong permissions?" << std::endl;
std::cerr << "GNSS-SDR cannot create dump file for the Acquisition block. Wrong permissions?\n";
d_dump = false;
}
}
@ -211,7 +212,7 @@ void pcps_acquisition_fine_doppler_cc::reset_grid()
for (int i = 0; i < d_num_doppler_points; i++)
{
// todo: use memset here
for (unsigned int j = 0; j < d_fft_size; j++)
for (int j = 0; j < d_fft_size; j++)
{
d_grid_data[i][j] = 0.0;
}
@ -227,10 +228,10 @@ void pcps_acquisition_fine_doppler_cc::update_carrier_wipeoff()
d_grid_doppler_wipeoffs = volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>>(d_num_doppler_points, volk_gnsssdr::vector<std::complex<float>>(d_fft_size));
for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
{
doppler_hz = d_doppler_step * doppler_index - d_config_doppler_max;
doppler_hz = static_cast<int>(d_doppler_step) * doppler_index - d_config_doppler_max;
// doppler search steps
// compute the carrier doppler wipe-off signal and store it
phase_step_rad = static_cast<float>(GPS_TWO_PI) * doppler_hz / static_cast<float>(d_fs_in);
phase_step_rad = static_cast<float>(TWO_PI) * static_cast<float>(doppler_hz) / static_cast<float>(d_fs_in);
float _phase[1];
_phase[0] = 0;
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase, d_fft_size);
@ -238,7 +239,7 @@ void pcps_acquisition_fine_doppler_cc::update_carrier_wipeoff()
}
double pcps_acquisition_fine_doppler_cc::compute_CAF()
float pcps_acquisition_fine_doppler_cc::compute_CAF()
{
float firstPeak = 0.0;
int index_doppler = 0;
@ -379,7 +380,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
int signal_samples = prn_replicas * d_fft_size;
// int fft_size_extended = nextPowerOf2(signal_samples * zero_padding_factor);
int fft_size_extended = signal_samples * zero_padding_factor;
auto fft_operator = std::make_shared<gr::fft::fft_complex>(fft_size_extended, true);
auto fft_operator = std::make_unique<gr::fft::fft_complex>(fft_size_extended, true);
// zero padding the entire vector
std::fill_n(fft_operator->get_inbuf(), fft_size_extended, gr_complex(0.0, 0.0));
@ -433,7 +434,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
if (std::abs(fftFreqBins[tmp_index_freq] - d_gnss_synchro->Acq_doppler_hz) < 1000)
{
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(fftFreqBins[tmp_index_freq]);
// std::cout << "FFT maximum present at " << fftFreqBins[tmp_index_freq] << " [Hz]" << std::endl;
// std::cout << "FFT maximum present at " << fftFreqBins[tmp_index_freq] << " [Hz]\n";
}
else
{
@ -641,7 +642,7 @@ void pcps_acquisition_fine_doppler_cc::dump_results(int effective_fft_size)
mat_t *matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (matfp == nullptr)
{
std::cout << "Unable to create or open Acquisition dump file" << std::endl;
std::cout << "Unable to create or open Acquisition dump file\n";
d_dump = false;
}
else

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