From aa5f9697b7c0a71c0180c3c00511d7526269545f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 13 Feb 2022 20:13:20 +0100 Subject: [PATCH 01/27] Bump version number to 0.0.16 --- CITATION.cff | 4 ++-- CMakeLists.txt | 6 +++--- docs/CHANGELOG.md | 2 +- docs/manpage/gnss-sdr-manpage | 2 +- .../libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt | 2 +- .../cmake/Packaging/volk_gnsssdr-config-info-manpage | 2 +- .../cmake/Packaging/volk_gnsssdr_profile-manpage | 2 +- src/main/main.cc | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 11eddf59f..35e0246e6 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -102,7 +102,7 @@ authors: family-names: "van der Linden" given-names: Stefan cff-version: "1.2.0" -date-released: "2021-08-23" +date-released: "2022-02-14" identifiers: - description: "The concept DOI of the work. This is a DOI always pointing to the latest stable release." type: doi @@ -326,4 +326,4 @@ repository-code: "https://github.com/gnss-sdr/gnss-sdr" title: GNSS-SDR type: software url: "https://gnss-sdr.org" -version: "0.0.15" +version: "0.0.16" diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a648dbb4..ceebcde7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,7 +130,7 @@ option(ENABLE_ORC "Use (if available) the Optimized Inner Loop Runtime Compiler ################################################################################ # GNSS-SDR version information ################################################################################ -set(THIS_IS_A_RELEASE OFF) # only related to version name, no further implications. +set(THIS_IS_A_RELEASE ON) # only related to version name, no further implications. if(NOT ${THIS_IS_A_RELEASE}) find_package(Git) set_package_properties(Git PROPERTIES @@ -166,9 +166,9 @@ endif() set(VERSION_INFO_MAJOR_VERSION 0) set(VERSION_INFO_API_COMPAT 0) if(${THIS_IS_A_RELEASE}) - set(VERSION_INFO_MINOR_VERSION 15) + set(VERSION_INFO_MINOR_VERSION 16) else() - set(VERSION_INFO_MINOR_VERSION 15.git-${GIT_BRANCH}-${GIT_COMMIT_HASH}) + set(VERSION_INFO_MINOR_VERSION 16.git-${GIT_BRANCH}-${GIT_COMMIT_HASH}) endif() set(VERSION ${VERSION_INFO_MAJOR_VERSION}.${VERSION_INFO_API_COMPAT}.${VERSION_INFO_MINOR_VERSION}) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f284f6248..f8f883c3d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -12,7 +12,7 @@ SPDX-FileCopyrightText: 2011-2022 Carles Fernandez-Prades .\" Contact carles.fernandez@cttc.es to correct errors or typos. -.TH gnss\-sdr 1 "23 Aug 2021" "0.0.15" "gnss\-sdr man page" +.TH gnss\-sdr 1 "14 Feb 2022" "0.0.16" "gnss\-sdr man page" .SH NAME \fBgnss\-sdr\fR \- GNSS Software Defined Receiver. .SH SYNOPSIS diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index 80e8d283f..bc0774e34 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -209,7 +209,7 @@ message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.") set(VERSION_INFO_MAJOR_VERSION 0) set(VERSION_INFO_MINOR_VERSION 0) -set(VERSION_INFO_MAINT_VERSION 15) +set(VERSION_INFO_MAINT_VERSION 16) include(VolkGnsssdrVersion) # setup version info diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage index 94d3ca45e..b5d10e547 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage @@ -2,7 +2,7 @@ .\" SPDX-License-Identifier: GPL-3.0-or-later .\" SPDX-FileCopyrightText: Carles Fernandez-Prades .\" Contact carles.fernandez@cttc.es to correct errors or typos. -.TH volk_gnsssdr\-config\-info 1 "23 Aug 2021" "0.0.15" "volk_gnsssdr\-config\-info man page" +.TH volk_gnsssdr\-config\-info 1 "14 Feb 2022" "0.0.16" "volk_gnsssdr\-config\-info man page" .SH NAME \fBvolk_gnsssdr\-config\-info\fR \- Prints configuration information of libvolk_gnsssdr functions. .SH SYNOPSIS diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage index 440fb492a..7915f790b 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage @@ -2,7 +2,7 @@ .\" SPDX-License-Identifier: GPL-3.0-or-later .\" SPDX-FileCopyrightText: Carles Fernandez-Prades .\" Contact carles.fernandez@cttc.es to correct errors or typos. -.TH volk_gnsssdr_profile 1 "23 Aug 2021" "0.0.15" "volk_gnsssdr_profile man page" +.TH volk_gnsssdr_profile 1 "14 Feb 2022" "0.0.16" "volk_gnsssdr_profile man page" .SH NAME \fBvolk_gnsssdr_profile\fR \- Profiler application for libvolk_gnsssdr functions. .SH SYNOPSIS diff --git a/src/main/main.cc b/src/main/main.cc index 544b7b444..05b84eed1 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -18,7 +18,7 @@ */ #ifndef GNSS_SDR_VERSION -#define GNSS_SDR_VERSION "0.0.15" +#define GNSS_SDR_VERSION "0.0.16" #endif #ifndef GOOGLE_STRIP_LOG From ad9add84269a478e0d783a3b771eb28300b9d0cb Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 13 Feb 2022 21:18:31 +0100 Subject: [PATCH 02/27] Fix indentation --- src/algorithms/tracking/libs/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index 65dda2ca4..b8e80cd37 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -78,7 +78,7 @@ else() add_library(tracking_libs ${TRACKING_LIB_SOURCES} ${TRACKING_LIB_HEADERS}) endif() - target_link_libraries(tracking_libs +target_link_libraries(tracking_libs PUBLIC Armadillo::armadillo Boost::headers From cf91334d664e1236f441fca3377b289b47bf94ad Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 15 Feb 2022 11:31:35 +0100 Subject: [PATCH 03/27] Fix navdata_monitor extraction of FNAV message data --- .../galileo_telemetry_decoder_gs.cc | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc index d06fefae6..8c259691f 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc @@ -1003,18 +1003,18 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { d_TOW_at_current_symbol_ms += static_cast(GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS); } - if (d_enable_navdata_monitor && !d_nav_msg_packet.nav_message.empty()) - { - d_nav_msg_packet.system = std::string(1, current_symbol.System); - d_nav_msg_packet.signal = std::string(current_symbol.Signal); - d_nav_msg_packet.prn = static_cast(current_symbol.PRN); - d_nav_msg_packet.tow_at_current_symbol_ms = static_cast(d_TOW_at_current_symbol_ms); - const std::shared_ptr tmp_obj = std::make_shared(d_nav_msg_packet); - this->message_port_pub(pmt::mp("Nav_msg_from_TLM"), pmt::make_any(tmp_obj)); - d_nav_msg_packet.nav_message = ""; - } - break; } + if (d_enable_navdata_monitor && !d_nav_msg_packet.nav_message.empty()) + { + d_nav_msg_packet.system = std::string(1, current_symbol.System); + d_nav_msg_packet.signal = std::string(current_symbol.Signal); + d_nav_msg_packet.prn = static_cast(current_symbol.PRN); + d_nav_msg_packet.tow_at_current_symbol_ms = static_cast(d_TOW_at_current_symbol_ms); + const std::shared_ptr tmp_obj = std::make_shared(d_nav_msg_packet); + this->message_port_pub(pmt::mp("Nav_msg_from_TLM"), pmt::make_any(tmp_obj)); + d_nav_msg_packet.nav_message = ""; + } + break; } case 3: // CNAV { From 70a4eda4d41da8ef60b4b9c0386259a5fe2573d2 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 15 Feb 2022 12:07:35 +0100 Subject: [PATCH 04/27] Bump release date --- docs/CHANGELOG.md | 2 +- docs/manpage/gnss-sdr-manpage | 2 +- .../cmake/Packaging/volk_gnsssdr-config-info-manpage | 2 +- .../volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f8f883c3d..77cc00563 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -12,7 +12,7 @@ SPDX-FileCopyrightText: 2011-2022 Carles Fernandez-Prades .\" Contact carles.fernandez@cttc.es to correct errors or typos. -.TH gnss\-sdr 1 "14 Feb 2022" "0.0.16" "gnss\-sdr man page" +.TH gnss\-sdr 1 "15 Feb 2022" "0.0.16" "gnss\-sdr man page" .SH NAME \fBgnss\-sdr\fR \- GNSS Software Defined Receiver. .SH SYNOPSIS diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage index b5d10e547..97b1f6096 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage @@ -2,7 +2,7 @@ .\" SPDX-License-Identifier: GPL-3.0-or-later .\" SPDX-FileCopyrightText: Carles Fernandez-Prades .\" Contact carles.fernandez@cttc.es to correct errors or typos. -.TH volk_gnsssdr\-config\-info 1 "14 Feb 2022" "0.0.16" "volk_gnsssdr\-config\-info man page" +.TH volk_gnsssdr\-config\-info 1 "15 Feb 2022" "0.0.16" "volk_gnsssdr\-config\-info man page" .SH NAME \fBvolk_gnsssdr\-config\-info\fR \- Prints configuration information of libvolk_gnsssdr functions. .SH SYNOPSIS diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage index 7915f790b..3303347a1 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage @@ -2,7 +2,7 @@ .\" SPDX-License-Identifier: GPL-3.0-or-later .\" SPDX-FileCopyrightText: Carles Fernandez-Prades .\" Contact carles.fernandez@cttc.es to correct errors or typos. -.TH volk_gnsssdr_profile 1 "14 Feb 2022" "0.0.16" "volk_gnsssdr_profile man page" +.TH volk_gnsssdr_profile 1 "15 Feb 2022" "0.0.16" "volk_gnsssdr_profile man page" .SH NAME \fBvolk_gnsssdr_profile\fR \- Profiler application for libvolk_gnsssdr functions. .SH SYNOPSIS From 7df5c3118ca10222d7e3705f47b2ec850efd5319 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 15 Feb 2022 13:28:29 +0100 Subject: [PATCH 05/27] Fix incorrect spelling --- src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 2 +- src/algorithms/PVT/libs/rinex_printer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index f0c039506..b9dfff0ab 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -1698,7 +1698,7 @@ void rtklib_pvt_gs::log_source_timetag_info(double RX_time_ns, double TAG_time_n } catch (const std::exception& e) { - std::cerr << "Problem writting at the log PVT timetag metadata file: " << e.what() << '\n'; + std::cerr << "Problem writing at the log PVT timetag metadata file: " << e.what() << '\n'; } } } diff --git a/src/algorithms/PVT/libs/rinex_printer.h b/src/algorithms/PVT/libs/rinex_printer.h index 6ffeca87f..e0e68a780 100644 --- a/src/algorithms/PVT/libs/rinex_printer.h +++ b/src/algorithms/PVT/libs/rinex_printer.h @@ -98,7 +98,7 @@ public: * \brief Print RINEX annotation. If it is the first annotation, it also * prints the RINEX headers for navigation and observation files. If it is * not the first annotation, it only annotates the observation, and updates - * the navigation header if UTC data was not available when writting it for + * the navigation header if UTC data was not available when writing it for * the first time. The meaning of type_of_rx is as follows: * * type_of_rx | Signals From d58720ea5808ae653d3fd8b9dbcfe88554ede89a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 15 Feb 2022 14:21:55 +0100 Subject: [PATCH 06/27] The action continues at the next branch --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ceebcde7f..ad52e1a26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,7 +130,7 @@ option(ENABLE_ORC "Use (if available) the Optimized Inner Loop Runtime Compiler ################################################################################ # GNSS-SDR version information ################################################################################ -set(THIS_IS_A_RELEASE ON) # only related to version name, no further implications. +set(THIS_IS_A_RELEASE OFF) # only related to version name, no further implications. if(NOT ${THIS_IS_A_RELEASE}) find_package(Git) set_package_properties(Git PROPERTIES From 48b55382692b0d52dcb5d3f0c0bec6adcf06058e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 16 Feb 2022 11:34:12 +0100 Subject: [PATCH 07/27] Fix defects detected by Coverity Scan 2021.12.1: Unintentional integer overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit overflow_before_widen: Potentially overflowing expression this->d_fft_size * ninput_items[0UL] with type unsigned int (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type uint64_t (64 bits, unsigned) --- .../gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc | 6 +++--- .../gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc | 6 +++--- .../gnuradio_blocks/pcps_opencl_acquisition_cc.cc | 8 ++++---- .../gnuradio_blocks/pcps_quicksync_acquisition_cc.cc | 2 +- .../gnuradio_blocks/pcps_tong_acquisition_cc.cc | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc index 85ad12ff1..b534f30f9 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc @@ -216,7 +216,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items, d_state = 1; } - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter consume_each(ninput_items[0]); break; @@ -368,7 +368,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items, d_active = false; d_state = 0; - d_sample_counter += d_fft_size * ninput_items[0]; // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter consume_each(ninput_items[0]); acquisition_message = 1; @@ -403,7 +403,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items, d_active = false; d_state = 0; - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter consume_each(ninput_items[0]); acquisition_message = 2; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc index 47db3495a..47905fab9 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc @@ -226,7 +226,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items, d_state = 1; } - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter consume_each(ninput_items[0]); break; @@ -389,7 +389,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items, d_active = false; d_state = 0; - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter consume_each(ninput_items[0]); acquisition_message = 1; @@ -424,7 +424,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items, d_active = false; d_state = 0; - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter consume_each(ninput_items[0]); acquisition_message = 2; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc index 8aacb315f..b55015d6a 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc @@ -680,7 +680,7 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items, d_state = 1; } - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter break; } @@ -710,7 +710,7 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items, { // We already have d_max_dwells consecutive blocks in the internal buffer, // just skip input blocks. - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; } // We create a new thread to process next block if the following @@ -754,7 +754,7 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items, d_active = false; d_state = 0; - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter acquisition_message = 1; this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message)); @@ -788,7 +788,7 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items, d_active = false; d_state = 0; - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter acquisition_message = 2; this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message)); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc index 0463ef99f..3cf56f87a 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -290,7 +290,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items, d_test_statistics = 0.0; d_noise_floor_power = 0.0; - d_sample_counter += static_cast(d_sampled_ms * d_samples_per_ms); // sample counter + d_sample_counter += static_cast(d_sampled_ms) * d_samples_per_ms; // sample counter d_well_count++; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc index b3c5c61a9..720bdf917 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -251,7 +251,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items, d_state = 1; } - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter consume_each(ninput_items[0]); break; @@ -390,7 +390,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items, d_active = false; d_state = 0; - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter consume_each(ninput_items[0]); acquisition_message = 1; @@ -425,7 +425,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items, d_active = false; d_state = 0; - d_sample_counter += static_cast(d_fft_size * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_fft_size) * ninput_items[0]; // sample counter consume_each(ninput_items[0]); acquisition_message = 2; From c151b03b774956fe7e93f301f85d4a2363eac7a1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 16 Feb 2022 12:22:11 +0100 Subject: [PATCH 08/27] Fix defects detected by Coverity Scan 2021.12.1: Out-of-bounds access (ARRAY_VS_SINGLETON) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit callee_ptr_arith: Passing &this->d_acquisition_gnss_synchro->System to function basic_string which uses it as an array. This might corrupt or misinterpret adjacent memory locations --- .../gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc | 3 +-- .../gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 3 +-- .../gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 3 +-- .../gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc | 3 +-- .../gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 3 +-- .../gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 3 +-- .../gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc | 3 +-- .../gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 3 +-- .../tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc | 3 +-- .../gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc | 3 +-- 10 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index 03ee2f82c..f9c7297d7 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -178,8 +178,7 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking() d_carrier_doppler_hz = d_acq_carrier_doppler_hz; d_current_prn_length_samples = d_vector_length; - std::string sys_ = &d_acquisition_gnss_synchro->System; - sys = sys_.substr(0, 1); + sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); // DEBUG OUTPUT std::cout << "Tracking of Galileo E1 signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index 04f88b999..80eeeadd6 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -263,8 +263,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_pll_to_dll_assist_secs_Ti = 0.0; d_code_phase_samples = d_acq_code_phase_samples; - const std::string sys_ = &d_acquisition_gnss_synchro->System; - sys = sys_.substr(0, 1); + sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); d_acc_carrier_phase_initialized = false; // DEBUG OUTPUT diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index 9162f7bcc..21257d198 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -263,8 +263,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking() d_pll_to_dll_assist_secs_Ti = 0.0; d_code_phase_samples = d_acq_code_phase_samples; - const std::string sys_ = &d_acquisition_gnss_synchro->System; - sys = sys_.substr(0, 1); + sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); d_acc_carrier_phase_initialized = false; // DEBUG OUTPUT diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index 242469b0a..b3ee29623 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -205,8 +205,7 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() d_code_phase_samples = d_acq_code_phase_samples; - const std::string sys_ = &d_acquisition_gnss_synchro->System; - sys = sys_.substr(0, 1); + sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); d_acc_carrier_phase_initialized = false; // DEBUG OUTPUT diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 485b0d93f..48a1cc540 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -259,8 +259,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_pll_to_dll_assist_secs_Ti = 0.0; d_code_phase_samples = d_acq_code_phase_samples; - const std::string sys_ = &d_acquisition_gnss_synchro->System; - sys = sys_.substr(0, 1); + sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); // DEBUG OUTPUT std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index 5dfcb2d53..dc687a67f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -260,8 +260,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking() d_pll_to_dll_assist_secs_Ti = 0.0; d_code_phase_samples = d_acq_code_phase_samples; - const std::string sys_ = &d_acquisition_gnss_synchro->System; - sys = sys_.substr(0, 1); + sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); // DEBUG OUTPUT std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index 0f3ae0abb..18e9608fb 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -206,8 +206,7 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::start_tracking() d_code_phase_samples = d_acq_code_phase_samples; - const std::string sys_ = &d_acquisition_gnss_synchro->System; - sys = sys_.substr(0, 1); + sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); // DEBUG OUTPUT std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index 858244669..f1f35497e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -218,8 +218,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking() d_pll_to_dll_assist_secs_Ti = 0.0; d_code_phase_samples = d_acq_code_phase_samples; - const std::string sys_ = &d_acquisition_gnss_synchro->System; - sys = sys_.substr(0, 1); + sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); // DEBUG OUTPUT std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc index f1fb20c82..3e38d625b 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc @@ -302,8 +302,7 @@ void Gps_L1_Ca_Kf_Tracking_cc::start_tracking() d_code_phase_samples = d_acq_code_phase_samples; - std::string sys_ = &d_acquisition_gnss_synchro->System; - sys = sys_.substr(0, 1); + sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); // DEBUG OUTPUT std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index 7d964cdfe..148010ed1 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -203,8 +203,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking() d_code_phase_samples = d_acq_code_phase_samples; - std::string sys_ = &d_acquisition_gnss_synchro->System; - sys = sys_.substr(0, 1); + sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); // DEBUG OUTPUT std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; From 3755d78aee0b800ab6a6e9bd7990fb7757ccd2a6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 16 Feb 2022 13:56:25 +0100 Subject: [PATCH 09/27] Fix defects detected by Coverity Scan 2021.12.1: Out-of-bounds access (ARRAY_VS_SINGLETON) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit callee_ptr_arith: Passing &this->d_acquisition_gnss_synchro->System to function basic_string which uses it as an array. This might corrupt or misinterpret adjacent memory locations --- .../gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc | 2 +- .../glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 2 +- .../glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 2 +- .../gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc | 2 +- .../glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 2 +- .../glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 2 +- .../gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc | 2 +- .../gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 2 +- .../tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc | 4 ++-- .../gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index f9c7297d7..7f6262d58 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -178,7 +178,7 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking() d_carrier_doppler_hz = d_acq_carrier_doppler_hz; d_current_prn_length_samples = d_vector_length; - sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); + sys = std::string(1, d_acquisition_gnss_synchro->System); // DEBUG OUTPUT std::cout << "Tracking of Galileo E1 signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index 80eeeadd6..e1fb1f44b 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -263,7 +263,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_pll_to_dll_assist_secs_Ti = 0.0; d_code_phase_samples = d_acq_code_phase_samples; - sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); + sys = std::string(1, d_acquisition_gnss_synchro->System); d_acc_carrier_phase_initialized = false; // DEBUG OUTPUT diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index 21257d198..f8fbe3b56 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -263,7 +263,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking() d_pll_to_dll_assist_secs_Ti = 0.0; d_code_phase_samples = d_acq_code_phase_samples; - sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); + sys = std::string(1, d_acquisition_gnss_synchro->System); d_acc_carrier_phase_initialized = false; // DEBUG OUTPUT diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index b3ee29623..06f5914cd 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -205,7 +205,7 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() d_code_phase_samples = d_acq_code_phase_samples; - sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); + sys = std::string(1, d_acquisition_gnss_synchro->System); d_acc_carrier_phase_initialized = false; // DEBUG OUTPUT diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 48a1cc540..16f1dbc58 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -259,7 +259,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_pll_to_dll_assist_secs_Ti = 0.0; d_code_phase_samples = d_acq_code_phase_samples; - sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); + sys = std::string(1, d_acquisition_gnss_synchro->System); // DEBUG OUTPUT std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index dc687a67f..2f3e66890 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -260,7 +260,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking() d_pll_to_dll_assist_secs_Ti = 0.0; d_code_phase_samples = d_acq_code_phase_samples; - sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); + sys = std::string(1, d_acquisition_gnss_synchro->System); // DEBUG OUTPUT std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index 18e9608fb..42041eec1 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -206,7 +206,7 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::start_tracking() d_code_phase_samples = d_acq_code_phase_samples; - sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); + sys = std::string(1, d_acquisition_gnss_synchro->System); // DEBUG OUTPUT std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index f1f35497e..45d274b9f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -218,7 +218,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking() d_pll_to_dll_assist_secs_Ti = 0.0; d_code_phase_samples = d_acq_code_phase_samples; - sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); + sys = std::string(1, d_acquisition_gnss_synchro->System); // DEBUG OUTPUT std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc index 3e38d625b..da03112e7 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc @@ -302,8 +302,8 @@ void Gps_L1_Ca_Kf_Tracking_cc::start_tracking() d_code_phase_samples = d_acq_code_phase_samples; - sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); - + sys = std::string(1, d_acquisition_gnss_synchro->System); + std::cout << "++++++++++++++ " << sys << "++++++++++++\n"; // DEBUG OUTPUT std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; LOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index 148010ed1..06b2c262e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -203,7 +203,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking() d_code_phase_samples = d_acq_code_phase_samples; - sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1); + sys = std::string(1, d_acquisition_gnss_synchro->System); // DEBUG OUTPUT std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; From dae76fa70e5c423756417d06d47ceb09a29aaca4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 16 Feb 2022 15:02:27 +0100 Subject: [PATCH 10/27] Fix defects detected by Coverity Scan 2021.12.1: Unintentional integer overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit overflow_before_widen: Potentially overflowing expression this->d_fft_size * ninput_items[0UL] with type unsigned int (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type uint64_t (64 bits, unsigned) --- .../gnuradio_blocks/pcps_quicksync_acquisition_cc.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc index 3cf56f87a..5576a3f63 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -256,7 +256,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items, d_state = 1; } - d_sample_counter += static_cast(d_sampled_ms * d_samples_per_ms * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_sampled_ms) * d_samples_per_ms * ninput_items[0]; // sample counter consume_each(ninput_items[0]); // DLOG(INFO) << "END CASE 0"; break; @@ -495,7 +495,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items, d_active = false; d_state = 0; - d_sample_counter += static_cast(d_sampled_ms * d_samples_per_ms * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_sampled_ms) * d_samples_per_ms * ninput_items[0]; // sample counter consume_each(ninput_items[0]); acquisition_message = 1; @@ -538,7 +538,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items, d_active = false; d_state = 0; - d_sample_counter += static_cast(d_sampled_ms * d_samples_per_ms * ninput_items[0]); // sample counter + d_sample_counter += static_cast(d_sampled_ms) * d_samples_per_ms * ninput_items[0]; // sample counter consume_each(ninput_items[0]); acquisition_message = 2; From 24a9781017473f337f08fa544aadd1c793e06b92 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 16 Feb 2022 15:34:03 +0100 Subject: [PATCH 11/27] Update changelog. Add DOI for former versions --- docs/CHANGELOG.md | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 77cc00563..c1c58e872 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -12,8 +12,21 @@ SPDX-FileCopyrightText: 2011-2022 Carles Fernandez-Prades Date: Thu, 17 Feb 2022 17:28:34 +0100 Subject: [PATCH 12/27] Fix defects detected by Coverity Scan 2021.12.1: Declaring variable data without initializer --- src/algorithms/signal_source/libs/rtl_tcp_dongle_info.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/libs/rtl_tcp_dongle_info.cc b/src/algorithms/signal_source/libs/rtl_tcp_dongle_info.cc index 0dfcadb2a..a89963f95 100644 --- a/src/algorithms/signal_source/libs/rtl_tcp_dongle_info.cc +++ b/src/algorithms/signal_source/libs/rtl_tcp_dongle_info.cc @@ -33,11 +33,11 @@ boost::system::error_code Rtl_Tcp_Dongle_Info::read(boost::asio::ip::tcp::socket { boost::system::error_code ec; - unsigned char data[sizeof(char) * 4 + sizeof(uint32_t) * 2]; + std::vector data(sizeof(char) * 4 + sizeof(uint32_t) * 2); size_t received_bits = socket.receive(boost::asio::buffer(data), 0, ec); if (!ec && (received_bits > 0)) { - std::memcpy(magic_, data, 4); + std::memcpy(magic_, data.data(), 4); uint32_t type; std::memcpy(&type, &data[4], 4); From 530f894968d57c06c1e19e986cc268c2c5b68f87 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 20 Feb 2022 03:16:37 +0100 Subject: [PATCH 13/27] Remove abstract key from CITATION.cff file so it does not smash release text in Zenodo page --- CITATION.cff | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 35e0246e6..f09da0438 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,7 +1,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later # SPDX-FileCopyrightText: 2022 C. Fernandez-Prades carles.fernandez(at)cttc.es --- -abstract: "An open-source Global Navigation Satellite Systems software-defined receiver." authors: - affiliation: "Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)" alias: carlesfernandez @@ -102,7 +101,7 @@ authors: family-names: "van der Linden" given-names: Stefan cff-version: "1.2.0" -date-released: "2022-02-14" +date-released: "2022-02-15" identifiers: - description: "The concept DOI of the work. This is a DOI always pointing to the latest stable release." type: doi From f5b3e44b5f10abe8f4e29b36f03340ebc7e65310 Mon Sep 17 00:00:00 2001 From: JM Friedt Date: Tue, 22 Feb 2022 12:32:15 +0100 Subject: [PATCH 14/27] correct name of SSE3 in Linux kernel for volk_profile SIMD detection --- .../volk_gnsssdr/cpu_features/src/cpuinfo_x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/cpuinfo_x86.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/cpuinfo_x86.c index f7b79f54c..43270fac8 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/cpuinfo_x86.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/cpuinfo_x86.c @@ -1439,7 +1439,7 @@ static void ParseCpuId(const uint32_t max_cpuid_leaf, X86Info* info, if (!CpuFeatures_StringView_IsEquals(key, str("flags"))) continue; features->sse = CpuFeatures_StringView_HasWord(value, "sse", ' '); features->sse2 = CpuFeatures_StringView_HasWord(value, "sse2", ' '); - features->sse3 = CpuFeatures_StringView_HasWord(value, "sse3", ' '); + features->sse3 = CpuFeatures_StringView_HasWord(value, "pni", ' '); features->ssse3 = CpuFeatures_StringView_HasWord(value, "ssse3", ' '); features->sse4_1 = CpuFeatures_StringView_HasWord(value, "sse4_1", ' '); features->sse4_2 = CpuFeatures_StringView_HasWord(value, "sse4_2", ' '); From e81e82145ab3fab7c3337d2fcdbc029e3962f987 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 26 Feb 2022 12:32:36 +0100 Subject: [PATCH 15/27] Update link --- docs/doxygen/other/main_page.dox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index 28548550d..e04373e60 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -89,7 +89,7 @@ dependencies and build process. Mainly, it consists on installing Volk, a Vector-Optimized Library of Kernels which provides an abstraction of optimized math routines targeting several SIMD processors, and, optionally, -\li GNU Radio modules for hardware interface (gr-uhd, gr-osmosdr, gr-iio), +\li GNU Radio modules for hardware interface (gr-uhd, gr-osmosdr, gr-iio), \li Benchmark, a library to benchmark code snippets, \li Gperftools, which provides fast, multi-threaded malloc() and performance analysis tools. From b7f8a7d554ce6de35b8b23e4991d98f9e0da5dcc Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 26 Feb 2022 13:03:53 +0100 Subject: [PATCH 16/27] Compute PVT solutions when using GPS L5 signals even if the satellite is reported as not healthy in the CNAV message (Fixes: #588) --- docs/CHANGELOG.md | 5 +++++ src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index c1c58e872..df6b88cda 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -14,6 +14,11 @@ All notable changes to GNSS-SDR will be documented in this file. ## [Unreleased](https://github.com/gnss-sdr/gnss-sdr/tree/next) +### Improvements in Availability: + +- Compute PVT solutions when using GPS L5 signals even if the satellite is + reported as not healthy in the CNAV message. + ### Improvements in Reliability: - Fix some defects detected by Coverity Scan 2021.12.1. diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index b9dfff0ab..62934c891 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -1254,8 +1254,9 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) } if (gps_cnav_ephemeris->signal_health != 0) { - std::cout << TEXT_RED << "Satellite " << Gnss_Satellite(std::string("GPS"), gps_cnav_ephemeris->PRN) - << " is not healthy, not used for navigation" << TEXT_RESET << '\n'; + std::cout << "Satellite " << Gnss_Satellite(std::string("GPS"), gps_cnav_ephemeris->PRN) + << " does not report a healthy status in the CNAV message," + << " use PVT solutions at your own risk.\n"; } DLOG(INFO) << "New GPS CNAV ephemeris record has arrived "; } @@ -2023,7 +2024,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item if (tmp_eph_iter_cnav != d_internal_pvt_solver->gps_cnav_ephemeris_map.cend()) { const uint32_t prn_aux = tmp_eph_iter_cnav->second.PRN; - if ((prn_aux == in[i][epoch].PRN) && (((std::string(in[i][epoch].Signal) == std::string("2S")) || (std::string(in[i][epoch].Signal) == std::string("L5"))) && (tmp_eph_iter_cnav->second.signal_health == 0))) + if ((prn_aux == in[i][epoch].PRN) && (((std::string(in[i][epoch].Signal) == std::string("2S")) || (std::string(in[i][epoch].Signal) == std::string("L5"))))) { store_valid_observable = true; } From feaab97c3d5e7cf73716a3bf6476f4df5ed24256 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 26 Feb 2022 14:50:21 +0100 Subject: [PATCH 17/27] CI: Update VS generator version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 87771b0c9..e5334141a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -124,7 +124,7 @@ jobs: pip install mako - name: configure shell: powershell - run: cd build; cmake -G "Visual Studio 16 2019" ..\src\algorithms\libs\volk_gnsssdr_module\volk_gnsssdr + run: cd build; cmake -G "Visual Studio 17 2022" ..\src\algorithms\libs\volk_gnsssdr_module\volk_gnsssdr - name: build run: cmake --build build --config Release - name: test From 9af3e6c125a5fd23aecff77f85e5e75b972b9b85 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 19 Mar 2022 10:57:33 +0100 Subject: [PATCH 18/27] Add a Doppler prediction method to Ephemeris objects --- src/core/system_parameters/gnss_ephemeris.cc | 204 ++++++++++++++++--- src/core/system_parameters/gnss_ephemeris.h | 16 ++ 2 files changed, 187 insertions(+), 33 deletions(-) diff --git a/src/core/system_parameters/gnss_ephemeris.cc b/src/core/system_parameters/gnss_ephemeris.cc index 101fbf63c..6e33f231b 100644 --- a/src/core/system_parameters/gnss_ephemeris.cc +++ b/src/core/system_parameters/gnss_ephemeris.cc @@ -17,10 +17,156 @@ #include "gnss_ephemeris.h" #include "MATH_CONSTANTS.h" +#include "gnss_frequencies.h" +#include #include +#include +#include +#include + + +double Gnss_Ephemeris::sv_clock_drift(double transmitTime) +{ + const double dt = check_t(transmitTime - this->toc); + this->dtr = sv_clock_relativistic_term(transmitTime); + this->satClkDrift = this->af0 + this->af1 * dt + this->af2 * (dt * dt) + this->dtr; + return this->satClkDrift; +} + + +double Gnss_Ephemeris::predicted_doppler(double rx_time_s, + double lat, + double lon, + double h, + double ve, + double vn, + double vu, + int band) const +{ + const double RE_WGS84 = 6378137.0; //!< earth semimajor axis (WGS84) (m) + const double FE_WGS84 = (1.0 / 298.257223563); //!< earth flattening (WGS84) + const double lat_rad = lat * D2R; + const double lon_rad = lon * D2R; + + const double sinp = sin(lat_rad); + const double cosp = cos(lat_rad); + const double sinl = sin(lon_rad); + const double cosl = cos(lon_rad); + + const double e2 = FE_WGS84 * (2.0 - FE_WGS84); + const double v = RE_WGS84 / std::sqrt(1.0 - e2 * sinp * sinp); + + // Position in EFEF + const std::vector pos_rx = {(v + h) * cosp * cosl, (v + h) * cosp * sinl, (v * (1.0 - e2) + h) * sinp}; + + // Velovity in EFEF + const double t = cosp * vu - sinp * vn; + const std::vector vel_rx = {cosl * t - sinl * ve, sinl * t + cosl * ve, sinp * vu + cosp * vn}; + + std::array sat_pos_vel = {0}; + satellitePosVelComputation(rx_time_s, sat_pos_vel); + const std::vector pos_sat = {sat_pos_vel[0], sat_pos_vel[1], sat_pos_vel[2]}; + const std::vector vel_sat = {sat_pos_vel[3], sat_pos_vel[4], sat_pos_vel[5]}; + + std::vector x_sr = pos_sat; + std::transform(x_sr.begin(), x_sr.end(), pos_rx.begin(), x_sr.begin(), std::minus()); // pos_sat - pos_rx + + const double norm_x_sr = std::sqrt(std::inner_product(x_sr.begin(), x_sr.end(), x_sr.begin(), 0.0)); // Euclidean norm + + std::vector v_sr = vel_sat; + std::transform(v_sr.begin(), v_sr.end(), vel_rx.begin(), v_sr.begin(), std::minus()); // vel_sat - vel_rx + + const double radial_vel = std::inner_product(v_sr.begin(), v_sr.end(), x_sr.begin(), 0.0) / norm_x_sr; + const double predicted_doppler_normalized = -(radial_vel / SPEED_OF_LIGHT_M_S); + double predicted_doppler = 0.0; + if (this->System == 'E') // Galileo + { + if (band == 1) + { + predicted_doppler = predicted_doppler_normalized * FREQ1; + } + else if (band == 5) + { + predicted_doppler = predicted_doppler_normalized * FREQ5; + } + else if (band == 6) + { + predicted_doppler = predicted_doppler_normalized * FREQ6; + } + else if (band == 7) + { + predicted_doppler = predicted_doppler_normalized * FREQ7; + } + else if (band == 8) + { + predicted_doppler = predicted_doppler_normalized * FREQ8; + } + else + { + predicted_doppler = 0.0; + } + } + else if (this->System == 'G') // GPS + { + if (band == 1) + { + predicted_doppler = predicted_doppler_normalized * FREQ1; + } + else if (band == 2) + { + predicted_doppler = predicted_doppler_normalized * FREQ2; + } + else if (band == 5) + { + predicted_doppler = predicted_doppler_normalized * FREQ5; + } + else + { + predicted_doppler = 0.0; + } + } + else if (this->System == 'B') // Beidou + { + if (band == 1) + { + predicted_doppler = predicted_doppler_normalized * FREQ1_BDS; + } + else if (band == 2) + { + predicted_doppler = predicted_doppler_normalized * FREQ2_BDS; + } + else if (band == 3) + { + predicted_doppler = predicted_doppler_normalized * FREQ3_BDS; + } + else + { + predicted_doppler = 0.0; + } + } + else + { + predicted_doppler = 0.0; + } + return predicted_doppler; +} void Gnss_Ephemeris::satellitePosition(double transmitTime) +{ + std::array pos_vel_dtr = {0}; + satellitePosVelComputation(transmitTime, pos_vel_dtr); + this->satpos_X = pos_vel_dtr[0]; + this->satpos_Y = pos_vel_dtr[1]; + this->satpos_Z = pos_vel_dtr[2]; + this->satvel_X = pos_vel_dtr[3]; + this->satvel_Y = pos_vel_dtr[4]; + this->satvel_Z = pos_vel_dtr[5]; + this->dtr = pos_vel_dtr[6]; +} + + +void Gnss_Ephemeris::satellitePosVelComputation(double transmitTime, std::array& pos_vel_dtr) const { // Restore semi-major axis const double a = this->sqrtA * this->sqrtA; @@ -128,45 +274,53 @@ void Gnss_Ephemeris::satellitePosition(double transmitTime) // --- Compute satellite coordinates in Earth-fixed coordinates const double xprime = r * cuk; const double yprime = r * suk; - this->satpos_X = xprime * cok - yprime * cik * sok; - this->satpos_Y = xprime * sok + yprime * cik * cok; // ********NOTE: in GALILEO ICD this expression is not correct because it has minus (- sin(u) * r * cos(i) * cos(Omega)) instead of plus - this->satpos_Z = yprime * sik; + + pos_vel_dtr[0] = xprime * cok - yprime * cik * sok; + pos_vel_dtr[1] = xprime * sok + yprime * cik * cok; // ********NOTE: in GALILEO ICD this expression is not correct because it has minus (- sin(u) * r * cos(i) * cos(Omega)) instead of plus + pos_vel_dtr[2] = yprime * sik; // Satellite's velocity. Can be useful for Vector Tracking loops const double xpkdot = rkdot * cuk - yprime * ukdot; const double ypkdot = rkdot * suk + xprime * ukdot; - const double tmp = ypkdot * cik - this->satpos_Z * ikdot; + const double tmp = ypkdot * cik - pos_vel_dtr[2] * ikdot; - this->satvel_X = -Omega_dot * this->satpos_Y + xpkdot * cok - tmp * sok; - this->satvel_Y = Omega_dot * this->satpos_X + xpkdot * sok + tmp * cok; - this->satvel_Z = yprime * cik * ikdot + ypkdot * sik; + pos_vel_dtr[3] = -Omega_dot * pos_vel_dtr[1] + xpkdot * cok - tmp * sok; + pos_vel_dtr[4] = Omega_dot * pos_vel_dtr[0] + xpkdot * sok + tmp * cok; + pos_vel_dtr[5] = yprime * cik * ikdot + ypkdot * sik; // Time from ephemeris reference clock tk = check_t(transmitTime - this->toc); - this->dtr = this->af0 + this->af1 * tk + this->af2 * tk * tk; + pos_vel_dtr[6] = this->af0 + this->af1 * tk + this->af2 * tk * tk; if (this->System == 'E') { - this->dtr -= 2.0 * sqrt(GALILEO_GM * a) * this->ecc * sek / (SPEED_OF_LIGHT_M_S * SPEED_OF_LIGHT_M_S); + pos_vel_dtr[6] -= 2.0 * sqrt(GALILEO_GM * a) * this->ecc * sek / (SPEED_OF_LIGHT_M_S * SPEED_OF_LIGHT_M_S); } else if (this->System == 'B') { - this->dtr -= 2.0 * sqrt(BEIDOU_GM * a) * this->ecc * sek / (SPEED_OF_LIGHT_M_S * SPEED_OF_LIGHT_M_S); + pos_vel_dtr[6] -= 2.0 * sqrt(BEIDOU_GM * a) * this->ecc * sek / (SPEED_OF_LIGHT_M_S * SPEED_OF_LIGHT_M_S); } else { - this->dtr -= 2.0 * sqrt(GPS_GM * a) * this->ecc * sek / (SPEED_OF_LIGHT_M_S * SPEED_OF_LIGHT_M_S); + pos_vel_dtr[6] -= 2.0 * sqrt(GPS_GM * a) * this->ecc * sek / (SPEED_OF_LIGHT_M_S * SPEED_OF_LIGHT_M_S); } } -double Gnss_Ephemeris::sv_clock_drift(double transmitTime) +double Gnss_Ephemeris::check_t(double time) const { - const double dt = check_t(transmitTime - this->toc); - this->dtr = sv_clock_relativistic_term(transmitTime); - this->satClkDrift = this->af0 + this->af1 * dt + this->af2 * (dt * dt) + this->dtr; - return this->satClkDrift; + const double half_week = 302400.0; // seconds + double corrTime = time; + if (time > half_week) + { + corrTime = time - 2.0 * half_week; + } + else if (time < -half_week) + { + corrTime = time + 2.0 * half_week; + } + return corrTime; } @@ -184,7 +338,7 @@ double Gnss_Ephemeris::sv_clock_relativistic_term(double transmitTime) const { n0 = sqrt(GALILEO_GM / (a * a * a)); } - else if (this->System == 'E') + else if (this->System == 'B') { n0 = sqrt(BEIDOU_GM / (a * a * a)); } @@ -235,19 +389,3 @@ double Gnss_Ephemeris::sv_clock_relativistic_term(double transmitTime) const } return dtr_; } - - -double Gnss_Ephemeris::check_t(double time) const -{ - const double half_week = 302400.0; // seconds - double corrTime = time; - if (time > half_week) - { - corrTime = time - 2.0 * half_week; - } - else if (time < -half_week) - { - corrTime = time + 2.0 * half_week; - } - return corrTime; -} diff --git a/src/core/system_parameters/gnss_ephemeris.h b/src/core/system_parameters/gnss_ephemeris.h index 644f430d4..a5549bff6 100644 --- a/src/core/system_parameters/gnss_ephemeris.h +++ b/src/core/system_parameters/gnss_ephemeris.h @@ -19,6 +19,7 @@ #ifndef GNSS_SDR_GNSS_EPHEMERIS_H #define GNSS_SDR_GNSS_EPHEMERIS_H +#include #include /*! @@ -36,6 +37,20 @@ public: */ double sv_clock_drift(double transmitTime); + /*! + * \brief Computes prediction of the Doppler shift for a given time and receiver's position and velocity. + * @param[in] rx_time_s Time of Week in seconds + * @param[in] lat Receiver's latitude in degrees + * @param[in] lon Receiver's longitude in degrees + * @param[in] h Receiver's height in meters + * @param[in] ve Receiver's velocity in the East direction [m/s] + * @param[in] vn Receiver's velocity in the North direction [m/s] + * @param[in] vu Receiver's velocity in the Up direction [m/s] + * @param[in] band Signal band for which the Doppler will be computed + * (1: L1 C/A, E1B, BI1; 2: L2C, BI2; 3: BI3; 5: L5/E5a; 6: E6B; 7: E5b; 8: E5a+E5b) + */ + double predicted_doppler(double rx_time_s, double lat, double lon, double h, double ve, double vn, double vu, int band) const; + void satellitePosition(double transmitTime); //!< Computes the ECEF SV coordinates and ECEF velocity uint32_t PRN{}; //!< SV ID @@ -83,6 +98,7 @@ protected: char System{}; //!< Character ID of the GNSS system. 'G': GPS. 'E': Galileo. 'B': BeiDou private: + void satellitePosVelComputation(double transmitTime, std::array& pos_vel_dtr) const; double check_t(double time) const; double sv_clock_relativistic_term(double transmitTime) const; }; From 08782a208523e872d23baee189575b6417dda951 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 19 Mar 2022 10:59:44 +0100 Subject: [PATCH 19/27] Remove unused variables --- .../system_parameters/gps_navigation_message.cc | 12 ------------ .../system_parameters/gps_navigation_message.h | 16 ---------------- 2 files changed, 28 deletions(-) diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index e7c39e71a..1ea1a6f22 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -465,18 +465,6 @@ Gps_Ephemeris Gps_Navigation_Message::get_ephemeris() const ephemeris.alert_flag = b_alert_flag; ephemeris.antispoofing_flag = b_antispoofing_flag; - // These parameters are empty; can be computed later with - // ephemeris.sv_clock_drift(double transmitTime); - // ephemeris.satellitePosition(double transmitTime); - ephemeris.satClkDrift = d_satClkDrift; - ephemeris.dtr = d_dtr; - ephemeris.satpos_X = d_satpos_X; - ephemeris.satpos_Y = d_satpos_Y; - ephemeris.satpos_Z = d_satpos_Z; - ephemeris.satvel_X = d_satvel_X; - ephemeris.satvel_Y = d_satvel_Y; - ephemeris.satvel_Z = d_satvel_Z; - return ephemeris; } diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index efe18144e..1d239a8fa 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -195,22 +195,6 @@ private: int32_t i_Toa{}; // Almanac reference time [s] int32_t i_WN_A{}; // Modulo 256 of the GPS week number to which the almanac reference time (i_Toa) is referenced - // clock terms - // double d_master_clock{}; // GPS transmission time - - double d_dtr{}; // relativistic clock correction term - double d_satClkDrift{}; - - // satellite positions - double d_satpos_X{}; // Earth-fixed coordinate x of the satellite [m]. Intersection of the IERS Reference Meridian (IRM) and the plane passing through the origin and normal to the Z-axis. - double d_satpos_Y{}; // Earth-fixed coordinate y of the satellite [m]. Completes a right-handed, Earth-Centered, Earth-Fixed orthogonal coordinate system. - double d_satpos_Z{}; // Earth-fixed coordinate z of the satellite [m]. The direction of the IERS (International Earth Rotation and Reference Systems Service) Reference Pole (IRP). - - // Satellite velocity - double d_satvel_X{}; // Earth-fixed velocity coordinate x of the satellite [m] - double d_satvel_Y{}; // Earth-fixed velocity coordinate y of the satellite [m] - double d_satvel_Z{}; // Earth-fixed velocity coordinate z of the satellite [m] - // satellite identification info int32_t i_channel_ID{}; uint32_t i_satellite_PRN{}; From 9a91fb319251d57bb305f5c99bffb17107f95208 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 20 Mar 2022 10:44:26 +0100 Subject: [PATCH 20/27] Add Doppler prediction in almanacs --- src/core/libs/gnss_sdr_supl_client.cc | 4 +- src/core/system_parameters/CMakeLists.txt | 1 + .../system_parameters/beidou_dnav_almanac.h | 5 +- src/core/system_parameters/galileo_almanac.h | 5 +- src/core/system_parameters/gnss_almanac.cc | 275 ++++++++++++++++++ src/core/system_parameters/gnss_almanac.h | 42 +++ src/core/system_parameters/gnss_ephemeris.cc | 13 +- src/core/system_parameters/gnss_ephemeris.h | 14 + src/core/system_parameters/gps_almanac.h | 5 +- 9 files changed, 349 insertions(+), 15 deletions(-) create mode 100644 src/core/system_parameters/gnss_almanac.cc diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index 10dda2be4..90c5fd0e6 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -19,6 +19,7 @@ #include "gnss_sdr_supl_client.h" #include "GPS_L1_CA.h" +#include "MATH_CONSTANTS.h" #include #include #include @@ -858,6 +859,7 @@ bool Gnss_Sdr_Supl_Client::read_gal_almanac_from_gsa(const std::string& file_nam Galileo_Almanac gal_alm; try { + const double sqrtAnominal = 5440.588203494; // square root of Galileo nominal orbit semi-major axis uint32_t prn = static_cast(std::stoi(almanac.child_value("SVID"))); gal_alm.PRN = prn; gal_alm.toa = std::stoi(almanac.child("almanac").child_value("t0a")); @@ -866,7 +868,7 @@ bool Gnss_Sdr_Supl_Client::read_gal_almanac_from_gsa(const std::string& file_nam gal_alm.delta_i = std::stod(almanac.child("almanac").child_value("deltai")); gal_alm.M_0 = std::stod(almanac.child("almanac").child_value("m0")); gal_alm.ecc = std::stod(almanac.child("almanac").child_value("ecc")); - gal_alm.sqrtA = std::stod(almanac.child("almanac").child_value("aSqRoot")); + gal_alm.sqrtA = std::stod(almanac.child("almanac").child_value("aSqRoot")) + sqrtAnominal; gal_alm.OMEGA_0 = std::stod(almanac.child("almanac").child_value("omega0")); gal_alm.omega = std::stod(almanac.child("almanac").child_value("w")); gal_alm.OMEGAdot = std::stod(almanac.child("almanac").child_value("omegaDot")); diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index e88306991..49d8fdb80 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -6,6 +6,7 @@ set(SYSTEM_PARAMETERS_SOURCES + gnss_almanac.cc gnss_ephemeris.cc gnss_satellite.cc gnss_signal.cc diff --git a/src/core/system_parameters/beidou_dnav_almanac.h b/src/core/system_parameters/beidou_dnav_almanac.h index 03610990f..6bf616fc6 100644 --- a/src/core/system_parameters/beidou_dnav_almanac.h +++ b/src/core/system_parameters/beidou_dnav_almanac.h @@ -36,7 +36,10 @@ public: /*! * Default constructor */ - Beidou_Dnav_Almanac() = default; + Beidou_Dnav_Almanac() + { + this->System = 'B'; + }; int SV_health{}; //!< SV Health diff --git a/src/core/system_parameters/galileo_almanac.h b/src/core/system_parameters/galileo_almanac.h index a76a3af66..9b65f84bd 100644 --- a/src/core/system_parameters/galileo_almanac.h +++ b/src/core/system_parameters/galileo_almanac.h @@ -36,7 +36,10 @@ public: /*! * Default constructor */ - Galileo_Almanac() = default; + Galileo_Almanac() + { + this->System = 'E'; + }; int32_t IODa{}; int32_t E5b_HS{}; diff --git a/src/core/system_parameters/gnss_almanac.cc b/src/core/system_parameters/gnss_almanac.cc new file mode 100644 index 000000000..2c609a53d --- /dev/null +++ b/src/core/system_parameters/gnss_almanac.cc @@ -0,0 +1,275 @@ +/*! + * \file gnss_almanac.cc + * \brief Base class for GNSS almanac storage + * \author Carles Fernandez, 2022. 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-2022 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "gnss_almanac.h" +#include "MATH_CONSTANTS.h" +#include "gnss_frequencies.h" +#include +#include +#include +#include +#include + +double Gnss_Almanac::check_t(double time) const +{ + const double half_week = 302400.0; // seconds + double corrTime = time; + if (time > half_week) + { + corrTime = time - 2.0 * half_week; + } + else if (time < -half_week) + { + corrTime = time + 2.0 * half_week; + } + return corrTime; +} + +double Gnss_Almanac::predicted_doppler(double rx_time_s, + double lat, + double lon, + double h, + double ve, + double vn, + double vu, + int band) const +{ + const double RE_WGS84 = 6378137.0; //!< earth semimajor axis (WGS84) (m) + const double FE_WGS84 = (1.0 / 298.257223563); //!< earth flattening (WGS84) + const double lat_rad = lat * D2R; + const double lon_rad = lon * D2R; + + const double sinp = sin(lat_rad); + const double cosp = cos(lat_rad); + const double sinl = sin(lon_rad); + const double cosl = cos(lon_rad); + + const double e2 = FE_WGS84 * (2.0 - FE_WGS84); + const double v = RE_WGS84 / std::sqrt(1.0 - e2 * sinp * sinp); + + // Position in EFEF + const std::vector pos_rx = {(v + h) * cosp * cosl, (v + h) * cosp * sinl, (v * (1.0 - e2) + h) * sinp}; + + // Velovity in EFEF + const double t = cosp * vu - sinp * vn; + const std::vector vel_rx = {cosl * t - sinl * ve, sinl * t + cosl * ve, sinp * vu + cosp * vn}; + + std::array sat_pos_vel = {0}; + satellitePosVelComputation(rx_time_s, sat_pos_vel); + const std::vector pos_sat = {sat_pos_vel[0], sat_pos_vel[1], sat_pos_vel[2]}; + const std::vector vel_sat = {sat_pos_vel[3], sat_pos_vel[4], sat_pos_vel[5]}; + + std::vector x_sr = pos_sat; + std::transform(x_sr.begin(), x_sr.end(), pos_rx.begin(), x_sr.begin(), std::minus()); // pos_sat - pos_rx + + const double norm_x_sr = std::sqrt(std::inner_product(x_sr.begin(), x_sr.end(), x_sr.begin(), 0.0)); // Euclidean norm + + std::vector v_sr = vel_sat; + std::transform(v_sr.begin(), v_sr.end(), vel_rx.begin(), v_sr.begin(), std::minus()); // vel_sat - vel_rx + + const double radial_vel = std::inner_product(v_sr.begin(), v_sr.end(), x_sr.begin(), 0.0) / norm_x_sr; + const double predicted_doppler_normalized = -(radial_vel / SPEED_OF_LIGHT_M_S); + double predicted_doppler = 0.0; + if (this->System == 'E') // Galileo + { + if (band == 1) + { + predicted_doppler = predicted_doppler_normalized * FREQ1; + } + else if (band == 5) + { + predicted_doppler = predicted_doppler_normalized * FREQ5; + } + else if (band == 6) + { + predicted_doppler = predicted_doppler_normalized * FREQ6; + } + else if (band == 7) + { + predicted_doppler = predicted_doppler_normalized * FREQ7; + } + else if (band == 8) + { + predicted_doppler = predicted_doppler_normalized * FREQ8; + } + else + { + predicted_doppler = 0.0; + } + } + else if (this->System == 'G') // GPS + { + if (band == 1) + { + predicted_doppler = predicted_doppler_normalized * FREQ1; + } + else if (band == 2) + { + predicted_doppler = predicted_doppler_normalized * FREQ2; + } + else if (band == 5) + { + predicted_doppler = predicted_doppler_normalized * FREQ5; + } + else + { + predicted_doppler = 0.0; + } + } + else if (this->System == 'B') // Beidou + { + if (band == 1) + { + predicted_doppler = predicted_doppler_normalized * FREQ1_BDS; + } + else if (band == 2) + { + predicted_doppler = predicted_doppler_normalized * FREQ2_BDS; + } + else if (band == 3) + { + predicted_doppler = predicted_doppler_normalized * FREQ3_BDS; + } + else + { + predicted_doppler = 0.0; + } + } + else + { + predicted_doppler = 0.0; + } + return predicted_doppler; +} + + +void Gnss_Almanac::satellitePosVelComputation(double transmitTime, std::array& pos_vel_dtr) const +{ + // Restore semi-major axis + const double a = this->sqrtA * this->sqrtA; + + // Computed mean motion + double n; + if (this->System == 'E') + { + n = sqrt(GALILEO_GM / (a * a * a)); + } + else if (this->System == 'B') + { + n = sqrt(BEIDOU_GM / (a * a * a)); + } + else + { + n = sqrt(GPS_GM / (a * a * a)); + } + + // Time from ephemeris reference epoch + const double tk = check_t(transmitTime - static_cast(this->toa)); + + // Mean anomaly + const double M = this->M_0 * GNSS_PI + n * tk; + + // Initial guess of eccentric anomaly + double E = M; + double E_old; + double dE; + + // --- Iteratively compute eccentric anomaly ------------------------------- + for (int32_t ii = 1; ii < 20; ii++) + { + E_old = E; + E = M + this->ecc * sin(E); + dE = fmod(E - E_old, 2.0 * GNSS_PI); + if (fabs(dE) < 1e-12) + { + // Necessary precision is reached, exit from the loop + break; + } + } + + const double sek = sin(E); + const double cek = cos(E); + const double OneMinusecosE = 1.0 - this->ecc * cek; + const double sq1e2 = sqrt(1.0 - this->ecc * this->ecc); + const double ekdot = n / OneMinusecosE; + + // Compute the true anomaly + const double tmp_Y = sq1e2 * sek; + const double tmp_X = cek - this->ecc; + const double nu = atan2(tmp_Y, tmp_X); + + // Compute angle phi (argument of Latitude) + const double phi = nu + this->omega * GNSS_PI; + + const double pkdot = sq1e2 * ekdot / OneMinusecosE; + + // Correct argument of latitude + const double suk = sin(phi); + const double cuk = cos(phi); + + // Correct radius + const double r = a * OneMinusecosE; + const double rkdot = a * this->ecc * sek * ekdot; + + // Correct inclination + double i; + if (this->System == 'E') + { + i = ((56.0 / 180.0) + this->delta_i) * GNSS_PI; + } + else + { + i = (0.3 + this->delta_i) * GNSS_PI; + } + + const double sik = sin(i); + const double cik = cos(i); + + // Compute the angle between the ascending node and the Greenwich meridian + double Omega; + double Omega_dot; + if (this->System == 'B') + { + Omega_dot = this->OMEGAdot * GNSS_PI - BEIDOU_OMEGA_EARTH_DOT; + Omega = this->OMEGA_0 * GNSS_PI + Omega_dot * tk - BEIDOU_OMEGA_EARTH_DOT * static_cast(this->toa); + } + else + { + Omega_dot = this->OMEGAdot * GNSS_PI - GNSS_OMEGA_EARTH_DOT; + Omega = this->OMEGA_0 * GNSS_PI + Omega_dot * tk - GNSS_OMEGA_EARTH_DOT * static_cast(this->toa); + } + + const double sok = sin(Omega); + const double cok = cos(Omega); + + // --- Compute satellite coordinates in Earth-fixed coordinates + const double xprime = r * cuk; + const double yprime = r * suk; + + pos_vel_dtr[0] = xprime * cok - yprime * cik * sok; + pos_vel_dtr[1] = xprime * sok + yprime * cik * cok; + pos_vel_dtr[2] = yprime * sik; + + // Satellite's velocity + const double xpkdot = rkdot * cuk - yprime * pkdot; + const double ypkdot = rkdot * suk + xprime * pkdot; + const double tmp = ypkdot * cik; + + pos_vel_dtr[3] = -Omega_dot * pos_vel_dtr[1] + xpkdot * cok - tmp * sok; + pos_vel_dtr[4] = Omega_dot * pos_vel_dtr[0] + xpkdot * sok + tmp * cok; + pos_vel_dtr[5] = ypkdot * sik; + pos_vel_dtr[6] = 0; +} diff --git a/src/core/system_parameters/gnss_almanac.h b/src/core/system_parameters/gnss_almanac.h index 2206f4acc..a8e28aeeb 100644 --- a/src/core/system_parameters/gnss_almanac.h +++ b/src/core/system_parameters/gnss_almanac.h @@ -18,6 +18,7 @@ #ifndef GNSS_SDR_GNSS_ALMANAC_H #define GNSS_SDR_GNSS_ALMANAC_H +#include #include /** \addtogroup Core @@ -37,6 +38,42 @@ public: */ Gnss_Almanac() = default; + /* \brief Computes prediction of the Doppler shift for a given time and receiver's position and velocity. + * \f[ + * f_{d} = - \mathbf{v} \frac{\mathbf{x}^{T}}{\left| \mathbf{x} \right| } \frac{f_{L}}{c} + * \f] + * where: + * \f[ + * \mathbf{v} = \mathbf{v}_{sat} - \mathbf{v}_{rx} + * \f] + * \f[ + * \mathbf{x} = \mathbf{x}_{sat} - \mathbf{x}_{rx} + * \f] + * \f[ + * \left| \mathbf{x} \right| = \sqrt{\mathbf{x}\mathbf{x}^{T}} + * \f] + * + * @param[in] rx_time_s Time of Week in seconds + * @param[in] lat Receiver's latitude in degrees + * @param[in] lon Receiver's longitude in degrees + * @param[in] h Receiver's height in meters + * @param[in] ve Receiver's velocity in the East direction [m/s] + * @param[in] vn Receiver's velocity in the North direction [m/s] + * @param[in] vu Receiver's velocity in the Up direction [m/s] + * @param[in] band Signal band for which the Doppler will be computed + * (1: L1 C/A, E1B, BI1; 2: L2C, BI2; 3: BI3; 5: L5/E5a; 6: E6B; 7: E5b; 8: E5a+E5b) + */ + double predicted_doppler(double rx_time_s, + double lat, + double lon, + double h, + double ve, + double vn, + double vu, + int band) const; + + void satellitePosVelComputation(double transmitTime, std::array& pos_vel_dtr) const; + uint32_t PRN{}; //!< SV PRN NUMBER double delta_i{}; //!< Inclination Angle at Reference Time (relative to i_0 = 0.30 semi-circles) int32_t toa{}; //!< Almanac data reference time of week [s] @@ -49,6 +86,11 @@ public: double OMEGAdot{}; //!< Rate of Right Ascension [semi-circles/s] double af0{}; //!< Coefficient 0 of code phase offset model [s] double af1{}; //!< Coefficient 1 of code phase offset model [s/s] + +protected: + char System{}; //!< Character ID of the GNSS system. 'G': GPS. 'E': Galileo. 'B': BeiDou +private: + double check_t(double time) const; }; diff --git a/src/core/system_parameters/gnss_ephemeris.cc b/src/core/system_parameters/gnss_ephemeris.cc index 6e33f231b..9505242ca 100644 --- a/src/core/system_parameters/gnss_ephemeris.cc +++ b/src/core/system_parameters/gnss_ephemeris.cc @@ -193,10 +193,7 @@ void Gnss_Ephemeris::satellitePosVelComputation(double transmitTime, std::array< const double n = n0 + this->delta_n; // Mean anomaly - double M = this->M_0 + n * tk; - - // Reduce mean anomaly to between 0 and 2pi - M = fmod((M + 2.0 * GNSS_PI), (2.0 * GNSS_PI)); + const double M = this->M_0 + n * tk; // Initial guess of eccentric anomaly double E = M; @@ -228,10 +225,9 @@ void Gnss_Ephemeris::satellitePosVelComputation(double transmitTime, std::array< const double nu = atan2(tmp_Y, tmp_X); // Compute angle phi (argument of Latitude) - double phi = nu + this->omega; + const double phi = nu + this->omega; // Reduce phi to between 0 and 2*pi rad - phi = fmod((phi), (2.0 * GNSS_PI)); const double s2pk = sin(2.0 * phi); const double c2pk = cos(2.0 * phi); const double pkdot = sq1e2 * ekdot / OneMinusecosE; @@ -266,8 +262,6 @@ void Gnss_Ephemeris::satellitePosVelComputation(double transmitTime, std::array< Omega = this->OMEGA_0 + Omega_dot * tk - GNSS_OMEGA_EARTH_DOT * static_cast(this->toe); } - // Reduce to between 0 and 2*pi rad - Omega = fmod((Omega + 2.0 * GNSS_PI), (2.0 * GNSS_PI)); const double sok = sin(Omega); const double cok = cos(Omega); @@ -352,9 +346,6 @@ double Gnss_Ephemeris::sv_clock_relativistic_term(double transmitTime) const // Mean anomaly const double M = this->M_0 + n * tk; - // Reduce mean anomaly to between 0 and 2pi - // M = fmod((M + 2.0 * GNSS_PI), (2.0 * GNSS_PI)); - // Initial guess of eccentric anomaly double E = M; double E_old; diff --git a/src/core/system_parameters/gnss_ephemeris.h b/src/core/system_parameters/gnss_ephemeris.h index a5549bff6..c3f9a8e78 100644 --- a/src/core/system_parameters/gnss_ephemeris.h +++ b/src/core/system_parameters/gnss_ephemeris.h @@ -39,6 +39,20 @@ public: /*! * \brief Computes prediction of the Doppler shift for a given time and receiver's position and velocity. + * \f[ + * f_{d} = - \mathbf{v} \frac{\mathbf{x}^{T}}{\left| \mathbf{x} \right| } \frac{f_{L}}{c} + * \f] + * where: + * \f[ + * \mathbf{v} = \mathbf{v}_{sat} - \mathbf{v}_{rx} + * \f] + * \f[ + * \mathbf{x} = \mathbf{x}_{sat} - \mathbf{x}_{rx} + * \f] + * \f[ + * \left| \mathbf{x} \right| = \sqrt{\mathbf{x}\mathbf{x}^{T}} + * \f] + * * @param[in] rx_time_s Time of Week in seconds * @param[in] lat Receiver's latitude in degrees * @param[in] lon Receiver's longitude in degrees diff --git a/src/core/system_parameters/gps_almanac.h b/src/core/system_parameters/gps_almanac.h index c03278841..9c0cce600 100644 --- a/src/core/system_parameters/gps_almanac.h +++ b/src/core/system_parameters/gps_almanac.h @@ -38,7 +38,10 @@ public: /*! * Default constructor */ - Gps_Almanac() = default; + Gps_Almanac() + { + this->System = 'G'; + }; int32_t SV_health{}; //!< SV Health int32_t AS_status{}; //!< Anti-Spoofing Flags and SV Configuration From bcd725e2b7109a7ccd223db3a88ccd4a16056dc5 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 21 Mar 2022 08:55:57 +0100 Subject: [PATCH 21/27] Add script to download latest Galileo almanac from EUSPA website --- src/utils/scripts/download-galileo-almanac.sh | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100755 src/utils/scripts/download-galileo-almanac.sh diff --git a/src/utils/scripts/download-galileo-almanac.sh b/src/utils/scripts/download-galileo-almanac.sh new file mode 100755 index 000000000..1967a03a1 --- /dev/null +++ b/src/utils/scripts/download-galileo-almanac.sh @@ -0,0 +1,126 @@ +#!/bin/sh +# GNSS-SDR shell script that tries to download the latest Galileo Almanac file +# published by the European GNSS Service Centre. +# +# Usage: ./download-galileo-almanac.sh +# +# SPDX-FileCopyrightText: 2022 Carles Fernandez-Prades +# SPDX-License-Identifier: GPL-3.0-or-later + +if ! [ -x "$(command -v wget)" ]; then + echo "Please install wget before using this script." + exit 1 +fi + +help() +{ + echo "This script tries to download the most recent Galileo Almanac XML file" + echo "published by the European GNSS Service Centre." + echo "More info at https://www.gsc-europa.eu/product-almanacs" + echo "If today there is no published file, the script will look up to one week ago." + echo "" + echo "Usage:" + echo "./download-galileo-almanac.sh [OPTION]" + echo " Options:" + echo " -h, --help Prints this message" + echo " -r, --rename Gets latest Galileo Almanac XML file and saves it as gal_almanac.xml" + echo " -d, --date [date] Retrieves file for a specific date, with format YYYY-MM-DD" + echo " -rd [date] Retrieves file for a specific date, with format YYYY-MM-DD" + echo " and saves it as gal_almanac.xml" + echo "" + echo " Examples:" + echo " ./download-galileo-almanac.sh # Gets latest Galileo Almanac XML file" + echo " ./download-galileo-almanac.sh -r # Gets latest Galileo Almanac XML file, stores it as gal_almanac.xml" + echo " ./download-galileo-almanac.sh -d 2022-03-15 # Gets Galileo Almanac XML file for that day" + echo " ./download-galileo-almanac.sh -rd 2022-03-15 # Gets Galileo Almanac XML file for that day, stores it as gal_almanac.xml" +} + +if (([ "$1" = "-h" ]) || ([ "$1" = "--help" ])) ; then + help + exit 0 +fi + +RENAME="" +if (([ "$1" = "-r" ]) || ([ "$1" = "--rename" ])) ; then + RENAME=" -O gal_almanac.xml " +fi + +BASE_URL="https://www.gsc-europa.eu/sites/default/files/sites/all/files/" +YEAR=$(date '+%Y') +SPACING="-" +MONTH=$(date '+%m') +DAY=$(date '+%d') + +TERMINATION1="_0.xml" +TERMINATION2=".xml" + +COUNTER=1 +MAX_COUNTER=7 + +if (([ "$1" = "-d" ]) || ([ "$1" = "--date" ])) ; then + if wget "$BASE_URL$2$TERMINATION2" >/dev/null 2>&1 ; then + echo "Downloaded latest Galileo almanac from $BASE_URL$2$TERMINATION2" + exit 0 + else + echo "Couldn't find an XML file for that date." + exit 1 + fi +elif [ "$1" = "-rd" ] ; then + if wget -O gal_almanac.xml "$BASE_URL$2$TERMINATION2" >/dev/null 2>&1 ; then + echo "Downloaded latest Galileo almanac from $BASE_URL$2$TERMINATION2" + exit 0 + else + echo "Couldn't find an XML file for that date." + rm gal_almanac.xml + exit 1 + fi +else + echo "According to system time, today is $(date '+%Y-%m-%d'). Searching for the latest Galileo almanac ..." +fi + +lowercase() +{ + echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" +} + +OS=`lowercase \`uname\`` + +date_before() +{ + if [ "$OS" = "darwin" ]; then + YEAR=$(date -v -"$COUNTER"d '+%Y') + MONTH=$(date -v -"$COUNTER"d '+%m') + DAY=$(date -v -"$COUNTER"d '+%d') + else + YEAR=$(date -d "$COUNTER day ago" '+%Y') + MONTH=$(date -d "$COUNTER day ago" '+%m') + DAY=$(date -d "$COUNTER day ago" '+%d') + fi + COUNTER=$(($COUNTER+1)) +} + + +try_download() +{ + while [ $COUNTER -le $MAX_COUNTER ] + do + url="$BASE_URL$YEAR$SPACING$MONTH$SPACING$DAY$TERMINATION2" + if wget $RENAME $url >/dev/null 2>&1 ; then + echo "Downloaded latest Galileo almanac from $url" + exit 0 + else + date_before + try_download + fi + done +} + + +url="$BASE_URL$YEAR$SPACING$MONTH$SPACING$DAY$TERMINATION1" +if wget $RENAME $url >/dev/null 2>&1 ; then + echo "Downloaded latest Galileo almanac from $url" +else + try_download + echo "Couldn't find a recent Galileo almanac." + exit 1 +fi From db9bd588c91f57a961974ddcc0283ceea0e782be Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 21 Mar 2022 08:58:09 +0100 Subject: [PATCH 22/27] Improve code visualization in some editors --- src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 62934c891..6fb9a2510 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -2115,10 +2115,10 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item { const double Rx_clock_offset_s = d_internal_pvt_solver->get_time_offset_s(); - //**************** time tags **************** + // **************** time tags **************** if (d_enable_rx_clock_correction == false) // todo: currently only works if clock correction is disabled (computed clock offset is applied here) { - //************ Source TimeTag comparison with GNSS computed TOW ************* + // ************ Source TimeTag comparison with GNSS computed TOW ************* if (!d_TimeChannelTagTimestamps.empty()) { @@ -2152,7 +2152,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item } } } - //********************************************** + // ********************************************** if (fabs(Rx_clock_offset_s) * 1000.0 > d_max_obs_block_rx_clock_offset_ms) { From c1f03135aa9367d11536af96551e0ec490da8e83 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 21 Mar 2022 11:53:13 +0100 Subject: [PATCH 23/27] Fix documentation and typos --- src/core/system_parameters/gnss_almanac.cc | 2 +- src/core/system_parameters/gnss_almanac.h | 6 +++++- src/core/system_parameters/gnss_ephemeris.cc | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/system_parameters/gnss_almanac.cc b/src/core/system_parameters/gnss_almanac.cc index 2c609a53d..923416832 100644 --- a/src/core/system_parameters/gnss_almanac.cc +++ b/src/core/system_parameters/gnss_almanac.cc @@ -63,7 +63,7 @@ double Gnss_Almanac::predicted_doppler(double rx_time_s, // Position in EFEF const std::vector pos_rx = {(v + h) * cosp * cosl, (v + h) * cosp * sinl, (v * (1.0 - e2) + h) * sinp}; - // Velovity in EFEF + // Velocity in EFEF const double t = cosp * vu - sinp * vn; const std::vector vel_rx = {cosl * t - sinl * ve, sinl * t + cosl * ve, sinp * vu + cosp * vn}; diff --git a/src/core/system_parameters/gnss_almanac.h b/src/core/system_parameters/gnss_almanac.h index a8e28aeeb..a8c265a80 100644 --- a/src/core/system_parameters/gnss_almanac.h +++ b/src/core/system_parameters/gnss_almanac.h @@ -38,7 +38,8 @@ public: */ Gnss_Almanac() = default; - /* \brief Computes prediction of the Doppler shift for a given time and receiver's position and velocity. + /*! + * \brief Computes prediction of the Doppler shift for a given time and receiver's position and velocity. * \f[ * f_{d} = - \mathbf{v} \frac{\mathbf{x}^{T}}{\left| \mathbf{x} \right| } \frac{f_{L}}{c} * \f] @@ -72,6 +73,9 @@ public: double vu, int band) const; + /*! + * \brief Computes satellite Position and Velocity, in ECEF, for a given time (expressed in seconds of week) + */ void satellitePosVelComputation(double transmitTime, std::array& pos_vel_dtr) const; uint32_t PRN{}; //!< SV PRN NUMBER diff --git a/src/core/system_parameters/gnss_ephemeris.cc b/src/core/system_parameters/gnss_ephemeris.cc index 9505242ca..d95d14a28 100644 --- a/src/core/system_parameters/gnss_ephemeris.cc +++ b/src/core/system_parameters/gnss_ephemeris.cc @@ -59,7 +59,7 @@ double Gnss_Ephemeris::predicted_doppler(double rx_time_s, // Position in EFEF const std::vector pos_rx = {(v + h) * cosp * cosl, (v + h) * cosp * sinl, (v * (1.0 - e2) + h) * sinp}; - // Velovity in EFEF + // Velocity in EFEF const double t = cosp * vu - sinp * vn; const std::vector vel_rx = {cosl * t - sinl * ve, sinl * t + cosl * ve, sinp * vu + cosp * vn}; From 8ab82f9817718376b180eb718769dd19b548aa46 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 23 Mar 2022 13:15:14 +0100 Subject: [PATCH 24/27] Fix building with newest GNU Radio --- src/utils/front-end-cal/main.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index 38ee8206c..42d7a7601 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -344,9 +344,9 @@ int main(int argc, char** argv) { std::cout << "Exception caught while capturing samples (bad lexical cast)\n"; } - catch (const boost::io::too_few_args& e) + catch (const std::exception& e) { - std::cout << "Exception caught while capturing samples (too few args)\n"; + std::cout << "Exception caught while capturing samples: " << e.what() << '\n'; } catch (...) { From 07ad51f975e9442f640a1df009282b0d1461cd13 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 25 Mar 2022 09:14:28 +0100 Subject: [PATCH 25/27] Remove debug line --- .../tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc index da03112e7..560992b45 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc @@ -303,7 +303,7 @@ void Gps_L1_Ca_Kf_Tracking_cc::start_tracking() d_code_phase_samples = d_acq_code_phase_samples; sys = std::string(1, d_acquisition_gnss_synchro->System); - std::cout << "++++++++++++++ " << sys << "++++++++++++\n"; + // DEBUG OUTPUT std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; LOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel; From 7267e0067b51c79efbf2bb5828ab3c47873a1536 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 26 Mar 2022 09:32:28 +0100 Subject: [PATCH 26/27] Update local version of Matio to v1.5.22 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad52e1a26..5f3e6e45b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -330,7 +330,7 @@ else() endif() 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_MATIO_LOCAL_VERSION "1.5.22") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.12") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.19.4") set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.6.1") From 102098d26e4622c74107d5ac0f2da72948435cab Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 27 Mar 2022 00:47:05 +0100 Subject: [PATCH 27/27] Update matio version to 1.5.22 in README.md file --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 13904c1d8..d6e81db87 100644 --- a/README.md +++ b/README.md @@ -470,9 +470,9 @@ your GNU/Linux distribution, GNSS-SDR can also work well with OpenSSL. #### Install [Matio](https://github.com/tbeu/matio "Matio's Homepage"), MATLAB MAT file I/O library: ``` -$ wget https://github.com/tbeu/matio/releases/download/v1.5.21/matio-1.5.21.tar.gz -$ tar xvfz matio-1.5.21.tar.gz -$ cd matio-1.5.21 +$ wget https://github.com/tbeu/matio/releases/download/v1.5.22/matio-1.5.22.tar.gz +$ tar xvfz matio-1.5.22.tar.gz +$ cd matio-1.5.22 $ ./configure $ make $ sudo make install