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 diff --git a/CITATION.cff b/CITATION.cff index 11eddf59f..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: "2021-08-23" +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 @@ -326,4 +325,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..5f3e6e45b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) @@ -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") 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 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f284f6248..df6b88cda 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -16,6 +16,24 @@ All notable changes to GNSS-SDR will be documented in this file. ### 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. + +See the definitions of concepts and metrics at +https://gnss-sdr.org/design-forces/ + +  + +## [GNSS-SDR v0.0.16](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.16) - 2022-02-15 + +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6090349.svg)](https://doi.org/10.5281/zenodo.6090349) + +### Improvements in Availability: + - Added the Galileo E5b receiving chain. The software is now able to compute PVT solutions as a standalone Galileo E5b receiver. - Improved Time-To-First-Fix when using GPS L1 C/A signals, fixing a bug that @@ -120,6 +138,8 @@ 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 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5242839.svg)](https://doi.org/10.5281/zenodo.5242839) + ### Improvements in Availability: - Added the reading of reduced clock and ephemeris data (CED) in the Galileo E1B @@ -244,6 +264,8 @@ https://gnss-sdr.org/design-forces/ ## [GNSS-SDR v0.0.14](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.14) - 2021-01-08 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4428100.svg)](https://doi.org/10.5281/zenodo.4428100) + ### Improvements in Availability: - Fixed bug in acquisition detection when the configuration parameter @@ -353,6 +375,8 @@ https://gnss-sdr.org/design-forces/ ## [GNSS-SDR v0.0.13](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.13) - 2020-07-29 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3965566.svg)](https://doi.org/10.5281/zenodo.3965566) + ### Improvements in Efficiency: - Faster internal handling of `Gnss_Synchro` objects by reducing the amount of @@ -467,6 +491,8 @@ https://gnss-sdr.org/design-forces/ ## [GNSS-SDR v0.0.12](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.12) - 2020-03-13 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3709089.svg)](https://doi.org/10.5281/zenodo.3709089) + ### Improvements in Accuracy: - Improved accuracy of the C/N0 estimator. @@ -661,6 +687,8 @@ https://gnss-sdr.org/design-forces/ ## [GNSS-SDR v0.0.11](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.11) - 2019-08-04 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3359989.svg)](https://doi.org/10.5281/zenodo.3359989) + This release has several improvements in different dimensions, addition of new features and bug fixes: @@ -814,6 +842,8 @@ https://gnss-sdr.org/design-forces/ ## [GNSS-SDR v0.0.10](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.10) - 2018-12-14 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2279988.svg)](https://doi.org/10.5281/zenodo.2279988) + This release has several improvements in different dimensions, addition of new features and bug fixes: @@ -1046,7 +1076,7 @@ https://gnss-sdr.org/design-forces/ ## [GNSS-SDR v0.0.9](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.9) - 2017-02-13 -DOI: https://doi.org/10.5281/zenodo.291371 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.291371.svg)](https://doi.org/10.5281/zenodo.291371) This release has several improvements, addition of new features and bug fixes in many dimensions: @@ -1167,7 +1197,7 @@ https://gnss-sdr.org/design-forces/ ## [GNSS-SDR v0.0.8](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.8) - 2016-07-04 -DOI: https://doi.org/10.5281/zenodo.57022 +[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.57022.svg)](http://dx.doi.org/10.5281/zenodo.57022) This is a maintenance and bug fix release with no relevant new features with respect to v0.0.7. The main changes are: @@ -1193,7 +1223,7 @@ respect to v0.0.7. The main changes are: ## [GNSS-SDR v0.0.7](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.7) - 2016-05-15 -DOI: https://doi.org/10.5281/zenodo.51521 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.51521.svg)](https://doi.org/10.5281/zenodo.51521) This release has several improvements, addition of new features and bug fixes: @@ -1285,6 +1315,8 @@ This release has several improvements, addition of new features and bug fixes: ## [GNSS-SDR v0.0.6](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.6) - 2015-09-02 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.30104.svg)](https://doi.org/10.5281/zenodo.30104) + This release has several improvements and bug fixes: - Added initial support to multi-band, multi-source configurations (multiple @@ -1335,6 +1367,8 @@ This release has several improvements and bug fixes: ## [GNSS-SDR v0.0.5](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.5) - 2015-01-13 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13920.svg)](https://doi.org/10.5281/zenodo.13920) + This release has several improvements and bug fixes: - Now GNSS-SDR can be installed on the system with the usual @@ -1362,6 +1396,8 @@ This release has several improvements and bug fixes: ## [GNSS-SDR v0.0.4](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.4) - 2014-09-08 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.11628.svg)](https://doi.org/10.5281/zenodo.11628) + This release has several improvements and bug fixes: - Added hybrid processing GPS L1 C/A and Galileo E1B, providing position fixes @@ -1399,6 +1435,8 @@ This release has several improvements and bug fixes: ## [GNSS-SDR v0.0.3](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.3) - 2014-06-30 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10708.svg)](https://doi.org/10.5281/zenodo.10708) + This release has several improvements and bug fixes, completing the transition from Subversion to Git. The main changes are: 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. diff --git a/docs/manpage/gnss-sdr-manpage b/docs/manpage/gnss-sdr-manpage index bbcc0623c..f11304483 100644 --- a/docs/manpage/gnss-sdr-manpage +++ b/docs/manpage/gnss-sdr-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 gnss\-sdr 1 "23 Aug 2021" "0.0.15" "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/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index f0c039506..6fb9a2510 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 "; } @@ -1698,7 +1699,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'; } } } @@ -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; } @@ -2114,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()) { @@ -2151,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) { 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 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..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; @@ -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++; @@ -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; 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; 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..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 "23 Aug 2021" "0.0.15" "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 440fb492a..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 "23 Aug 2021" "0.0.15" "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 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", ' '); 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); 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 110f57d3c..db723cdf9 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 { 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..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,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(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 04f88b999..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,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(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 9162f7bcc..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,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(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 242469b0a..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,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(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 485b0d93f..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,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(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 5dfcb2d53..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,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(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 0f3ae0abb..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,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(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 858244669..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,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(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 f1fb20c82..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 @@ -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(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_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index 7d964cdfe..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,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(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/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 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..923416832 --- /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}; + + // 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}; + + 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..a8c265a80 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,46 @@ 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; + + /*! + * \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 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 +90,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 101fbf63c..d95d14a28 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}; + + // 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}; + + 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; @@ -47,10 +193,7 @@ void Gnss_Ephemeris::satellitePosition(double transmitTime) 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; @@ -82,10 +225,9 @@ void Gnss_Ephemeris::satellitePosition(double transmitTime) 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; @@ -120,53 +262,59 @@ void Gnss_Ephemeris::satellitePosition(double transmitTime) 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); // --- 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 +332,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)); } @@ -198,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; @@ -235,19 +380,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..c3f9a8e78 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,34 @@ public: */ double sv_clock_drift(double transmitTime); + /*! + * \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 satellitePosition(double transmitTime); //!< Computes the ECEF SV coordinates and ECEF velocity uint32_t PRN{}; //!< SV ID @@ -83,6 +112,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; }; 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 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{}; 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 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 (...) { 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