mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-12 11:10:33 +00:00
Merge with next
This commit is contained in:
commit
c9d6688f1b
10
.github/workflows/main.yml
vendored
10
.github/workflows/main.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: install dependencies
|
||||
run: brew update && brew install ninja pkg-config hdf5 automake armadillo lapack gflags glog gnuradio log4cpp pugixml protobuf && pip3 install mako
|
||||
run: brew update && brew install ninja pkg-config hdf5 automake armadillo lapack gflags glog gnuradio log4cpp openssl pugixml protobuf && pip3 install mako
|
||||
- name: configure
|
||||
run: cd build && cmake -GNinja ..
|
||||
- name: build
|
||||
@ -54,11 +54,11 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: install dependencies
|
||||
run: brew update && brew install llvm pkg-config hdf5 armadillo lapack gflags glog gnuradio libmatio log4cpp pugixml protobuf && ln -s /usr/local/opt/llvm/bin/clang-tidy /usr/local/bin && ln -s /usr/local/Cellar/llvm/12.*/bin/clang-apply-replacements /usr/local/bin && cp /usr/local/Cellar/llvm/12.*/share/clang/run-clang-tidy.py /usr/local/bin && pip3 install mako
|
||||
run: brew update && brew install llvm pkg-config hdf5 armadillo lapack gflags glog gnuradio libmatio log4cpp openssl pugixml protobuf && ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin && ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin && ln -s $(brew --prefix llvm)/bin/run-clang-tidy /usr/local/bin && pip3 install mako
|
||||
- name: Prepare run
|
||||
run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.11.0 core_monitor pvt_libs
|
||||
run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.11.0 core_monitor core_libs pvt_libs
|
||||
- name: run clang-tidy
|
||||
run: cd build && run-clang-tidy.py -fix
|
||||
run: cd build && run-clang-tidy -fix
|
||||
- name: check
|
||||
run: git diff > clang_tidy.patch && echo -e "if \n [ -s clang_tidy.patch ] \nthen \n echo "clang_tidy not applied:"; echo ""; more clang_tidy.patch; exit 1 \nfi \n" > detect && chmod +x ./detect && ./detect
|
||||
|
||||
@ -70,7 +70,7 @@ jobs:
|
||||
- name: install dependencies
|
||||
run: sudo apt-get install python3-pip && sudo pip3 install cpplint
|
||||
- name: run checks
|
||||
run: find ./src/ -iname *.h -o -iname *.cc | xargs cpplint --filter=-,+build/class,+build/c++14,+build/deprecated,+build/explicit_make_pair,+build/printf_format,+build/storage_class,+readability/constructors,+readability/namespace,+readability/newline,+readability/utf8,+runtime/casting,+runtime/explicit,+runtime/indentation_namespace,+runtime/init,+runtime/invalid_increment,+runtime/member_string_references,+runtime/memset,+runtime/operator,+runtime/printf,+runtime/printf_format,+whitespace/blank_line,+whitespace/comma,+whitespace/comments,+whitespace/empty_conditional_body,+whitespace/end-of-line,+whitespace/ending-newline,+whitespace/semicolon,+whitespace/tab
|
||||
run: find ./src/ -iname *.h -o -iname *.cc | xargs cpplint --filter=-,+build/class,+build/c++14,+build/deprecated,+build/explicit_make_pair,+build/include_what_you_use,+build/printf_format,+build/storage_class,+readability/constructors,+readability/namespace,+readability/newline,+readability/utf8,+runtime/casting,+runtime/explicit,+runtime/indentation_namespace,+runtime/init,+runtime/invalid_increment,+runtime/member_string_references,+runtime/memset,+runtime/operator,+runtime/printf,+runtime/printf_format,+whitespace/blank_line,+whitespace/comma,+whitespace/comments,+whitespace/empty_conditional_body,+whitespace/end-of-line,+whitespace/ending-newline,+whitespace/semicolon,+whitespace/tab --exclude=./src/core/interfaces/gnss_block_interface.h --exclude=./src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/hwcaps_for_testing.* --exclude=./src/utils/nav-listener/build/nav_message.pb.h
|
||||
|
||||
|
||||
prettier-markdown:
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ docs/latex
|
||||
docs/GNSS-SDR_manual.pdf
|
||||
src/tests/data/output.dat
|
||||
thirdparty/
|
||||
src/utils/nav-listener/build
|
||||
.settings
|
||||
.project
|
||||
.cproject
|
||||
|
@ -158,9 +158,9 @@ endif()
|
||||
set(VERSION_INFO_MAJOR_VERSION 0)
|
||||
set(VERSION_INFO_API_COMPAT 0)
|
||||
if(${THIS_IS_A_RELEASE})
|
||||
set(VERSION_INFO_MINOR_VERSION 14)
|
||||
set(VERSION_INFO_MINOR_VERSION 15)
|
||||
else()
|
||||
set(VERSION_INFO_MINOR_VERSION 14.git-${GIT_BRANCH}-${GIT_COMMIT_HASH})
|
||||
set(VERSION_INFO_MINOR_VERSION 15.git-${GIT_BRANCH}-${GIT_COMMIT_HASH})
|
||||
endif()
|
||||
|
||||
set(VERSION ${VERSION_INFO_MAJOR_VERSION}.${VERSION_INFO_API_COMPAT}.${VERSION_INFO_MINOR_VERSION})
|
||||
@ -323,7 +323,7 @@ set(GNSSSDR_PROTOBUF_MIN_VERSION "3.0.0")
|
||||
################################################################################
|
||||
set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2")
|
||||
set(GNSSSDR_GLOG_LOCAL_VERSION "0.5.0")
|
||||
set(GNSSSDR_ARMADILLO_LOCAL_VERSION "10.6.x")
|
||||
set(GNSSSDR_ARMADILLO_LOCAL_VERSION "10.7.x")
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
|
||||
set(GNSSSDR_GTEST_LOCAL_VERSION "1.10.x")
|
||||
@ -334,8 +334,8 @@ set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master")
|
||||
set(GNSSSDR_GPSTK_LOCAL_VERSION "8.0.0")
|
||||
set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.21")
|
||||
set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.11.4")
|
||||
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.17.3")
|
||||
set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.5.5")
|
||||
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.18.0")
|
||||
set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.5.6")
|
||||
set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7")
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.3")
|
||||
|
@ -470,9 +470,9 @@ $ sudo apt-get install autoconf automake libtool curl make g++ unzip
|
||||
and then:
|
||||
|
||||
```
|
||||
$ wget https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-cpp-3.17.3.tar.gz
|
||||
$ tar xvfz protobuf-cpp-3.17.3.tar.gz
|
||||
$ cd protobuf-3.17.3
|
||||
$ wget https://github.com/protocolbuffers/protobuf/releases/download/v3.18.0/protobuf-cpp-3.18.0.tar.gz
|
||||
$ tar xvfz protobuf-cpp-3.18.0.tar.gz
|
||||
$ cd protobuf-3.18.0
|
||||
$ ./autogen.sh
|
||||
$ ./configure
|
||||
$ make
|
||||
|
@ -15,7 +15,7 @@ if(${DARWIN_VERSION} VERSION_GREATER "19")
|
||||
string(REGEX REPLACE ".$" "" macOS_NAME ${macOS_NAME})
|
||||
execute_process(COMMAND sw_vers -productVersion OUTPUT_VARIABLE macOS_VERSION)
|
||||
string(REGEX REPLACE "\n$" "" macOS_VERSION ${macOS_VERSION})
|
||||
set(MACOS_DISTRIBUTION "macOS ${macOS_NAME} ${macOS_VERSION}")
|
||||
set(MACOS_DISTRIBUTION "macOS ${macOS_NAME} ${macOS_VERSION} (${CMAKE_SYSTEM_PROCESSOR})")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||
# This file is part of GNSS-SDR.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es
|
||||
# SPDX-FileCopyrightText: 2011-2021 C. Fernandez-Prades cfernandez(at)cttc.es
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
if(GNSSSIMULATOR_ROOT)
|
||||
@ -27,8 +27,17 @@ find_program(SW_GENERATOR_BIN gnss_sim
|
||||
/usr/local
|
||||
/opt/local
|
||||
PATH_SUFFIXES bin
|
||||
ONLY_CMAKE_FIND_ROOT_PATH
|
||||
)
|
||||
|
||||
if(SW_GENERATOR_BIN AND CMAKE_CROSSCOMPILING)
|
||||
if(CMAKE_SYSROOT)
|
||||
string(REGEX REPLACE "${CMAKE_SYSROOT}" "" SW_GENERATOR_BIN "${SW_GENERATOR_BIN}")
|
||||
elseif(DEFINED ENV{OECORE_TARGET_SYSROOT})
|
||||
string(REGEX REPLACE "$ENV{OECORE_TARGET_SYSROOT}" "" SW_GENERATOR_BIN "${SW_GENERATOR_BIN}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GNSSSIMULATOR DEFAULT_MSG SW_GENERATOR_BIN)
|
||||
mark_as_advanced(SW_GENERATOR_BIN)
|
||||
|
45
cmake/Modules/FindGNUPLOT.cmake
Normal file
45
cmake/Modules/FindGNUPLOT.cmake
Normal file
@ -0,0 +1,45 @@
|
||||
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||
# This file is part of GNSS-SDR.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
find_program(GNUPLOT_EXECUTABLE
|
||||
NAMES
|
||||
gnuplot
|
||||
pgnuplot
|
||||
PATHS
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
/opt/local/bin
|
||||
ONLY_CMAKE_FIND_ROOT_PATH
|
||||
)
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
if(GNUPLOT_EXECUTABLE)
|
||||
execute_process(COMMAND "${GNUPLOT_EXECUTABLE}" --version
|
||||
OUTPUT_VARIABLE GNUPLOT_OUTPUT_VARIABLE
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REGEX REPLACE "^gnuplot ([0-9\\.]+)( patchlevel )?" "\\1." GNUPLOT_VERSION_STRING "${GNUPLOT_OUTPUT_VARIABLE}")
|
||||
string(REGEX REPLACE "\\.$" "" GNUPLOT_VERSION_STRING "${GNUPLOT_VERSION_STRING}")
|
||||
unset(GNUPLOT_OUTPUT_VARIABLE)
|
||||
endif()
|
||||
else()
|
||||
if(GNUPLOT_EXECUTABLE)
|
||||
if(CMAKE_SYSROOT)
|
||||
string(REGEX REPLACE "${CMAKE_SYSROOT}" "" GNUPLOT_EXECUTABLE "${GNUPLOT_EXECUTABLE}")
|
||||
elseif(DEFINED ENV{OECORE_TARGET_SYSROOT})
|
||||
string(REGEX REPLACE "$ENV{OECORE_TARGET_SYSROOT}" "" GNUPLOT_EXECUTABLE "${GNUPLOT_EXECUTABLE}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Warning: Gnuplot is not found, you can install it later.")
|
||||
message(STATUS " Setting default path to /usr/bin/gnuplot")
|
||||
set(GNUPLOT_EXECUTABLE "/usr/bin/gnuplot")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GNUPLOT DEFAULT_MSG GNUPLOT_EXECUTABLE)
|
@ -1,4 +1,4 @@
|
||||
GNSS-SDR.num_sources; This is a GNSS-SDR configuration file
|
||||
; This is a GNSS-SDR configuration file
|
||||
; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/
|
||||
; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
||||
|
@ -16,17 +16,82 @@ All notable changes to GNSS-SDR will be documented in this file.
|
||||
|
||||
### Improvements in Availability:
|
||||
|
||||
- Improved Time-To-First-Fix when using GPS L1 C/A signals, fixing a bug that
|
||||
was making the receiver to drop the satellite if the PLL got locked at 180
|
||||
degrees, and making some optimizations on bit transition detection.
|
||||
|
||||
### Improvements in Interoperability:
|
||||
|
||||
- Fixed setting of the signal source gain if the AGC is enabled when using the
|
||||
AD9361 front-end.
|
||||
- Fixed the regeneration of Galileo ephemeris from the reduced clock and
|
||||
ephemeris data (CED) defined in the Galileo E1B INAV message introduced in
|
||||
Galileo OS SIS ICD Issue 2.0.
|
||||
|
||||
### Improvements in Maintainability:
|
||||
|
||||
- Rewritten Viterbi decoder for Galileo navigation messages: encapsulated in a
|
||||
class instead of being implemented as free inline functions. This improves
|
||||
memory management and source code readability.
|
||||
- Updated GSL implementation to v0.39.0. See
|
||||
https://github.com/gsl-lite/gsl-lite/releases/tag/v0.39.0
|
||||
- CI - `cpplint` job on GitHub: Added the `build/include_what_you_use` filter
|
||||
for early detection of missing includes.
|
||||
- CI - `clang-tidy` job on GitHub: More robust detection of LLVM paths installed
|
||||
by homebrew.
|
||||
|
||||
### Improvements in Reliability
|
||||
|
||||
- Fixed some potential buffer overflows.
|
||||
|
||||
### Improvements in Usability:
|
||||
|
||||
- Added a new monitor to extract the decoded data bits of the navigation
|
||||
messages and send them elsewhere via UDP. Activated by setting
|
||||
`NavDataMonitor.enable_monitor=true`,
|
||||
`NavDataMonitor.client_addresses=127.0.0.1` and `NavDataMonitor.port=1237` in
|
||||
the configuration file. Format described in the `nav_message.proto` file. A
|
||||
simple listener application written in C++ is included in
|
||||
`src/utils/nav-listener` as an example.
|
||||
- Extract successful rate of the CRC check in the decoding of navigation
|
||||
messages. This can be enabled by setting
|
||||
`TelemetryDecoder_XX.dump_crc_stats=true` and, optionally,
|
||||
`TelemetryDecoder_XX.dump_crc_stats_filename=./crc_stats` in the configuration
|
||||
file. At the end of the processing (or exiting with `q` + `[Enter]`), the CRC
|
||||
check success rate will be reported in a file.
|
||||
- The `UHD_Signal_Source` learned to dump data in folders that do not exist,
|
||||
_e.g._, if `SignalSource.dump=true`,
|
||||
`SignalSource.dump_filename=./non-existing/data.dat`, and the `non-existing`
|
||||
folder does not exist, it will be created if the running user has writing
|
||||
permissions. This also works for absolute paths.
|
||||
- Added a new configuration parameter `PVT.rtk_trace_level` that sets the
|
||||
logging verbosity level of the RTKLIB library.
|
||||
- Added a new output parameter `Flag_PLL_180_deg_phase_locked` in the monitor
|
||||
output that indicates if the PLL got locked at 180 degrees, so the symbol sign
|
||||
is reversed.
|
||||
|
||||
See the definitions of concepts and metrics at
|
||||
https://gnss-sdr.org/design-forces/
|
||||
|
||||
|
||||
|
||||
## [GNSS-SDR v0.0.15](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.15) - 2021-08-23
|
||||
|
||||
### Improvements in Availability:
|
||||
|
||||
- Added the reading of reduced clock and ephemeris data (CED) in the Galileo E1B
|
||||
INAV message introduced in Galileo OS SIS ICD Issue 2.0. If the reduced CED is
|
||||
available before the full ephemeris set, it is used for PVT computation until
|
||||
the full set has not yet been received. This can contribute to shortening the
|
||||
Time-To-First-Fix.
|
||||
Time-To-First-Fix. Still experimental.
|
||||
- Added the exploitation of the FEC2 Erasure Correction in the Galileo E1B INAV
|
||||
message introduced in Galileo OS SIS ICD Issue 2.0. This can contribute to
|
||||
shortening the Time-To-First-Fix. Since the added computational cost could
|
||||
break some real-time configurations, this feature is disabled by default. It
|
||||
can be activated from the configuration file by adding
|
||||
`TelemetryDecoder_1B.enable_reed_solomon=true`.
|
||||
- Reduction of the TTFF in GPS L1 and Galileo E1 by improving the frame
|
||||
synchronization mechanism.
|
||||
|
||||
### Improvements in Maintainability:
|
||||
|
||||
@ -37,7 +102,7 @@ All notable changes to GNSS-SDR will be documented in this file.
|
||||
a manifestation that contributors have the right to submit their work under
|
||||
the open source license indicated in the contributed file(s) (instead of
|
||||
asking them to sign the CLA document).
|
||||
- Improved handling of change in GNU Radio 3.9 FFT API.
|
||||
- Improved handling of changes in GNU Radio 3.9 FFT API.
|
||||
- Improved handling of the filesystem library.
|
||||
- Added an abstract class `SignalSourceInterface` and a common base class
|
||||
`SignalSourceBase`, which allow removing a lot of duplicated code in Signal
|
||||
@ -74,9 +139,14 @@ All notable changes to GNSS-SDR will be documented in this file.
|
||||
- Added support for Apple M1 AArch64 architecture processor and for FreeBSD on
|
||||
x86, improved AMD microarchitecture detection.
|
||||
- CMake now selects the C++23 standard if the environment allows for it.
|
||||
- Improved detection of Gnuplot and `gnss_sim` when cross-compiling.
|
||||
- NEON kernel implementations of the `volk_gnsssdr` library are now enabled in
|
||||
aarch64 architectures.
|
||||
|
||||
### Improvements in Reliability
|
||||
|
||||
- Bug fix in the Galileo E1/E5 telemetry decoder that produced incorrect timing
|
||||
information if a satellite is lost and then readquired.
|
||||
- Check satellites' health status. If a satellite is marked as not healthy in
|
||||
its navigation message, the corresponding observables are not used for
|
||||
navigation.
|
||||
|
@ -2,7 +2,7 @@
|
||||
.\" SPDX-License-Identifier: GPL-3.0-or-later
|
||||
.\" SPDX-FileCopyrightText: Carles Fernandez-Prades <carles.fernandez(at)cttc.es>
|
||||
.\" Contact carles.fernandez@cttc.es to correct errors or typos.
|
||||
.TH gnss\-sdr 1 "29 Jul 2020" "0.0.14" "gnss\-sdr man page"
|
||||
.TH gnss\-sdr 1 "23 Aug 2021" "0.0.15" "gnss\-sdr man page"
|
||||
.SH NAME
|
||||
\fBgnss\-sdr\fR \- GNSS Software Defined Receiver.
|
||||
.SH SYNOPSIS
|
||||
|
@ -36,6 +36,7 @@ message GnssSynchro {
|
||||
double rx_time = 23; // Receiving time after the start of the week, in s
|
||||
bool flag_valid_pseudorange = 24; // Pseudorange computation status
|
||||
double interp_tow_ms = 25; // Interpolated time of week, in ms
|
||||
bool flag_PLL_180_deg_phase_locked = 26; // PLL lock at 180º
|
||||
}
|
||||
|
||||
/* Observables represents a collection of GnssSynchro annotations */
|
||||
|
17
docs/protobuf/nav_message.proto
Normal file
17
docs/protobuf/nav_message.proto
Normal file
@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-FileCopyrightText: 2021 Carles Fernandez-Prades <carles.fernandez@cttc.es>
|
||||
syntax = "proto3";
|
||||
|
||||
package gnss_sdr;
|
||||
|
||||
message navMsg {
|
||||
string system = 1; // GNSS constellation: "G" for GPS, "R" for Glonass, "E" for Galileo, and "C" for Beidou.
|
||||
string signal = 2; // GNSS signal: "1C" for GPS L1 C/A, "1B" for Galileo E1b/c, "1G" for Glonass L1 C/A, "2S" for GPS L2 L2C(M), "2G" for Glonass L2 C/A, "L5" for GPS L5, "5X" for Galileo E5a, and "E6" for Galileo E6B.
|
||||
int32 prn = 3; // SV ID.
|
||||
int32 tow_at_current_symbol_ms = 4; // Time of week of the last symbol received, in ms
|
||||
string nav_message = 5; // for Galileo I/NAV: decoded half page (even or odd), 120 bits, as described in OS SIS ICD 2.0, paragraph 4.3.2.3. I/NAV Page Part.
|
||||
// for Galileo F/NAV: decoded word, 244 bits, as described in OS SIS ICD 2.0, paragraph 4.2.2. F/NAV Page Layout.
|
||||
// for Galileo HAS: decoded full HAS message (header + body), variable length, as described in Galileo HAS SIS ICD.
|
||||
// For GPS LNAV: decoded subframe, 300 bits, as described in IS-GPS-200M paragraph 20.3.2 Message Structure.
|
||||
// For GPS CNAV: decoded subframe, 300 bits, as described in IS-GPS-200M paragraph 30.3.3 Message Content.
|
||||
}
|
@ -16,17 +16,18 @@
|
||||
|
||||
|
||||
#include "rtklib_pvt.h"
|
||||
#include "MATH_CONSTANTS.h" // for D2R
|
||||
#include "configuration_interface.h" // for ConfigurationInterface
|
||||
#include "galileo_almanac.h" // for Galileo_Almanac
|
||||
#include "galileo_ephemeris.h" // for Galileo_Ephemeris
|
||||
#include "gnss_sdr_flags.h" // for FLAGS_RINEX_version
|
||||
#include "gps_almanac.h" // for Gps_Almanac
|
||||
#include "gps_ephemeris.h" // for Gps_Ephemeris
|
||||
#include "pvt_conf.h" // for Pvt_Conf
|
||||
#include "rtklib_rtkpos.h" // for rtkfree, rtkinit
|
||||
#include <glog/logging.h> // for LOG
|
||||
#include <iostream> // for operator<<
|
||||
#include "MATH_CONSTANTS.h" // for D2R
|
||||
#include "configuration_interface.h" // for ConfigurationInterface
|
||||
#include "galileo_almanac.h" // for Galileo_Almanac
|
||||
#include "galileo_ephemeris.h" // for Galileo_Ephemeris
|
||||
#include "gnss_sdr_flags.h" // for FLAGS_RINEX_version
|
||||
#include "gnss_sdr_string_literals.h" // for std::string_literals
|
||||
#include "gps_almanac.h" // for Gps_Almanac
|
||||
#include "gps_ephemeris.h" // for Gps_Ephemeris
|
||||
#include "pvt_conf.h" // for Pvt_Conf
|
||||
#include "rtklib_rtkpos.h" // for rtkfree, rtkinit
|
||||
#include <glog/logging.h> // for LOG
|
||||
#include <iostream> // for std::cout
|
||||
#if USE_OLD_BOOST_MATH_COMMON_FACTOR
|
||||
#include <boost/math/common_factor_rt.hpp>
|
||||
namespace bc = boost::math;
|
||||
@ -35,6 +36,7 @@ namespace bc = boost::math;
|
||||
namespace bc = boost::integer;
|
||||
#endif
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
@ -54,6 +56,8 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
|
||||
pvt_output_parameters.dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
pvt_output_parameters.dump_mat = configuration->property(role + ".dump_mat", true);
|
||||
|
||||
pvt_output_parameters.rtk_trace_level = configuration->property(role + ".rtk_trace_level"s, 0);
|
||||
|
||||
// Flag to postprocess old gnss records (older than 2009) and avoid wrong week rollover
|
||||
pvt_output_parameters.pre_2009_file = configuration->property("GNSS-SDR.pre_2009_file", false);
|
||||
|
||||
@ -118,10 +122,35 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
|
||||
pvt_output_parameters.rtcm_msg_rate_ms[k] = rtcm_MT1097_rate_ms;
|
||||
}
|
||||
|
||||
// Advanced Nativation Protocol Printer settings
|
||||
pvt_output_parameters.an_output_enabled = configuration->property(role + ".an_output_enabled", pvt_output_parameters.an_output_enabled);
|
||||
pvt_output_parameters.an_dump_devname = configuration->property(role + ".an_dump_devname", default_nmea_dump_devname);
|
||||
if (pvt_output_parameters.an_output_enabled && pvt_output_parameters.flag_nmea_tty_port)
|
||||
{
|
||||
if (pvt_output_parameters.nmea_dump_devname == pvt_output_parameters.an_dump_devname)
|
||||
{
|
||||
std::cerr << "Warning: NMEA an Advanced Nativation printers set to write to the same serial port.\n"
|
||||
<< "Please make sure that PVT.an_dump_devname and PVT.an_dump_devname are different.\n"
|
||||
<< "Shutting down the NMEA serial output.\n";
|
||||
pvt_output_parameters.flag_nmea_tty_port = false;
|
||||
}
|
||||
}
|
||||
if (pvt_output_parameters.an_output_enabled && pvt_output_parameters.flag_rtcm_tty_port)
|
||||
{
|
||||
if (pvt_output_parameters.rtcm_dump_devname == pvt_output_parameters.an_dump_devname)
|
||||
{
|
||||
std::cerr << "Warning: RTCM an Advanced Nativation printers set to write to the same serial port.\n"
|
||||
<< "Please make sure that PVT.an_dump_devname and .rtcm_dump_devname are different.\n"
|
||||
<< "Shutting down the RTCM serial output.\n";
|
||||
pvt_output_parameters.flag_rtcm_tty_port = false;
|
||||
}
|
||||
}
|
||||
|
||||
pvt_output_parameters.kml_rate_ms = bc::lcm(configuration->property(role + ".kml_rate_ms", pvt_output_parameters.kml_rate_ms), pvt_output_parameters.output_rate_ms);
|
||||
pvt_output_parameters.gpx_rate_ms = bc::lcm(configuration->property(role + ".gpx_rate_ms", pvt_output_parameters.gpx_rate_ms), pvt_output_parameters.output_rate_ms);
|
||||
pvt_output_parameters.geojson_rate_ms = bc::lcm(configuration->property(role + ".geojson_rate_ms", pvt_output_parameters.geojson_rate_ms), pvt_output_parameters.output_rate_ms);
|
||||
pvt_output_parameters.nmea_rate_ms = bc::lcm(configuration->property(role + ".nmea_rate_ms", pvt_output_parameters.nmea_rate_ms), pvt_output_parameters.output_rate_ms);
|
||||
pvt_output_parameters.an_rate_ms = bc::lcm(configuration->property(role + ".an_rate_ms", pvt_output_parameters.an_rate_ms), pvt_output_parameters.output_rate_ms);
|
||||
|
||||
// Infer the type of receiver
|
||||
/*
|
||||
@ -442,10 +471,11 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
|
||||
if (positioning_mode == -1)
|
||||
{
|
||||
// warn user and set the default
|
||||
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";
|
||||
std::cout << "WARNING: Bad specification of positioning mode.\n"
|
||||
<< "positioning_mode possible values: Single / Static / Kinematic / PPP_Static / PPP_Kinematic\n"
|
||||
<< "positioning_mode specified value: " << positioning_mode_str << "\n"
|
||||
<< "Setting positioning_mode to Single\n"
|
||||
<< std::flush;
|
||||
positioning_mode = PMODE_SINGLE;
|
||||
}
|
||||
|
||||
@ -529,10 +559,11 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
|
||||
if (iono_model == -1)
|
||||
{
|
||||
// warn user and set the default
|
||||
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";
|
||||
std::cout << "WARNING: Bad specification of ionospheric model.\n"
|
||||
<< "iono_model possible values: OFF / Broadcast / SBAS / Iono-Free-LC / Estimate_STEC / IONEX\n"
|
||||
<< "iono_model specified value: " << iono_model_str << "\n"
|
||||
<< "Setting iono_model to OFF\n"
|
||||
<< std::flush;
|
||||
iono_model = IONOOPT_OFF; /* 0: ionosphere option: correction off */
|
||||
}
|
||||
|
||||
@ -562,10 +593,11 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
|
||||
if (trop_model == -1)
|
||||
{
|
||||
// warn user and set the default
|
||||
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";
|
||||
std::cout << "WARNING: Bad specification of tropospheric model.\n"
|
||||
<< "trop_model possible values: OFF / Saastamoinen / SBAS / Estimate_ZTD / Estimate_ZTD_Grad\n"
|
||||
<< "trop_model specified value: " << trop_model_str << "\n"
|
||||
<< "Setting trop_model to OFF\n"
|
||||
<< std::flush;
|
||||
trop_model = TROPOPT_OFF;
|
||||
}
|
||||
|
||||
@ -640,10 +672,11 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
|
||||
if (integer_ambiguity_resolution_gps == -1)
|
||||
{
|
||||
// warn user and set the default
|
||||
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";
|
||||
std::cout << "WARNING: Bad specification of GPS ambiguity resolution method.\n"
|
||||
<< "AR_GPS possible values: OFF / Continuous / Instantaneous / Fix-and-Hold / PPP-AR\n"
|
||||
<< "AR_GPS specified value: " << integer_ambiguity_resolution_gps_str << "\n"
|
||||
<< "Setting AR_GPS to OFF\n"
|
||||
<< std::flush;
|
||||
integer_ambiguity_resolution_gps = ARMODE_OFF;
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,131 @@ class Gps_Ephemeris;
|
||||
|
||||
/*!
|
||||
* \brief This class implements a PvtInterface for the RTKLIB PVT block
|
||||
*
|
||||
* Global configuration options used:
|
||||
*
|
||||
* GNSS-SDR.pre_2009_file - flag indicating a file older than 2009 rollover should be processed (false)
|
||||
* GNSS-SDR.observable_interval_ms - (20)
|
||||
*
|
||||
* It supports the following configuration options:
|
||||
*
|
||||
* .dump - (false)
|
||||
* .dump_filename - ("./pvt.dat")
|
||||
* .dump_mat - (true)
|
||||
* .rtk_trace_level - debug level for the RTKLIB methods (0)
|
||||
*
|
||||
* .output_rate_ms - (500)
|
||||
* Note that the actual rate is the least common multiple of this value and GNSS-SDR.observable_interval_ms
|
||||
* .display_rate_ms - (500)
|
||||
*
|
||||
* .flag_nmea_tty_port - (false)
|
||||
* .nmea_dump_filename - ("./nmea_pvt.nmea")
|
||||
* .nmea_dump_devname - ("/dev/tty1")
|
||||
*
|
||||
* .rinex_version - (3) overridden by -RINEX_version=n.nn command line argument
|
||||
* .rinexobs_rate_ms - rate at which RINEX observations are written (1000). Note that
|
||||
* the actual rate is the least common multiple of this value and
|
||||
* .output_rate_ms
|
||||
* .rinex_name - (-RINEX_name command-line argument)
|
||||
*
|
||||
* .flag_rtcm_tty_port - (false)
|
||||
* .rtcm_dump_devname - ("/dev/pts/1")
|
||||
* .flag_rtcm_server - (false)
|
||||
* .rtcm_tcp_port - (2101)
|
||||
* .rtcm_station_id - (1234)
|
||||
* Output rates ... all values are LCM with the computed output rate (above)
|
||||
* .rtcm_MT1019_rate_ms - (5000)
|
||||
* .rtcm_MT1020_rate_ms - (5000)
|
||||
* .rtcm_MT1045_rate_ms - (5000)
|
||||
* .rtcm_MSM_rate_ms - (1000)
|
||||
* .rtcm_MT1077_rate_ms - (.rtcm_MSM_rate_ms)
|
||||
* .rtcm_MT1087_rate_ms - (.rtcm_MSM_rate_ms)
|
||||
* .rtcm_MT1097_rate_ms - (.rtcm_MSM_rate_ms)
|
||||
*
|
||||
* .kml_rate_ms - (1000)
|
||||
* .gpx_rate_ms - (1000)
|
||||
* .geojson_rate_ms - (1000)
|
||||
* .nmea_rate_ms - (1000)
|
||||
*
|
||||
* .positioning_mode - The RTKLIB positioning mode. ("Single") Supported values are "Single",
|
||||
* "Static", "Kinematic", "PPP_Static" and "PPP_Kinematic". Unsupported modes
|
||||
* include DGPS/DGNSS, Moving Baseline, Fixed, and PPP-fixed
|
||||
* .num_bands - number of frequencies to use, between 1 and 3. Default is based on the channels configured
|
||||
* .elevation_mask - (15.0). Value must be in the range [0,90.0]
|
||||
* .dynamics_model - (0) 0:none, 1:velocity, 2:acceleration
|
||||
|
||||
* .iono_model - ("OFF"). Supported values are "OFF", "Broadcast", "SBAS", "Iono-Free-LC",
|
||||
* "Estimate_STEC", "IONEX". Unsupported values include QZSS broadcast, QZSS
|
||||
* LEX, and SLANT TEC.
|
||||
* .trop_model - ("OFF"). Supported values are "OFF", "Saastamoinen", "SBAS", "Estimate_ZTD", and
|
||||
* "Estimate_ZTD_Grad". Unsupported values include ZTD correction and ZTD+grad
|
||||
* correction
|
||||
* .phwindup - phase windup correction for PPP modes (0)
|
||||
* .reject_GPS_IIA - whether the GPS Block IIA satellites in eclipse are excluded (0). Only applies in PPP-* modes
|
||||
* .raim_fde - whether RAIM (receiver autonomous integrity monitoring) FDE (fault detection and exclusion) is enabled (0)
|
||||
* .earth_tide - (0)
|
||||
* .navigation_system - mask of navigation systems to use. Default based on configured channels
|
||||
* 0x01:GPS, 0x02:SBAS, 0x04:GLONASS, 0x08:Galileo, 0x10:QZSS, 0x20:BeiDou,
|
||||
* 0x40:IRNS, 0x80:LEO
|
||||
*
|
||||
* .AR_GPS - Ambiguity Resolution mode for GPS ("Continuous"). Supported values are "OFF",
|
||||
* "Continuous", "Instantaneous", "Fix-and-Hold", "PPP-AR". Unsupported values
|
||||
* include PPP-AR ILS, WLNL, and TCAR.
|
||||
* .AR_GLO - Ambiguity Resolution mode for GLONASS (1). Value must be in the range [0,3]. (0:off,1:on,2:auto cal,3:ext cal)
|
||||
* .AR_DBS - Ambiguity Resolution Mode for BeiDou (1). Value must be in the range [0,1]. (0:off,1:on)
|
||||
* .min_ratio_to_fix_ambiguity - (3.0)
|
||||
* .min_lock_to_fix_ambiguity - (0)
|
||||
* .min_elevation_to_fix_ambiguity - minimum elevation (deg) to fix integer ambiguity (0.0)
|
||||
* .outage_reset_ambiguity - (5)
|
||||
* .slip_threshold - (0.05)
|
||||
* .threshold_reject_gdop - if GDOP is over this value, the observable is excluded (30.0)
|
||||
* .threshold_reject_innovation - if innovation is over this value, the observable is excluded (30.0)
|
||||
* .number_filter_iter - number of iterations for the estimation filter (1)
|
||||
* .bias_0 - (30.0)
|
||||
* .iono_0 - (0.03)
|
||||
* .trop_0 - (0.3)
|
||||
* .sigma_bias - process noise stddev of carrier-phase bias(ambiguity)(cycle/sqrt(s)) (1e-4)
|
||||
* .sigma_iono - process noise stddev of vertical ionospheric delay per 10km baseline (m/sqrt(s)) (1e-3)
|
||||
* .sigma_trop - process noise stddev of zenith tropospheric delay (m/sqrt(s)) (1e-4)
|
||||
* .sigma_acch - process noise stddev of the receiver acceleration horizontal component (m/s2/sqrt(s)) (1e-1)
|
||||
* .sigma_accv - process noise stddev of the receiver acceleration vertical component (m/s2/sqrt(s)) (1e-2)
|
||||
* .sigma_pos - (0.0)
|
||||
* .code_phase_error_ratio_l1 - (100.0)
|
||||
* .code_phase_error_ratio_l2 - (100.0)
|
||||
* .code_phase_error_ratio_l5 - (100.0)
|
||||
* .carrier_phase_error_factor_a - (0.003)
|
||||
* .carrier_phase_error_factor_b - (0.003)
|
||||
*
|
||||
* .output_enabled - (true)
|
||||
* .rinex_output_enabled - (.output_enabled)
|
||||
* .gpx_output_enabled - (.output_enabled)
|
||||
* .geojson_output_enabled - (.output_enabled)
|
||||
* .kml_output_enabled - (.output_enabled)
|
||||
* .xml_output_enabled - (.output_enabled)
|
||||
* .nmea_output_enabled - (.output_enabled)
|
||||
* .rtcm_output_enabled - (false)
|
||||
|
||||
* .output_path - directory to which output files are written (".")
|
||||
* .rinex_output_path - (.output_path)
|
||||
* .gpx_output_path - (.output_path)
|
||||
* .geojson_output_path - (.output_path)
|
||||
* .kml_output_path - (.output_path)
|
||||
* .xml_output_path - (.output_path)
|
||||
* .nmea_output_path - (.output_path)
|
||||
* .rtcm_output_path - (.output_path)
|
||||
*
|
||||
* .enable_monitor - enable the PVT monitor (false)
|
||||
* .monitor_client_addresses - ("127.0.0.1")
|
||||
* .monitor_udp_port - DO NOT USE THE DEFAULT (1234)
|
||||
* .enable_protobuf - serialize using protocol buffers (true). Monitor.enable_protobuf if true, sets this to true
|
||||
*
|
||||
* .enable_monitor_ephemeris - enable the ephemeris monitor (false)
|
||||
* .monitor_ephemeris_client_addresses - ("127.0.0.1")
|
||||
* .monitor_ephemeris_udp_port - DO NOT USE THE DEFAULT (1234)
|
||||
*
|
||||
* .show_local_time_zone - (false)
|
||||
* .enable_rx_clock_correction - (false)
|
||||
* .max_clock_offset_ms - (40)
|
||||
*/
|
||||
class Rtklib_Pvt : public PvtInterface
|
||||
{
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "rtklib_pvt_gs.h"
|
||||
#include "MATH_CONSTANTS.h"
|
||||
#include "an_packet_printer.h"
|
||||
#include "beidou_dnav_almanac.h"
|
||||
#include "beidou_dnav_ephemeris.h"
|
||||
#include "beidou_dnav_iono.h"
|
||||
@ -44,6 +45,7 @@
|
||||
#include "gps_iono.h"
|
||||
#include "gps_utc_model.h"
|
||||
#include "gpx_printer.h"
|
||||
#include "has_simple_printer.h"
|
||||
#include "kml_printer.h"
|
||||
#include "monitor_ephemeris_udp_sink.h"
|
||||
#include "monitor_pvt.h"
|
||||
@ -52,6 +54,7 @@
|
||||
#include "pvt_conf.h"
|
||||
#include "rinex_printer.h"
|
||||
#include "rtcm_printer.h"
|
||||
#include "rtklib_rtkcmn.h"
|
||||
#include "rtklib_solver.h"
|
||||
#include "trackingcmd.h"
|
||||
#include <boost/any.hpp> // for any_cast, any
|
||||
@ -105,9 +108,60 @@ rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
|
||||
|
||||
rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
const Pvt_Conf& conf_,
|
||||
const rtk_t& rtk) : gr::sync_block("rtklib_pvt_gs",
|
||||
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(0, 0, 0))
|
||||
const rtk_t& rtk)
|
||||
: gr::sync_block("rtklib_pvt_gs",
|
||||
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(0, 0, 0)),
|
||||
d_dump_filename(conf_.dump_filename),
|
||||
d_gps_ephemeris_sptr_type_hash_code(typeid(std::shared_ptr<Gps_Ephemeris>).hash_code()),
|
||||
d_gps_iono_sptr_type_hash_code(typeid(std::shared_ptr<Gps_Iono>).hash_code()),
|
||||
d_gps_utc_model_sptr_type_hash_code(typeid(std::shared_ptr<Gps_Utc_Model>).hash_code()),
|
||||
d_gps_cnav_ephemeris_sptr_type_hash_code(typeid(std::shared_ptr<Gps_CNAV_Ephemeris>).hash_code()),
|
||||
d_gps_cnav_iono_sptr_type_hash_code(typeid(std::shared_ptr<Gps_CNAV_Iono>).hash_code()),
|
||||
d_gps_cnav_utc_model_sptr_type_hash_code(typeid(std::shared_ptr<Gps_CNAV_Utc_Model>).hash_code()),
|
||||
d_gps_almanac_sptr_type_hash_code(typeid(std::shared_ptr<Gps_Almanac>).hash_code()),
|
||||
d_galileo_ephemeris_sptr_type_hash_code(typeid(std::shared_ptr<Galileo_Ephemeris>).hash_code()),
|
||||
d_galileo_iono_sptr_type_hash_code(typeid(std::shared_ptr<Galileo_Iono>).hash_code()),
|
||||
d_galileo_utc_model_sptr_type_hash_code(typeid(std::shared_ptr<Galileo_Utc_Model>).hash_code()),
|
||||
d_galileo_almanac_helper_sptr_type_hash_code(typeid(std::shared_ptr<Galileo_Almanac_Helper>).hash_code()),
|
||||
d_galileo_almanac_sptr_type_hash_code(typeid(std::shared_ptr<Galileo_Almanac>).hash_code()),
|
||||
d_glonass_gnav_ephemeris_sptr_type_hash_code(typeid(std::shared_ptr<Glonass_Gnav_Ephemeris>).hash_code()),
|
||||
d_glonass_gnav_utc_model_sptr_type_hash_code(typeid(std::shared_ptr<Glonass_Gnav_Utc_Model>).hash_code()),
|
||||
d_glonass_gnav_almanac_sptr_type_hash_code(typeid(std::shared_ptr<Glonass_Gnav_Almanac>).hash_code()),
|
||||
d_beidou_dnav_ephemeris_sptr_type_hash_code(typeid(std::shared_ptr<Beidou_Dnav_Ephemeris>).hash_code()),
|
||||
d_beidou_dnav_iono_sptr_type_hash_code(typeid(std::shared_ptr<Beidou_Dnav_Iono>).hash_code()),
|
||||
d_beidou_dnav_utc_model_sptr_type_hash_code(typeid(std::shared_ptr<Beidou_Dnav_Utc_Model>).hash_code()),
|
||||
d_beidou_dnav_almanac_sptr_type_hash_code(typeid(std::shared_ptr<Beidou_Dnav_Almanac>).hash_code()),
|
||||
d_galileo_has_data_sptr_type_hash_code(typeid(std::shared_ptr<Galileo_HAS_data>).hash_code()),
|
||||
d_rinex_version(conf_.rinex_version),
|
||||
d_rx_time(0.0),
|
||||
d_rinexobs_rate_ms(conf_.rinexobs_rate_ms),
|
||||
d_kml_rate_ms(conf_.kml_rate_ms),
|
||||
d_gpx_rate_ms(conf_.gpx_rate_ms),
|
||||
d_geojson_rate_ms(conf_.geojson_rate_ms),
|
||||
d_nmea_rate_ms(conf_.nmea_rate_ms),
|
||||
d_an_rate_ms(conf_.an_rate_ms),
|
||||
d_output_rate_ms(conf_.output_rate_ms),
|
||||
d_display_rate_ms(conf_.display_rate_ms),
|
||||
d_report_rate_ms(1000),
|
||||
d_max_obs_block_rx_clock_offset_ms(conf_.max_obs_block_rx_clock_offset_ms),
|
||||
d_nchannels(nchannels),
|
||||
d_type_of_rx(conf_.type_of_receiver),
|
||||
d_observable_interval_ms(conf_.observable_interval_ms),
|
||||
d_dump(conf_.dump),
|
||||
d_dump_mat(conf_.dump_mat && conf_.dump),
|
||||
d_rinex_output_enabled(conf_.rinex_output_enabled),
|
||||
d_geojson_output_enabled(conf_.geojson_output_enabled),
|
||||
d_gpx_output_enabled(conf_.gpx_output_enabled),
|
||||
d_kml_output_enabled(conf_.kml_output_enabled),
|
||||
d_nmea_output_file_enabled(conf_.nmea_output_file_enabled || conf_.flag_nmea_tty_port),
|
||||
d_xml_storage(conf_.xml_output_enabled),
|
||||
d_flag_monitor_pvt_enabled(conf_.monitor_enabled),
|
||||
d_flag_monitor_ephemeris_enabled(conf_.monitor_ephemeris_enabled),
|
||||
d_show_local_time_zone(conf_.show_local_time_zone),
|
||||
d_waiting_obs_block_rx_clock_offset_correction_msg(false),
|
||||
d_enable_rx_clock_correction(conf_.enable_rx_clock_correction),
|
||||
d_an_printer_enabled(conf_.an_output_enabled)
|
||||
{
|
||||
// Send feedback message to observables block with the receiver clock offset
|
||||
this->message_port_register_out(pmt::mp("pvt_to_observables"));
|
||||
@ -116,31 +170,37 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
// Send PVT status to gnss_flowgraph
|
||||
this->message_port_register_out(pmt::mp("status"));
|
||||
|
||||
d_mapStringValues["1C"] = evGPS_1C;
|
||||
d_mapStringValues["2S"] = evGPS_2S;
|
||||
d_mapStringValues["L5"] = evGPS_L5;
|
||||
d_mapStringValues["1B"] = evGAL_1B;
|
||||
d_mapStringValues["5X"] = evGAL_5X;
|
||||
d_mapStringValues["E6"] = evGAL_E6;
|
||||
d_mapStringValues["7X"] = evGAL_7X;
|
||||
d_mapStringValues["1G"] = evGLO_1G;
|
||||
d_mapStringValues["2G"] = evGLO_2G;
|
||||
d_mapStringValues["B1"] = evBDS_B1;
|
||||
d_mapStringValues["B2"] = evBDS_B2;
|
||||
d_mapStringValues["B3"] = evBDS_B3;
|
||||
// GPS Ephemeris data message port in
|
||||
this->message_port_register_in(pmt::mp("telemetry"));
|
||||
this->set_msg_handler(pmt::mp("telemetry"),
|
||||
#if HAS_GENERIC_LAMBDA
|
||||
[this](auto&& PH1) { msg_handler_telemetry(PH1); });
|
||||
#else
|
||||
#if USE_BOOST_BIND_PLACEHOLDERS
|
||||
boost::bind(&rtklib_pvt_gs::msg_handler_telemetry, this, boost::placeholders::_1));
|
||||
#else
|
||||
boost::bind(&rtklib_pvt_gs::msg_handler_telemetry, this, _1));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Galileo E6 HAS messages port in
|
||||
this->message_port_register_in(pmt::mp("E6_HAS_to_PVT"));
|
||||
this->set_msg_handler(pmt::mp("E6_HAS_to_PVT"),
|
||||
#if HAS_GENERIC_LAMBDA
|
||||
[this](auto&& PH1) { msg_handler_has_data(PH1); });
|
||||
#else
|
||||
#if USE_BOOST_BIND_PLACEHOLDERS
|
||||
boost::bind(&rtklib_pvt_gs::msg_handler_has_data, this, boost::placeholders::_1));
|
||||
#else
|
||||
boost::bind(&rtklib_pvt_gs::msg_handler_has_data, this, _1));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
d_initial_carrier_phase_offset_estimation_rads = std::vector<double>(nchannels, 0.0);
|
||||
d_channel_initialized = std::vector<bool>(nchannels, false);
|
||||
|
||||
d_max_obs_block_rx_clock_offset_ms = conf_.max_obs_block_rx_clock_offset_ms;
|
||||
|
||||
d_output_rate_ms = conf_.output_rate_ms;
|
||||
d_display_rate_ms = conf_.display_rate_ms;
|
||||
d_report_rate_ms = 1000; // report every second PVT to gnss_synchro
|
||||
d_dump = conf_.dump;
|
||||
d_dump_mat = conf_.dump_mat && d_dump;
|
||||
d_dump_filename = conf_.dump_filename;
|
||||
std::string dump_ls_pvt_filename = conf_.dump_filename;
|
||||
|
||||
if (d_dump)
|
||||
{
|
||||
std::string dump_path;
|
||||
@ -174,41 +234,8 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
}
|
||||
}
|
||||
|
||||
d_nchannels = nchannels;
|
||||
|
||||
d_type_of_rx = conf_.type_of_receiver;
|
||||
d_observable_interval_ms = conf_.observable_interval_ms;
|
||||
|
||||
// GPS Ephemeris data message port in
|
||||
this->message_port_register_in(pmt::mp("telemetry"));
|
||||
this->set_msg_handler(pmt::mp("telemetry"),
|
||||
#if HAS_GENERIC_LAMBDA
|
||||
[this](auto&& PH1) { msg_handler_telemetry(PH1); });
|
||||
#else
|
||||
#if USE_BOOST_BIND_PLACEHOLDERS
|
||||
boost::bind(&rtklib_pvt_gs::msg_handler_telemetry, this, boost::placeholders::_1));
|
||||
#else
|
||||
boost::bind(&rtklib_pvt_gs::msg_handler_telemetry, this, _1));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Galileo E6 HAS messages port in
|
||||
this->message_port_register_in(pmt::mp("E6_HAS_to_PVT"));
|
||||
this->set_msg_handler(pmt::mp("E6_HAS_to_PVT"),
|
||||
#if HAS_GENERIC_LAMBDA
|
||||
[this](auto&& PH1) { msg_handler_has_data(PH1); });
|
||||
#else
|
||||
#if USE_BOOST_BIND_PLACEHOLDERS
|
||||
boost::bind(&rtklib_pvt_gs::msg_handler_has_data, this, boost::placeholders::_1));
|
||||
#else
|
||||
boost::bind(&rtklib_pvt_gs::msg_handler_has_data, this, _1));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// initialize kml_printer
|
||||
const std::string kml_dump_filename = d_dump_filename;
|
||||
d_kml_output_enabled = conf_.kml_output_enabled;
|
||||
d_kml_rate_ms = conf_.kml_rate_ms;
|
||||
if (d_kml_rate_ms == 0)
|
||||
{
|
||||
d_kml_output_enabled = false;
|
||||
@ -225,8 +252,6 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
|
||||
// initialize gpx_printer
|
||||
const std::string gpx_dump_filename = d_dump_filename;
|
||||
d_gpx_output_enabled = conf_.gpx_output_enabled;
|
||||
d_gpx_rate_ms = conf_.gpx_rate_ms;
|
||||
if (d_gpx_rate_ms == 0)
|
||||
{
|
||||
d_gpx_output_enabled = false;
|
||||
@ -243,8 +268,6 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
|
||||
// initialize geojson_printer
|
||||
const std::string geojson_dump_filename = d_dump_filename;
|
||||
d_geojson_output_enabled = conf_.geojson_output_enabled;
|
||||
d_geojson_rate_ms = conf_.geojson_rate_ms;
|
||||
if (d_geojson_rate_ms == 0)
|
||||
{
|
||||
d_geojson_output_enabled = false;
|
||||
@ -260,8 +283,6 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
}
|
||||
|
||||
// initialize nmea_printer
|
||||
d_nmea_output_file_enabled = (conf_.nmea_output_file_enabled || conf_.flag_nmea_tty_port);
|
||||
d_nmea_rate_ms = conf_.nmea_rate_ms;
|
||||
if (d_nmea_rate_ms == 0)
|
||||
{
|
||||
d_nmea_output_file_enabled = false;
|
||||
@ -348,8 +369,6 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
}
|
||||
|
||||
// initialize RINEX printer
|
||||
d_rinex_output_enabled = conf_.rinex_output_enabled;
|
||||
d_rinex_version = conf_.rinex_version;
|
||||
if (d_rinex_output_enabled)
|
||||
{
|
||||
d_rp = std::make_unique<Rinex_Printer>(d_rinex_version, conf_.rinex_output_path, conf_.rinex_name);
|
||||
@ -359,10 +378,8 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
{
|
||||
d_rp = nullptr;
|
||||
}
|
||||
d_rinexobs_rate_ms = conf_.rinexobs_rate_ms;
|
||||
|
||||
// XML printer
|
||||
d_xml_storage = conf_.xml_output_enabled;
|
||||
if (d_xml_storage)
|
||||
{
|
||||
d_xml_base_path = conf_.xml_output_path;
|
||||
@ -398,11 +415,28 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
d_xml_base_path = d_xml_base_path + fs::path::preferred_separator;
|
||||
}
|
||||
|
||||
d_rx_time = 0.0;
|
||||
d_last_status_print_seg = 0;
|
||||
// Initialize HAS simple printer
|
||||
d_enable_has_messages = (((d_type_of_rx >= 100) && (d_type_of_rx < 107)) && (conf_.output_enabled));
|
||||
if (d_enable_has_messages)
|
||||
{
|
||||
d_has_simple_printer = std::make_unique<Has_Simple_Printer>();
|
||||
}
|
||||
else
|
||||
{
|
||||
d_has_simple_printer = nullptr;
|
||||
}
|
||||
|
||||
// Initialize AN printer
|
||||
if (d_an_printer_enabled)
|
||||
{
|
||||
d_an_printer = std::make_unique<An_Packet_Printer>(conf_.an_dump_devname);
|
||||
}
|
||||
else
|
||||
{
|
||||
d_an_printer = nullptr;
|
||||
}
|
||||
|
||||
// PVT MONITOR
|
||||
d_flag_monitor_pvt_enabled = conf_.monitor_enabled;
|
||||
if (d_flag_monitor_pvt_enabled)
|
||||
{
|
||||
std::string address_string = conf_.udp_addresses;
|
||||
@ -418,7 +452,6 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
}
|
||||
|
||||
// EPHEMERIS MONITOR
|
||||
d_flag_monitor_ephemeris_enabled = conf_.monitor_ephemeris_enabled;
|
||||
if (d_flag_monitor_ephemeris_enabled)
|
||||
{
|
||||
std::string address_string = conf_.udp_eph_addresses;
|
||||
@ -444,7 +477,6 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
}
|
||||
|
||||
// Display time in local time zone
|
||||
d_show_local_time_zone = conf_.show_local_time_zone;
|
||||
std::ostringstream os;
|
||||
#ifdef HAS_PUT_TIME
|
||||
time_t when = std::time(nullptr);
|
||||
@ -480,55 +512,45 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
d_local_time_str = std::string(" ") + time_zone_abrv + " (UTC " + utc_diff_str.substr(0, 3) + ":" + utc_diff_str.substr(3, 2) + ")";
|
||||
}
|
||||
|
||||
d_waiting_obs_block_rx_clock_offset_correction_msg = false;
|
||||
|
||||
d_enable_rx_clock_correction = conf_.enable_rx_clock_correction;
|
||||
|
||||
if (d_enable_rx_clock_correction == true)
|
||||
{
|
||||
// setup two PVT solvers: internal solver for rx clock and user solver
|
||||
// user PVT solver
|
||||
d_user_pvt_solver = std::make_shared<Rtklib_Solver>(rtk, static_cast<int32_t>(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat);
|
||||
d_user_pvt_solver = std::make_shared<Rtklib_Solver>(rtk, dump_ls_pvt_filename, d_dump, d_dump_mat);
|
||||
d_user_pvt_solver->set_averaging_depth(1);
|
||||
d_user_pvt_solver->set_pre_2009_file(conf_.pre_2009_file);
|
||||
|
||||
// internal PVT solver, mainly used to estimate the receiver clock
|
||||
rtk_t internal_rtk = rtk;
|
||||
internal_rtk.opt.mode = PMODE_SINGLE; // use single positioning mode in internal PVT solver
|
||||
d_internal_pvt_solver = std::make_shared<Rtklib_Solver>(internal_rtk, static_cast<int32_t>(nchannels), dump_ls_pvt_filename, false, false);
|
||||
d_internal_pvt_solver = std::make_shared<Rtklib_Solver>(internal_rtk, dump_ls_pvt_filename, false, false);
|
||||
d_internal_pvt_solver->set_averaging_depth(1);
|
||||
d_internal_pvt_solver->set_pre_2009_file(conf_.pre_2009_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
// only one solver, customized by the user options
|
||||
d_internal_pvt_solver = std::make_shared<Rtklib_Solver>(rtk, static_cast<int32_t>(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat);
|
||||
d_internal_pvt_solver = std::make_shared<Rtklib_Solver>(rtk, dump_ls_pvt_filename, d_dump, d_dump_mat);
|
||||
d_internal_pvt_solver->set_averaging_depth(1);
|
||||
d_internal_pvt_solver->set_pre_2009_file(conf_.pre_2009_file);
|
||||
d_user_pvt_solver = d_internal_pvt_solver;
|
||||
}
|
||||
|
||||
d_gps_ephemeris_sptr_type_hash_code = typeid(std::shared_ptr<Gps_Ephemeris>).hash_code();
|
||||
d_gps_iono_sptr_type_hash_code = typeid(std::shared_ptr<Gps_Iono>).hash_code();
|
||||
d_gps_utc_model_sptr_type_hash_code = typeid(std::shared_ptr<Gps_Utc_Model>).hash_code();
|
||||
d_gps_cnav_ephemeris_sptr_type_hash_code = typeid(std::shared_ptr<Gps_CNAV_Ephemeris>).hash_code();
|
||||
d_gps_cnav_iono_sptr_type_hash_code = typeid(std::shared_ptr<Gps_CNAV_Iono>).hash_code();
|
||||
d_gps_cnav_utc_model_sptr_type_hash_code = typeid(std::shared_ptr<Gps_CNAV_Utc_Model>).hash_code();
|
||||
d_gps_almanac_sptr_type_hash_code = typeid(std::shared_ptr<Gps_Almanac>).hash_code();
|
||||
d_galileo_ephemeris_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_Ephemeris>).hash_code();
|
||||
d_galileo_iono_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_Iono>).hash_code();
|
||||
d_galileo_utc_model_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_Utc_Model>).hash_code();
|
||||
d_galileo_almanac_helper_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_Almanac_Helper>).hash_code();
|
||||
d_galileo_almanac_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_Almanac>).hash_code();
|
||||
d_galileo_has_message_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_HAS_data>).hash_code();
|
||||
d_glonass_gnav_ephemeris_sptr_type_hash_code = typeid(std::shared_ptr<Glonass_Gnav_Ephemeris>).hash_code();
|
||||
d_glonass_gnav_utc_model_sptr_type_hash_code = typeid(std::shared_ptr<Glonass_Gnav_Utc_Model>).hash_code();
|
||||
d_glonass_gnav_almanac_sptr_type_hash_code = typeid(std::shared_ptr<Glonass_Gnav_Almanac>).hash_code();
|
||||
d_beidou_dnav_ephemeris_sptr_type_hash_code = typeid(std::shared_ptr<Beidou_Dnav_Ephemeris>).hash_code();
|
||||
d_beidou_dnav_iono_sptr_type_hash_code = typeid(std::shared_ptr<Beidou_Dnav_Iono>).hash_code();
|
||||
d_beidou_dnav_utc_model_sptr_type_hash_code = typeid(std::shared_ptr<Beidou_Dnav_Utc_Model>).hash_code();
|
||||
d_beidou_dnav_almanac_sptr_type_hash_code = typeid(std::shared_ptr<Beidou_Dnav_Almanac>).hash_code();
|
||||
d_galileo_has_data_sptr_type_hash_code = typeid(std::shared_ptr<Galileo_HAS_data>).hash_code();
|
||||
d_mapStringValues["1C"] = evGPS_1C;
|
||||
d_mapStringValues["2S"] = evGPS_2S;
|
||||
d_mapStringValues["L5"] = evGPS_L5;
|
||||
d_mapStringValues["1B"] = evGAL_1B;
|
||||
d_mapStringValues["5X"] = evGAL_5X;
|
||||
d_mapStringValues["E6"] = evGAL_E6;
|
||||
d_mapStringValues["7X"] = evGAL_7X;
|
||||
d_mapStringValues["1G"] = evGLO_1G;
|
||||
d_mapStringValues["2G"] = evGLO_2G;
|
||||
d_mapStringValues["B1"] = evBDS_B1;
|
||||
d_mapStringValues["B2"] = evBDS_B2;
|
||||
d_mapStringValues["B3"] = evBDS_B3;
|
||||
|
||||
// set the RTKLIB trace (debug) level
|
||||
tracelevel(conf_.rtk_trace_level);
|
||||
|
||||
//timetag
|
||||
d_log_timetag = conf_.log_source_timetag;
|
||||
@ -1366,10 +1388,6 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
|
||||
d_user_pvt_solver->galileo_almanac_map[galileo_alm->PRN] = *galileo_alm;
|
||||
}
|
||||
}
|
||||
else if (msg_type_hash_code == d_galileo_has_message_sptr_type_hash_code)
|
||||
{
|
||||
// Store HAS message and print its content
|
||||
}
|
||||
|
||||
// **************** GLONASS GNAV Telemetry *************************
|
||||
else if (msg_type_hash_code == d_glonass_gnav_ephemeris_sptr_type_hash_code)
|
||||
@ -1531,9 +1549,11 @@ void rtklib_pvt_gs::msg_handler_has_data(const pmt::pmt_t& msg) const
|
||||
const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code();
|
||||
if (msg_type_hash_code == d_galileo_has_data_sptr_type_hash_code)
|
||||
{
|
||||
const auto has_data = boost::any_cast<std::shared_ptr<Galileo_HAS_data>>(pmt::any_ref(msg));
|
||||
// TODO: Dump HAS message
|
||||
// std::cout << "HAS data received at PVT block.\n";
|
||||
if (d_enable_has_messages)
|
||||
{
|
||||
const auto has_data = boost::any_cast<std::shared_ptr<Galileo_HAS_data>>(pmt::any_ref(msg));
|
||||
d_has_simple_printer->print_message(has_data.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const boost::bad_any_cast& e)
|
||||
@ -2322,6 +2342,13 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
|
||||
flag_write_RTCM_1045_output,
|
||||
d_enable_rx_clock_correction);
|
||||
}
|
||||
if (d_an_printer_enabled)
|
||||
{
|
||||
if (current_RX_time_ms % d_an_rate_ms == 0)
|
||||
{
|
||||
d_an_printer->print_packet(d_user_pvt_solver.get(), d_gnss_observables_map);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,8 @@ class Nmea_Printer;
|
||||
class Pvt_Conf;
|
||||
class Rinex_Printer;
|
||||
class Rtcm_Printer;
|
||||
class An_Packet_Printer;
|
||||
class Has_Simple_Printer;
|
||||
class Rtklib_Solver;
|
||||
class rtklib_pvt_gs;
|
||||
|
||||
@ -179,6 +181,8 @@ private:
|
||||
std::unique_ptr<Rtcm_Printer> d_rtcm_printer;
|
||||
std::unique_ptr<Monitor_Pvt_Udp_Sink> d_udp_sink_ptr;
|
||||
std::unique_ptr<Monitor_Ephemeris_Udp_Sink> d_eph_udp_sink_ptr;
|
||||
std::unique_ptr<Has_Simple_Printer> d_has_simple_printer;
|
||||
std::unique_ptr<An_Packet_Printer> d_an_printer;
|
||||
|
||||
std::chrono::time_point<std::chrono::system_clock> d_start;
|
||||
std::chrono::time_point<std::chrono::system_clock> d_end;
|
||||
@ -227,7 +231,6 @@ private:
|
||||
size_t d_galileo_utc_model_sptr_type_hash_code;
|
||||
size_t d_galileo_almanac_helper_sptr_type_hash_code;
|
||||
size_t d_galileo_almanac_sptr_type_hash_code;
|
||||
size_t d_galileo_has_message_sptr_type_hash_code;
|
||||
size_t d_glonass_gnav_ephemeris_sptr_type_hash_code;
|
||||
size_t d_glonass_gnav_utc_model_sptr_type_hash_code;
|
||||
size_t d_glonass_gnav_almanac_sptr_type_hash_code;
|
||||
@ -255,7 +258,7 @@ private:
|
||||
int32_t d_gpx_rate_ms;
|
||||
int32_t d_geojson_rate_ms;
|
||||
int32_t d_nmea_rate_ms;
|
||||
int32_t d_last_status_print_seg; // for status printer
|
||||
int32_t d_an_rate_ms;
|
||||
int32_t d_output_rate_ms;
|
||||
int32_t d_display_rate_ms;
|
||||
int32_t d_report_rate_ms;
|
||||
@ -280,6 +283,8 @@ private:
|
||||
bool d_show_local_time_zone;
|
||||
bool d_waiting_obs_block_rx_clock_offset_correction_msg;
|
||||
bool d_enable_rx_clock_correction;
|
||||
bool d_enable_has_messages;
|
||||
bool d_an_printer_enabled;
|
||||
};
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ protobuf_generate_cpp(PROTO_SRCS2 PROTO_HDRS2 ${CMAKE_SOURCE_DIR}/docs/protobuf/
|
||||
protobuf_generate_cpp(PROTO_SRCS3 PROTO_HDRS3 ${CMAKE_SOURCE_DIR}/docs/protobuf/galileo_ephemeris.proto)
|
||||
|
||||
set(PVT_LIB_SOURCES
|
||||
pvt_conf.cc
|
||||
an_packet_printer.cc
|
||||
pvt_solution.cc
|
||||
geojson_printer.cc
|
||||
gpx_printer.cc
|
||||
@ -21,9 +21,11 @@ set(PVT_LIB_SOURCES
|
||||
rtklib_solver.cc
|
||||
monitor_pvt_udp_sink.cc
|
||||
monitor_ephemeris_udp_sink.cc
|
||||
has_simple_printer.cc
|
||||
)
|
||||
|
||||
set(PVT_LIB_HEADERS
|
||||
an_packet_printer.h
|
||||
pvt_conf.h
|
||||
pvt_solution.h
|
||||
geojson_printer.h
|
||||
@ -40,6 +42,7 @@ set(PVT_LIB_HEADERS
|
||||
serdes_galileo_eph.h
|
||||
serdes_gps_eph.h
|
||||
monitor_ephemeris_udp_sink.h
|
||||
has_simple_printer.h
|
||||
)
|
||||
|
||||
list(SORT PVT_LIB_HEADERS)
|
||||
|
355
src/algorithms/PVT/libs/an_packet_printer.cc
Normal file
355
src/algorithms/PVT/libs/an_packet_printer.cc
Normal file
@ -0,0 +1,355 @@
|
||||
/*!
|
||||
* \file an_packet_printer.cc
|
||||
* \brief Implementation of a class that prints PVT solutions in a serial device
|
||||
* following a custom version of the Advanced Navigation Packet Protocol
|
||||
* \author Carles Fernandez-Prades, 2021. cfernandez(at)cttc.es
|
||||
* \author Miguel Angel Gomez Lopez, 2021. gomezlma(at)inta.es
|
||||
*
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "an_packet_printer.h"
|
||||
#include "rtklib_solver.h" // for Rtklib_Solver
|
||||
#include <glog/logging.h> // for DLOG
|
||||
#include <cmath> // for M_PI
|
||||
#include <cstring> // for memcpy
|
||||
#include <fcntl.h> // for fcntl
|
||||
#include <iostream> // for std::cerr
|
||||
#include <limits> // std::numeric_limits
|
||||
#include <termios.h> // values for termios
|
||||
#include <unistd.h> // for write(), read(), close()
|
||||
|
||||
|
||||
An_Packet_Printer::An_Packet_Printer(const std::string& an_dump_devname) : d_an_devname(an_dump_devname),
|
||||
d_an_dev_descriptor(init_serial(d_an_devname))
|
||||
{
|
||||
if (d_an_dev_descriptor != -1)
|
||||
{
|
||||
DLOG(INFO) << "AN Printer writing on " << d_an_devname;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
An_Packet_Printer::~An_Packet_Printer()
|
||||
{
|
||||
try
|
||||
{
|
||||
close_serial();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cerr << e.what() << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool An_Packet_Printer::print_packet(const Rtklib_Solver* const pvt_data, const std::map<int, Gnss_Synchro>& gnss_observables_map)
|
||||
{
|
||||
an_packet_t an_packet{};
|
||||
sdr_gnss_packet_t sdr_gnss_packet{};
|
||||
|
||||
update_sdr_gnss_packet(&sdr_gnss_packet, pvt_data, gnss_observables_map);
|
||||
encode_sdr_gnss_packet(&sdr_gnss_packet, &an_packet);
|
||||
|
||||
if (d_an_dev_descriptor != -1)
|
||||
{
|
||||
if (write(d_an_dev_descriptor, &an_packet, sizeof(an_packet)) == -1)
|
||||
{
|
||||
LOG(ERROR) << "Advanced Navigation printer cannot write on serial device " << d_an_devname;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void An_Packet_Printer::close_serial() const
|
||||
{
|
||||
if (d_an_dev_descriptor != -1)
|
||||
{
|
||||
close(d_an_dev_descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @brief update_sdr_gnss_packet
|
||||
* @param sdr_gnss_packet_t* Pointer to a structure that contains
|
||||
* the output information.
|
||||
* @param NavData_t* pointer to input packet with all the information
|
||||
* @reval None
|
||||
*/
|
||||
void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const Rtklib_Solver* const pvt, const std::map<int, Gnss_Synchro>& gnss_observables_map) const
|
||||
{
|
||||
std::map<int, Gnss_Synchro>::const_iterator gnss_observables_iter;
|
||||
uint8_t num_gps_sats = 0;
|
||||
uint8_t num_gal_sats = 0;
|
||||
uint32_t microseconds = 0;
|
||||
int index = 0;
|
||||
const int max_reported_sats = *(&_packet->sats + 1) - _packet->sats;
|
||||
|
||||
for (gnss_observables_iter = gnss_observables_map.cbegin();
|
||||
gnss_observables_iter != gnss_observables_map.cend();
|
||||
++gnss_observables_iter)
|
||||
{
|
||||
if (gnss_observables_iter->second.Flag_valid_pseudorange)
|
||||
{
|
||||
switch (gnss_observables_iter->second.System)
|
||||
{
|
||||
case 'G':
|
||||
num_gps_sats++;
|
||||
if (index < max_reported_sats)
|
||||
{
|
||||
_packet->sats[index].prn = static_cast<uint8_t>(gnss_observables_iter->second.PRN);
|
||||
_packet->sats[index].snr = static_cast<uint8_t>(gnss_observables_iter->second.CN0_dB_hz);
|
||||
int16_t doppler = 0;
|
||||
double Carrier_Doppler_hz = gnss_observables_iter->second.Carrier_Doppler_hz;
|
||||
if (Carrier_Doppler_hz > static_cast<double>(std::numeric_limits<int16_t>::max()))
|
||||
{
|
||||
doppler = std::numeric_limits<int16_t>::max();
|
||||
}
|
||||
else if (Carrier_Doppler_hz < static_cast<double>(std::numeric_limits<int16_t>::min()))
|
||||
{
|
||||
doppler = std::numeric_limits<int16_t>::min();
|
||||
}
|
||||
else
|
||||
{
|
||||
doppler = static_cast<int16_t>(Carrier_Doppler_hz);
|
||||
}
|
||||
|
||||
_packet->sats[index].doppler = doppler;
|
||||
microseconds = static_cast<uint32_t>(static_cast<double>(gnss_observables_iter->second.Tracking_sample_counter) / static_cast<double>(gnss_observables_iter->second.fs)) * 1e6;
|
||||
index++;
|
||||
}
|
||||
break;
|
||||
case 'E':
|
||||
num_gal_sats++;
|
||||
if (index < max_reported_sats)
|
||||
{
|
||||
_packet->sats[index].prn = static_cast<uint8_t>(gnss_observables_iter->second.PRN) + 100;
|
||||
_packet->sats[index].snr = static_cast<uint8_t>(gnss_observables_iter->second.CN0_dB_hz);
|
||||
int16_t doppler = 0;
|
||||
double Carrier_Doppler_hz = gnss_observables_iter->second.Carrier_Doppler_hz;
|
||||
if (Carrier_Doppler_hz > static_cast<double>(std::numeric_limits<int16_t>::max()))
|
||||
{
|
||||
doppler = std::numeric_limits<int16_t>::max();
|
||||
}
|
||||
else if (Carrier_Doppler_hz < static_cast<double>(std::numeric_limits<int16_t>::min()))
|
||||
{
|
||||
doppler = std::numeric_limits<int16_t>::min();
|
||||
}
|
||||
else
|
||||
{
|
||||
doppler = static_cast<int16_t>(Carrier_Doppler_hz);
|
||||
}
|
||||
|
||||
_packet->sats[index].doppler = doppler;
|
||||
microseconds = static_cast<uint32_t>(static_cast<double>(gnss_observables_iter->second.Tracking_sample_counter) / static_cast<double>(gnss_observables_iter->second.fs)) * 1e6;
|
||||
index++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_packet->nsvfix = static_cast<uint8_t>(pvt->get_num_valid_observations());
|
||||
_packet->gps_satellites = num_gps_sats;
|
||||
_packet->galileo_satellites = num_gal_sats;
|
||||
_packet->microseconds = microseconds;
|
||||
_packet->latitude = static_cast<double>(pvt->get_latitude()) * (M_PI / 180.0);
|
||||
_packet->longitude = static_cast<double>(pvt->get_longitude()) * (M_PI / 180.0);
|
||||
_packet->height = static_cast<double>(pvt->get_height());
|
||||
_packet->velocity[0] = static_cast<float>(pvt->get_rx_vel()[1]);
|
||||
_packet->velocity[1] = static_cast<float>(pvt->get_rx_vel()[0]);
|
||||
_packet->velocity[2] = static_cast<float>(-pvt->get_rx_vel()[2]);
|
||||
|
||||
uint16_t status = 0;
|
||||
// Set 3D fix (bit 0 and 1) / Set Doppler velocity valid (bit 2) / Set Time valid (bit 3)
|
||||
status = status & 0b00001111;
|
||||
_packet->status = status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @brief encode_sdr_gnss_packet
|
||||
* @param sdr_gnss_packet_t* Pointer to a structure that contains the data.
|
||||
* @param an_packet_t* pointer to output packet
|
||||
* @reval None
|
||||
*/
|
||||
void An_Packet_Printer::encode_sdr_gnss_packet(sdr_gnss_packet_t* sdr_gnss_packet, an_packet_t* _packet) const
|
||||
{
|
||||
_packet->id = SDR_GNSS_PACKET_ID;
|
||||
_packet->length = SDR_GNSS_PACKET_LENGTH;
|
||||
uint8_t offset = 0;
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->nsvfix), offset, _packet->data, sizeof(sdr_gnss_packet->nsvfix));
|
||||
offset += sizeof(sdr_gnss_packet->nsvfix);
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->gps_satellites), offset, _packet->data, sizeof(sdr_gnss_packet->gps_satellites));
|
||||
offset += sizeof(sdr_gnss_packet->gps_satellites);
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->galileo_satellites), offset, _packet->data, sizeof(sdr_gnss_packet->galileo_satellites));
|
||||
offset += sizeof(sdr_gnss_packet->galileo_satellites);
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->microseconds), offset, _packet->data, sizeof(sdr_gnss_packet->microseconds));
|
||||
offset += sizeof(sdr_gnss_packet->microseconds);
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->latitude), offset, _packet->data, sizeof(sdr_gnss_packet->latitude));
|
||||
offset += sizeof(sdr_gnss_packet->latitude);
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->longitude), offset, _packet->data, sizeof(sdr_gnss_packet->longitude));
|
||||
offset += sizeof(sdr_gnss_packet->longitude);
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->height), offset, _packet->data, sizeof(sdr_gnss_packet->height));
|
||||
offset += sizeof(sdr_gnss_packet->height);
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->velocity[0]), offset, _packet->data, sizeof(sdr_gnss_packet->velocity[0]));
|
||||
offset += sizeof(sdr_gnss_packet->velocity[0]);
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->velocity[1]), offset, _packet->data, sizeof(sdr_gnss_packet->velocity[1]));
|
||||
offset += sizeof(sdr_gnss_packet->velocity[1]);
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->velocity[2]), offset, _packet->data, sizeof(sdr_gnss_packet->velocity[2]));
|
||||
offset += sizeof(sdr_gnss_packet->velocity[2]);
|
||||
for (auto& sat : sdr_gnss_packet->sats)
|
||||
{
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sat.prn), offset, _packet->data, sizeof(sat.prn));
|
||||
offset += sizeof(sat.prn);
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sat.snr), offset, _packet->data, sizeof(sat.snr));
|
||||
offset += sizeof(sat.snr);
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sat.doppler), offset, _packet->data, sizeof(sat.doppler));
|
||||
offset += sizeof(sat.doppler);
|
||||
}
|
||||
|
||||
offset = static_cast<uint8_t>(SDR_GNSS_PACKET_LENGTH - sizeof(sdr_gnss_packet->status));
|
||||
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->status), offset, _packet->data, sizeof(sdr_gnss_packet->status));
|
||||
|
||||
an_packet_encode(_packet);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function to encode an an_packet
|
||||
*/
|
||||
void An_Packet_Printer::an_packet_encode(an_packet_t* an_packet) const
|
||||
{
|
||||
uint16_t crc;
|
||||
an_packet->header[1] = an_packet->id;
|
||||
an_packet->header[2] = an_packet->length;
|
||||
crc = calculate_crc16(an_packet->data, an_packet->length);
|
||||
memcpy(&an_packet->header[3], &crc, sizeof(uint16_t));
|
||||
an_packet->header[0] = calculate_header_lrc(&an_packet->header[1]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function to calculate a 4 byte LRC
|
||||
*/
|
||||
uint8_t An_Packet_Printer::calculate_header_lrc(const uint8_t* data) const
|
||||
{
|
||||
return ((data[0] + data[1] + data[2] + data[3]) ^ 0xFF) + 1;
|
||||
}
|
||||
|
||||
|
||||
void An_Packet_Printer::LSB_bytes_to_array(void* _in, int offset, uint8_t* _out, uint8_t var_size) const
|
||||
{
|
||||
switch (var_size)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
auto* tmp = reinterpret_cast<uint8_t*>(_in);
|
||||
for (int i = 0; i < var_size; i++)
|
||||
{
|
||||
_out[offset + i] = (*tmp >> 8 * i) & 0xFF;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
auto* tmp = reinterpret_cast<uint16_t*>(_in);
|
||||
for (int i = 0; i < var_size; i++)
|
||||
{
|
||||
_out[offset + i] = (*tmp >> 8 * i) & 0xFF;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
auto* tmp = reinterpret_cast<uint32_t*>(_in);
|
||||
for (int i = 0; i < var_size; i++)
|
||||
{
|
||||
_out[offset + i] = (*tmp >> 8 * i) & 0xFF;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
auto* tmp = reinterpret_cast<uint64_t*>(_in);
|
||||
for (int i = 0; i < var_size; i++)
|
||||
{
|
||||
_out[offset + i] = (*tmp >> 8 * i) & 0xFF;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function to calculate the CRC16 of data
|
||||
* CRC16-CCITT
|
||||
* Initial value = 0xFFFF
|
||||
* Polynomial = x^16 + x^12 + x^5 + x^0
|
||||
*/
|
||||
uint16_t An_Packet_Printer::calculate_crc16(const void* data, uint16_t length) const
|
||||
{
|
||||
const auto* bytes = reinterpret_cast<const uint8_t*>(data);
|
||||
uint16_t crc = 0xFFFF;
|
||||
for (uint16_t i = 0; i < length; i++)
|
||||
{
|
||||
crc = static_cast<uint16_t>((crc << 8) ^ d_crc16_table[(crc >> 8) ^ bytes[i]]);
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Opens the serial device and sets the default baud rate for a transmission (115200,8,N,1)
|
||||
*/
|
||||
int An_Packet_Printer::init_serial(const std::string& serial_device)
|
||||
{
|
||||
int fd = 0;
|
||||
// clang-format off
|
||||
struct termios options{};
|
||||
// clang-format on
|
||||
const int64_t BAUD = B115200;
|
||||
const int64_t DATABITS = CS8;
|
||||
const int64_t STOPBITS = 0;
|
||||
const int64_t PARITYON = 0;
|
||||
const int64_t PARITY = 0;
|
||||
|
||||
fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY | O_CLOEXEC);
|
||||
if (fd == -1)
|
||||
{
|
||||
return fd; // failed to open TTY port
|
||||
}
|
||||
|
||||
if (fcntl(fd, F_SETFL, 0) == -1)
|
||||
{
|
||||
LOG(INFO) << "Error enabling direct I/O"; // clear all flags on descriptor, enable direct I/O
|
||||
}
|
||||
tcgetattr(fd, &options); // read serial port options
|
||||
|
||||
options.c_cflag = BAUD | DATABITS | STOPBITS | PARITYON | PARITY | CLOCAL | CREAD;
|
||||
// enable receiver, set 8 bit data, ignore control lines
|
||||
// options.c_cflag |= (CLOCAL | CREAD | CS8);
|
||||
options.c_iflag = IGNPAR;
|
||||
|
||||
// set the new port options
|
||||
tcsetattr(fd, TCSANOW, &options);
|
||||
return fd;
|
||||
}
|
130
src/algorithms/PVT/libs/an_packet_printer.h
Normal file
130
src/algorithms/PVT/libs/an_packet_printer.h
Normal file
@ -0,0 +1,130 @@
|
||||
/*!
|
||||
* \file an_packet_printer.h
|
||||
* \brief Interface of a class that prints PVT solutions in a serial device
|
||||
* following a custom version of the Advanced Navigation Packet Protocol
|
||||
* \author Carles Fernandez-Prades, 2021. cfernandez(at)cttc.es
|
||||
* \author Miguel Angel Gomez Lopez, 2021. gomezlma(at)inta.es
|
||||
*
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GNSS_SDR_AN_PACKET_PRINTER_H
|
||||
#define GNSS_SDR_AN_PACKET_PRINTER_H
|
||||
|
||||
#include "gnss_synchro.h"
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
/** \addtogroup PVT
|
||||
* \{ */
|
||||
/** \addtogroup PVT_libs
|
||||
* \{ */
|
||||
|
||||
class Rtklib_Solver;
|
||||
|
||||
struct sdr_gnss_packet_t
|
||||
{
|
||||
uint8_t nsvfix; // number of sats used in PVT fix
|
||||
uint8_t gps_satellites; // number of tracked GPS satellites
|
||||
uint8_t galileo_satellites; // number of tracked Galileo satellites
|
||||
uint32_t microseconds; // from start of receiver operation
|
||||
double latitude; // in [rad]
|
||||
double longitude; // in [rad]
|
||||
double height; // in [m]
|
||||
float velocity[3]; // North, East, Down, in [m/s]
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t prn; // PRN ID. Galileo sats expressed as PRN + 100
|
||||
uint8_t snr; // in [dB-Hz]
|
||||
int16_t doppler; // in [Hz], saturates at +32767 / -32768 Hz
|
||||
} sats[6];
|
||||
|
||||
uint32_t reserved;
|
||||
uint16_t status;
|
||||
};
|
||||
|
||||
|
||||
struct an_packet_t
|
||||
{
|
||||
uint8_t id;
|
||||
uint8_t length;
|
||||
uint8_t header[5]; // AN_PACKET_HEADER_SIZE
|
||||
uint8_t data[126]; // AN_MAXIMUM_PACKET_SIZE
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* \brief class that prints PVT solutions in a serial device following a custom
|
||||
* version of the Advanced Navigation Packet Protocol.
|
||||
*/
|
||||
class An_Packet_Printer
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* \brief Default constructor.
|
||||
*/
|
||||
explicit An_Packet_Printer(const std::string& an_dump_devname);
|
||||
|
||||
/*!
|
||||
* \brief Default destructor.
|
||||
*/
|
||||
~An_Packet_Printer();
|
||||
|
||||
/*!
|
||||
* \brief Print AN packet to the initialized device.
|
||||
*/
|
||||
bool print_packet(const Rtklib_Solver* const pvt_data, const std::map<int, Gnss_Synchro>& gnss_observables_map);
|
||||
|
||||
/*!
|
||||
* \brief Close serial port. Also done in the destructor, this is only
|
||||
* for testing.
|
||||
*/
|
||||
void close_serial() const;
|
||||
|
||||
private:
|
||||
const std::array<uint16_t, 256> d_crc16_table = {
|
||||
{0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273,
|
||||
0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528,
|
||||
0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886,
|
||||
0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf,
|
||||
0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5,
|
||||
0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2,
|
||||
0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8,
|
||||
0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691,
|
||||
0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f,
|
||||
0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64,
|
||||
0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0}};
|
||||
|
||||
const size_t SDR_GNSS_PACKET_LENGTH = 73;
|
||||
const uint8_t SDR_GNSS_PACKET_ID = 201;
|
||||
|
||||
int init_serial(const std::string& serial_device);
|
||||
void update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const Rtklib_Solver* const pvt, const std::map<int, Gnss_Synchro>& gnss_observables_map) const;
|
||||
void encode_gnss_cttc_packet(sdr_gnss_packet_t* sdr_gnss_packet, an_packet_t* _packet) const;
|
||||
uint16_t calculate_crc16(const void* data, uint16_t length) const;
|
||||
uint8_t calculate_header_lrc(const uint8_t* data) const;
|
||||
void an_packet_encode(an_packet_t* an_packet) const;
|
||||
void encode_sdr_gnss_packet(sdr_gnss_packet_t* sdr_gnss_packet, an_packet_t* _packet) const;
|
||||
void LSB_bytes_to_array(void* _in, int offset, uint8_t* _out, uint8_t var_size) const;
|
||||
|
||||
std::string d_an_devname;
|
||||
int d_an_dev_descriptor; // serial device descriptor (i.e. COM port)
|
||||
};
|
||||
|
||||
/** \} */
|
||||
/** \} */
|
||||
#endif // GNSS_SDR_AN_PACKET_PRINTER_H
|
@ -28,10 +28,9 @@
|
||||
#include <sstream> // for stringstream
|
||||
|
||||
|
||||
GeoJSON_Printer::GeoJSON_Printer(const std::string& base_path)
|
||||
GeoJSON_Printer::GeoJSON_Printer(const std::string& base_path) : geojson_base_path(base_path),
|
||||
first_pos(true)
|
||||
{
|
||||
first_pos = true;
|
||||
geojson_base_path = base_path;
|
||||
fs::path full_path(fs::current_path());
|
||||
const fs::path p(geojson_base_path);
|
||||
if (!fs::exists(p))
|
||||
|
@ -28,11 +28,10 @@
|
||||
#include <sstream> // for stringstream
|
||||
|
||||
|
||||
Gpx_Printer::Gpx_Printer(const std::string& base_path)
|
||||
Gpx_Printer::Gpx_Printer(const std::string& base_path) : indent(" "),
|
||||
gpx_base_path(base_path),
|
||||
positions_printed(false)
|
||||
{
|
||||
positions_printed = false;
|
||||
indent = " ";
|
||||
gpx_base_path = base_path;
|
||||
fs::path full_path(fs::current_path());
|
||||
const fs::path p(gpx_base_path);
|
||||
if (!fs::exists(p))
|
||||
|
447
src/algorithms/PVT/libs/has_simple_printer.cc
Normal file
447
src/algorithms/PVT/libs/has_simple_printer.cc
Normal file
@ -0,0 +1,447 @@
|
||||
/*!
|
||||
* \file has_simple_printer.cc
|
||||
* \brief Implementation of a class that prints HAS messages content in a txt
|
||||
* file.
|
||||
* \author Carles Fernandez-Prades, 2021. cfernandez(at)cttc.es
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "has_simple_printer.h"
|
||||
#include "Galileo_CNAV.h"
|
||||
#include "galileo_has_data.h"
|
||||
#include "gnss_sdr_filesystem.h"
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm> // for std::find, std::count
|
||||
#include <bitset> // for std::bitset
|
||||
#include <cstdint> // for uint8_t, ...
|
||||
#include <ctime> // for tm
|
||||
#include <exception> // for std::exception
|
||||
#include <iomanip> // for std::setw, std::setprecision
|
||||
#include <ios> // for std::fixed
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
#include <sstream> // for std::stringstream
|
||||
|
||||
|
||||
Has_Simple_Printer::Has_Simple_Printer(const std::string& base_path,
|
||||
const std::string& filename,
|
||||
bool time_tag_name) : d_has_base_path(base_path),
|
||||
d_data_printed(false)
|
||||
|
||||
{
|
||||
fs::path full_path(fs::current_path());
|
||||
const fs::path p(d_has_base_path);
|
||||
if (!fs::exists(p))
|
||||
{
|
||||
std::string new_folder;
|
||||
for (const auto& folder : fs::path(d_has_base_path))
|
||||
{
|
||||
new_folder += folder.string();
|
||||
errorlib::error_code ec;
|
||||
if (!fs::exists(new_folder))
|
||||
{
|
||||
if (!fs::create_directory(new_folder, ec))
|
||||
{
|
||||
std::cerr << "Could not create the " << new_folder << " folder.\n";
|
||||
d_has_base_path = full_path.string();
|
||||
}
|
||||
}
|
||||
new_folder += fs::path::preferred_separator;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
d_has_base_path = p.string();
|
||||
}
|
||||
if (d_has_base_path != ".")
|
||||
{
|
||||
std::cout << "HAS Message file will be stored at " << d_has_base_path << '\n';
|
||||
}
|
||||
|
||||
d_has_base_path = d_has_base_path + fs::path::preferred_separator;
|
||||
|
||||
const boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time();
|
||||
const tm timeinfo = boost::posix_time::to_tm(pt);
|
||||
|
||||
if (time_tag_name)
|
||||
{
|
||||
std::stringstream strm0;
|
||||
const int year = timeinfo.tm_year - 100;
|
||||
strm0 << year;
|
||||
const int month = timeinfo.tm_mon + 1;
|
||||
if (month < 10)
|
||||
{
|
||||
strm0 << "0";
|
||||
}
|
||||
strm0 << month;
|
||||
const int day = timeinfo.tm_mday;
|
||||
if (day < 10)
|
||||
{
|
||||
strm0 << "0";
|
||||
}
|
||||
strm0 << day << "_";
|
||||
const int hour = timeinfo.tm_hour;
|
||||
if (hour < 10)
|
||||
{
|
||||
strm0 << "0";
|
||||
}
|
||||
strm0 << hour;
|
||||
const int min = timeinfo.tm_min;
|
||||
if (min < 10)
|
||||
{
|
||||
strm0 << "0";
|
||||
}
|
||||
strm0 << min;
|
||||
const int sec = timeinfo.tm_sec;
|
||||
if (sec < 10)
|
||||
{
|
||||
strm0 << "0";
|
||||
}
|
||||
strm0 << sec;
|
||||
|
||||
d_has_filename = filename + "_" + strm0.str() + ".txt";
|
||||
}
|
||||
else
|
||||
{
|
||||
d_has_filename = filename + ".txt";
|
||||
}
|
||||
d_has_filename = d_has_base_path + d_has_filename;
|
||||
d_has_file.open(d_has_filename.c_str());
|
||||
}
|
||||
|
||||
|
||||
Has_Simple_Printer::~Has_Simple_Printer()
|
||||
{
|
||||
DLOG(INFO) << "HAS Message printer destructor called.";
|
||||
try
|
||||
{
|
||||
close_file();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::cerr << e.what() << '\n';
|
||||
}
|
||||
if (!d_data_printed)
|
||||
{
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(d_has_filename), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary HAS Message file.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Has_Simple_Printer::print_message(const Galileo_HAS_data* const has_data)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(d_mutex);
|
||||
|
||||
d_data_printed = true;
|
||||
std::string indent = " ";
|
||||
|
||||
if (d_has_file.is_open())
|
||||
{
|
||||
d_has_file << "HAS Message Type 1 Received.\n";
|
||||
d_has_file << "----------------------------\n";
|
||||
d_has_file << "HAS mode: ";
|
||||
switch (has_data->has_status)
|
||||
{
|
||||
case 0:
|
||||
d_has_file << "Test\n";
|
||||
break;
|
||||
case 1:
|
||||
d_has_file << "Operational\n";
|
||||
break;
|
||||
case 2:
|
||||
d_has_file << "Reserved\n";
|
||||
break;
|
||||
case 3:
|
||||
d_has_file << "Do not use HAS\n";
|
||||
break;
|
||||
default:
|
||||
d_has_file << "Unknown\n";
|
||||
}
|
||||
d_has_file << "HAS message ID: " << static_cast<float>(has_data->message_id) << "\n\n";
|
||||
|
||||
d_has_file << indent << "MT1 Header\n";
|
||||
d_has_file << indent << "----------\n";
|
||||
d_has_file << indent << indent << "TOH [s]: " << static_cast<float>(has_data->header.toh) << '\n';
|
||||
d_has_file << indent << indent << "Mask flag: " << static_cast<float>(has_data->header.mask_flag) << '\n';
|
||||
d_has_file << indent << indent << "Orbit Corr. Flag: " << static_cast<float>(has_data->header.orbit_correction_flag) << '\n';
|
||||
d_has_file << indent << indent << "Clock Full-set Flag: " << static_cast<float>(has_data->header.clock_fullset_flag) << '\n';
|
||||
d_has_file << indent << indent << "Clock Subset Flag: " << static_cast<float>(has_data->header.clock_subset_flag) << '\n';
|
||||
d_has_file << indent << indent << "Code Bias Flag: " << static_cast<float>(has_data->header.code_bias_flag) << '\n';
|
||||
d_has_file << indent << indent << "Phase Bias Flag: " << static_cast<float>(has_data->header.phase_bias_flag) << '\n';
|
||||
d_has_file << indent << indent << "Mask ID: " << static_cast<float>(has_data->header.mask_id) << '\n';
|
||||
d_has_file << indent << indent << "IOD Set ID: " << static_cast<float>(has_data->header.iod_id) << "\n\n";
|
||||
|
||||
d_has_file << indent << "MT1 Body\n";
|
||||
d_has_file << indent << "--------\n";
|
||||
d_has_file << indent << indent << "Mask Block\n";
|
||||
d_has_file << indent << indent << "----------\n";
|
||||
d_has_file << indent << indent << "Nsys: " << static_cast<float>(has_data->Nsys) << '\n';
|
||||
d_has_file << indent << indent << "GNSS ID: " << print_vector(has_data->gnss_id_mask) << " (0: GPS, 2: Galileo)\n";
|
||||
|
||||
int Nsat = has_data->get_nsat();
|
||||
d_has_file << indent << indent << "Satellite Mask: " << print_vector_binary(has_data->satellite_mask, HAS_MSG_SATELLITE_MASK_LENGTH) << '\n';
|
||||
d_has_file << indent << indent << " Nsat: " << Nsat << '\n';
|
||||
std::vector<std::string> system_strings = has_data->get_systems_string();
|
||||
for (uint8_t i = 0; i < has_data->Nsys; i++)
|
||||
{
|
||||
d_has_file << indent << indent << " PRN for " << system_strings[i] << ": " << print_vector(has_data->get_PRNs_in_mask(i)) << " (" << has_data->get_PRNs_in_mask(i).size() << " satellites)\n";
|
||||
}
|
||||
|
||||
d_has_file << indent << indent << "Signal Mask: " << print_vector_binary(has_data->signal_mask, HAS_MSG_SIGNAL_MASK_LENGTH) << '\n';
|
||||
for (uint8_t i = 0; i < has_data->Nsys; i++)
|
||||
{
|
||||
d_has_file << indent << indent << " Bias corrections for " << system_strings[i] << " signals: " << print_vector_string(has_data->get_signals_in_mask(i)) << '\n';
|
||||
}
|
||||
|
||||
d_has_file << indent << indent << "Cell Mask Availability Flag: " << print_vector(has_data->cell_mask_availability_flag) << '\n';
|
||||
for (uint8_t i = 0; i < has_data->Nsys; i++)
|
||||
{
|
||||
if (has_data->cell_mask_availability_flag[i] == true)
|
||||
{
|
||||
std::string text;
|
||||
if (has_data->gnss_id_mask[i] == 0)
|
||||
{
|
||||
text = "Cell Mask for GPS: ";
|
||||
}
|
||||
else if (has_data->gnss_id_mask[i] == 2)
|
||||
{
|
||||
text = "Cell Mask for Galileo: ";
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "Cell Mask for Reserved: ";
|
||||
}
|
||||
d_has_file << indent << indent << text;
|
||||
const std::string filler(indent.length() * 2 + text.length(), ' ');
|
||||
d_has_file << print_matrix(has_data->cell_mask[i], filler);
|
||||
}
|
||||
}
|
||||
d_has_file << indent << indent << "Nav message: " << print_vector(has_data->nav_message) << " (0: GPS LNAV or Galileo I/NAV)\n";
|
||||
|
||||
if (has_data->header.orbit_correction_flag == true)
|
||||
{
|
||||
d_has_file << '\n';
|
||||
d_has_file << indent << indent << "Orbit Corrections Block\n";
|
||||
d_has_file << indent << indent << "-----------------------\n";
|
||||
d_has_file << indent << indent << "Validity interval: " << static_cast<float>(has_data->validity_interval_index_orbit_corrections) << '\n';
|
||||
d_has_file << indent << indent << "GNSS IOD: " << print_vector(has_data->gnss_iod) << '\n';
|
||||
d_has_file << indent << indent << "Delta Radial [m]: " << print_vector(has_data->delta_radial, HAS_MSG_DELTA_RADIAL_SCALE_FACTOR) << '\n';
|
||||
d_has_file << indent << indent << "Delta Along Track [m]: " << print_vector(has_data->delta_along_track, HAS_MSG_DELTA_ALONG_TRACK_SCALE_FACTOR) << '\n';
|
||||
d_has_file << indent << indent << "Delta Cross Track [m]: " << print_vector(has_data->delta_cross_track, HAS_MSG_DELTA_CROSS_TRACK_SCALE_FACTOR) << '\n';
|
||||
}
|
||||
|
||||
if (has_data->header.clock_fullset_flag == true)
|
||||
{
|
||||
d_has_file << '\n';
|
||||
d_has_file << indent << indent << "Clock Full-set Corrections Block\n";
|
||||
d_has_file << indent << indent << "--------------------------------\n";
|
||||
d_has_file << indent << indent << "Validity interval: " << static_cast<float>(has_data->validity_interval_index_clock_fullset_corrections) << '\n';
|
||||
d_has_file << indent << indent << "Delta Clock C0 Multiplier: " << print_vector(has_data->delta_clock_c0_multiplier) << '\n';
|
||||
d_has_file << indent << indent << "Delta Clock C0 [m]: " << print_vector(has_data->delta_clock_c0, HAS_MSG_DELTA_CLOCK_SCALE_FACTOR) << '\n';
|
||||
}
|
||||
|
||||
if (has_data->header.clock_subset_flag == true)
|
||||
{
|
||||
d_has_file << '\n';
|
||||
d_has_file << indent << indent << "Clock Subset Corrections Block\n";
|
||||
d_has_file << indent << indent << "------------------------------\n";
|
||||
d_has_file << indent << indent << "Validity interval: " << static_cast<float>(has_data->validity_interval_index_clock_subset_corrections) << '\n';
|
||||
d_has_file << indent << indent << "Nsysprime: " << static_cast<float>(has_data->Nsysprime) << '\n';
|
||||
d_has_file << indent << indent << "GNSS ID: " << print_vector(has_data->gnss_id_clock_subset) << '\n';
|
||||
d_has_file << indent << indent << "Delta Clock C0 Multiplier: " << print_vector(has_data->delta_clock_c0_multiplier_clock_subset) << '\n';
|
||||
d_has_file << indent << indent << "Satellite sub-mask: ";
|
||||
int Nsatprime = 0;
|
||||
for (uint8_t k = 0; k < has_data->Nsysprime; k++)
|
||||
{
|
||||
auto it = std::find(has_data->gnss_id_mask.begin(), has_data->gnss_id_mask.end(), has_data->gnss_id_clock_subset[k]);
|
||||
if (it != has_data->gnss_id_mask.end())
|
||||
{
|
||||
int index = it - has_data->gnss_id_mask.begin();
|
||||
std::string sat_mask = print_vector_binary(std::vector<uint64_t>(1, has_data->satellite_mask[index]), HAS_MSG_SATELLITE_MASK_LENGTH);
|
||||
int number_sats_satellite_mask = std::count(sat_mask.begin(), sat_mask.end(), '1');
|
||||
uint64_t mask_value = has_data->satellite_submask[index];
|
||||
// convert value into string
|
||||
std::string binary("");
|
||||
uint64_t mask = 1;
|
||||
for (int i = 0; i < number_sats_satellite_mask - 1; i++)
|
||||
{
|
||||
if ((mask & mask_value) >= 1)
|
||||
{
|
||||
binary.insert(0, "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
binary.insert(0, "0");
|
||||
}
|
||||
mask <<= 1;
|
||||
}
|
||||
d_has_file << binary << " ";
|
||||
Nsatprime += std::count(binary.begin(), binary.end(), '1');
|
||||
}
|
||||
}
|
||||
d_has_file << '\n';
|
||||
d_has_file << " Nsat in subset = " << Nsatprime << '\n';
|
||||
const std::string text("Delta Clock C0 [m]: ");
|
||||
const std::string filler(indent.length() * 2 + text.length(), ' ');
|
||||
d_has_file << indent << indent << text << print_matrix(has_data->delta_clock_c0_clock_subset, filler, HAS_MSG_DELTA_CLOCK_SCALE_FACTOR);
|
||||
}
|
||||
|
||||
if (has_data->header.code_bias_flag == true)
|
||||
{
|
||||
d_has_file << '\n';
|
||||
d_has_file << indent << indent << "Code Bias Block\n";
|
||||
d_has_file << indent << indent << "---------------\n";
|
||||
d_has_file << indent << indent << "Validity interval: " << static_cast<float>(has_data->validity_interval_index_code_bias_corrections) << '\n';
|
||||
const std::string text("Code bias [m]: ");
|
||||
const std::string filler(indent.length() * 2 + text.length(), ' ');
|
||||
d_has_file << indent << indent << text << print_matrix(has_data->code_bias, filler, HAS_MSG_CODE_BIAS_SCALE_FACTOR);
|
||||
}
|
||||
|
||||
if (has_data->header.phase_bias_flag == true)
|
||||
{
|
||||
d_has_file << '\n';
|
||||
d_has_file << indent << indent << "Phase Bias Block\n";
|
||||
d_has_file << indent << indent << "----------------\n";
|
||||
d_has_file << indent << indent << "Validity interval: " << static_cast<float>(has_data->validity_interval_index_phase_bias_corrections) << '\n';
|
||||
const std::string text("Phase bias [cycles]: ");
|
||||
const std::string filler(indent.length() * 2 + text.length(), ' ');
|
||||
d_has_file << indent << indent << text << print_matrix(has_data->phase_bias, filler, HAS_MSG_PHASE_BIAS_SCALE_FACTOR);
|
||||
d_has_file << indent << indent << "Phase discontinuity indicator: " << print_matrix(has_data->phase_discontinuity_indicator, filler);
|
||||
}
|
||||
|
||||
d_has_file << "\n\n";
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
std::string Has_Simple_Printer::print_vector(const std::vector<T>& vec, float scale_factor) const
|
||||
{
|
||||
std::string msg;
|
||||
std::stringstream ss;
|
||||
for (auto el : vec)
|
||||
{
|
||||
if (scale_factor == 1)
|
||||
{
|
||||
ss << static_cast<float>(el) << " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << std::setw(9) << std::setprecision(4) << std::fixed << static_cast<float>(el) * scale_factor << " ";
|
||||
}
|
||||
}
|
||||
msg += ss.str();
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
std::string Has_Simple_Printer::print_vector_binary(const std::vector<T>& vec, size_t bit_length) const
|
||||
{
|
||||
std::string msg;
|
||||
std::stringstream ss;
|
||||
for (auto el : vec)
|
||||
{
|
||||
if (bit_length == HAS_MSG_SATELLITE_MASK_LENGTH)
|
||||
{
|
||||
std::bitset<HAS_MSG_SATELLITE_MASK_LENGTH> bits(el);
|
||||
ss << bits.to_string() << " ";
|
||||
}
|
||||
if (bit_length == HAS_MSG_SIGNAL_MASK_LENGTH)
|
||||
{
|
||||
std::bitset<HAS_MSG_SIGNAL_MASK_LENGTH> bits(el);
|
||||
ss << bits.to_string() << " ";
|
||||
}
|
||||
}
|
||||
msg += ss.str();
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
std::string Has_Simple_Printer::print_matrix(const std::vector<std::vector<T>>& mat, const std::string& filler, float scale_factor) const
|
||||
{
|
||||
std::string msg;
|
||||
std::stringstream ss;
|
||||
bool first_row = true;
|
||||
|
||||
if (!mat.empty())
|
||||
{
|
||||
for (size_t row = 0; row < mat.size(); row++)
|
||||
{
|
||||
if (first_row)
|
||||
{
|
||||
first_row = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << filler;
|
||||
}
|
||||
for (size_t col = 0; col < mat[0].size(); col++)
|
||||
{
|
||||
if (scale_factor == 1)
|
||||
{
|
||||
ss << static_cast<float>(mat[row][col]) << " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << std::setw(9) << std::setprecision(2) << std::fixed << static_cast<float>(mat[row][col]) * scale_factor << " ";
|
||||
}
|
||||
}
|
||||
ss << '\n';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << '\n';
|
||||
}
|
||||
msg += ss.str();
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
std::string Has_Simple_Printer::print_vector_string(const std::vector<std::string>& vec) const
|
||||
{
|
||||
std::string msg;
|
||||
bool first = true;
|
||||
for (const auto& el : vec)
|
||||
{
|
||||
if (first == true)
|
||||
{
|
||||
msg += el;
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += " " + el;
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
bool Has_Simple_Printer::close_file()
|
||||
{
|
||||
if (d_has_file.is_open())
|
||||
{
|
||||
d_has_file.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
67
src/algorithms/PVT/libs/has_simple_printer.h
Normal file
67
src/algorithms/PVT/libs/has_simple_printer.h
Normal file
@ -0,0 +1,67 @@
|
||||
/*!
|
||||
* \file has_simple_printer.h
|
||||
* \brief Interface of a class that prints HAS messages content in a txt file.
|
||||
* \author Carles Fernandez-Prades, 2021. cfernandez(at)cttc.es
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_HAS_SIMPLE_PRINTER_H
|
||||
#define GNSS_SDR_HAS_SIMPLE_PRINTER_H
|
||||
|
||||
#include <cstddef> // for size_t
|
||||
#include <fstream> // for std::ofstream
|
||||
#include <mutex> // for std::mutex
|
||||
#include <string> // for std::string
|
||||
#include <vector> // for std::vector
|
||||
|
||||
/** \addtogroup PVT
|
||||
* \{ */
|
||||
/** \addtogroup PVT_libs
|
||||
* \{ */
|
||||
|
||||
class Galileo_HAS_data;
|
||||
|
||||
/*!
|
||||
* \brief Prints HAS messages content in a txt file. See HAS-SIS-ICD for a
|
||||
* message description.
|
||||
*/
|
||||
class Has_Simple_Printer
|
||||
{
|
||||
public:
|
||||
explicit Has_Simple_Printer(const std::string& base_path = std::string("."), const std::string& filename = std::string("HAS_Messages"), bool time_tag_name = true);
|
||||
~Has_Simple_Printer();
|
||||
bool print_message(const Galileo_HAS_data* const has_data);
|
||||
|
||||
private:
|
||||
template <class T>
|
||||
std::string print_vector(const std::vector<T>& vec, float scale_factor = 1) const;
|
||||
|
||||
template <class T>
|
||||
std::string print_vector_binary(const std::vector<T>& vec, size_t bit_length) const;
|
||||
|
||||
template <class T>
|
||||
std::string print_matrix(const std::vector<std::vector<T>>& mat, const std::string& filler, float scale_factor = 1) const;
|
||||
|
||||
std::string print_vector_string(const std::vector<std::string>& vec) const;
|
||||
|
||||
bool close_file();
|
||||
|
||||
std::mutex d_mutex;
|
||||
std::ofstream d_has_file;
|
||||
std::string d_has_filename;
|
||||
std::string d_has_base_path;
|
||||
bool d_data_printed;
|
||||
};
|
||||
|
||||
/** \} */
|
||||
/** \} */
|
||||
#endif // GNSS_SDR_HAS_SIMPLE_PRINTER_H
|
@ -30,11 +30,10 @@
|
||||
#include <sys/types.h> // for mode_t
|
||||
|
||||
|
||||
Kml_Printer::Kml_Printer(const std::string& base_path)
|
||||
Kml_Printer::Kml_Printer(const std::string& base_path) : kml_base_path(base_path),
|
||||
indent(" "),
|
||||
positions_printed(false)
|
||||
{
|
||||
positions_printed = false;
|
||||
indent = " ";
|
||||
kml_base_path = base_path;
|
||||
fs::path full_path(fs::current_path());
|
||||
const fs::path p(kml_base_path);
|
||||
if (!fs::exists(p))
|
||||
|
@ -21,15 +21,16 @@
|
||||
#include <sstream>
|
||||
|
||||
|
||||
Monitor_Ephemeris_Udp_Sink::Monitor_Ephemeris_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context}
|
||||
Monitor_Ephemeris_Udp_Sink::Monitor_Ephemeris_Udp_Sink(const std::vector<std::string>& addresses,
|
||||
const uint16_t& port,
|
||||
bool protobuf_enabled) : socket{io_context},
|
||||
use_protobuf(protobuf_enabled)
|
||||
{
|
||||
for (const auto& address : addresses)
|
||||
{
|
||||
boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port);
|
||||
endpoints.push_back(endpoint);
|
||||
}
|
||||
|
||||
use_protobuf = protobuf_enabled;
|
||||
if (use_protobuf)
|
||||
{
|
||||
serdes_gal = Serdes_Galileo_Eph();
|
||||
|
@ -21,7 +21,10 @@
|
||||
#include <sstream>
|
||||
|
||||
|
||||
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context}
|
||||
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses,
|
||||
const uint16_t& port,
|
||||
bool protobuf_enabled) : socket{io_context},
|
||||
use_protobuf(protobuf_enabled)
|
||||
{
|
||||
for (const auto& address : addresses)
|
||||
{
|
||||
@ -29,7 +32,6 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addre
|
||||
endpoints.push_back(endpoint);
|
||||
}
|
||||
|
||||
use_protobuf = protobuf_enabled;
|
||||
if (use_protobuf)
|
||||
{
|
||||
serdes = Serdes_Monitor_Pvt();
|
||||
|
@ -33,10 +33,13 @@
|
||||
#include <utility>
|
||||
|
||||
|
||||
Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_file, bool flag_nmea_tty_port, std::string nmea_dump_devname, const std::string& base_path)
|
||||
Nmea_Printer::Nmea_Printer(const std::string& filename,
|
||||
bool flag_nmea_output_file,
|
||||
bool flag_nmea_tty_port,
|
||||
std::string nmea_dump_devname,
|
||||
const std::string& base_path) : nmea_base_path(base_path),
|
||||
d_flag_nmea_output_file(flag_nmea_output_file)
|
||||
{
|
||||
nmea_base_path = base_path;
|
||||
d_flag_nmea_output_file = flag_nmea_output_file;
|
||||
if (d_flag_nmea_output_file == true)
|
||||
{
|
||||
fs::path full_path(fs::current_path());
|
||||
|
@ -30,64 +30,65 @@
|
||||
class Pvt_Conf
|
||||
{
|
||||
public:
|
||||
Pvt_Conf();
|
||||
|
||||
std::map<int, int> rtcm_msg_rate_ms;
|
||||
|
||||
std::string rinex_name;
|
||||
std::string rinex_name = std::string("-");
|
||||
std::string dump_filename;
|
||||
std::string nmea_dump_filename;
|
||||
std::string nmea_dump_devname;
|
||||
std::string rtcm_dump_devname;
|
||||
std::string output_path;
|
||||
std::string rinex_output_path;
|
||||
std::string gpx_output_path;
|
||||
std::string geojson_output_path;
|
||||
std::string nmea_output_file_path;
|
||||
std::string kml_output_path;
|
||||
std::string xml_output_path;
|
||||
std::string rtcm_output_file_path;
|
||||
std::string an_dump_devname;
|
||||
std::string output_path = std::string(".");
|
||||
std::string rinex_output_path = std::string(".");
|
||||
std::string gpx_output_path = std::string(".");
|
||||
std::string geojson_output_path = std::string(".");
|
||||
std::string nmea_output_file_path = std::string(".");
|
||||
std::string kml_output_path = std::string(".");
|
||||
std::string xml_output_path = std::string(".");
|
||||
std::string rtcm_output_file_path = std::string(".");
|
||||
std::string udp_addresses;
|
||||
std::string udp_eph_addresses;
|
||||
|
||||
uint32_t type_of_receiver;
|
||||
uint32_t observable_interval_ms;
|
||||
uint32_t type_of_receiver = 0;
|
||||
uint32_t observable_interval_ms = 20;
|
||||
|
||||
int32_t output_rate_ms;
|
||||
int32_t display_rate_ms;
|
||||
int32_t kml_rate_ms;
|
||||
int32_t gpx_rate_ms;
|
||||
int32_t geojson_rate_ms;
|
||||
int32_t nmea_rate_ms;
|
||||
int32_t rinex_version;
|
||||
int32_t rinexobs_rate_ms;
|
||||
int32_t max_obs_block_rx_clock_offset_ms;
|
||||
int udp_port;
|
||||
int udp_eph_port;
|
||||
int32_t output_rate_ms = 0;
|
||||
int32_t display_rate_ms = 0;
|
||||
int32_t kml_rate_ms = 1000;
|
||||
int32_t gpx_rate_ms = 1000;
|
||||
int32_t geojson_rate_ms = 1000;
|
||||
int32_t nmea_rate_ms = 1000;
|
||||
int32_t rinex_version = 0;
|
||||
int32_t rinexobs_rate_ms = 0;
|
||||
int32_t an_rate_ms = 1000;
|
||||
int32_t max_obs_block_rx_clock_offset_ms = 40;
|
||||
int udp_port = 0;
|
||||
int udp_eph_port = 0;
|
||||
int rtk_trace_level = 0;
|
||||
|
||||
uint16_t rtcm_tcp_port;
|
||||
uint16_t rtcm_station_id;
|
||||
|
||||
bool flag_nmea_tty_port;
|
||||
bool flag_rtcm_server;
|
||||
bool flag_rtcm_tty_port;
|
||||
bool output_enabled;
|
||||
bool rinex_output_enabled;
|
||||
bool gpx_output_enabled;
|
||||
bool geojson_output_enabled;
|
||||
bool nmea_output_file_enabled;
|
||||
bool kml_output_enabled;
|
||||
bool xml_output_enabled;
|
||||
bool rtcm_output_file_enabled;
|
||||
bool monitor_enabled;
|
||||
bool monitor_ephemeris_enabled;
|
||||
bool protobuf_enabled;
|
||||
bool enable_rx_clock_correction;
|
||||
bool show_local_time_zone;
|
||||
bool pre_2009_file;
|
||||
bool dump;
|
||||
bool dump_mat;
|
||||
uint16_t rtcm_tcp_port = 0;
|
||||
uint16_t rtcm_station_id = 0;
|
||||
|
||||
bool flag_nmea_tty_port = false;
|
||||
bool flag_rtcm_server = false;
|
||||
bool flag_rtcm_tty_port = false;
|
||||
bool output_enabled = true;
|
||||
bool rinex_output_enabled = true;
|
||||
bool gpx_output_enabled = true;
|
||||
bool geojson_output_enabled = true;
|
||||
bool nmea_output_file_enabled = true;
|
||||
bool an_output_enabled = false;
|
||||
bool kml_output_enabled = true;
|
||||
bool xml_output_enabled = true;
|
||||
bool rtcm_output_file_enabled = true;
|
||||
bool monitor_enabled = false;
|
||||
bool monitor_ephemeris_enabled = false;
|
||||
bool protobuf_enabled = true;
|
||||
bool enable_rx_clock_correction = true;
|
||||
bool show_local_time_zone = false;
|
||||
bool pre_2009_file = false;
|
||||
bool dump = false;
|
||||
bool dump_mat = true;
|
||||
bool log_source_timetag;
|
||||
std::string log_source_timetag_file;
|
||||
};
|
||||
|
@ -22,26 +22,6 @@
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
Pvt_Solution::Pvt_Solution()
|
||||
{
|
||||
d_latitude_d = 0.0;
|
||||
d_longitude_d = 0.0;
|
||||
d_height_m = 0.0;
|
||||
d_speed_over_ground_m_s = 0.0;
|
||||
d_course_over_ground_d = 0.0;
|
||||
d_avg_latitude_d = 0.0;
|
||||
d_avg_longitude_d = 0.0;
|
||||
d_avg_height_m = 0.0;
|
||||
d_flag_averaging = false;
|
||||
b_valid_position = false;
|
||||
d_averaging_depth = 0;
|
||||
d_valid_observations = 0;
|
||||
d_rx_dt_s = 0.0;
|
||||
d_rx_clock_drift_ppm = 0.0;
|
||||
d_pre_2009_file = false; // disabled by default
|
||||
}
|
||||
|
||||
|
||||
int Pvt_Solution::cart2geo(double X, double Y, double Z, int elipsoid_selection)
|
||||
{
|
||||
/* Conversion of Cartesian coordinates (X,Y,Z) to geographical
|
||||
@ -130,7 +110,7 @@ void Pvt_Solution::perform_pos_averaging()
|
||||
d_avg_latitude_d = d_avg_latitude_d / static_cast<double>(d_averaging_depth);
|
||||
d_avg_longitude_d = d_avg_longitude_d / static_cast<double>(d_averaging_depth);
|
||||
d_avg_height_m = d_avg_height_m / static_cast<double>(d_averaging_depth);
|
||||
b_valid_position = true;
|
||||
d_valid_position = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -143,12 +123,12 @@ void Pvt_Solution::perform_pos_averaging()
|
||||
d_avg_latitude_d = d_latitude_d;
|
||||
d_avg_longitude_d = d_longitude_d;
|
||||
d_avg_height_m = d_height_m;
|
||||
b_valid_position = false;
|
||||
d_valid_position = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
b_valid_position = true;
|
||||
d_valid_position = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,13 +225,13 @@ bool Pvt_Solution::is_averaging() const
|
||||
|
||||
bool Pvt_Solution::is_valid_position() const
|
||||
{
|
||||
return b_valid_position;
|
||||
return d_valid_position;
|
||||
}
|
||||
|
||||
|
||||
void Pvt_Solution::set_valid_position(bool is_valid)
|
||||
{
|
||||
b_valid_position = is_valid;
|
||||
d_valid_position = is_valid;
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
class Pvt_Solution
|
||||
{
|
||||
public:
|
||||
Pvt_Solution();
|
||||
Pvt_Solution() = default;
|
||||
virtual ~Pvt_Solution() = default;
|
||||
|
||||
void set_rx_pos(const std::array<double, 3> &pos); //!< Set position: X, Y, Z in Cartesian ECEF coordinates [m]
|
||||
@ -102,24 +102,24 @@ private:
|
||||
std::deque<double> d_hist_longitude_d;
|
||||
std::deque<double> d_hist_height_m;
|
||||
|
||||
double d_latitude_d; // RX position Latitude WGS84 [deg]
|
||||
double d_longitude_d; // RX position Longitude WGS84 [deg]
|
||||
double d_height_m; // RX position height WGS84 [m]
|
||||
double d_rx_dt_s; // RX time offset [s]
|
||||
double d_rx_clock_drift_ppm; // RX clock drift [ppm]
|
||||
double d_speed_over_ground_m_s; // RX speed over ground [m/s]
|
||||
double d_course_over_ground_d; // RX course over ground [deg]
|
||||
double d_latitude_d{0.0}; // RX position Latitude WGS84 [deg]
|
||||
double d_longitude_d{0.0}; // RX position Longitude WGS84 [deg]
|
||||
double d_height_m{0.0}; // RX position height WGS84 [m]
|
||||
double d_rx_dt_s{0.0}; // RX time offset [s]
|
||||
double d_rx_clock_drift_ppm{0.0}; // RX clock drift [ppm]
|
||||
double d_speed_over_ground_m_s{0.0}; // RX speed over ground [m/s]
|
||||
double d_course_over_ground_d{0.0}; // RX course over ground [deg]
|
||||
|
||||
double d_avg_latitude_d; // Averaged latitude in degrees
|
||||
double d_avg_longitude_d; // Averaged longitude in degrees
|
||||
double d_avg_height_m; // Averaged height [m]
|
||||
double d_avg_latitude_d{0.0}; // Averaged latitude in degrees
|
||||
double d_avg_longitude_d{0.0}; // Averaged longitude in degrees
|
||||
double d_avg_height_m{0.0}; // Averaged height [m]
|
||||
|
||||
int d_averaging_depth; // Length of averaging window
|
||||
int d_valid_observations;
|
||||
int d_averaging_depth{0}; // Length of averaging window
|
||||
int d_valid_observations{0}; // Number of valid observations in this epoch
|
||||
|
||||
bool d_pre_2009_file; // Flag to correct week rollover in post processing mode for signals older than 2009
|
||||
bool b_valid_position;
|
||||
bool d_flag_averaging;
|
||||
bool d_pre_2009_file{false}; // Flag to correct week rollover in post processing mode for signals older than 2009
|
||||
bool d_valid_position{false};
|
||||
bool d_flag_averaging{false};
|
||||
};
|
||||
|
||||
|
||||
|
@ -56,65 +56,15 @@
|
||||
#include <vector>
|
||||
|
||||
|
||||
Rinex_Printer::Rinex_Printer(int32_t conf_version, const std::string& base_path, const std::string& base_name)
|
||||
Rinex_Printer::Rinex_Printer(int32_t conf_version,
|
||||
const std::string& base_path,
|
||||
const std::string& base_name) : d_fake_cnav_iode(1),
|
||||
d_numberTypesObservations(4),
|
||||
d_rinex_header_updated(false),
|
||||
d_rinex_header_written(false),
|
||||
d_pre_2009_file(false)
|
||||
|
||||
{
|
||||
d_pre_2009_file = false;
|
||||
d_rinex_header_updated = false;
|
||||
d_rinex_header_written = false;
|
||||
std::string base_rinex_path = base_path;
|
||||
fs::path full_path(fs::current_path());
|
||||
const fs::path p(base_rinex_path);
|
||||
if (!fs::exists(p))
|
||||
{
|
||||
std::string new_folder;
|
||||
for (const auto& folder : fs::path(base_rinex_path))
|
||||
{
|
||||
new_folder += folder.string();
|
||||
errorlib::error_code ec;
|
||||
if (!fs::exists(new_folder))
|
||||
{
|
||||
if (!fs::create_directory(new_folder, ec))
|
||||
{
|
||||
std::cout << "Could not create the " << new_folder << " folder.\n";
|
||||
base_rinex_path = full_path.string();
|
||||
}
|
||||
}
|
||||
new_folder += fs::path::preferred_separator;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base_rinex_path = p.string();
|
||||
}
|
||||
if (base_rinex_path != ".")
|
||||
{
|
||||
std::cout << "RINEX files will be stored at " << base_rinex_path << '\n';
|
||||
}
|
||||
|
||||
navfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GPS_NAV", base_name);
|
||||
obsfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_OBS", base_name);
|
||||
sbsfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_SBAS", base_name);
|
||||
navGalfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GAL_NAV", base_name);
|
||||
navMixfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_MIXED_NAV", base_name);
|
||||
navGlofilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GLO_NAV", base_name);
|
||||
navBdsfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_BDS_NAV", base_name);
|
||||
|
||||
Rinex_Printer::navFile.open(navfilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
Rinex_Printer::obsFile.open(obsfilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
Rinex_Printer::sbsFile.open(sbsfilename, std::ios::out | std::ios::app);
|
||||
Rinex_Printer::navGalFile.open(navGalfilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
Rinex_Printer::navMixFile.open(navMixfilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
Rinex_Printer::navGloFile.open(navGlofilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
Rinex_Printer::navBdsFile.open(navBdsfilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
|
||||
|
||||
if (!Rinex_Printer::navFile.is_open() or !Rinex_Printer::obsFile.is_open() or
|
||||
!Rinex_Printer::sbsFile.is_open() or !Rinex_Printer::navGalFile.is_open() or
|
||||
!Rinex_Printer::navMixFile.is_open() or !Rinex_Printer::navGloFile.is_open())
|
||||
{
|
||||
std::cout << "RINEX files cannot be saved. Wrong permissions?\n";
|
||||
}
|
||||
|
||||
// RINEX v3.02 codes
|
||||
satelliteSystem["GPS"] = "G";
|
||||
satelliteSystem["GLONASS"] = "R";
|
||||
@ -199,6 +149,59 @@ Rinex_Printer::Rinex_Printer(int32_t conf_version, const std::string& base_path,
|
||||
observationCode["GPS_L1_CA_v2"] = "1";
|
||||
observationCode["GLONASS_G1_CA_v2"] = "1";
|
||||
|
||||
std::string base_rinex_path = base_path;
|
||||
fs::path full_path(fs::current_path());
|
||||
const fs::path p(base_rinex_path);
|
||||
if (!fs::exists(p))
|
||||
{
|
||||
std::string new_folder;
|
||||
for (const auto& folder : fs::path(base_rinex_path))
|
||||
{
|
||||
new_folder += folder.string();
|
||||
errorlib::error_code ec;
|
||||
if (!fs::exists(new_folder))
|
||||
{
|
||||
if (!fs::create_directory(new_folder, ec))
|
||||
{
|
||||
std::cout << "Could not create the " << new_folder << " folder.\n";
|
||||
base_rinex_path = full_path.string();
|
||||
}
|
||||
}
|
||||
new_folder += fs::path::preferred_separator;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base_rinex_path = p.string();
|
||||
}
|
||||
if (base_rinex_path != ".")
|
||||
{
|
||||
std::cout << "RINEX files will be stored at " << base_rinex_path << '\n';
|
||||
}
|
||||
|
||||
navfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GPS_NAV", base_name);
|
||||
obsfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_OBS", base_name);
|
||||
sbsfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_SBAS", base_name);
|
||||
navGalfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GAL_NAV", base_name);
|
||||
navMixfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_MIXED_NAV", base_name);
|
||||
navGlofilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GLO_NAV", base_name);
|
||||
navBdsfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_BDS_NAV", base_name);
|
||||
|
||||
Rinex_Printer::navFile.open(navfilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
Rinex_Printer::obsFile.open(obsfilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
Rinex_Printer::sbsFile.open(sbsfilename, std::ios::out | std::ios::app);
|
||||
Rinex_Printer::navGalFile.open(navGalfilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
Rinex_Printer::navMixFile.open(navMixfilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
Rinex_Printer::navGloFile.open(navGlofilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
Rinex_Printer::navBdsFile.open(navBdsfilename, std::ios::out | std::ios::in | std::ios::app);
|
||||
|
||||
if (!Rinex_Printer::navFile.is_open() or !Rinex_Printer::obsFile.is_open() or
|
||||
!Rinex_Printer::sbsFile.is_open() or !Rinex_Printer::navGalFile.is_open() or
|
||||
!Rinex_Printer::navMixFile.is_open() or !Rinex_Printer::navGloFile.is_open())
|
||||
{
|
||||
std::cout << "RINEX files cannot be saved. Wrong permissions?\n";
|
||||
}
|
||||
|
||||
if (conf_version == 2)
|
||||
{
|
||||
d_version = 2;
|
||||
@ -209,9 +212,6 @@ Rinex_Printer::Rinex_Printer(int32_t conf_version, const std::string& base_path,
|
||||
d_version = 3;
|
||||
d_stringVersion = "3.02";
|
||||
}
|
||||
|
||||
d_numberTypesObservations = 4; // Number of available types of observable in the system
|
||||
d_fake_cnav_iode = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -222,8 +222,8 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns name of RINEX observation file
|
||||
*/
|
||||
* \brief Returns name of RINEX observation file
|
||||
*/
|
||||
inline std::string get_obsfilename() const
|
||||
{
|
||||
return obsfilename;
|
||||
|
@ -35,15 +35,13 @@
|
||||
#include <sstream> // for std::stringstream
|
||||
|
||||
|
||||
Rtcm::Rtcm(uint16_t port)
|
||||
Rtcm::Rtcm(uint16_t port) : RTCM_port(port), server_is_running(false)
|
||||
{
|
||||
RTCM_port = port;
|
||||
preamble = std::bitset<8>("11010011");
|
||||
reserved_field = std::bitset<6>("000000");
|
||||
rtcm_message_queue = std::make_shared<Concurrent_Queue<std::string> >();
|
||||
rtcm_message_queue = std::make_shared<Concurrent_Queue<std::string>>();
|
||||
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), RTCM_port);
|
||||
servers.emplace_back(io_context, endpoint);
|
||||
server_is_running = false;
|
||||
}
|
||||
|
||||
|
||||
@ -175,8 +173,7 @@ std::string Rtcm::bin_to_binary_data(const std::string& s) const
|
||||
{
|
||||
std::string s_aux;
|
||||
const auto remainder = static_cast<int32_t>(std::fmod(s.length(), 8));
|
||||
std::vector<uint8_t> c;
|
||||
c.reserve(s.length());
|
||||
std::vector<uint8_t> c(s.length());
|
||||
|
||||
uint32_t k = 0;
|
||||
if (remainder != 0)
|
||||
@ -628,8 +625,8 @@ std::string Rtcm::print_MT1003(const Gps_Ephemeris& ephL1, const Gps_CNAV_Epheme
|
||||
}
|
||||
|
||||
// Get common observables
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro> > common_observables;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro> >::const_iterator common_observables_iter;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro>> common_observables;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro>>::const_iterator common_observables_iter;
|
||||
std::map<int32_t, Gnss_Synchro> observablesL1_with_L2;
|
||||
|
||||
for (observables_iter = observablesL1.cbegin();
|
||||
@ -737,8 +734,8 @@ std::string Rtcm::print_MT1004(const Gps_Ephemeris& ephL1, const Gps_CNAV_Epheme
|
||||
}
|
||||
|
||||
// Get common observables
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro> > common_observables;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro> >::const_iterator common_observables_iter;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro>> common_observables;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro>>::const_iterator common_observables_iter;
|
||||
std::map<int32_t, Gnss_Synchro> observablesL1_with_L2;
|
||||
|
||||
for (observables_iter = observablesL1.cbegin();
|
||||
@ -1310,8 +1307,8 @@ std::string Rtcm::print_MT1011(const Glonass_Gnav_Ephemeris& ephL1, const Glonas
|
||||
}
|
||||
|
||||
// Get common observables
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro> > common_observables;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro> >::const_iterator common_observables_iter;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro>> common_observables;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro>>::const_iterator common_observables_iter;
|
||||
std::map<int32_t, Gnss_Synchro> observablesL1_with_L2;
|
||||
|
||||
for (observables_iter = observablesL1.begin();
|
||||
@ -1421,8 +1418,8 @@ std::string Rtcm::print_MT1012(const Glonass_Gnav_Ephemeris& ephL1, const Glonas
|
||||
}
|
||||
|
||||
// Get common observables
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro> > common_observables;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro> >::const_iterator common_observables_iter;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro>> common_observables;
|
||||
std::vector<std::pair<Gnss_Synchro, Gnss_Synchro>>::const_iterator common_observables_iter;
|
||||
std::map<int32_t, Gnss_Synchro> observablesL1_with_L2;
|
||||
|
||||
for (observables_iter = observablesL1.begin();
|
||||
@ -2382,10 +2379,11 @@ std::string Rtcm::get_MSM_1_content_sat_data(const std::map<int32_t, Gnss_Synchr
|
||||
const uint32_t num_satellites = DF394.count();
|
||||
const uint32_t numobs = observables.size();
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
|
||||
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
|
||||
|
||||
observables_vector.reserve(numobs);
|
||||
std::map<int32_t, Gnss_Synchro>::const_iterator gnss_synchro_iter;
|
||||
std::vector<uint32_t> pos;
|
||||
auto pos = std::vector<uint32_t>();
|
||||
pos.reserve(numobs);
|
||||
std::vector<uint32_t>::iterator it;
|
||||
|
||||
@ -2401,7 +2399,7 @@ std::string Rtcm::get_MSM_1_content_sat_data(const std::map<int32_t, Gnss_Synchr
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(observables_vector);
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(observables_vector);
|
||||
|
||||
for (uint32_t nsat = 0; nsat < num_satellites; nsat++)
|
||||
{
|
||||
@ -2418,7 +2416,7 @@ std::string Rtcm::get_MSM_1_content_signal_data(const std::map<int32_t, Gnss_Syn
|
||||
std::string signal_data;
|
||||
const uint32_t Ncells = observables.size();
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
|
||||
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
|
||||
observables_vector.reserve(Ncells);
|
||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
||||
|
||||
@ -2429,9 +2427,9 @@ std::string Rtcm::get_MSM_1_content_signal_data(const std::map<int32_t, Gnss_Syn
|
||||
observables_vector.emplace_back(*map_iter);
|
||||
}
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::reverse(ordered_by_signal.begin(), ordered_by_signal.end());
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
|
||||
for (uint32_t cell = 0; cell < Ncells; cell++)
|
||||
{
|
||||
@ -2527,7 +2525,7 @@ std::string Rtcm::get_MSM_2_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
|
||||
const uint32_t Ncells = observables.size();
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
|
||||
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
|
||||
observables_vector.reserve(Ncells);
|
||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
||||
|
||||
@ -2538,9 +2536,9 @@ std::string Rtcm::get_MSM_2_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
observables_vector.emplace_back(*map_iter);
|
||||
}
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::reverse(ordered_by_signal.begin(), ordered_by_signal.end());
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
|
||||
for (uint32_t cell = 0; cell < Ncells; cell++)
|
||||
{
|
||||
@ -2642,7 +2640,7 @@ std::string Rtcm::get_MSM_3_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
|
||||
const uint32_t Ncells = observables.size();
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
|
||||
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
|
||||
observables_vector.reserve(Ncells);
|
||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
||||
|
||||
@ -2653,9 +2651,9 @@ std::string Rtcm::get_MSM_3_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
observables_vector.emplace_back(*map_iter);
|
||||
}
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::reverse(ordered_by_signal.begin(), ordered_by_signal.end());
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
|
||||
for (uint32_t cell = 0; cell < Ncells; cell++)
|
||||
{
|
||||
@ -2754,10 +2752,10 @@ std::string Rtcm::get_MSM_4_content_sat_data(const std::map<int32_t, Gnss_Synchr
|
||||
const uint32_t num_satellites = DF394.count();
|
||||
const uint32_t numobs = observables.size();
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
|
||||
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
|
||||
observables_vector.reserve(numobs);
|
||||
std::map<int32_t, Gnss_Synchro>::const_iterator gnss_synchro_iter;
|
||||
std::vector<uint32_t> pos;
|
||||
auto pos = std::vector<uint32_t>();
|
||||
pos.reserve(numobs);
|
||||
std::vector<uint32_t>::iterator it;
|
||||
|
||||
@ -2773,7 +2771,7 @@ std::string Rtcm::get_MSM_4_content_sat_data(const std::map<int32_t, Gnss_Synchr
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(observables_vector);
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(observables_vector);
|
||||
|
||||
for (uint32_t nsat = 0; nsat < num_satellites; nsat++)
|
||||
{
|
||||
@ -2803,7 +2801,7 @@ std::string Rtcm::get_MSM_4_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
|
||||
const uint32_t Ncells = observables.size();
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
|
||||
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
|
||||
observables_vector.reserve(Ncells);
|
||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
||||
|
||||
@ -2814,9 +2812,9 @@ std::string Rtcm::get_MSM_4_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
observables_vector.emplace_back(*map_iter);
|
||||
}
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::reverse(ordered_by_signal.begin(), ordered_by_signal.end());
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
|
||||
for (uint32_t cell = 0; cell < Ncells; cell++)
|
||||
{
|
||||
@ -2919,10 +2917,10 @@ std::string Rtcm::get_MSM_5_content_sat_data(const std::map<int32_t, Gnss_Synchr
|
||||
const uint32_t num_satellites = DF394.count();
|
||||
const uint32_t numobs = observables.size();
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
|
||||
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
|
||||
observables_vector.reserve(numobs);
|
||||
std::map<int32_t, Gnss_Synchro>::const_iterator gnss_synchro_iter;
|
||||
std::vector<uint32_t> pos;
|
||||
auto pos = std::vector<uint32_t>();
|
||||
pos.reserve(numobs);
|
||||
std::vector<uint32_t>::iterator it;
|
||||
|
||||
@ -2938,7 +2936,7 @@ std::string Rtcm::get_MSM_5_content_sat_data(const std::map<int32_t, Gnss_Synchr
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(observables_vector);
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(observables_vector);
|
||||
|
||||
for (uint32_t nsat = 0; nsat < num_satellites; nsat++)
|
||||
{
|
||||
@ -2973,7 +2971,7 @@ std::string Rtcm::get_MSM_5_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
|
||||
const uint32_t Ncells = observables.size();
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
|
||||
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
|
||||
observables_vector.reserve(Ncells);
|
||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
||||
|
||||
@ -2984,9 +2982,9 @@ std::string Rtcm::get_MSM_5_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
observables_vector.emplace_back(*map_iter);
|
||||
}
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::reverse(ordered_by_signal.begin(), ordered_by_signal.end());
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
|
||||
for (uint32_t cell = 0; cell < Ncells; cell++)
|
||||
{
|
||||
@ -3095,7 +3093,7 @@ std::string Rtcm::get_MSM_6_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
|
||||
const uint32_t Ncells = observables.size();
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
|
||||
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
|
||||
observables_vector.reserve(Ncells);
|
||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
||||
|
||||
@ -3106,9 +3104,9 @@ std::string Rtcm::get_MSM_6_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
observables_vector.emplace_back(*map_iter);
|
||||
}
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::reverse(ordered_by_signal.begin(), ordered_by_signal.end());
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
|
||||
for (uint32_t cell = 0; cell < Ncells; cell++)
|
||||
{
|
||||
@ -3216,7 +3214,7 @@ std::string Rtcm::get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
|
||||
const uint32_t Ncells = observables.size();
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
|
||||
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
|
||||
observables_vector.reserve(Ncells);
|
||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
||||
|
||||
@ -3227,9 +3225,9 @@ std::string Rtcm::get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
observables_vector.emplace_back(*map_iter);
|
||||
}
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_signal = Rtcm::sort_by_signal(observables_vector);
|
||||
std::reverse(ordered_by_signal.begin(), ordered_by_signal.end());
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro> > ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
const std::vector<std::pair<int32_t, Gnss_Synchro>> ordered_by_PRN_pos = Rtcm::sort_by_PRN_mask(ordered_by_signal);
|
||||
|
||||
for (uint32_t cell = 0; cell < Ncells; cell++)
|
||||
{
|
||||
@ -3256,10 +3254,10 @@ std::string Rtcm::get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV,
|
||||
// Some utilities
|
||||
// *****************************************************************************************************
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > Rtcm::sort_by_PRN_mask(const std::vector<std::pair<int32_t, Gnss_Synchro> >& synchro_map) const
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> Rtcm::sort_by_PRN_mask(const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map) const
|
||||
{
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> >::const_iterator synchro_map_iter;
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > my_vec;
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>>::const_iterator synchro_map_iter;
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> my_vec;
|
||||
struct
|
||||
{
|
||||
bool operator()(const std::pair<int32_t, Gnss_Synchro>& a, const std::pair<int32_t, Gnss_Synchro>& b)
|
||||
@ -3285,10 +3283,10 @@ std::vector<std::pair<int32_t, Gnss_Synchro> > Rtcm::sort_by_PRN_mask(const std:
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > Rtcm::sort_by_signal(const std::vector<std::pair<int32_t, Gnss_Synchro> >& synchro_map) const
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> Rtcm::sort_by_signal(const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map) const
|
||||
{
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> >::const_iterator synchro_map_iter;
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > my_vec;
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>>::const_iterator synchro_map_iter;
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> my_vec;
|
||||
|
||||
struct
|
||||
{
|
||||
@ -5152,7 +5150,7 @@ std::string Rtcm::set_DF396(const std::map<int32_t, Gnss_Synchro>& observables)
|
||||
std::string s("");
|
||||
return s;
|
||||
}
|
||||
std::vector<std::vector<bool> > matrix(num_signals, std::vector<bool>());
|
||||
std::vector<std::vector<bool>> matrix(num_signals, std::vector<bool>());
|
||||
|
||||
std::string sig;
|
||||
std::vector<uint32_t> list_of_sats;
|
||||
|
@ -191,12 +191,12 @@ public:
|
||||
int32_t read_MT1019(const std::string& message, Gps_Ephemeris& gps_eph) const;
|
||||
|
||||
/*!
|
||||
* \brief Prints message type 1020 (GLONASS Ephemeris).
|
||||
* \note Code added as part of GSoC 2017 program
|
||||
* \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
|
||||
* \param glonass_gnav_utc_model GLONASS GNAV Clock Information
|
||||
* \return Returns message type as a string type
|
||||
*/
|
||||
* \brief Prints message type 1020 (GLONASS Ephemeris).
|
||||
* \note Code added as part of GSoC 2017 program
|
||||
* \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
|
||||
* \param glonass_gnav_utc_model GLONASS GNAV Clock Information
|
||||
* \return Returns message type as a string type
|
||||
*/
|
||||
std::string print_MT1020(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model);
|
||||
|
||||
/*!
|
||||
@ -481,8 +481,8 @@ private:
|
||||
//
|
||||
static std::map<std::string, int> galileo_signal_map;
|
||||
static std::map<std::string, int> gps_signal_map;
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > sort_by_signal(const std::vector<std::pair<int32_t, Gnss_Synchro> >& synchro_map) const;
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro> > sort_by_PRN_mask(const std::vector<std::pair<int32_t, Gnss_Synchro> >& synchro_map) const;
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> sort_by_signal(const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map) const;
|
||||
std::vector<std::pair<int32_t, Gnss_Synchro>> sort_by_PRN_mask(const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map) const;
|
||||
boost::posix_time::ptime compute_GPS_time(const Gps_Ephemeris& eph, double obs_time) const;
|
||||
boost::posix_time::ptime compute_GPS_time(const Gps_CNAV_Ephemeris& eph, double obs_time) const;
|
||||
boost::posix_time::ptime compute_Galileo_time(const Galileo_Ephemeris& eph, double obs_time) const;
|
||||
@ -630,7 +630,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
std::set<std::shared_ptr<RtcmListener> > participants_;
|
||||
std::set<std::shared_ptr<RtcmListener>> participants_;
|
||||
enum
|
||||
{
|
||||
max_recent_msgs = 1
|
||||
@ -840,7 +840,7 @@ private:
|
||||
class Queue_Reader
|
||||
{
|
||||
public:
|
||||
Queue_Reader(b_io_context& io_context, std::shared_ptr<Concurrent_Queue<std::string> >& queue, int32_t port) : queue_(queue)
|
||||
Queue_Reader(b_io_context& io_context, std::shared_ptr<Concurrent_Queue<std::string>>& queue, int32_t port) : queue_(queue)
|
||||
{
|
||||
boost::asio::ip::tcp::resolver resolver(io_context);
|
||||
std::string host("localhost");
|
||||
@ -871,7 +871,7 @@ private:
|
||||
|
||||
private:
|
||||
std::shared_ptr<Tcp_Internal_Client> c;
|
||||
std::shared_ptr<Concurrent_Queue<std::string> >& queue_;
|
||||
std::shared_ptr<Concurrent_Queue<std::string>>& queue_;
|
||||
};
|
||||
|
||||
|
||||
@ -946,7 +946,7 @@ private:
|
||||
};
|
||||
|
||||
b_io_context io_context;
|
||||
std::shared_ptr<Concurrent_Queue<std::string> > rtcm_message_queue;
|
||||
std::shared_ptr<Concurrent_Queue<std::string>> rtcm_message_queue;
|
||||
std::thread t;
|
||||
std::thread tq;
|
||||
std::list<Rtcm::Tcp_Server> servers;
|
||||
|
@ -38,12 +38,23 @@
|
||||
#include <unistd.h> // for close, write
|
||||
|
||||
|
||||
Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, const std::string& rtcm_dump_devname, bool time_tag_name, const std::string& base_path)
|
||||
Rtcm_Printer::Rtcm_Printer(const std::string& filename,
|
||||
bool flag_rtcm_file_dump,
|
||||
bool flag_rtcm_server,
|
||||
bool flag_rtcm_tty_port,
|
||||
uint16_t rtcm_tcp_port,
|
||||
uint16_t rtcm_station_id,
|
||||
const std::string& rtcm_dump_devname,
|
||||
bool time_tag_name,
|
||||
const std::string& base_path) : rtcm_base_path(base_path),
|
||||
rtcm_devname(rtcm_dump_devname),
|
||||
port(rtcm_tcp_port),
|
||||
station_id(rtcm_station_id),
|
||||
d_rtcm_writing_started(false),
|
||||
d_rtcm_file_dump(flag_rtcm_file_dump)
|
||||
{
|
||||
const boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time();
|
||||
const tm timeinfo = boost::posix_time::to_tm(pt);
|
||||
d_rtcm_file_dump = flag_rtcm_file_dump;
|
||||
rtcm_base_path = base_path;
|
||||
if (d_rtcm_file_dump)
|
||||
{
|
||||
fs::path full_path(fs::current_path());
|
||||
@ -134,7 +145,6 @@ Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump
|
||||
}
|
||||
}
|
||||
|
||||
rtcm_devname = rtcm_dump_devname;
|
||||
if (flag_rtcm_tty_port == true)
|
||||
{
|
||||
rtcm_dev_descriptor = init_serial(rtcm_devname.c_str());
|
||||
@ -148,10 +158,6 @@ Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump
|
||||
rtcm_dev_descriptor = -1;
|
||||
}
|
||||
|
||||
port = rtcm_tcp_port;
|
||||
station_id = rtcm_station_id;
|
||||
d_rtcm_writing_started = false;
|
||||
|
||||
rtcm = std::make_unique<Rtcm>(port);
|
||||
|
||||
if (flag_rtcm_server)
|
||||
|
@ -43,14 +43,14 @@
|
||||
#include <vector>
|
||||
|
||||
|
||||
Rtklib_Solver::Rtklib_Solver(const rtk_t &rtk, int nchannels, const std::string &dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat)
|
||||
Rtklib_Solver::Rtklib_Solver(const rtk_t &rtk,
|
||||
const std::string &dump_filename,
|
||||
bool flag_dump_to_file,
|
||||
bool flag_dump_to_mat) : d_rtk(rtk),
|
||||
d_dump_filename(dump_filename),
|
||||
d_flag_dump_enabled(flag_dump_to_file),
|
||||
d_flag_dump_mat_enabled(flag_dump_to_mat)
|
||||
{
|
||||
// init empty ephemeris for all the available GNSS channels
|
||||
rtk_ = rtk;
|
||||
d_nchannels = nchannels;
|
||||
d_dump_filename = dump_filename;
|
||||
d_flag_dump_enabled = flag_dump_to_file;
|
||||
d_flag_dump_mat_enabled = flag_dump_to_mat;
|
||||
this->set_averaging_flag(false);
|
||||
|
||||
// ############# ENABLE DATA FILE LOG #################
|
||||
@ -351,31 +351,31 @@ bool Rtklib_Solver::save_matfile() const
|
||||
|
||||
double Rtklib_Solver::get_gdop() const
|
||||
{
|
||||
return dop_[0];
|
||||
return d_dop[0];
|
||||
}
|
||||
|
||||
|
||||
double Rtklib_Solver::get_pdop() const
|
||||
{
|
||||
return dop_[1];
|
||||
return d_dop[1];
|
||||
}
|
||||
|
||||
|
||||
double Rtklib_Solver::get_hdop() const
|
||||
{
|
||||
return dop_[2];
|
||||
return d_dop[2];
|
||||
}
|
||||
|
||||
|
||||
double Rtklib_Solver::get_vdop() const
|
||||
{
|
||||
return dop_[3];
|
||||
return d_dop[3];
|
||||
}
|
||||
|
||||
|
||||
Monitor_Pvt Rtklib_Solver::get_monitor_pvt() const
|
||||
{
|
||||
return monitor_pvt;
|
||||
return d_monitor_pvt;
|
||||
}
|
||||
|
||||
|
||||
@ -398,7 +398,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
int valid_obs = 0; // valid observations counter
|
||||
int glo_valid_obs = 0; // GLONASS L1/L2 valid observations counter
|
||||
|
||||
obs_data.fill({});
|
||||
d_obs_data.fill({});
|
||||
std::vector<eph_t> eph_data(MAXOBS);
|
||||
std::vector<geph_t> geph_data(MAXOBS);
|
||||
|
||||
@ -455,7 +455,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second);
|
||||
// convert observation from GNSS-SDR class to RTKLIB structure
|
||||
obsd_t newobs{};
|
||||
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
d_obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
gnss_observables_iter->second,
|
||||
galileo_ephemeris_iter->second.WN,
|
||||
0);
|
||||
@ -479,7 +479,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
{
|
||||
if (eph_data[i].sat == (static_cast<int>(gnss_observables_iter->second.PRN + NSATGPS + NSATGLO)))
|
||||
{
|
||||
obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs],
|
||||
d_obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(d_obs_data[i + glo_valid_obs],
|
||||
gnss_observables_iter->second,
|
||||
galileo_ephemeris_iter->second.WN,
|
||||
2); // Band 3 (L5/E5)
|
||||
@ -497,7 +497,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
obsd_t newobs = {{0, 0}, '0', '0', {}, {},
|
||||
{default_code_, default_code_, default_code_},
|
||||
{}, {0.0, 0.0, 0.0}, {}};
|
||||
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
d_obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
gnss_observables_iter->second,
|
||||
galileo_ephemeris_iter->second.WN,
|
||||
2); // Band 3 (L5/E5)
|
||||
@ -525,7 +525,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
eph_data[valid_obs] = eph_to_rtklib(gps_ephemeris_iter->second, this->is_pre_2009());
|
||||
// convert observation from GNSS-SDR class to RTKLIB structure
|
||||
obsd_t newobs{};
|
||||
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
d_obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
gnss_observables_iter->second,
|
||||
gps_ephemeris_iter->second.WN,
|
||||
0,
|
||||
@ -555,7 +555,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
if (eph_data[i].sat == static_cast<int>(gnss_observables_iter->second.PRN))
|
||||
{
|
||||
eph_data[i] = eph_to_rtklib(gps_cnav_ephemeris_iter->second);
|
||||
obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs],
|
||||
d_obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(d_obs_data[i + glo_valid_obs],
|
||||
gnss_observables_iter->second,
|
||||
eph_data[i].week,
|
||||
1); // Band 2 (L2)
|
||||
@ -574,7 +574,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
obsd_t newobs = {{0, 0}, '0', '0', {}, {},
|
||||
{default_code_, default_code_, default_code_},
|
||||
{}, {0.0, 0.0, 0.0}, {}};
|
||||
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
d_obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
gnss_observables_iter->second,
|
||||
gps_cnav_ephemeris_iter->second.WN,
|
||||
1); // Band 2 (L2)
|
||||
@ -603,7 +603,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
if (eph_data[i].sat == static_cast<int>(gnss_observables_iter->second.PRN))
|
||||
{
|
||||
eph_data[i] = eph_to_rtklib(gps_cnav_ephemeris_iter->second);
|
||||
obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i],
|
||||
d_obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(d_obs_data[i],
|
||||
gnss_observables_iter->second,
|
||||
gps_cnav_ephemeris_iter->second.WN,
|
||||
2); // Band 3 (L5)
|
||||
@ -621,7 +621,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
obsd_t newobs = {{0, 0}, '0', '0', {}, {},
|
||||
{default_code_, default_code_, default_code_},
|
||||
{}, {0.0, 0.0, 0.0}, {}};
|
||||
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
d_obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
gnss_observables_iter->second,
|
||||
gps_cnav_ephemeris_iter->second.WN,
|
||||
2); // Band 3 (L5)
|
||||
@ -649,7 +649,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
geph_data[glo_valid_obs] = eph_to_rtklib(glonass_gnav_ephemeris_iter->second, gnav_utc);
|
||||
// convert observation from GNSS-SDR class to RTKLIB structure
|
||||
obsd_t newobs{};
|
||||
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
d_obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
gnss_observables_iter->second,
|
||||
glonass_gnav_ephemeris_iter->second.d_WN,
|
||||
0); // Band 0 (L1)
|
||||
@ -672,7 +672,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
{
|
||||
if (geph_data[i].sat == (static_cast<int>(gnss_observables_iter->second.PRN + NSATGPS)))
|
||||
{
|
||||
obs_data[i + valid_obs] = insert_obs_to_rtklib(obs_data[i + valid_obs],
|
||||
d_obs_data[i + valid_obs] = insert_obs_to_rtklib(d_obs_data[i + valid_obs],
|
||||
gnss_observables_iter->second,
|
||||
glonass_gnav_ephemeris_iter->second.d_WN,
|
||||
1); // Band 1 (L2)
|
||||
@ -687,7 +687,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
geph_data[glo_valid_obs] = eph_to_rtklib(glonass_gnav_ephemeris_iter->second, gnav_utc);
|
||||
// convert observation from GNSS-SDR class to RTKLIB structure
|
||||
obsd_t newobs{};
|
||||
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
d_obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
gnss_observables_iter->second,
|
||||
glonass_gnav_ephemeris_iter->second.d_WN,
|
||||
1); // Band 1 (L2)
|
||||
@ -715,7 +715,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
eph_data[valid_obs] = eph_to_rtklib(beidou_ephemeris_iter->second);
|
||||
// convert observation from GNSS-SDR class to RTKLIB structure
|
||||
obsd_t newobs{};
|
||||
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
d_obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
gnss_observables_iter->second,
|
||||
beidou_ephemeris_iter->second.WN + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET,
|
||||
0);
|
||||
@ -737,7 +737,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
{
|
||||
if (eph_data[i].sat == (static_cast<int>(gnss_observables_iter->second.PRN + NSATGPS + NSATGLO + NSATGAL + NSATQZS)))
|
||||
{
|
||||
obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs],
|
||||
d_obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(d_obs_data[i + glo_valid_obs],
|
||||
gnss_observables_iter->second,
|
||||
beidou_ephemeris_iter->second.WN + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET,
|
||||
2); // Band 3 (L2/G2/B3)
|
||||
@ -755,7 +755,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
obsd_t newobs = {{0, 0}, '0', '0', {}, {},
|
||||
{default_code_, default_code_, default_code_},
|
||||
{}, {0.0, 0.0, 0.0}, {}};
|
||||
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
d_obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
|
||||
gnss_observables_iter->second,
|
||||
beidou_ephemeris_iter->second.WN + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET,
|
||||
2); // Band 2 (L2/G2)
|
||||
@ -878,34 +878,33 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
}
|
||||
}
|
||||
|
||||
result = rtkpos(&rtk_, obs_data.data(), valid_obs + glo_valid_obs, &nav_data);
|
||||
result = rtkpos(&d_rtk, d_obs_data.data(), valid_obs + glo_valid_obs, &nav_data);
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
LOG(INFO) << "RTKLIB rtkpos error: " << rtk_.errbuf;
|
||||
rtk_.neb = 0; // clear error buffer to avoid repeating the error message
|
||||
LOG(INFO) << "RTKLIB rtkpos error: " << d_rtk.errbuf;
|
||||
d_rtk.neb = 0; // clear error buffer to avoid repeating the error message
|
||||
this->set_time_offset_s(0.0); // reset rx time estimation
|
||||
this->set_num_valid_observations(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->set_num_valid_observations(rtk_.sol.ns); // record the number of valid satellites used by the PVT solver
|
||||
pvt_sol = rtk_.sol;
|
||||
this->set_num_valid_observations(d_rtk.sol.ns); // record the number of valid satellites used by the PVT solver
|
||||
pvt_sol = d_rtk.sol;
|
||||
// DOP computation
|
||||
unsigned int used_sats = 0;
|
||||
for (unsigned int i = 0; i < MAXSAT; i++)
|
||||
{
|
||||
pvt_ssat[i] = rtk_.ssat[i];
|
||||
if (rtk_.ssat[i].vs == 1)
|
||||
pvt_ssat[i] = d_rtk.ssat[i];
|
||||
if (d_rtk.ssat[i].vs == 1)
|
||||
{
|
||||
used_sats++;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<double> azel;
|
||||
azel.reserve(used_sats * 2);
|
||||
std::vector<double> azel(used_sats * 2);
|
||||
int index_aux = 0;
|
||||
for (auto &i : rtk_.ssat)
|
||||
for (auto &i : d_rtk.ssat)
|
||||
{
|
||||
if (i.vs == 1)
|
||||
{
|
||||
@ -917,7 +916,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
|
||||
if (index_aux > 0)
|
||||
{
|
||||
dops(index_aux, azel.data(), 0.0, dop_.data());
|
||||
dops(index_aux, azel.data(), 0.0, d_dop.data());
|
||||
}
|
||||
this->set_valid_position(true);
|
||||
std::array<double, 4> rx_position_and_time{};
|
||||
@ -925,7 +924,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
rx_position_and_time[1] = pvt_sol.rr[1]; // [m]
|
||||
rx_position_and_time[2] = pvt_sol.rr[2]; // [m]
|
||||
// todo: fix this ambiguity in the RTKLIB units in receiver clock offset!
|
||||
if (rtk_.opt.mode == PMODE_SINGLE)
|
||||
if (d_rtk.opt.mode == PMODE_SINGLE)
|
||||
{
|
||||
// if the RTKLIB solver is set to SINGLE, the dtr is already expressed in [s]
|
||||
// add also the clock offset from gps to galileo (pvt_sol.dtr[2])
|
||||
@ -978,53 +977,53 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
|
||||
// ######## PVT MONITOR #########
|
||||
// TOW
|
||||
monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms;
|
||||
d_monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms;
|
||||
// WEEK
|
||||
monitor_pvt.week = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009());
|
||||
d_monitor_pvt.week = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009());
|
||||
// PVT GPS time
|
||||
monitor_pvt.RX_time = gnss_observables_map.cbegin()->second.RX_time;
|
||||
d_monitor_pvt.RX_time = gnss_observables_map.cbegin()->second.RX_time;
|
||||
// User clock offset [s]
|
||||
monitor_pvt.user_clk_offset = rx_position_and_time[3];
|
||||
d_monitor_pvt.user_clk_offset = rx_position_and_time[3];
|
||||
|
||||
// ECEF POS X,Y,X [m] + ECEF VEL X,Y,X [m/s] (6 x double)
|
||||
monitor_pvt.pos_x = pvt_sol.rr[0];
|
||||
monitor_pvt.pos_y = pvt_sol.rr[1];
|
||||
monitor_pvt.pos_z = pvt_sol.rr[2];
|
||||
monitor_pvt.vel_x = pvt_sol.rr[3];
|
||||
monitor_pvt.vel_y = pvt_sol.rr[4];
|
||||
monitor_pvt.vel_z = pvt_sol.rr[5];
|
||||
d_monitor_pvt.pos_x = pvt_sol.rr[0];
|
||||
d_monitor_pvt.pos_y = pvt_sol.rr[1];
|
||||
d_monitor_pvt.pos_z = pvt_sol.rr[2];
|
||||
d_monitor_pvt.vel_x = pvt_sol.rr[3];
|
||||
d_monitor_pvt.vel_y = pvt_sol.rr[4];
|
||||
d_monitor_pvt.vel_z = pvt_sol.rr[5];
|
||||
|
||||
// position variance/covariance (m^2) {c_xx,c_yy,c_zz,c_xy,c_yz,c_zx} (6 x double)
|
||||
monitor_pvt.cov_xx = pvt_sol.qr[0];
|
||||
monitor_pvt.cov_yy = pvt_sol.qr[1];
|
||||
monitor_pvt.cov_zz = pvt_sol.qr[2];
|
||||
monitor_pvt.cov_xy = pvt_sol.qr[3];
|
||||
monitor_pvt.cov_yz = pvt_sol.qr[4];
|
||||
monitor_pvt.cov_zx = pvt_sol.qr[5];
|
||||
d_monitor_pvt.cov_xx = pvt_sol.qr[0];
|
||||
d_monitor_pvt.cov_yy = pvt_sol.qr[1];
|
||||
d_monitor_pvt.cov_zz = pvt_sol.qr[2];
|
||||
d_monitor_pvt.cov_xy = pvt_sol.qr[3];
|
||||
d_monitor_pvt.cov_yz = pvt_sol.qr[4];
|
||||
d_monitor_pvt.cov_zx = pvt_sol.qr[5];
|
||||
|
||||
// GEO user position Latitude [deg]
|
||||
monitor_pvt.latitude = this->get_latitude();
|
||||
d_monitor_pvt.latitude = this->get_latitude();
|
||||
// GEO user position Longitude [deg]
|
||||
monitor_pvt.longitude = this->get_longitude();
|
||||
d_monitor_pvt.longitude = this->get_longitude();
|
||||
// GEO user position Height [m]
|
||||
monitor_pvt.height = this->get_height();
|
||||
d_monitor_pvt.height = this->get_height();
|
||||
|
||||
// NUMBER OF VALID SATS
|
||||
monitor_pvt.valid_sats = pvt_sol.ns;
|
||||
d_monitor_pvt.valid_sats = pvt_sol.ns;
|
||||
// RTKLIB solution status
|
||||
monitor_pvt.solution_status = pvt_sol.stat;
|
||||
d_monitor_pvt.solution_status = pvt_sol.stat;
|
||||
// RTKLIB solution type (0:xyz-ecef,1:enu-baseline)
|
||||
monitor_pvt.solution_type = pvt_sol.type;
|
||||
d_monitor_pvt.solution_type = pvt_sol.type;
|
||||
// AR ratio factor for validation
|
||||
monitor_pvt.AR_ratio_factor = pvt_sol.ratio;
|
||||
d_monitor_pvt.AR_ratio_factor = pvt_sol.ratio;
|
||||
// AR ratio threshold for validation
|
||||
monitor_pvt.AR_ratio_threshold = pvt_sol.thres;
|
||||
d_monitor_pvt.AR_ratio_threshold = pvt_sol.thres;
|
||||
|
||||
// GDOP / PDOP/ HDOP/ VDOP
|
||||
monitor_pvt.gdop = dop_[0];
|
||||
monitor_pvt.pdop = dop_[1];
|
||||
monitor_pvt.hdop = dop_[2];
|
||||
monitor_pvt.vdop = dop_[3];
|
||||
d_monitor_pvt.gdop = d_dop[0];
|
||||
d_monitor_pvt.pdop = d_dop[1];
|
||||
d_monitor_pvt.hdop = d_dop[2];
|
||||
d_monitor_pvt.vdop = d_dop[3];
|
||||
|
||||
this->set_rx_vel({enuv[0], enuv[1], enuv[2]});
|
||||
|
||||
@ -1032,7 +1031,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
|
||||
this->set_clock_drift_ppm(clock_drift_ppm);
|
||||
// User clock drift [ppm]
|
||||
monitor_pvt.user_clk_drift_ppm = clock_drift_ppm;
|
||||
d_monitor_pvt.user_clk_drift_ppm = clock_drift_ppm;
|
||||
|
||||
// ######## LOG FILE #########
|
||||
if (d_flag_dump_enabled == true)
|
||||
@ -1104,11 +1103,11 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
// AR ratio threshold for validation
|
||||
d_dump_file.write(reinterpret_cast<char *>(&pvt_sol.thres), sizeof(float));
|
||||
|
||||
// GDOP / PDOP/ HDOP/ VDOP
|
||||
d_dump_file.write(reinterpret_cast<char *>(&dop_[0]), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&dop_[1]), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&dop_[2]), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&dop_[3]), sizeof(double));
|
||||
// GDOP / PDOP / HDOP / VDOP
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_dop[0]), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_dop[1]), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_dop[2]), sizeof(double));
|
||||
d_dump_file.write(reinterpret_cast<char *>(&d_dop[3]), sizeof(double));
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@
|
||||
class Rtklib_Solver : public Pvt_Solution
|
||||
{
|
||||
public:
|
||||
Rtklib_Solver(const rtk_t& rtk, int nchannels, const std::string& dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat);
|
||||
Rtklib_Solver(const rtk_t& rtk, const std::string& dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat);
|
||||
~Rtklib_Solver();
|
||||
|
||||
bool get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_map, bool flag_averaging);
|
||||
@ -116,13 +116,12 @@ public:
|
||||
private:
|
||||
bool save_matfile() const;
|
||||
|
||||
std::array<obsd_t, MAXOBS> obs_data{};
|
||||
std::array<double, 4> dop_{};
|
||||
rtk_t rtk_{};
|
||||
Monitor_Pvt monitor_pvt{};
|
||||
std::array<obsd_t, MAXOBS> d_obs_data{};
|
||||
std::array<double, 4> d_dop{};
|
||||
rtk_t d_rtk{};
|
||||
Monitor_Pvt d_monitor_pvt{};
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
int d_nchannels; // Number of available channels for positioning
|
||||
bool d_flag_dump_enabled;
|
||||
bool d_flag_dump_mat_enabled;
|
||||
};
|
||||
|
@ -49,9 +49,8 @@ public:
|
||||
// google::protobuf::ShutdownProtobufLibrary();
|
||||
}
|
||||
|
||||
inline Serdes_Galileo_Eph(const Serdes_Galileo_Eph& other) noexcept //!< Copy constructor
|
||||
inline Serdes_Galileo_Eph(const Serdes_Galileo_Eph& other) noexcept : monitor_(other.monitor_) //!< Copy constructor
|
||||
{
|
||||
this->monitor_ = other.monitor_;
|
||||
}
|
||||
|
||||
inline Serdes_Galileo_Eph& operator=(const Serdes_Galileo_Eph& rhs) noexcept //!< Copy assignment operator
|
||||
@ -60,9 +59,8 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Serdes_Galileo_Eph(Serdes_Galileo_Eph&& other) noexcept //!< Move constructor
|
||||
inline Serdes_Galileo_Eph(Serdes_Galileo_Eph&& other) noexcept : monitor_(std::move(other.monitor_)) //!< Move constructor
|
||||
{
|
||||
this->monitor_ = std::move(other.monitor_);
|
||||
}
|
||||
|
||||
inline Serdes_Galileo_Eph& operator=(Serdes_Galileo_Eph&& other) noexcept //!< Move assignment operator
|
||||
|
@ -48,9 +48,8 @@ public:
|
||||
// google::protobuf::ShutdownProtobufLibrary();
|
||||
}
|
||||
|
||||
inline Serdes_Gps_Eph(const Serdes_Gps_Eph& other) noexcept //!< Copy constructor
|
||||
inline Serdes_Gps_Eph(const Serdes_Gps_Eph& other) noexcept : monitor_(other.monitor_) //!< Copy constructor
|
||||
{
|
||||
this->monitor_ = other.monitor_;
|
||||
}
|
||||
|
||||
inline Serdes_Gps_Eph& operator=(const Serdes_Gps_Eph& rhs) noexcept //!< Copy assignment operator
|
||||
@ -59,9 +58,8 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Serdes_Gps_Eph(Serdes_Gps_Eph&& other) noexcept //!< Move constructor
|
||||
inline Serdes_Gps_Eph(Serdes_Gps_Eph&& other) noexcept : monitor_(std::move(other.monitor_)) //!< Move constructor
|
||||
{
|
||||
this->monitor_ = std::move(other.monitor_);
|
||||
}
|
||||
|
||||
inline Serdes_Gps_Eph& operator=(Serdes_Gps_Eph&& other) noexcept //!< Move assignment operator
|
||||
|
@ -49,9 +49,8 @@ public:
|
||||
// google::protobuf::ShutdownProtobufLibrary();
|
||||
}
|
||||
|
||||
inline Serdes_Monitor_Pvt(const Serdes_Monitor_Pvt& other) noexcept //!< Copy constructor
|
||||
inline Serdes_Monitor_Pvt(const Serdes_Monitor_Pvt& other) noexcept : monitor_(other.monitor_) //!< Copy constructor
|
||||
{
|
||||
this->monitor_ = other.monitor_;
|
||||
}
|
||||
|
||||
inline Serdes_Monitor_Pvt& operator=(const Serdes_Monitor_Pvt& rhs) noexcept //!< Copy assignment operator
|
||||
@ -60,9 +59,8 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Serdes_Monitor_Pvt(Serdes_Monitor_Pvt&& other) noexcept //!< Move constructor
|
||||
inline Serdes_Monitor_Pvt(Serdes_Monitor_Pvt&& other) noexcept : monitor_(std::move(other.monitor_)) //!< Move constructor
|
||||
{
|
||||
this->monitor_ = std::move(other.monitor_);
|
||||
}
|
||||
|
||||
inline Serdes_Monitor_Pvt& operator=(Serdes_Monitor_Pvt&& other) noexcept //!< Move assignment operator
|
||||
|
@ -100,6 +100,7 @@ target_link_libraries(acquisition_adapters
|
||||
PUBLIC
|
||||
acquisition_gr_blocks
|
||||
Gnuradio::blocks
|
||||
Volkgnsssdr::volkgnsssdr
|
||||
PRIVATE
|
||||
gnss_sdr_flags
|
||||
Boost::headers
|
||||
@ -124,7 +125,6 @@ if(ENABLE_FPGA)
|
||||
algorithms_libs
|
||||
core_libs
|
||||
Volk::volk
|
||||
Volkgnsssdr::volkgnsssdr
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
@ -40,7 +40,10 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
threshold_(0.0),
|
||||
channel_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -62,7 +65,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
|
||||
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_ = 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_);
|
||||
code_ = volk_gnsssdr::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters_);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
@ -73,10 +76,6 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
|
||||
float_to_complex_ = gr::blocks::float_to_complex::make();
|
||||
}
|
||||
|
||||
channel_ = 0;
|
||||
threshold_ = 0.0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@ -141,7 +140,7 @@ void BeidouB1iPcpsAcquisition::init()
|
||||
|
||||
void BeidouB1iPcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::vector<std::complex<float>> code(code_length_);
|
||||
volk_gnsssdr::vector<std::complex<float>> code(code_length_);
|
||||
|
||||
beidou_b1i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
|
@ -26,10 +26,10 @@
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -152,7 +152,7 @@ public:
|
||||
|
||||
private:
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
@ -38,7 +38,10 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
threshold_(0.0),
|
||||
channel_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -60,7 +63,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
|
||||
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_ = 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_);
|
||||
code_ = volk_gnsssdr::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters_);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
@ -71,10 +74,6 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
|
||||
float_to_complex_ = gr::blocks::float_to_complex::make();
|
||||
}
|
||||
|
||||
channel_ = 0;
|
||||
threshold_ = 0.0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@ -138,7 +137,7 @@ void BeidouB3iPcpsAcquisition::init()
|
||||
|
||||
void BeidouB3iPcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::vector<std::complex<float>> code(code_length_);
|
||||
volk_gnsssdr::vector<std::complex<float>> code(code_length_);
|
||||
|
||||
beidou_b3i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
|
@ -25,10 +25,10 @@
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -151,7 +151,7 @@ public:
|
||||
|
||||
private:
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
|
@ -88,8 +88,8 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
@ -37,11 +37,16 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
configuration_(configuration),
|
||||
role_(role),
|
||||
threshold_(0.0),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
configuration_ = configuration;
|
||||
acq_parameters_.ms_per_code = 4;
|
||||
acq_parameters_.SetFromConfiguration(configuration_, role, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_OPT_ACQ_FS_SPS);
|
||||
|
||||
@ -60,7 +65,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
|
||||
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_ = 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_);
|
||||
code_ = volk_gnsssdr::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
sampled_ms_ = acq_parameters_.sampled_ms;
|
||||
|
||||
@ -73,11 +78,6 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
float_to_complex_ = gr::blocks::float_to_complex::make();
|
||||
}
|
||||
|
||||
channel_ = 0;
|
||||
threshold_ = 0.0;
|
||||
doppler_center_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@ -152,7 +152,7 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
|
||||
bool cboc = configuration_->property(
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
std::vector<std::complex<float>> code(code_length_);
|
||||
volk_gnsssdr::vector<std::complex<float>> code(code_length_);
|
||||
|
||||
if (acquire_pilot_ == true)
|
||||
{
|
||||
|
@ -24,9 +24,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -156,7 +156,7 @@ public:
|
||||
|
||||
private:
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -35,7 +35,11 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -95,7 +99,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
|
||||
auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT
|
||||
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
|
||||
volk_gnsssdr::vector<gr_complex> fft_codes_padded(nsamples_total);
|
||||
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E1_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = volk_gnsssdr::vector<uint32_t>(nsamples_total * GALILEO_E1_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp;
|
||||
@ -172,10 +176,6 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
|
||||
|
||||
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
|
||||
|
||||
channel_ = 0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition_fpga.h"
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -191,7 +192,7 @@ private:
|
||||
static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
|
||||
|
||||
pcps_acquisition_fpga_sptr acquisition_fpga_;
|
||||
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
|
@ -89,8 +89,8 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
|
@ -89,8 +89,8 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
@ -37,7 +37,12 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
threshold_(0.0),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -65,18 +70,13 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(
|
||||
|
||||
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_ = 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_);
|
||||
code_ = volk_gnsssdr::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
sampled_ms_ = acq_parameters_.sampled_ms;
|
||||
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters_);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
|
||||
channel_ = 0;
|
||||
threshold_ = 0.0;
|
||||
doppler_center_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@ -145,7 +145,7 @@ void GalileoE5aPcpsAcquisition::init()
|
||||
|
||||
void GalileoE5aPcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::vector<std::complex<float>> code(code_length_);
|
||||
volk_gnsssdr::vector<std::complex<float>> code(code_length_);
|
||||
std::array<char, 3> signal_{};
|
||||
signal_[0] = '5';
|
||||
signal_[2] = '\0';
|
||||
|
@ -22,9 +22,9 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -149,7 +149,7 @@ public:
|
||||
|
||||
private:
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
volk_gnsssdr::vector<std::complex<float>> code_;
|
||||
std::weak_ptr<ChannelFsm> channel_fsm_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
Acq_Conf acq_parameters_;
|
||||
|
@ -34,7 +34,11 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -96,7 +100,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(
|
||||
auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT
|
||||
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
|
||||
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
|
||||
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = volk_gnsssdr::vector<uint32_t>(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp;
|
||||
@ -175,10 +179,6 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(
|
||||
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
|
||||
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
|
||||
|
||||
channel_ = 0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
|
@ -22,9 +22,9 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition_fpga.h"
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -200,7 +200,7 @@ private:
|
||||
|
||||
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
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -30,14 +30,19 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
threshold_(0.0),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -65,18 +70,13 @@ GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const ConfigurationInterfac
|
||||
|
||||
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GALILEO_E5B_CODE_CHIP_RATE_CPS / GALILEO_E5B_CODE_LENGTH_CHIPS)));
|
||||
vector_length_ = static_cast<unsigned int>(std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2.0F : 1.0F));
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
code_ = volk_gnsssdr::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
sampled_ms_ = acq_parameters_.sampled_ms;
|
||||
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters_);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
|
||||
channel_ = 0;
|
||||
threshold_ = 0.0;
|
||||
doppler_center_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@ -143,7 +143,7 @@ void GalileoE5bPcpsAcquisition::init()
|
||||
|
||||
void GalileoE5bPcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::vector<std::complex<float>> code(code_length_);
|
||||
volk_gnsssdr::vector<std::complex<float>> code(code_length_);
|
||||
std::array<char, 3> signal_{};
|
||||
signal_[0] = '7';
|
||||
signal_[2] = '\0';
|
||||
|
@ -23,9 +23,9 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -181,7 +181,7 @@ public:
|
||||
private:
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
|
||||
std::vector<std::complex<float>> code_;
|
||||
volk_gnsssdr::vector<std::complex<float>> code_;
|
||||
std::weak_ptr<ChannelFsm> channel_fsm_;
|
||||
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
|
@ -26,15 +26,18 @@
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <algorithm> // for copy_n
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
#include <algorithm> // for copy_n
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
|
||||
GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -96,7 +99,7 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration
|
||||
auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT
|
||||
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total); // Buffer for local code
|
||||
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
|
||||
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E5B_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = volk_gnsssdr::vector<uint32_t>(nsamples_total * GALILEO_E5B_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp;
|
||||
@ -175,10 +178,6 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration
|
||||
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
|
||||
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
|
||||
|
||||
channel_ = 0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
|
@ -23,9 +23,9 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition_fpga.h"
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -198,7 +198,7 @@ private:
|
||||
static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
|
||||
|
||||
pcps_acquisition_fpga_sptr acquisition_fpga_;
|
||||
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
|
||||
volk_gnsssdr::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
|
||||
std::weak_ptr<ChannelFsm> channel_fsm_;
|
||||
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
@ -36,11 +36,16 @@ GalileoE6PcpsAcquisition::GalileoE6PcpsAcquisition(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
configuration_(configuration),
|
||||
role_(role),
|
||||
threshold_(0),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
configuration_ = configuration;
|
||||
acq_parameters_.ms_per_code = 1;
|
||||
acq_parameters_.SetFromConfiguration(configuration_, role, GALILEO_E6_B_CODE_CHIP_RATE_CPS, GALILEO_E6_OPT_ACQ_FS_SPS);
|
||||
|
||||
@ -58,7 +63,7 @@ GalileoE6PcpsAcquisition::GalileoE6PcpsAcquisition(
|
||||
|
||||
code_length_ = static_cast<unsigned int>(std::floor(static_cast<double>(acq_parameters_.resampled_fs) / (GALILEO_E6_B_CODE_CHIP_RATE_CPS / GALILEO_E6_B_CODE_LENGTH_CHIPS)));
|
||||
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_);
|
||||
code_ = volk_gnsssdr::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
sampled_ms_ = acq_parameters_.sampled_ms;
|
||||
|
||||
@ -71,11 +76,6 @@ GalileoE6PcpsAcquisition::GalileoE6PcpsAcquisition(
|
||||
float_to_complex_ = gr::blocks::float_to_complex::make();
|
||||
}
|
||||
|
||||
channel_ = 0;
|
||||
threshold_ = 0.0;
|
||||
doppler_center_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@ -147,7 +147,7 @@ void GalileoE6PcpsAcquisition::init()
|
||||
|
||||
void GalileoE6PcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::vector<std::complex<float>> code(code_length_);
|
||||
volk_gnsssdr::vector<std::complex<float>> code(code_length_);
|
||||
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
|
@ -24,9 +24,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -156,7 +156,7 @@ public:
|
||||
|
||||
private:
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
@ -38,7 +38,11 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
threshold_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -59,7 +63,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
|
||||
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_ = 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_);
|
||||
code_ = volk_gnsssdr::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
sampled_ms_ = acq_parameters_.sampled_ms;
|
||||
|
||||
@ -72,11 +76,6 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
float_to_complex_ = gr::blocks::float_to_complex::make();
|
||||
}
|
||||
|
||||
channel_ = 0;
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@ -142,7 +141,7 @@ void GlonassL1CaPcpsAcquisition::init()
|
||||
|
||||
void GlonassL1CaPcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::vector<std::complex<float>> code(code_length_);
|
||||
volk_gnsssdr::vector<std::complex<float>> code(code_length_);
|
||||
|
||||
glonass_l1_ca_code_gen_complex_sampled(code, fs_in_, 0);
|
||||
|
||||
|
@ -26,9 +26,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -150,7 +150,7 @@ public:
|
||||
|
||||
private:
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
@ -37,7 +37,11 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
threshold_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -58,7 +62,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
|
||||
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_ = 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_);
|
||||
code_ = volk_gnsssdr::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
sampled_ms_ = acq_parameters_.sampled_ms;
|
||||
|
||||
@ -71,11 +75,6 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
float_to_complex_ = gr::blocks::float_to_complex::make();
|
||||
}
|
||||
|
||||
channel_ = 0;
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@ -141,7 +140,7 @@ void GlonassL2CaPcpsAcquisition::init()
|
||||
|
||||
void GlonassL2CaPcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::vector<std::complex<float>> code(code_length_);
|
||||
volk_gnsssdr::vector<std::complex<float>> code(code_length_);
|
||||
|
||||
glonass_l2_ca_code_gen_complex_sampled(code, fs_in_, 0);
|
||||
|
||||
|
@ -25,9 +25,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -149,7 +149,7 @@ public:
|
||||
|
||||
private:
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
@ -40,7 +40,12 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
threshold_(0.0),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -61,7 +66,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
|
||||
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_ = 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_);
|
||||
code_ = volk_gnsssdr::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
sampled_ms_ = acq_parameters_.sampled_ms;
|
||||
|
||||
@ -74,11 +79,6 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
float_to_complex_ = gr::blocks::float_to_complex::make();
|
||||
}
|
||||
|
||||
channel_ = 0;
|
||||
threshold_ = 0.0;
|
||||
doppler_center_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@ -150,7 +150,7 @@ void GpsL1CaPcpsAcquisition::init()
|
||||
|
||||
void GpsL1CaPcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::vector<std::complex<float>> code(code_length_);
|
||||
volk_gnsssdr::vector<std::complex<float>> code(code_length_);
|
||||
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
|
@ -28,9 +28,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* Classes for GNSS signal acquisition
|
||||
@ -162,7 +162,7 @@ public:
|
||||
|
||||
private:
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -28,16 +28,19 @@
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <algorithm> // for copy_n
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
#include <algorithm> // for copy_n
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
|
||||
GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -89,7 +92,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
||||
// allocate memory to compute all the PRNs and compute all the possible codes
|
||||
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
|
||||
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
|
||||
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = volk_gnsssdr::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
float max;
|
||||
int32_t tmp;
|
||||
int32_t tmp2;
|
||||
@ -151,10 +154,6 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
||||
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
|
||||
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
|
||||
|
||||
channel_ = 0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
|
@ -25,9 +25,9 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition_fpga.h"
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -196,7 +196,7 @@ private:
|
||||
|
||||
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
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -57,7 +57,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
|
||||
// --- Find number of samples per spreading code -------------------------
|
||||
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_);
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
@ -38,7 +38,12 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
threshold_(0),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -59,7 +64,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
|
||||
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_ = 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_);
|
||||
code_ = volk_gnsssdr::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters_);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
@ -70,11 +75,6 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
float_to_complex_ = gr::blocks::float_to_complex::make();
|
||||
}
|
||||
|
||||
channel_ = 0;
|
||||
threshold_ = 0.0;
|
||||
doppler_center_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
num_codes_ = acq_parameters_.sampled_ms / acq_parameters_.ms_per_code;
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
@ -149,7 +149,7 @@ void GpsL2MPcpsAcquisition::init()
|
||||
|
||||
void GpsL2MPcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::vector<std::complex<float>> code(code_length_);
|
||||
volk_gnsssdr::vector<std::complex<float>> code(code_length_);
|
||||
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -157,7 +158,7 @@ public:
|
||||
|
||||
private:
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
volk_gnsssdr::vector<std::complex<float>> code_;
|
||||
gr::blocks::float_to_complex::sptr float_to_complex_;
|
||||
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
|
||||
std::weak_ptr<ChannelFsm> channel_fsm_;
|
||||
|
@ -37,7 +37,11 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
threshold_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -89,7 +93,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
|
||||
// allocate memory to compute all the PRNs and compute all the possible codes
|
||||
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
|
||||
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
|
||||
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = volk_gnsssdr::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp;
|
||||
|
@ -23,10 +23,10 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "pcps_acquisition_fpga.h"
|
||||
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
|
||||
#include <cstddef> // for size_t
|
||||
#include <memory> // for weak_ptr
|
||||
#include <string> // for string
|
||||
#include <vector>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <cstddef> // for size_t
|
||||
#include <memory> // for weak_ptr
|
||||
#include <string> // for string
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -158,7 +158,7 @@ private:
|
||||
static const uint32_t SHL_CODE_BITS = 65536; // shift left by 10 bits
|
||||
|
||||
pcps_acquisition_fpga_sptr acquisition_fpga_;
|
||||
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
@ -37,7 +37,12 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
threshold_(0.0),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -58,7 +63,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
|
||||
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_ = 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_);
|
||||
code_ = volk_gnsssdr::vector<std::complex<float>>(vector_length_);
|
||||
fs_in_ = acq_parameters_.fs_in;
|
||||
|
||||
num_codes_ = acq_parameters_.sampled_ms;
|
||||
@ -72,11 +77,6 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
float_to_complex_ = gr::blocks::float_to_complex::make();
|
||||
}
|
||||
|
||||
channel_ = 0;
|
||||
threshold_ = 0.0;
|
||||
doppler_center_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@ -150,7 +150,7 @@ void GpsL5iPcpsAcquisition::init()
|
||||
|
||||
void GpsL5iPcpsAcquisition::set_local_code()
|
||||
{
|
||||
std::vector<std::complex<float>> code(code_length_);
|
||||
volk_gnsssdr::vector<std::complex<float>> code(code_length_);
|
||||
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
|
@ -25,9 +25,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** \addtogroup Acquisition
|
||||
* \{ */
|
||||
@ -157,7 +157,7 @@ public:
|
||||
|
||||
private:
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
volk_gnsssdr::vector<std::complex<float>> code_;
|
||||
gr::blocks::float_to_complex::sptr float_to_complex_;
|
||||
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
|
||||
std::weak_ptr<ChannelFsm> channel_fsm_;
|
||||
|
@ -37,7 +37,11 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
unsigned int out_streams) : gnss_synchro_(nullptr),
|
||||
role_(role),
|
||||
doppler_center_(0),
|
||||
channel_(0),
|
||||
doppler_step_(0),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
@ -92,7 +96,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
|
||||
auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT
|
||||
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
|
||||
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
|
||||
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = volk_gnsssdr::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp;
|
||||
@ -153,10 +157,6 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
|
||||
acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2);
|
||||
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
|
||||
|
||||
channel_ = 0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition_fpga.h"
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -198,7 +199,7 @@ private:
|
||||
|
||||
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
|
||||
volk_gnsssdr::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_;
|
||||
|
@ -96,25 +96,25 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
|
||||
d_CAF_window_hz = CAF_window_hz_;
|
||||
d_enable_monitor_output = enable_monitor_output;
|
||||
|
||||
d_inbuffer.reserve(d_fft_size);
|
||||
d_fft_code_I_A.reserve(d_fft_size);
|
||||
d_magnitudeIA.reserve(d_fft_size);
|
||||
d_inbuffer = std::vector<gr_complex>(d_fft_size);
|
||||
d_fft_code_I_A = std::vector<gr_complex>(d_fft_size);
|
||||
d_magnitudeIA = std::vector<float>(d_fft_size);
|
||||
|
||||
if (d_both_signal_components == true)
|
||||
{
|
||||
d_fft_code_Q_A.reserve(d_fft_size);
|
||||
d_magnitudeQA.reserve(d_fft_size);
|
||||
d_fft_code_Q_A = std::vector<gr_complex>(d_fft_size);
|
||||
d_magnitudeQA = std::vector<float>(d_fft_size);
|
||||
}
|
||||
|
||||
// IF COHERENT INTEGRATION TIME > 1
|
||||
if (d_sampled_ms > 1)
|
||||
{
|
||||
d_fft_code_I_B.reserve(d_fft_size);
|
||||
d_magnitudeIB.reserve(d_fft_size);
|
||||
d_fft_code_I_B = std::vector<gr_complex>(d_fft_size);
|
||||
d_magnitudeIB = std::vector<float>(d_fft_size);
|
||||
if (d_both_signal_components == true)
|
||||
{
|
||||
d_fft_code_Q_B.reserve(d_fft_size);
|
||||
d_magnitudeQB.reserve(d_fft_size);
|
||||
d_fft_code_Q_B = std::vector<gr_complex>(d_fft_size);
|
||||
d_magnitudeQB = std::vector<float>(d_fft_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,11 +244,11 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::init()
|
||||
* separately before non-coherent integration */
|
||||
if (d_CAF_window_hz > 0)
|
||||
{
|
||||
d_CAF_vector.reserve(d_num_doppler_bins);
|
||||
d_CAF_vector_I.reserve(d_num_doppler_bins);
|
||||
d_CAF_vector = std::vector<float>(d_num_doppler_bins);
|
||||
d_CAF_vector_I = std::vector<float>(d_num_doppler_bins);
|
||||
if (d_both_signal_components == true)
|
||||
{
|
||||
d_CAF_vector_Q.reserve(d_num_doppler_bins);
|
||||
d_CAF_vector_Q = std::vector<float>(d_num_doppler_bins);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,20 +47,41 @@ pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_)
|
||||
}
|
||||
|
||||
|
||||
pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acquisition",
|
||||
gr::io_signature::make(1, 1, conf_.it_size),
|
||||
gr::io_signature::make(0, 1, sizeof(Gnss_Synchro)))
|
||||
pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_)
|
||||
: gr::block("pcps_acquisition",
|
||||
gr::io_signature::make(1, 1, conf_.it_size),
|
||||
gr::io_signature::make(0, 1, sizeof(Gnss_Synchro))),
|
||||
d_acq_parameters(conf_),
|
||||
d_gnss_synchro(nullptr),
|
||||
d_dump_filename(conf_.dump_filename),
|
||||
d_dump_number(0LL),
|
||||
d_sample_counter(0ULL),
|
||||
d_threshold(0.0),
|
||||
d_mag(0),
|
||||
d_input_power(0.0),
|
||||
d_test_statistics(0.0),
|
||||
d_doppler_center_step_two(0.0),
|
||||
d_state(0),
|
||||
d_positive_acq(0),
|
||||
d_doppler_center(0U),
|
||||
d_doppler_bias(0),
|
||||
d_channel(0U),
|
||||
d_samplesPerChip(conf_.samples_per_chip),
|
||||
d_doppler_step(conf_.doppler_step),
|
||||
d_num_noncoherent_integrations_counter(0U),
|
||||
d_consumed_samples(conf_.sampled_ms * conf_.samples_per_ms * (conf_.bit_transition_flag ? 2.0 : 1.0)),
|
||||
d_num_doppler_bins(0U),
|
||||
d_num_doppler_bins_step2(conf_.num_doppler_bins_step2),
|
||||
d_dump_channel(conf_.dump_channel),
|
||||
d_buffer_count(0U),
|
||||
d_active(false),
|
||||
d_worker_active(false),
|
||||
d_step_two(false),
|
||||
d_use_CFAR_algorithm_flag(conf_.use_CFAR_algorithm_flag),
|
||||
d_dump(conf_.dump)
|
||||
{
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
|
||||
d_acq_parameters = conf_;
|
||||
d_sample_counter = 0ULL; // SAMPLE COUNTER
|
||||
d_active = false;
|
||||
d_positive_acq = 0;
|
||||
d_state = 0;
|
||||
d_doppler_bias = 0;
|
||||
d_num_noncoherent_integrations_counter = 0U;
|
||||
d_consumed_samples = 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;
|
||||
@ -70,23 +91,6 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
|
||||
d_fft_size = d_consumed_samples * 2;
|
||||
}
|
||||
// d_fft_size = next power of two? ////
|
||||
d_mag = 0;
|
||||
d_input_power = 0.0;
|
||||
d_num_doppler_bins = 0U;
|
||||
d_threshold = 0.0;
|
||||
d_doppler_step = d_acq_parameters.doppler_step;
|
||||
d_doppler_center = 0U;
|
||||
d_doppler_center_step_two = 0.0;
|
||||
d_test_statistics = 0.0;
|
||||
d_channel = 0U;
|
||||
if (conf_.it_size == sizeof(gr_complex))
|
||||
{
|
||||
d_cshort = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_cshort = true;
|
||||
}
|
||||
|
||||
// COD:
|
||||
// Experimenting with the overlap/save technique for handling bit trannsitions
|
||||
@ -110,25 +114,24 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
|
||||
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
|
||||
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
|
||||
|
||||
d_gnss_synchro = nullptr;
|
||||
d_worker_active = false;
|
||||
d_grid = arma::fmat();
|
||||
d_narrow_grid = arma::fmat();
|
||||
|
||||
if (conf_.it_size == sizeof(gr_complex))
|
||||
{
|
||||
d_cshort = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_cshort = true;
|
||||
}
|
||||
|
||||
d_data_buffer = volk_gnsssdr::vector<std::complex<float>>(d_consumed_samples);
|
||||
if (d_cshort)
|
||||
{
|
||||
d_data_buffer_sc = volk_gnsssdr::vector<lv_16sc_t>(d_consumed_samples);
|
||||
}
|
||||
d_grid = arma::fmat();
|
||||
d_narrow_grid = arma::fmat();
|
||||
d_step_two = false;
|
||||
d_num_doppler_bins_step2 = d_acq_parameters.num_doppler_bins_step2;
|
||||
|
||||
d_samplesPerChip = d_acq_parameters.samples_per_chip;
|
||||
d_buffer_count = 0U;
|
||||
d_use_CFAR_algorithm_flag = d_acq_parameters.use_CFAR_algorithm_flag;
|
||||
d_dump_number = 0LL;
|
||||
d_dump_channel = d_acq_parameters.dump_channel;
|
||||
d_dump = d_acq_parameters.dump;
|
||||
d_dump_filename = d_acq_parameters.dump_filename;
|
||||
if (d_dump)
|
||||
{
|
||||
std::string dump_path;
|
||||
|
@ -64,7 +64,7 @@
|
||||
#include <span>
|
||||
namespace own = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#include <gsl/gsl-lite.hpp>
|
||||
namespace own = gsl;
|
||||
#endif
|
||||
|
||||
@ -92,7 +92,7 @@ pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_);
|
||||
class pcps_acquisition : public gr::block
|
||||
{
|
||||
public:
|
||||
~pcps_acquisition() = default;
|
||||
~pcps_acquisition() override = default;
|
||||
|
||||
/*!
|
||||
* \brief Initializes acquisition algorithm and reserves memory.
|
||||
@ -212,7 +212,7 @@ public:
|
||||
*/
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
gr_vector_void_star& output_items) override;
|
||||
|
||||
private:
|
||||
friend pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_);
|
||||
@ -226,7 +226,7 @@ private:
|
||||
void send_positive_acquisition();
|
||||
void dump_results(int32_t effective_fft_size);
|
||||
bool is_fdma();
|
||||
bool start();
|
||||
bool start() override;
|
||||
void calculate_threshold(void);
|
||||
float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
|
||||
float max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
|
||||
|
@ -55,9 +55,9 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
|
||||
d_max_dwells = conf_.max_dwells;
|
||||
d_gnuradio_forecast_samples = d_fft_size;
|
||||
d_state = 0;
|
||||
d_fft_codes.reserve(d_fft_size);
|
||||
d_magnitude.reserve(d_fft_size);
|
||||
d_10_ms_buffer.reserve(50 * d_samples_per_ms);
|
||||
d_fft_codes = volk_gnsssdr::vector<gr_complex>(d_fft_size);
|
||||
d_magnitude = volk_gnsssdr::vector<float>(d_fft_size);
|
||||
d_10_ms_buffer = volk_gnsssdr::vector<gr_complex>(50 * d_samples_per_ms);
|
||||
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
|
||||
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
#include "pcps_acquisition_fpga.h"
|
||||
#include "gnss_sdr_make_unique.h"
|
||||
#include "gnss_sdr_make_unique.h" // for std::make_unique in C++11
|
||||
#include "gnss_synchro.h"
|
||||
#include <glog/logging.h>
|
||||
#include <cmath> // for ceil
|
||||
@ -34,37 +34,31 @@ pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_)
|
||||
|
||||
|
||||
pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_)
|
||||
: d_acq_parameters(std::move(conf_)),
|
||||
d_gnss_synchro(nullptr),
|
||||
d_sample_counter(0ULL),
|
||||
d_threshold(0.0),
|
||||
d_mag(0),
|
||||
d_input_power(0.0),
|
||||
d_test_statistics(0.0),
|
||||
d_doppler_step2(d_acq_parameters.doppler_step2),
|
||||
d_doppler_center_step_two(0.0),
|
||||
d_doppler_center(0U),
|
||||
d_state(0),
|
||||
d_doppler_index(0U),
|
||||
d_channel(0U),
|
||||
d_doppler_step(0U),
|
||||
d_doppler_max(d_acq_parameters.doppler_max),
|
||||
d_fft_size(d_acq_parameters.samples_per_code),
|
||||
d_num_doppler_bins(0U),
|
||||
d_downsampling_factor(d_acq_parameters.downsampling_factor),
|
||||
d_select_queue_Fpga(d_acq_parameters.select_queue_Fpga),
|
||||
d_total_block_exp(d_acq_parameters.total_block_exp),
|
||||
d_num_doppler_bins_step2(d_acq_parameters.num_doppler_bins_step2),
|
||||
d_max_num_acqs(d_acq_parameters.max_num_acqs),
|
||||
d_active(false),
|
||||
d_make_2_steps(d_acq_parameters.make_2_steps)
|
||||
{
|
||||
d_acq_parameters = std::move(conf_);
|
||||
d_sample_counter = 0ULL; // Sample Counter
|
||||
d_active = false;
|
||||
d_state = 0;
|
||||
d_fft_size = d_acq_parameters.samples_per_code;
|
||||
d_mag = 0;
|
||||
d_input_power = 0.0;
|
||||
d_num_doppler_bins = 0U;
|
||||
d_threshold = 0.0;
|
||||
d_doppler_step = 0U;
|
||||
d_doppler_center = 0U;
|
||||
d_doppler_index = 0U;
|
||||
d_test_statistics = 0.0;
|
||||
d_channel = 0U;
|
||||
d_gnss_synchro = nullptr;
|
||||
|
||||
d_downsampling_factor = d_acq_parameters.downsampling_factor;
|
||||
d_select_queue_Fpga = d_acq_parameters.select_queue_Fpga;
|
||||
|
||||
d_total_block_exp = d_acq_parameters.total_block_exp;
|
||||
|
||||
d_make_2_steps = d_acq_parameters.make_2_steps;
|
||||
d_num_doppler_bins_step2 = d_acq_parameters.num_doppler_bins_step2;
|
||||
d_doppler_step2 = d_acq_parameters.doppler_step2;
|
||||
d_doppler_center_step_two = 0.0;
|
||||
|
||||
d_doppler_max = d_acq_parameters.doppler_max;
|
||||
|
||||
d_max_num_acqs = d_acq_parameters.max_num_acqs;
|
||||
|
||||
d_acquisition_fpga = std::make_unique<Fpga_Acquisition>(d_acq_parameters.device_name, d_acq_parameters.code_length, d_acq_parameters.doppler_max, d_fft_size,
|
||||
d_acq_parameters.fs_in, d_acq_parameters.select_queue_Fpga, d_acq_parameters.all_fft_codes, d_acq_parameters.excludelimit);
|
||||
}
|
||||
@ -302,6 +296,7 @@ void pcps_acquisition_fpga::reset_acquisition()
|
||||
d_acquisition_fpga->close_device();
|
||||
}
|
||||
|
||||
|
||||
void pcps_acquisition_fpga::stop_acquisition()
|
||||
{
|
||||
// this function stops the acquisition and the other FPGA Modules.
|
||||
|
@ -66,7 +66,7 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc(
|
||||
d_input_power = 0.0;
|
||||
d_state = 0;
|
||||
d_disable_assist = false;
|
||||
d_fft_codes.reserve(d_fft_size);
|
||||
d_fft_codes = std::vector<gr_complex>(d_fft_size);
|
||||
|
||||
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
|
||||
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
|
||||
|
@ -77,13 +77,13 @@ pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc(
|
||||
d_input_power = 0.0;
|
||||
d_num_doppler_bins = 0;
|
||||
|
||||
d_fft_code_data.reserve(d_fft_size);
|
||||
d_fft_code_pilot.reserve(d_fft_size);
|
||||
d_data_correlation.reserve(d_fft_size);
|
||||
d_pilot_correlation.reserve(d_fft_size);
|
||||
d_correlation_plus.reserve(d_fft_size);
|
||||
d_correlation_minus.reserve(d_fft_size);
|
||||
d_magnitude.reserve(d_fft_size);
|
||||
d_fft_code_data = std::vector<gr_complex>(d_fft_size);
|
||||
d_fft_code_pilot = std::vector<gr_complex>(d_fft_size);
|
||||
d_data_correlation = std::vector<gr_complex>(d_fft_size);
|
||||
d_pilot_correlation = std::vector<gr_complex>(d_fft_size);
|
||||
d_correlation_plus = std::vector<gr_complex>(d_fft_size);
|
||||
d_correlation_minus = std::vector<gr_complex>(d_fft_size);
|
||||
d_magnitude = std::vector<float>(d_fft_size);
|
||||
|
||||
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
|
||||
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
|
||||
|
@ -102,8 +102,8 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc(
|
||||
d_cl_fft_batch_size = 1;
|
||||
|
||||
d_in_buffer = std::vector<std::vector<gr_complex>>(d_max_dwells, std::vector<gr_complex>(d_fft_size));
|
||||
d_magnitude.reserve(d_fft_size);
|
||||
d_fft_codes.reserve(d_fft_size_pow2);
|
||||
d_magnitude = std::vector<float>(d_fft_size);
|
||||
d_fft_codes = std::vector<gr_complex>(_fft_size_pow2);
|
||||
d_zero_vector = std::vector<gr_complex>(d_fft_size_pow2 - d_fft_size, 0.0);
|
||||
|
||||
d_opencl = init_opencl_environment("math_kernel.cl");
|
||||
|
@ -83,15 +83,14 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
|
||||
// fft size is reduced.
|
||||
d_fft_size = (d_samples_per_code) / d_folding_factor;
|
||||
|
||||
d_fft_codes.reserve(d_fft_size);
|
||||
d_magnitude.reserve(d_samples_per_code * d_folding_factor);
|
||||
d_magnitude_folded.reserve(d_fft_size);
|
||||
d_fft_codes = std::vector<gr_complex>(d_fft_size);
|
||||
d_magnitude = std::vector<float>(d_samples_per_code * d_folding_factor);
|
||||
d_magnitude_folded = std::vector<float>(d_fft_size);
|
||||
d_possible_delay = std::vector<uint32_t>(d_folding_factor);
|
||||
d_corr_output_f = std::vector<float>(d_folding_factor);
|
||||
|
||||
d_possible_delay.reserve(d_folding_factor);
|
||||
d_corr_output_f.reserve(d_folding_factor);
|
||||
|
||||
/*Create the d_code signal , which would store the values of the code in its
|
||||
original form to perform later correlation in time domain*/
|
||||
// Create the d_code vector, which would store the values of the code in its
|
||||
// original form to perform later correlation in time domain
|
||||
d_code = std::vector<gr_complex>(d_samples_per_code, lv_cmake(0.0F, 0.0F));
|
||||
|
||||
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
|
||||
@ -104,7 +103,8 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
|
||||
d_enable_monitor_output = enable_monitor_output;
|
||||
|
||||
d_code_folded = std::vector<gr_complex>(d_fft_size, lv_cmake(0.0F, 0.0F));
|
||||
d_signal_folded.reserve(d_fft_size);
|
||||
|
||||
d_signal_folded = std::vector<gr_complex>(d_fft_size);
|
||||
d_noise_floor_power = 0;
|
||||
d_doppler_resolution = 0;
|
||||
d_threshold = 0;
|
||||
|
@ -98,8 +98,8 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
|
||||
d_input_power = 0.0;
|
||||
d_num_doppler_bins = 0;
|
||||
|
||||
d_fft_codes.reserve(d_fft_size);
|
||||
d_magnitude.reserve(d_fft_size);
|
||||
d_fft_codes = std::vector<gr_complex>(d_fft_size);
|
||||
d_magnitude = std::vector<float>(d_fft_size);
|
||||
|
||||
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
|
||||
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
|
||||
|
@ -33,6 +33,8 @@ else()
|
||||
endif()
|
||||
|
||||
target_link_libraries(acquisition_libs
|
||||
INTERFACE
|
||||
Gnuradio::runtime
|
||||
PRIVATE
|
||||
Gflags::gflags
|
||||
Glog::glog
|
||||
|
@ -18,43 +18,8 @@
|
||||
#include "acq_conf.h"
|
||||
#include "item_type_helpers.h"
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <cmath>
|
||||
|
||||
Acq_Conf::Acq_Conf()
|
||||
{
|
||||
/* PCPS acquisition configuration */
|
||||
sampled_ms = 1U;
|
||||
ms_per_code = 1U;
|
||||
max_dwells = 1U;
|
||||
samples_per_chip = 2U;
|
||||
chips_per_second = 1023000;
|
||||
doppler_max = 5000;
|
||||
doppler_min = -5000;
|
||||
doppler_step = 250.0;
|
||||
num_doppler_bins_step2 = 4U;
|
||||
doppler_step2 = 125.0;
|
||||
pfa = 0.0;
|
||||
pfa2 = 0.0;
|
||||
fs_in = 4000000;
|
||||
samples_per_ms = 0.0;
|
||||
samples_per_code = 0.0;
|
||||
bit_transition_flag = false;
|
||||
use_CFAR_algorithm_flag = true;
|
||||
dump = false;
|
||||
blocking = true;
|
||||
make_2_steps = false;
|
||||
dump_channel = 0U;
|
||||
it_size = sizeof(gr_complex);
|
||||
item_type = std::string("gr_complex");
|
||||
blocking_on_standby = false;
|
||||
use_automatic_resampler = false;
|
||||
resampler_ratio = 1.0;
|
||||
resampled_fs = 0LL;
|
||||
resampler_latency_samples = 0U;
|
||||
enable_monitor_output = false;
|
||||
}
|
||||
|
||||
|
||||
void Acq_Conf::SetFromConfiguration(const ConfigurationInterface *configuration,
|
||||
const std::string &role, double chip_rate, double opt_freq)
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define GNSS_SDR_ACQ_CONF_H
|
||||
|
||||
#include "configuration_interface.h"
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
@ -32,46 +33,46 @@
|
||||
class Acq_Conf
|
||||
{
|
||||
public:
|
||||
Acq_Conf();
|
||||
Acq_Conf() = default;
|
||||
|
||||
void SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role, double chip_rate, double opt_freq);
|
||||
|
||||
/* PCPS Acquisition configuration */
|
||||
std::string item_type;
|
||||
std::string item_type{"gr_complex"};
|
||||
std::string dump_filename;
|
||||
|
||||
int64_t fs_in;
|
||||
int64_t resampled_fs;
|
||||
int64_t fs_in{4000000LL};
|
||||
int64_t resampled_fs{0LL};
|
||||
|
||||
size_t it_size;
|
||||
size_t it_size{sizeof(gr_complex)};
|
||||
|
||||
float doppler_step;
|
||||
float samples_per_ms;
|
||||
float doppler_step2;
|
||||
float pfa;
|
||||
float pfa2;
|
||||
float samples_per_code;
|
||||
float resampler_ratio;
|
||||
float doppler_step{250.0};
|
||||
float samples_per_ms{0.0};
|
||||
float doppler_step2{125.0};
|
||||
float pfa{0.0};
|
||||
float pfa2{0.0};
|
||||
float samples_per_code{0.0};
|
||||
float resampler_ratio{1.0};
|
||||
|
||||
uint32_t sampled_ms;
|
||||
uint32_t ms_per_code;
|
||||
uint32_t samples_per_chip;
|
||||
uint32_t chips_per_second;
|
||||
uint32_t max_dwells;
|
||||
uint32_t num_doppler_bins_step2;
|
||||
uint32_t resampler_latency_samples;
|
||||
uint32_t dump_channel;
|
||||
int32_t doppler_max;
|
||||
int32_t doppler_min;
|
||||
uint32_t sampled_ms{1U};
|
||||
uint32_t ms_per_code{1U};
|
||||
uint32_t samples_per_chip{2U};
|
||||
uint32_t chips_per_second{1023000U};
|
||||
uint32_t max_dwells{1U};
|
||||
uint32_t num_doppler_bins_step2{4U};
|
||||
uint32_t resampler_latency_samples{0U};
|
||||
uint32_t dump_channel{0U};
|
||||
int32_t doppler_max{5000};
|
||||
int32_t doppler_min{-5000};
|
||||
|
||||
bool bit_transition_flag;
|
||||
bool use_CFAR_algorithm_flag;
|
||||
bool dump;
|
||||
bool blocking;
|
||||
bool blocking_on_standby; // enable it only for unit testing to avoid sample consume on idle status
|
||||
bool make_2_steps;
|
||||
bool use_automatic_resampler;
|
||||
bool enable_monitor_output;
|
||||
bool bit_transition_flag{false};
|
||||
bool use_CFAR_algorithm_flag{true};
|
||||
bool dump{false};
|
||||
bool blocking{true};
|
||||
bool blocking_on_standby{false}; // enable it only for unit testing to avoid sample consume on idle status
|
||||
bool make_2_steps{false};
|
||||
bool use_automatic_resampler{false};
|
||||
bool enable_monitor_output{false};
|
||||
|
||||
private:
|
||||
void SetDerivedParams();
|
||||
|
@ -51,28 +51,25 @@ Fpga_Acquisition::Fpga_Acquisition(std::string device_name,
|
||||
int64_t fs_in,
|
||||
uint32_t select_queue,
|
||||
uint32_t *all_fft_codes,
|
||||
uint32_t excludelimit)
|
||||
uint32_t excludelimit) : d_device_name(std::move(device_name)),
|
||||
d_fs_in(fs_in),
|
||||
d_fd(0), // driver descriptor
|
||||
d_map_base(nullptr), // driver memory map
|
||||
d_all_fft_codes(all_fft_codes),
|
||||
d_vector_length(nsamples_total),
|
||||
d_excludelimit(excludelimit),
|
||||
d_nsamples_total(nsamples_total),
|
||||
d_nsamples(nsamples), // number of samples not including padding
|
||||
d_select_queue(select_queue),
|
||||
d_doppler_max(doppler_max),
|
||||
d_doppler_step(0),
|
||||
d_PRN(0)
|
||||
{
|
||||
const uint32_t vector_length = nsamples_total;
|
||||
|
||||
// initial values
|
||||
d_device_name = std::move(device_name);
|
||||
d_fs_in = fs_in;
|
||||
d_vector_length = vector_length;
|
||||
d_excludelimit = excludelimit;
|
||||
d_nsamples = nsamples; // number of samples not including padding
|
||||
d_select_queue = select_queue;
|
||||
d_nsamples_total = nsamples_total;
|
||||
d_doppler_max = doppler_max;
|
||||
d_doppler_step = 0;
|
||||
d_fd = 0; // driver descriptor
|
||||
d_map_base = nullptr; // driver memory map
|
||||
d_all_fft_codes = all_fft_codes;
|
||||
Fpga_Acquisition::open_device();
|
||||
Fpga_Acquisition::reset_acquisition();
|
||||
Fpga_Acquisition::fpga_acquisition_test_register();
|
||||
Fpga_Acquisition::close_device();
|
||||
d_PRN = 0;
|
||||
|
||||
DLOG(INFO) << "Acquisition FPGA class created";
|
||||
}
|
||||
|
||||
@ -244,12 +241,14 @@ void Fpga_Acquisition::reset_acquisition()
|
||||
// the FPGA HW modules including the multicorrelators
|
||||
}
|
||||
|
||||
|
||||
void Fpga_Acquisition::stop_acquisition()
|
||||
{
|
||||
d_map_base[8] = STOP_ACQUISITION; // setting bit 3 of d_map_base[8] stops the acquisition module. This stops all
|
||||
// the FPGA HW modules including the multicorrelators
|
||||
}
|
||||
|
||||
|
||||
// this function is only used for the unit tests
|
||||
void Fpga_Acquisition::read_fpga_total_scale_factor(uint32_t *total_scale_factor, uint32_t *fw_scale_factor)
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user