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

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

This commit is contained in:
Carles Fernandez 2020-07-11 11:37:54 +02:00
commit e13d0c2b76
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
497 changed files with 7557 additions and 7441 deletions

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)
@ -245,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()
@ -886,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
################################################################################
@ -1526,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()

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.
@ -37,21 +47,26 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc
requirements, with more intuitive naming for variables; fixed the
`ENABLE_CLANG_TIDY` option; better GFORTRAN module; and broader adoption of
the modern per-target approach.
- Add a new building option `ENABLE_BENCHMARKS` which activates the building of
benchmarks for some code snippets.
### 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:
@ -68,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

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

View File

@ -179,7 +179,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
// create directory
if (!gnss_sdr_create_directory(dump_path))
{
std::cerr << "GNSS-SDR cannot create dump file for the PVT block. Wrong permissions?" << std::endl;
std::cerr << "GNSS-SDR cannot create dump file for the PVT block. Wrong permissions?\n";
d_dump = false;
}
}
@ -382,7 +382,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
{
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";
d_xml_base_path = full_path.string();
}
}
@ -395,7 +395,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
}
if (d_xml_base_path != ".")
{
std::cout << "XML files will be stored at " << d_xml_base_path << std::endl;
std::cout << "XML files will be stored at " << d_xml_base_path << '\n';
}
d_xml_base_path = d_xml_base_path + fs::path::preferred_separator;
@ -426,8 +426,8 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
int msgflg = IPC_CREAT | 0666;
if ((d_sysv_msqid = msgget(d_sysv_msg_key, msgflg)) == -1)
{
std::cout << "GNSS-SDR cannot create System V message queues." << std::endl;
LOG(WARNING) << "The System V message queue is not available. Error: " << errno << " - " << strerror(errno) << std::endl;
std::cout << "GNSS-SDR cannot create System V message queues.\n";
LOG(WARNING) << "The System V message queue is not available. Error: " << errno << " - " << strerror(errno);
}
// Display time in local time zone
@ -501,6 +501,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
rtklib_pvt_gs::~rtklib_pvt_gs()
{
DLOG(INFO) << "PVT block destructor called.";
if (d_sysv_msqid != -1)
{
msgctl(d_sysv_msqid, IPC_RMID, nullptr);
@ -1089,17 +1090,11 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
switch (d_type_of_rx)
{
case 1: // GPS L1 C/A only
d_rp->log_rinex_nav(d_rp->navFile, new_eph);
break;
case 8: // L1+L5
d_rp->log_rinex_nav(d_rp->navFile, new_eph);
break;
case 9: // GPS L1 C/A + Galileo E1B
d_rp->log_rinex_nav(d_rp->navMixFile, new_eph, new_gal_eph);
break;
case 9: // GPS L1 C/A + Galileo E1B
case 10: // GPS L1 C/A + Galileo E5a
d_rp->log_rinex_nav(d_rp->navMixFile, new_eph, new_gal_eph);
break;
case 11: // GPS L1 C/A + Galileo E5b
d_rp->log_rinex_nav(d_rp->navMixFile, new_eph, new_gal_eph);
break;
@ -1124,8 +1119,6 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
}
break;
case 32: // L1+E1+L5+E5a
d_rp->log_rinex_nav(d_rp->navMixFile, new_eph, new_gal_eph);
break;
case 33: // L1+E1+E5a
d_rp->log_rinex_nav(d_rp->navMixFile, new_eph, new_gal_eph);
break;
@ -1200,11 +1193,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
switch (d_type_of_rx)
{
case 2: // GPS L2C only
d_rp->log_rinex_nav(d_rp->navFile, new_cnav_eph);
break;
case 3: // GPS L5 only
d_rp->log_rinex_nav(d_rp->navFile, new_cnav_eph);
break;
case 7: // GPS L1 C/A + GPS L2C
d_rp->log_rinex_nav(d_rp->navFile, new_cnav_eph);
break;
@ -1212,8 +1201,6 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
d_rp->log_rinex_nav(d_rp->navMixFile, new_cnav_eph, new_gal_eph);
break;
case 28: // GPS L2C + GLONASS L1 C/A
d_rp->log_rinex_nav(d_rp->navMixFile, new_cnav_eph, new_glo_eph);
break;
case 31: // GPS L2C + GLONASS L2 C/A
d_rp->log_rinex_nav(d_rp->navMixFile, new_cnav_eph, new_glo_eph);
break;
@ -1302,20 +1289,12 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
switch (d_type_of_rx)
{
case 4: // Galileo E1B only
d_rp->log_rinex_nav(d_rp->navGalFile, new_gal_eph);
break;
case 5: // Galileo E5a only
d_rp->log_rinex_nav(d_rp->navGalFile, new_gal_eph);
break;
case 6: // Galileo E5b only
d_rp->log_rinex_nav(d_rp->navGalFile, new_gal_eph);
break;
case 9: // GPS L1 C/A + Galileo E1B
d_rp->log_rinex_nav(d_rp->navMixFile, new_eph, new_gal_eph);
break;
case 9: // GPS L1 C/A + Galileo E1B
case 10: // GPS L1 C/A + Galileo E5a
d_rp->log_rinex_nav(d_rp->navMixFile, new_eph, new_gal_eph);
break;
case 11: // GPS L1 C/A + Galileo E5b
d_rp->log_rinex_nav(d_rp->navMixFile, new_eph, new_gal_eph);
break;
@ -1326,17 +1305,11 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
d_rp->log_rinex_nav(d_rp->navGalFile, new_gal_eph);
break;
case 27: // Galileo E1B + GLONASS L1 C/A
d_rp->log_rinex_nav(d_rp->navMixFile, new_gal_eph, new_glo_eph);
break;
case 30: // Galileo E1B + GLONASS L2 C/A
d_rp->log_rinex_nav(d_rp->navMixFile, new_gal_eph, new_glo_eph);
break;
case 32: // L1+E1+L5+E5a
d_rp->log_rinex_nav(d_rp->navMixFile, new_eph, new_gal_eph);
break;
case 33: // L1+E1+E5a
d_rp->log_rinex_nav(d_rp->navMixFile, new_eph, new_gal_eph);
break;
case 32: // L1+E1+L5+E5a
case 33: // L1+E1+E5a
case 1001: // L1+E1+L2+L5+E5a
d_rp->log_rinex_nav(d_rp->navMixFile, new_eph, new_gal_eph);
break;
@ -1462,11 +1435,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
switch (d_type_of_rx)
{
case 23: // GLONASS L1 C/A
d_rp->log_rinex_nav(d_rp->navGloFile, new_glo_eph);
break;
case 24: // GLONASS L2 C/A
d_rp->log_rinex_nav(d_rp->navGloFile, new_glo_eph);
break;
case 25: // GLONASS L1 C/A + GLONASS L2 C/A
d_rp->log_rinex_nav(d_rp->navGloFile, new_glo_eph);
break;
@ -1573,8 +1542,6 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
switch (d_type_of_rx)
{
case 500: // BDS B1I only
d_rp->log_rinex_nav(d_rp->navFile, new_bds_eph);
break;
case 600: // BDS B3I only
d_rp->log_rinex_nav(d_rp->navFile, new_bds_eph);
break;
@ -1748,7 +1715,7 @@ bool rtklib_pvt_gs::load_gnss_synchro_map_xml(const std::string& file_name)
boost::archive::xml_iarchive xml(ifs);
d_gnss_observables_map.clear();
xml >> boost::serialization::make_nvp("GNSS-SDR_gnss_synchro_map", d_gnss_observables_map);
// std::cout << "Loaded gnss_synchro map data with " << gnss_synchro_map.size() << " pseudoranges" << std::endl;
// std::cout << "Loaded gnss_synchro map data with " << gnss_synchro_map.size() << " pseudoranges\n";
}
catch (const std::exception& e)
{
@ -1824,42 +1791,36 @@ void rtklib_pvt_gs::apply_rx_clock_offset(std::map<int, Gnss_Synchro>& observabl
{
// all observables in the map are valid
observables_iter->second.RX_time -= rx_clock_offset_s;
observables_iter->second.Pseudorange_m -= rx_clock_offset_s * SPEED_OF_LIGHT;
observables_iter->second.Pseudorange_m -= rx_clock_offset_s * SPEED_OF_LIGHT_M_S;
switch (d_mapStringValues[observables_iter->second.Signal])
{
case evGPS_1C:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ1 * PI_2;
case evSBAS_1C:
case evGAL_1B:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ1 * TWO_PI;
break;
case evGPS_L5:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ5 * PI_2;
break;
case evSBAS_1C:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ1 * PI_2;
break;
case evGAL_1B:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ1 * PI_2;
break;
case evGAL_5X:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ5 * PI_2;
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ5 * TWO_PI;
break;
case evGPS_2S:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ2 * PI_2;
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ2 * TWO_PI;
break;
case evBDS_B3:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ3_BDS * PI_2;
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ3_BDS * TWO_PI;
break;
case evGLO_1G:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ1_GLO * PI_2;
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ1_GLO * TWO_PI;
break;
case evGLO_2G:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ2_GLO * PI_2;
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ2_GLO * TWO_PI;
break;
case evBDS_B1:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ1_BDS * PI_2;
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ1_BDS * TWO_PI;
break;
case evBDS_B2:
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ2_BDS * PI_2;
observables_iter->second.Carrier_phase_rads -= rx_clock_offset_s * FREQ2_BDS * TWO_PI;
break;
default:
break;
@ -1931,43 +1892,37 @@ void rtklib_pvt_gs::initialize_and_apply_carrier_phase_offset()
switch (d_mapStringValues[observables_iter->second.Signal])
{
case evGPS_1C:
wavelength_m = SPEED_OF_LIGHT / FREQ1;
case evSBAS_1C:
case evGAL_1B:
wavelength_m = SPEED_OF_LIGHT_M_S / FREQ1;
break;
case evGPS_L5:
wavelength_m = SPEED_OF_LIGHT / FREQ5;
break;
case evSBAS_1C:
wavelength_m = SPEED_OF_LIGHT / FREQ1;
break;
case evGAL_1B:
wavelength_m = SPEED_OF_LIGHT / FREQ1;
break;
case evGAL_5X:
wavelength_m = SPEED_OF_LIGHT / FREQ5;
wavelength_m = SPEED_OF_LIGHT_M_S / FREQ5;
break;
case evGPS_2S:
wavelength_m = SPEED_OF_LIGHT / FREQ2;
wavelength_m = SPEED_OF_LIGHT_M_S / FREQ2;
break;
case evBDS_B3:
wavelength_m = SPEED_OF_LIGHT / FREQ3_BDS;
wavelength_m = SPEED_OF_LIGHT_M_S / FREQ3_BDS;
break;
case evGLO_1G:
wavelength_m = SPEED_OF_LIGHT / FREQ1_GLO;
wavelength_m = SPEED_OF_LIGHT_M_S / FREQ1_GLO;
break;
case evGLO_2G:
wavelength_m = SPEED_OF_LIGHT / FREQ2_GLO;
wavelength_m = SPEED_OF_LIGHT_M_S / FREQ2_GLO;
break;
case evBDS_B1:
wavelength_m = SPEED_OF_LIGHT / FREQ1_BDS;
wavelength_m = SPEED_OF_LIGHT_M_S / FREQ1_BDS;
break;
case evBDS_B2:
wavelength_m = SPEED_OF_LIGHT / FREQ2_BDS;
wavelength_m = SPEED_OF_LIGHT_M_S / FREQ2_BDS;
break;
default:
break;
}
double wrap_carrier_phase_rad = fmod(observables_iter->second.Carrier_phase_rads, PI_2);
d_initial_carrier_phase_offset_estimation_rads.at(observables_iter->second.Channel_ID) = PI_2 * round(observables_iter->second.Pseudorange_m / wavelength_m) - observables_iter->second.Carrier_phase_rads + wrap_carrier_phase_rad;
double wrap_carrier_phase_rad = fmod(observables_iter->second.Carrier_phase_rads, TWO_PI);
d_initial_carrier_phase_offset_estimation_rads.at(observables_iter->second.Channel_ID) = TWO_PI * round(observables_iter->second.Pseudorange_m / wavelength_m) - observables_iter->second.Carrier_phase_rads + wrap_carrier_phase_rad;
d_channel_initialized.at(observables_iter->second.Channel_ID) = true;
DLOG(INFO) << "initialized carrier phase at channel " << observables_iter->second.Channel_ID;
}
@ -2087,12 +2042,12 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
}
catch (const boost::exception& ex)
{
std::cout << "RTCM boost exception: " << boost::diagnostic_information(ex) << std::endl;
std::cout << "RTCM boost exception: " << boost::diagnostic_information(ex) << '\n';
LOG(ERROR) << "RTCM boost exception: " << boost::diagnostic_information(ex);
}
catch (const std::exception& ex)
{
std::cout << "RTCM std exception: " << ex.what() << std::endl;
std::cout << "RTCM std exception: " << ex.what() << '\n';
LOG(ERROR) << "RTCM std exception: " << ex.what();
}
}
@ -2144,14 +2099,14 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
d_rx_time = static_cast<double>(current_RX_time_ms) / 1000.0;
// std::cout << " obs time t0: " << d_gnss_observables_map_t0.cbegin()->second.RX_time
// << " t1: " << d_gnss_observables_map_t1.cbegin()->second.RX_time
// << " interp time: " << d_rx_time << std::endl;
// << " interp time: " << d_rx_time << '\n';
d_gnss_observables_map = interpolate_observables(d_gnss_observables_map_t0,
d_gnss_observables_map_t1,
d_rx_time);
flag_compute_pvt_output = true;
// d_rx_time = current_RX_time;
// std::cout.precision(17);
// std::cout << "current_RX_time: " << current_RX_time << " map time: " << d_gnss_observables_map.begin()->second.RX_time << std::endl;
// std::cout << "current_RX_time: " << current_RX_time << " map time: " << d_gnss_observables_map.begin()->second.RX_time << '\n';
}
}
}
@ -2163,7 +2118,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
{
flag_compute_pvt_output = true;
// std::cout.precision(17);
// std::cout << "current_RX_time: " << current_RX_time << " map time: " << d_gnss_observables_map.begin()->second.RX_time << std::endl;
// std::cout << "current_RX_time: " << current_RX_time << " map time: " << d_gnss_observables_map.begin()->second.RX_time << '\n';
}
flag_pvt_valid = true;
}
@ -2198,7 +2153,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
DLOG(INFO) << "Rx clock offset at interpolated RX time: " << Rx_clock_offset_s * 1000.0 << "[s]"
<< " at RX time: " << static_cast<uint32_t>(d_rx_time * 1000.0) << " [ms]";
// Optional debug code: export observables snapshot for rtklib unit testing
// std::cout << "step 1: save gnss_synchro map" << std::endl;
// std::cout << "step 1: save gnss_synchro map\n";
// save_gnss_synchro_map_xml("./gnss_synchro_map.xml");
// getchar(); // stop the execution
// end debug
@ -2270,7 +2225,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
std::cout << "First position fix at " << d_user_pvt_solver->get_position_UTC_time() << " UTC";
}
std::cout << " is Lat = " << d_user_pvt_solver->get_latitude() << " [deg], Long = " << d_user_pvt_solver->get_longitude()
<< " [deg], Height= " << d_user_pvt_solver->get_height() << " [m]" << std::endl;
<< " [deg], Height= " << d_user_pvt_solver->get_height() << " [m]\n";
d_ttff_msgbuf ttff;
ttff.mtype = 1;
d_end = std::chrono::system_clock::now();
@ -2687,35 +2642,8 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
break;
case 503: // BeiDou B1I + GLONASS L1 C/A
if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
// d_rp->rinex_obs_header(d_rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1");
// d_rp->rinex_nav_header(d_rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model);
// d_rp->log_rinex_nav(d_rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map);
d_rinex_header_written = true; // do not write header anymore
}
break;
case 504: // BeiDou B1I + GPS L1 C/A + Galileo E1B
if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
// d_rp->rinex_obs_header(d_rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1");
// d_rp->rinex_nav_header(d_rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model);
// d_rp->log_rinex_nav(d_rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map);
d_rinex_header_written = true; // do not write header anymore
}
break;
case 505: // BeiDou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B
if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
// d_rp->rinex_obs_header(d_rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1");
// d_rp->rinex_nav_header(d_rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model);
// d_rp->log_rinex_nav(d_rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map);
d_rinex_header_written = true; // do not write header anymore
}
break;
case 506: // BeiDou B1I + Beidou B3I
if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
@ -2737,23 +2665,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
break;
case 601: // BeiDou B3I + GPS L2C
if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
d_rp->rinex_obs_header(d_rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3");
// d_rp->rinex_nav_header(d_rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model);
d_rinex_header_written = true; // do not write header anymore
}
break;
case 602: // BeiDou B3I + GLONASS L2 C/A
if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
d_rp->rinex_obs_header(d_rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3");
// d_rp->rinex_nav_header(d_rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model);
d_rinex_header_written = true; // do not write header anymore
}
break;
case 603: // BeiDou B3I + GPS L2C + GLONASS L2 C/A
if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
@ -2817,17 +2729,6 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
}
break;
case 2: // GPS L2C only
if (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())
{
d_rp->log_rinex_obs(d_rp->obsFile, gps_cnav_ephemeris_iter->second, d_rx_time, d_gnss_observables_map);
}
if (!d_rinex_header_updated and (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0))
{
d_rp->update_obs_header(d_rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model);
d_rp->update_nav_header(d_rp->navFile, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->gps_cnav_iono);
d_rinex_header_updated = true;
}
break;
case 3: // GPS L5
if (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())
{
@ -4210,12 +4111,12 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
}
catch (const boost::exception& ex)
{
std::cout << "RTCM boost exception: " << boost::diagnostic_information(ex) << std::endl;
std::cout << "RTCM boost exception: " << boost::diagnostic_information(ex) << '\n';
LOG(ERROR) << "RTCM boost exception: " << boost::diagnostic_information(ex);
}
catch (const std::exception& ex)
{
std::cout << "RTCM std exception: " << ex.what() << std::endl;
std::cout << "RTCM std exception: " << ex.what() << '\n';
LOG(ERROR) << "RTCM std exception: " << ex.what();
}
}
@ -4247,7 +4148,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
<< std::fixed << std::setprecision(9)
<< " observations is Lat = " << d_user_pvt_solver->get_latitude() << " [deg], Long = " << d_user_pvt_solver->get_longitude()
<< std::fixed << std::setprecision(3)
<< " [deg], Height = " << d_user_pvt_solver->get_height() << " [m]" << TEXT_RESET << std::endl;
<< " [deg], Height = " << d_user_pvt_solver->get_height() << " [m]" << TEXT_RESET << '\n';
std::cout << std::setprecision(ss);
DLOG(INFO) << "RX clock offset: " << d_user_pvt_solver->get_time_offset_s() << "[s]";
@ -4256,7 +4157,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
<< TEXT_BOLD_GREEN
<< "Velocity: " << std::fixed << std::setprecision(3)
<< "East: " << d_user_pvt_solver->get_rx_vel()[0] << " [m/s], North: " << d_user_pvt_solver->get_rx_vel()[1]
<< " [m/s], Up = " << d_user_pvt_solver->get_rx_vel()[2] << " [m/s]" << TEXT_RESET << std::endl;
<< " [m/s], Up = " << d_user_pvt_solver->get_rx_vel()[2] << " [m/s]" << TEXT_RESET << '\n';
std::cout << std::setprecision(ss);
DLOG(INFO) << "RX clock drift: " << d_user_pvt_solver->get_clock_drift_ppm() << " [ppm]";
@ -4265,7 +4166,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
// gtime_t rtklib_utc_time = gpst2time(adjgpsweek(d_user_pvt_solver->gps_ephemeris_map.cbegin()->second.i_GPS_week), d_rx_time);
// p_time = boost::posix_time::from_time_t(rtklib_utc_time.time);
// p_time += boost::posix_time::microseconds(round(rtklib_utc_time.sec * 1e6));
// std::cout << TEXT_MAGENTA << "Observable RX time (GPST) " << boost::posix_time::to_simple_string(p_time) << TEXT_RESET << std::endl;
// std::cout << TEXT_MAGENTA << "Observable RX time (GPST) " << boost::posix_time::to_simple_string(p_time) << TEXT_RESET << '\n';
DLOG(INFO) << "Position at " << boost::posix_time::to_simple_string(d_user_pvt_solver->get_position_UTC_time())
<< " UTC using " << d_user_pvt_solver->get_num_valid_observations() << " observations is Lat = " << d_user_pvt_solver->get_latitude() << " [deg], Long = " << d_user_pvt_solver->get_longitude()
@ -4274,7 +4175,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
/* std::cout << "Dilution of Precision at " << boost::posix_time::to_simple_string(d_user_pvt_solver->get_position_UTC_time())
<< " UTC using "<< d_user_pvt_solver->get_num_valid_observations() <<" observations is HDOP = " << d_user_pvt_solver->get_hdop() << " VDOP = "
<< d_user_pvt_solver->get_vdop()
<< " GDOP = " << d_user_pvt_solver->get_gdop() << std::endl; */
<< " GDOP = " << d_user_pvt_solver->get_gdop() << '\n'; */
}
// PVT MONITOR

View File

@ -160,6 +160,9 @@ private:
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;
@ -168,9 +171,6 @@ private:
std::unique_ptr<Rtcm_Printer> d_rtcm_printer;
std::unique_ptr<Monitor_Pvt_Udp_Sink> d_udp_sink_ptr;
std::shared_ptr<Rtklib_Solver> d_internal_pvt_solver;
std::shared_ptr<Rtklib_Solver> d_user_pvt_solver;
std::chrono::time_point<std::chrono::system_clock> d_start;
std::chrono::time_point<std::chrono::system_clock> d_end;

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

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

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

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

@ -41,11 +41,11 @@ public:
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;
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

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

File diff suppressed because it is too large Load Diff

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

@ -150,7 +150,7 @@ private:
void close_serial();
bool Print_Message(const std::string& message);
std::shared_ptr<Rtcm> rtcm;
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;

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

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

@ -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,7 @@
*/
#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>
@ -78,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;
@ -87,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;
@ -224,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++;
@ -237,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);
}
@ -331,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];
@ -342,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;
}
@ -390,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;
@ -470,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];
}
@ -481,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];
}
@ -505,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];
}
@ -516,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];
}
@ -539,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];
}
@ -597,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)
{
@ -605,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];
}
}
@ -654,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::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_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,7 @@
*/
#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>
@ -53,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
@ -151,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);
@ -165,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::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_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,8 +23,8 @@
*/
#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"
@ -82,7 +82,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
d_state = 0;
d_doppler_bias = 0;
d_num_noncoherent_integrations_counter = 0U;
d_consumed_samples = d_acq_parameters.sampled_ms * d_acq_parameters.samples_per_ms * (d_acq_parameters.bit_transition_flag ? 2 : 1);
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;
@ -182,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;
}
}
@ -240,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;
@ -258,11 +258,11 @@ void pcps_acquisition::update_local_carrier(own::span<gr_complex> carrier_vector
float phase_step_rad;
if (d_acq_parameters.use_automatic_resampler)
{
phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(d_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>(d_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());
@ -321,7 +321,7 @@ 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>(d_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);
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], static_cast<float>(d_doppler_bias + doppler));
}
}
@ -426,7 +426,7 @@ 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;
std::cout << "Unable to create or open Acquisition dump file\n";
// d_acq_parameters.dump = false;
}
else
@ -531,8 +531,8 @@ 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
@ -891,12 +891,12 @@ void pcps_acquisition::calculate_threshold()
return;
}
int effective_fft_size = (d_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 * d_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))));
}

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.
@ -208,8 +210,6 @@ public:
}
}
void set_resampler_latency(uint32_t latency_samples);
/*!
* \brief Parallel Code Phase Search Acquisition signal processing.
*/
@ -243,7 +243,6 @@ private:
volk_gnsssdr::vector<std::complex<float>> d_data_buffer;
volk_gnsssdr::vector<lv_16sc_t> d_data_buffer_sc;
std::string d_dump_filename;
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;
@ -253,6 +252,8 @@ private:
arma::fmat d_grid;
arma::fmat d_narrow_grid;
std::string d_dump_filename;
int64_t d_dump_number;
uint64_t d_sample_counter;

View File

@ -20,7 +20,7 @@
*/
#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"
@ -70,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
@ -117,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;
}
}
@ -212,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;
}
@ -228,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);
@ -239,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;
@ -434,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
{
@ -642,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

View File

@ -195,45 +195,55 @@ private:
int compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
int estimate_Doppler();
float estimate_input_power(gr_vector_const_void_star& input_items);
double compute_CAF();
float compute_CAF();
void reset_grid();
void update_carrier_wipeoff();
bool start();
Acq_Conf acq_parameters;
int64_t d_fs_in;
int d_samples_per_ms;
int d_max_dwells;
int d_gnuradio_forecast_samples;
float d_threshold;
std::string d_satellite_str;
int d_config_doppler_max;
int d_num_doppler_points;
int d_doppler_step;
unsigned int d_fft_size;
uint64_t d_sample_counter;
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;
volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
volk_gnsssdr::vector<volk_gnsssdr::vector<float>> d_grid_data;
volk_gnsssdr::vector<gr_complex> d_fft_codes;
volk_gnsssdr::vector<gr_complex> d_10_ms_buffer;
volk_gnsssdr::vector<float> d_magnitude;
volk_gnsssdr::vector<volk_gnsssdr::vector<float>> d_grid_data;
volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
arma::fmat grid_;
std::string d_satellite_str;
std::string d_dump_filename;
Gnss_Synchro* d_gnss_synchro;
unsigned int d_code_phase;
Acq_Conf acq_parameters;
int64_t d_fs_in;
int64_t d_dump_number;
uint64_t d_sample_counter;
float d_doppler_freq;
float d_threshold;
float d_test_statistics;
int d_positive_acq;
int d_state;
bool d_active;
int d_samples_per_ms;
int d_max_dwells;
int d_gnuradio_forecast_samples;
int d_config_doppler_max;
int d_num_doppler_points;
int d_well_count;
int d_n_samples_in_buffer;
bool d_dump;
int d_fft_size;
unsigned int d_doppler_step;
unsigned int d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
arma::fmat grid_;
int64_t d_dump_number;
unsigned int d_code_phase;
unsigned int d_dump_channel;
bool d_active;
bool d_dump;
};
#endif /* pcps_acquisition_fine_doppler_cc*/

View File

@ -195,11 +195,11 @@ private:
void acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_min);
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);
pcpsconf_fpga_t d_acq_parameters;
std::shared_ptr<Fpga_Acquisition> d_acquisition_fpga;
std::weak_ptr<ChannelFsm> d_channel_fsm;
pcpsconf_fpga_t d_acq_parameters;
Gnss_Synchro* d_gnss_synchro;
uint64_t d_sample_counter;

View File

@ -20,7 +20,7 @@
*/
#include "pcps_assisted_acquisition_cc.h"
#include "GPS_L1_CA.h"
#include "MATH_CONSTANTS.h"
#include "concurrent_map.h"
#include "gnss_sdr_make_unique.h"
#include "gps_acq_assist.h"
@ -177,12 +177,12 @@ void pcps_assisted_acquisition_cc::get_assistance()
}
this->d_disable_assist = false;
std::cout << "Acq assist ENABLED for GPS SV " << this->d_gnss_synchro->PRN << " (Doppler max,Doppler min)=("
<< d_doppler_max << "," << d_doppler_min << ")" << std::endl;
<< d_doppler_max << "," << d_doppler_min << ")\n";
}
else
{
this->d_disable_assist = true;
std::cout << "Acq assist DISABLED for GPS SV " << this->d_gnss_synchro->PRN << std::endl;
std::cout << "Acq assist DISABLED for GPS SV " << this->d_gnss_synchro->PRN << '\n';
}
}
@ -221,14 +221,14 @@ void pcps_assisted_acquisition_cc::redefine_grid()
doppler_hz = d_doppler_min + d_doppler_step * doppler_index;
// doppler search steps
// compute the carrier doppler wipe-off signal and store it
phase_step_rad = static_cast<float>(GPS_TWO_PI) * doppler_hz / static_cast<float>(d_fs_in);
phase_step_rad = static_cast<float>(TWO_PI) * doppler_hz / 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);
}
}
double pcps_assisted_acquisition_cc::search_maximum()
float pcps_assisted_acquisition_cc::search_maximum()
{
float magt = 0.0;
float fft_normalization_factor;
@ -252,7 +252,7 @@ double pcps_assisted_acquisition_cc::search_maximum()
magt = magt / (fft_normalization_factor * fft_normalization_factor);
// 5- Compute the test statistics and compare to the threshold
d_test_statistics = 2 * d_fft_size * magt / (d_input_power * d_well_count);
d_test_statistics = 2.0F * d_fft_size * magt / (d_input_power * d_well_count);
// 4- record the maximum peak and the associated synchronization parameters
d_gnss_synchro->Acq_delay_samples = static_cast<double>(index_time);
@ -394,7 +394,7 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
if (d_disable_assist == false)
{
d_disable_assist = true;
std::cout << "Acq assist DISABLED for GPS SV " << this->d_gnss_synchro->PRN << std::endl;
std::cout << "Acq assist DISABLED for GPS SV " << this->d_gnss_synchro->PRN << '\n';
d_state = 4;
}
else

View File

@ -149,6 +149,11 @@ public:
d_threshold = threshold;
}
inline void set_state(int32_t state)
{
d_state = state;
}
/*!
* \brief Set maximum Doppler grid search
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
@ -190,49 +195,53 @@ private:
int32_t compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
float estimate_input_power(gr_vector_const_void_star& input_items);
double search_maximum();
float search_maximum();
void get_assistance();
void reset_grid();
void redefine_grid();
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<std::complex<float>>> d_grid_doppler_wipeoffs;
std::vector<std::vector<float>> d_grid_data;
std::vector<gr_complex> d_fft_codes;
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_input_power;
float d_test_statistics;
int32_t d_samples_per_ms;
int32_t d_max_dwells;
uint32_t d_doppler_resolution;
int32_t d_gnuradio_forecast_samples;
float d_threshold;
std::string d_satellite_str;
int32_t d_doppler_max;
int32_t d_doppler_min;
int32_t d_config_doppler_max;
int32_t d_config_doppler_min;
int32_t d_num_doppler_points;
int32_t d_doppler_step;
int32_t d_state;
int32_t d_well_count;
uint32_t d_doppler_resolution;
uint32_t d_channel;
uint32_t d_sampled_ms;
uint32_t d_fft_size;
uint64_t d_sample_counter;
std::vector<gr_complex> d_fft_codes;
std::vector<std::vector<float>> d_grid_data;
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
int32_t d_state;
bool d_active;
bool d_disable_assist;
int32_t d_well_count;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
};
#endif // GNSS_SDR_PCPS_ASSISTED_ACQUISITION_CC_H

View File

@ -24,7 +24,7 @@
*/
#include "pcps_cccwsr_acquisition_cc.h"
#include "GPS_L1_CA.h" // GPS_TWO_PI
#include "MATH_CONSTANTS.h" // TWO_PI
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
@ -59,8 +59,8 @@ pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc(
int32_t samples_per_code,
bool dump,
const std::string &dump_filename) : gr::block("pcps_cccwsr_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
@ -175,7 +175,7 @@ void pcps_cccwsr_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 = GPS_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

@ -186,43 +186,51 @@ private:
void calculate_magnitudes(gr_complex* fft_begin, 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_data;
std::vector<gr_complex> d_fft_code_pilot;
std::vector<gr_complex> d_data_correlation;
std::vector<gr_complex> d_pilot_correlation;
std::vector<gr_complex> d_correlation_plus;
std::vector<gr_complex> d_correlation_minus;
std::vector<float> d_magnitude;
std::ofstream d_dump_file;
std::string d_satellite_str;
std::string d_dump_filename;
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_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_data;
std::vector<gr_complex> d_fft_code_pilot;
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_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;
std::vector<gr_complex> d_data_correlation;
std::vector<gr_complex> d_pilot_correlation;
std::vector<gr_complex> d_correlation_plus;
std::vector<gr_complex> d_correlation_minus;
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;
bool d_active;
bool d_dump;
};
#endif // GNSS_SDR_PCPS_CCCWSR_ACQUISITION_CC_H

View File

@ -38,7 +38,7 @@
*/
#include "pcps_opencl_acquisition_cc.h"
#include "GPS_L1_CA.h" // GPS_TWO_PI
#include "MATH_CONSTANTS.h" // TWO_PI
#include "gnss_sdr_make_unique.h"
#include "opencl/fft_base_kernels.h"
#include "opencl/fft_internal.h"
@ -79,8 +79,8 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc(
bool bit_transition_flag,
bool dump,
const std::string &dump_filename) : gr::block("pcps_opencl_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
@ -169,13 +169,13 @@ int pcps_opencl_acquisition_cc::init_opencl_environment(const std::string &kerne
if (all_platforms.empty())
{
std::cout << "No OpenCL platforms found. Check OpenCL installation!" << std::endl;
std::cout << "No OpenCL platforms found. Check OpenCL installation!\n";
return 1;
}
d_cl_platform = all_platforms[0]; // get default platform
std::cout << "Using platform: " << d_cl_platform.getInfo<CL_PLATFORM_NAME>()
<< std::endl;
<< '\n';
// get default GPU device of the default platform
std::vector<cl::Device> gpu_devices;
@ -183,7 +183,7 @@ int pcps_opencl_acquisition_cc::init_opencl_environment(const std::string &kerne
if (gpu_devices.empty())
{
std::cout << "No GPU devices found. Check OpenCL installation!" << std::endl;
std::cout << "No GPU devices found. Check OpenCL installation!\n";
return 2;
}
@ -191,7 +191,7 @@ int pcps_opencl_acquisition_cc::init_opencl_environment(const std::string &kerne
std::vector<cl::Device> device;
device.push_back(d_cl_device);
std::cout << "Using device: " << d_cl_device.getInfo<CL_DEVICE_NAME>() << std::endl;
std::cout << "Using device: " << d_cl_device.getInfo<CL_DEVICE_NAME>() << '\n';
cl::Context context(device);
d_cl_context = context;
@ -211,7 +211,7 @@ int pcps_opencl_acquisition_cc::init_opencl_environment(const std::string &kerne
{
std::cout << " Error building: "
<< program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(device[0])
<< std::endl;
<< '\n';
return 3;
}
d_cl_program = program;
@ -242,7 +242,7 @@ int pcps_opencl_acquisition_cc::init_opencl_environment(const std::string &kerne
delete d_cl_buffer_magnitude;
delete d_cl_buffer_fft_codes;
std::cout << "Error creating OpenCL FFT plan." << std::endl;
std::cout << "Error creating OpenCL FFT plan.\n";
return 4;
}
@ -282,7 +282,7 @@ void pcps_opencl_acquisition_cc::init()
for (uint32_t 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 = static_cast<float>(GPS_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);
@ -598,7 +598,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl()
// gettimeofday(&tv, NULL);
// end = tv.tv_sec *1e6 + tv.tv_usec;
// std::cout << "Acq time = " << (end-begin) << " us" << std::endl;
// std::cout << "Acq time = " << (end-begin) << " us\n";
if (!d_bit_transition_flag)
{

View File

@ -224,48 +224,6 @@ private:
int init_opencl_environment(const std::string& kernel_filename);
int64_t d_fs_in;
int d_samples_per_ms;
int d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint32_t d_fft_size_pow2;
int* d_max_doppler_indexs;
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_codes;
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_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;
bool d_bit_transition_flag;
std::ofstream d_dump_file;
bool d_active;
int d_state;
bool d_core_working;
bool d_dump;
uint32_t d_channel;
std::string d_dump_filename;
std::vector<gr_complex> d_zero_vector;
std::vector<std::vector<gr_complex>> d_in_buffer;
std::vector<uint64_t> d_sample_counter_buffer;
uint32_t d_in_dwell_count;
std::weak_ptr<ChannelFsm> d_channel_fsm;
int d_opencl;
cl::Platform d_cl_platform;
cl::Device d_cl_device;
cl::Context d_cl_context;
@ -279,6 +237,59 @@ private:
cl::CommandQueue* d_cl_queue;
clFFT_Plan d_cl_fft_plan;
cl_int d_cl_fft_batch_size;
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<std::vector<gr_complex>> d_in_buffer;
std::vector<gr_complex> d_fft_codes;
std::vector<gr_complex> d_zero_vector;
std::vector<uint64_t> d_sample_counter_buffer;
std::vector<float> d_magnitude;
std::string d_dump_filename;
std::string d_satellite_str;
std::ofstream d_dump_file;
Gnss_Synchro* d_gnss_synchro;
int64_t d_fs_in;
uint64_t d_sample_counter;
int* d_max_doppler_indexs;
float d_threshold;
float d_doppler_freq;
float d_mag;
float d_input_power;
float d_test_statistics;
int d_samples_per_ms;
int d_samples_per_code;
int d_state;
int d_opencl;
uint32_t d_doppler_resolution;
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;
uint32_t d_fft_size_pow2;
uint32_t d_num_doppler_bins;
uint32_t d_code_phase;
uint32_t d_channel;
uint32_t d_in_dwell_count;
bool d_bit_transition_flag;
bool d_active;
bool d_core_working;
bool d_dump;
};
#endif

View File

@ -18,7 +18,7 @@
*/
#include "pcps_quicksync_acquisition_cc.h"
#include "GPS_L1_CA.h"
#include "MATH_CONSTANTS.h"
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
@ -61,8 +61,8 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
bool bit_transition_flag,
bool dump,
const std::string& dump_filename) : gr::block("pcps_quicksync_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
@ -195,7 +195,7 @@ void pcps_quicksync_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 = GPS_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_samples_per_code * d_folding_factor);
}

View File

@ -212,47 +212,55 @@ private:
void calculate_magnitudes(gr_complex* fft_begin, 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_code;
uint32_t d_folding_factor; // also referred in the paper as 'p'
std::vector<uint32_t> d_possible_delay;
std::vector<float> d_corr_output_f;
std::vector<float> d_magnitude_folded;
std::vector<gr_complex> d_fft_codes;
std::vector<gr_complex> d_signal_folded;
std::vector<gr_complex> d_code_folded;
float d_noise_floor_power;
std::vector<float> d_magnitude;
std::vector<float> d_corr_output_f;
std::vector<float> d_magnitude_folded;
std::vector<uint32_t> d_possible_delay;
std::string d_dump_filename;
std::string d_satellite_str;
std::ofstream d_dump_file;
Gnss_Synchro* d_gnss_synchro;
int64_t d_fs_in;
uint64_t d_sample_counter;
float d_noise_floor_power;
float d_threshold;
float d_doppler_freq;
float d_mag;
float d_input_power;
float d_test_statistics;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
int32_t d_state;
uint32_t d_channel;
uint32_t d_folding_factor; // also referred in the paper as 'p'
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_codes;
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_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;
bool d_bit_transition_flag;
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_QUICKSYNC_ACQUISITION_CC_H

View File

@ -38,7 +38,7 @@
*/
#include "pcps_tong_acquisition_cc.h"
#include "GPS_L1_CA.h" // for GPS_TWO_PI
#include "MATH_CONSTANTS.h" // for TWO_PI
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
@ -77,8 +77,8 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
uint32_t tong_max_dwells,
bool dump,
const std::string &dump_filename) : gr::block("pcps_tong_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
@ -182,7 +182,7 @@ void pcps_tong_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 = GPS_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

@ -202,12 +202,36 @@ private:
void calculate_magnitudes(gr_complex* fft_begin, 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<std::vector<float>> d_grid_data;
std::vector<gr_complex> d_fft_codes;
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;
@ -217,27 +241,11 @@ private:
uint32_t d_tong_max_val;
uint32_t d_tong_max_dwells;
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_codes;
std::vector<std::vector<float>> d_grid_data;
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_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_TONG_ACQUISITION_CC_H

View File

@ -59,7 +59,7 @@ Acq_Conf::Acq_Conf()
}
void Acq_Conf::SetFromConfiguration(ConfigurationInterface *configuration,
void Acq_Conf::SetFromConfiguration(const ConfigurationInterface *configuration,
const std::string &role, double chip_rate, double opt_freq)
{
item_type = configuration->property(role + ".item_type", item_type);
@ -148,7 +148,7 @@ void Acq_Conf::ConfigureAutomaticResampler(double opt_freq)
void Acq_Conf::SetDerivedParams()
{
samples_per_ms = static_cast<float>(resampled_fs) * 0.001;
samples_per_ms = static_cast<float>(resampled_fs) * 0.001F;
samples_per_chip = static_cast<unsigned int>(std::ceil(static_cast<float>(resampled_fs) / chips_per_second));
samples_per_code = samples_per_ms * ms_per_code;
}

View File

@ -30,7 +30,7 @@ class Acq_Conf
public:
Acq_Conf();
void SetFromConfiguration(ConfigurationInterface *configuration, const std::string &role, double chip_rate, double opt_freq);
void SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role, double chip_rate, double opt_freq);
/* PCPS Acquisition configuration */
std::string item_type;

View File

@ -23,14 +23,14 @@
*/
#include "fpga_acquisition.h"
#include "GPS_L1_CA.h" // for GPS_TWO_PI
#include <glog/logging.h> // for LOG
#include <cmath> // for log2
#include <fcntl.h> // libraries used by the GIPO
#include <iostream> // for operator<<
#include <sys/mman.h> // libraries used by the GIPO
#include <unistd.h> // for write, close, read, ssize_t
#include <utility> // for move
#include "MATH_CONSTANTS.h" // for TWO_PI
#include <glog/logging.h> // for LOG
#include <cmath> // for log2
#include <fcntl.h> // libraries used by the GIPO
#include <iostream> // for operator<<
#include <sys/mman.h> // libraries used by the GIPO
#include <unistd.h> // for write, close, read, ssize_t
#include <utility> // for move
#ifndef TEMP_FAILURE_RETRY
@ -105,7 +105,7 @@ void Fpga_Acquisition::open_device()
if ((d_fd = open(d_device_name.c_str(), O_RDWR | O_SYNC)) == -1)
{
LOG(WARNING) << "Cannot open deviceio" << d_device_name;
std::cout << "Acq: cannot open deviceio" << d_device_name << std::endl;
std::cout << "Acq: cannot open deviceio" << d_device_name << '\n';
}
d_map_base = reinterpret_cast<volatile uint32_t *>(mmap(nullptr, PAGE_SIZE_DEFAULT,
PROT_READ | PROT_WRITE, MAP_SHARED, d_fd, 0));
@ -113,7 +113,7 @@ void Fpga_Acquisition::open_device()
if (d_map_base == reinterpret_cast<void *>(-1))
{
LOG(WARNING) << "Cannot map the FPGA acquisition module into user memory";
std::cout << "Acq: cannot map deviceio" << d_device_name << std::endl;
std::cout << "Acq: cannot map deviceio" << d_device_name << '\n';
}
}
@ -148,7 +148,7 @@ void Fpga_Acquisition::run_acquisition()
ssize_t nbytes = TEMP_FAILURE_RETRY(write(d_fd, reinterpret_cast<void *>(&reenable), sizeof(int32_t)));
if (nbytes != sizeof(int32_t))
{
std::cerr << "Error enabling run in the FPGA." << std::endl;
std::cerr << "Error enabling run in the FPGA.\n";
}
// launch the acquisition process
@ -160,8 +160,8 @@ void Fpga_Acquisition::run_acquisition()
nb = read(d_fd, &irq_count, sizeof(irq_count));
if (nb != sizeof(irq_count))
{
std::cout << "acquisition module Read failed to retrieve 4 bytes!" << std::endl;
std::cout << "acquisition module Interrupt number " << irq_count << std::endl;
std::cout << "acquisition module Read failed to retrieve 4 bytes!\n";
std::cout << "acquisition module Interrupt number " << irq_count << '\n';
}
}
@ -179,12 +179,12 @@ void Fpga_Acquisition::set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_s
// The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing
// The FPGA expects phase_step_rad between -1 (-pi) to +1 (+pi)
phase_step_rad_real = 2.0 * (doppler_min) / static_cast<float>(d_fs_in);
phase_step_rad_real = 2.0F * (doppler_min) / static_cast<float>(d_fs_in);
phase_step_rad_int = static_cast<int32_t>(phase_step_rad_real * (POW_2_31));
d_map_base[3] = phase_step_rad_int;
// repeat the calculation with the doppler step
phase_step_rad_real = 2.0 * (doppler_step) / static_cast<float>(d_fs_in);
phase_step_rad_real = 2.0F * (doppler_step) / static_cast<float>(d_fs_in);
phase_step_rad_int = static_cast<int32_t>(phase_step_rad_real * (POW_2_31)); // * 2^29 (in total it makes x2^31 in two steps to avoid the warnings
d_map_base[4] = phase_step_rad_int;
@ -245,7 +245,7 @@ void Fpga_Acquisition::close_device()
auto *aux = const_cast<uint32_t *>(d_map_base);
if (munmap(static_cast<void *>(aux), PAGE_SIZE_DEFAULT) == -1)
{
std::cout << "Failed to unmap memory uio" << std::endl;
std::cout << "Failed to unmap memory uio\n";
}
close(d_fd);
}

View File

@ -29,14 +29,13 @@
#include <utility> // for std::move
Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr<AcquisitionInterface> acq,
Channel::Channel(const ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr<AcquisitionInterface> acq,
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
const std::string& role, const std::string& implementation, Concurrent_Queue<pmt::pmt_t>* queue)
{
acq_ = std::move(acq);
trk_ = std::move(trk);
nav_ = std::move(nav);
queue_ = queue;
role_ = role;
implementation_ = implementation;
channel_ = channel;
@ -60,8 +59,8 @@ Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::s
int64_t deprecation_warning = configuration->property("GNSS-SDR.internal_fs_hz", 0);
if (deprecation_warning != 0)
{
std::cout << "WARNING: The global parameter name GNSS-SDR.internal_fs_hz has been DEPRECATED." << std::endl;
std::cout << "WARNING: Please replace it by GNSS-SDR.internal_fs_sps in your configuration file." << std::endl;
std::cout << "WARNING: The global parameter name GNSS-SDR.internal_fs_hz has been DEPRECATED.\n";
std::cout << "WARNING: Please replace it by GNSS-SDR.internal_fs_sps in your configuration file.\n";
}
}
@ -80,10 +79,10 @@ Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::s
acq_->set_doppler_step(doppler_step);
float threshold = configuration->property("Acquisition_" + implementation_ + std::to_string(channel_) + ".threshold", 0.0);
float threshold = configuration->property("Acquisition_" + implementation_ + std::to_string(channel_) + ".threshold", static_cast<float>(0.0));
if (threshold == 0.0)
{
threshold = configuration->property("Acquisition_" + implementation_ + ".threshold", 0.0);
threshold = configuration->property("Acquisition_" + implementation_ + ".threshold", static_cast<float>(0.0));
}
acq_->set_threshold(threshold);
@ -97,7 +96,7 @@ Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::s
channel_fsm_->set_tracking(trk_);
channel_fsm_->set_telemetry(nav_);
channel_fsm_->set_channel(channel_);
channel_fsm_->set_queue(queue_);
channel_fsm_->set_queue(queue);
connected_ = false;

View File

@ -54,7 +54,7 @@ class Channel : public ChannelInterface
{
public:
//! Constructor
Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr<AcquisitionInterface> acq,
Channel(const ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr<AcquisitionInterface> acq,
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
const std::string& role, const std::string& implementation, Concurrent_Queue<pmt::pmt_t>* queue);
@ -78,28 +78,26 @@ public:
void assist_acquisition_doppler(double Carrier_Doppler_hz) override;
inline std::shared_ptr<AcquisitionInterface> acquisition() { return acq_; }
inline std::shared_ptr<TrackingInterface> tracking() { return trk_; }
inline std::shared_ptr<TelemetryDecoderInterface> telemetry() { return nav_; }
inline std::shared_ptr<AcquisitionInterface> acquisition() const { return acq_; }
inline std::shared_ptr<TrackingInterface> tracking() const { return trk_; }
inline std::shared_ptr<TelemetryDecoderInterface> telemetry() const { return nav_; }
void msg_handler_events(pmt::pmt_t msg);
private:
std::shared_ptr<ChannelFsm> channel_fsm_;
std::shared_ptr<AcquisitionInterface> acq_;
std::shared_ptr<TrackingInterface> trk_;
std::shared_ptr<TelemetryDecoderInterface> nav_;
std::shared_ptr<ChannelFsm> channel_fsm_;
channel_msg_receiver_cc_sptr channel_msg_rx_;
Gnss_Synchro gnss_synchro_{};
Gnss_Signal gnss_signal_;
std::string role_;
std::string implementation_;
std::mutex mx_;
uint32_t channel_;
bool connected_;
bool repeat_;
bool flag_enable_fpga;
uint32_t channel_;
Gnss_Synchro gnss_synchro_{};
Gnss_Signal gnss_signal_;
Concurrent_Queue<pmt::pmt_t>* queue_;
};
#endif // GNSS_SDR_CHANNEL_H

View File

@ -52,11 +52,11 @@ public:
// FSM EVENTS
bool Event_start_acquisition();
bool Event_start_acquisition_fpga();
virtual bool Event_valid_acquisition();
bool Event_stop_channel();
bool Event_failed_tracking_standby();
virtual bool Event_valid_acquisition();
virtual bool Event_failed_acquisition_repeat();
virtual bool Event_failed_acquisition_no_repeat();
bool Event_failed_tracking_standby();
private:
void start_tracking();
@ -65,9 +65,6 @@ private:
void request_satellite();
void notify_stop_tracking();
uint32_t channel_;
uint32_t state_;
std::shared_ptr<AcquisitionInterface> acq_;
std::shared_ptr<TrackingInterface> trk_;
std::shared_ptr<TelemetryDecoderInterface> nav_;
@ -75,6 +72,9 @@ private:
std::mutex mx_;
Concurrent_Queue<pmt::pmt_t>* queue_;
uint32_t channel_;
uint32_t state_;
};
#endif // GNSS_SDR_CHANNEL_FSM_H

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