From 19f4da0aa64b7c1595ae260cc319c68a26dd2ac6 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Tue, 29 Aug 2017 01:20:38 -0600 Subject: [PATCH] merging: Starts merge procedure for glonass branch from upstream Starts merging process of the acquisition and tracking code for GLONASS processing developed by Gabriel Araujo. Fixes compile warnings and errors introduced during rebase operation --- .../glonass_l1_ca_pcps_acquisition.cc | 5 +- .../gnuradio_blocks/pcps_acquisition_cc.cc | 8 +-- .../gnuradio_blocks/pcps_acquisition_cc.h | 2 +- .../gnuradio_blocks/pcps_acquisition_sc.cc | 2 +- .../adapters/signal_generator.cc | 2 +- .../gnuradio_blocks/signal_generator_c.cc | 2 +- .../gnuradio_blocks/CMakeLists.txt | 7 +- .../glonass_l1_ca_telemetry_decoder_cc.cc | 5 +- .../glonass_l1_ca_dll_pll_c_aid_tracking.cc | 2 +- .../glonass_l1_ca_dll_pll_tracking.cc | 2 +- ...glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 2 +- ...glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 2 +- .../glonass_l1_ca_dll_pll_tracking_cc.cc | 2 +- src/core/receiver/gnss_block_factory.cc | 14 ++-- src/core/system_parameters/GLONASS_L1_CA.h | 32 +++++++++ src/core/system_parameters/Glonass_L1_CA.h | 69 ------------------- 16 files changed, 60 insertions(+), 98 deletions(-) delete mode 100644 src/core/system_parameters/Glonass_L1_CA.h diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc index 5d81dc992..4d321b220 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc @@ -2,7 +2,7 @@ #include #include #include "glonass_l1_signal_processing.h" -#include "Glonass_L1_CA.h" +#include "GLONASS_L1_CA.h" #include "configuration_interface.h" @@ -63,7 +63,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")"; - + if (item_type_.compare("cbyte") == 0) { cbyte_to_float_x2_ = make_complex_byte_to_float_x2(); @@ -357,4 +357,3 @@ gr::basic_block_sptr GlonassL1CaPcpsAcquisition::get_right_block() return acquisition_cc_; } } - diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc index 29506fbeb..cd314a342 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc @@ -42,7 +42,7 @@ #include #include "control_message_factory.h" #include "GPS_L1_CA.h" //GPS_TWO_PI -#include "Glonass_L1_CA.h" //GLONASS_TWO_PI +#include "GLONASS_L1_CA.h" //GLONASS_TWO_PI using google::LogMessage; @@ -178,12 +178,12 @@ void pcps_acquisition_cc::set_local_code(std::complex * code) int offset = d_fft_size/2; std::fill_n( d_fft_if->get_inbuf(), offset, gr_complex( 0.0, 0.0 ) ); memcpy(d_fft_if->get_inbuf() + offset, code, sizeof(gr_complex) * offset); - } - else + } + else { memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex) * d_fft_size); } - + d_fft_if->execute(); // We need the FFT of local code volk_32fc_conjugate_32fc(d_fft_codes, d_fft_if->get_outbuf(), d_fft_size); } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h index 4bd5ab857..272a0f9bc 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h @@ -56,7 +56,7 @@ #include #include #include "gnss_synchro.h" -#include "Glonass_L1_CA.h" //GLONASS_TWO_PI +#include "GLONASS_L1_CA.h" //GLONASS_TWO_PI class pcps_acquisition_cc; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc index 7200ce946..5a15e2037 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc @@ -41,7 +41,7 @@ #include #include "control_message_factory.h" #include "GPS_L1_CA.h" //GPS_TWO_PI -#include "Glonass_L1_CA.h" //GLONASS_TWO_PI +#include "GLONASS_L1_CA.h" //GLONASS_TWO_PI using google::LogMessage; diff --git a/src/algorithms/signal_generator/adapters/signal_generator.cc b/src/algorithms/signal_generator/adapters/signal_generator.cc index a2ef90cdf..57e3c0aa0 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.cc +++ b/src/algorithms/signal_generator/adapters/signal_generator.cc @@ -36,7 +36,7 @@ #include "Galileo_E1.h" #include "GPS_L1_CA.h" #include "Galileo_E5a.h" -#include "Glonass_L1_CA.h" +#include "GLONASS_L1_CA.h" using google::LogMessage; diff --git a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc index a99c4751d..2e383f40b 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc @@ -40,7 +40,7 @@ #include "Galileo_E1.h" #include "Galileo_E5a.h" #include "GPS_L1_CA.h" -#include "Glonass_L1_CA.h" +#include "GLONASS_L1_CA.h" /* * Create a new instance of signal_generator_c and return diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt index 7de1a365b..043440927 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt @@ -16,14 +16,15 @@ # along with GNSS-SDR. If not, see . # -set(TELEMETRY_DECODER_GR_BLOCKS_SOURCES +set(TELEMETRY_DECODER_GR_BLOCKS_SOURCES gps_l1_ca_telemetry_decoder_cc.cc gps_l2c_telemetry_decoder_cc.cc galileo_e1b_telemetry_decoder_cc.cc sbas_l1_telemetry_decoder_cc.cc galileo_e5a_telemetry_decoder_cc.cc + glonass_l1_ca_telemetry_decoder_cc.cc ) - + include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src/core/system_parameters @@ -40,4 +41,4 @@ file(GLOB TELEMETRY_DECODER_GR_BLOCKS_HEADERS "*.h") list(SORT TELEMETRY_DECODER_GR_BLOCKS_HEADERS) add_library(telemetry_decoder_gr_blocks ${TELEMETRY_DECODER_GR_BLOCKS_SOURCES} ${TELEMETRY_DECODER_GR_BLOCKS_HEADERS}) source_group(Headers FILES ${TELEMETRY_DECODER_GR_BLOCKS_HEADERS}) -target_link_libraries(telemetry_decoder_gr_blocks telemetry_decoder_libswiftcnav telemetry_decoder_lib gnss_system_parameters ${GNURADIO_RUNTIME_LIBRARIES}) \ No newline at end of file +target_link_libraries(telemetry_decoder_gr_blocks telemetry_decoder_libswiftcnav telemetry_decoder_lib gnss_system_parameters ${GNURADIO_RUNTIME_LIBRARIES}) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc index 3d63c38ea..6a9bc0944 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc @@ -71,7 +71,7 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc( LOG(INFO) << "Initializing GLONASS L1 CA TELEMETRY PROCESSING"; // Define the number of sampes per symbol. Notice that GLONASS has to rates, //one for the navigation data and the other for the preamble information - d_samples_per_symbol = ( GLONASS_L1_CODE_CHIP_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS ) / GLONASS_L1_CA_SYMBOL_RATE_BPS; + d_samples_per_symbol = ( GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS ) / GLONASS_L1_CA_SYMBOL_RATE_BPS; // Set the preamble information unsigned short int preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS] = GLONASS_GNAV_PREAMBLE; @@ -108,7 +108,6 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc( d_TOW_at_current_symbol = 0; delta_t = 0; d_CRC_error_counter = 0; - flag_even_word_arrived = 0; d_flag_preamble = false; d_channel = 0; flag_TOW_set = false; @@ -149,7 +148,7 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols,int } // 2. Call the GLONASS GNAV string decoder - d_nav.decode_string(page_String); + d_nav.string_decoder(frame_string); // 3. Check operation executed correctly if(d_nav.flag_CRC_test == true) diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc index 4f73fa200..8ae399d7f 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc @@ -1,6 +1,6 @@ #include "glonass_l1_ca_dll_pll_c_aid_tracking.h" #include -#include "Glonass_L1_CA.h" +#include "GLONASS_L1_CA.h" #include "configuration_interface.h" diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc index cce1b19a7..da7fd324c 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc @@ -38,7 +38,7 @@ #include "glonass_l1_ca_dll_pll_tracking.h" #include -#include "Glonass_L1_CA.h" +#include "GLONASS_L1_CA.h" #include "configuration_interface.h" 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 f08edc5a3..9b9818717 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 @@ -12,7 +12,7 @@ #include "glonass_l1_signal_processing.h" #include "tracking_discriminators.h" #include "lock_detectors.h" -#include "Glonass_L1_CA.h" +#include "GLONASS_L1_CA.h" #include "control_message_factory.h" 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 e13c48108..dcd94d281 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 @@ -13,7 +13,7 @@ #include "glonass_l1_signal_processing.h" #include "tracking_discriminators.h" #include "lock_detectors.h" -#include "Glonass_L1_CA.h" +#include "GLONASS_L1_CA.h" #include "control_message_factory.h" 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 65e756c2e..052d89a36 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 @@ -10,7 +10,7 @@ #include "glonass_l1_signal_processing.h" #include "tracking_discriminators.h" #include "lock_detectors.h" -#include "Glonass_L1_CA.h" +#include "GLONASS_L1_CA.h" #include "control_message_factory.h" diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 1f9c73529..927aaf0fe 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -529,7 +529,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1G( stream << channel; std::string id = stream.str(); LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " - << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; + << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder Implementation: " << tlm; std::string aux = configuration->property("Acquisition_1G" + boost::lexical_cast(channel) + ".implementation", std::string("W")); std::string appendix1; @@ -1354,12 +1354,6 @@ std::unique_ptr GNSSBlockFactory::GetAcqBlock( out_streams)); block = std::move(block_); } - else if (implementation.compare("GLONASS_L1_CA_Telemetry_Decoder") == 0) - { - std::unique_ptr block_(new GlonassL1CaTelemetryDecoder(configuration.get(), role, in_streams, - out_streams)); - block = std::move(block_); - } else { // Log fatal. This causes execution to stop. @@ -1496,6 +1490,12 @@ std::unique_ptr GNSSBlockFactory::GetTlmBlock( out_streams)); block = std::move(block_); } + else if (implementation.compare("GLONASS_L1_CA_Telemetry_Decoder") == 0) + { + std::unique_ptr block_(new GlonassL1CaTelemetryDecoder(configuration.get(), role, in_streams, + out_streams)); + block = std::move(block_); + } else { // Log fatal. This causes execution to stop. diff --git a/src/core/system_parameters/GLONASS_L1_CA.h b/src/core/system_parameters/GLONASS_L1_CA.h index 3b03a58e5..750b41136 100644 --- a/src/core/system_parameters/GLONASS_L1_CA.h +++ b/src/core/system_parameters/GLONASS_L1_CA.h @@ -88,6 +88,38 @@ const double GLONASS_L1_CA_CODE_PERIOD = 0.001; //!< GLONASS L1 C/ const double GLONASS_L1_CA_CHIP_PERIOD = 1.9569e-06; //!< GLONASS L1 C/A chip period [seconds] const double GLONASS_L1_CA_SYMBOL_RATE_BPS = 1000; +// GLONASS SV's orbital slots PRN = (orbital_slot - 1) +const std::map GLONASS_PRN = + {{ 0, 8,}, //For test + { 1, 1,}, //Plane 1 + { 2,-4,}, //Plane 1 + { 3, 5,}, //Plane 1 + { 4, 6,}, //Plane 1 + { 5, 1,}, //Plane 1 + { 6,-4,}, //Plane 1 + { 7, 5,}, //Plane 1 + { 8, 6,}, //Plane 1 + { 9,-2,}, //Plane 2 + {10,-7,}, //Plane 2 + {11, 0,}, //Plane 2 + {12,-1,}, //Plane 2 + {13,-2,}, //Plane 2 + {14,-7,}, //Plane 2 + {15, 0,}, //Plane 2 + {16,-1,}, //Plane 2 + {17, 4,}, //Plane 3 + {18,-3,}, //Plane 3 + {19, 3,}, //Plane 3 + {20, 2,}, //Plane 3 + {21, 4,}, //Plane 3 + {22,-3,}, //Plane 3 + {23, 3,}, //Plane 3 + {24, 2}}; //Plane 3 + + +const int GLONASS_CA_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s] + + const double GLONASS_STARTOFFSET_ms = 68.802; //[ms] Initial sign. travel time (this cannot go here) // OBSERVABLE HISTORY DEEP FOR INTERPOLATION diff --git a/src/core/system_parameters/Glonass_L1_CA.h b/src/core/system_parameters/Glonass_L1_CA.h deleted file mode 100644 index bcdfd2b32..000000000 --- a/src/core/system_parameters/Glonass_L1_CA.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef GNSS_SDR_GLONASS_L1_CA_H_ -#define GNSS_SDR_GLONASS_L1_CA_H_ - -#include -#include // std::map -#include "MATH_CONSTANTS.h" -#include "gnss_frequencies.h" - -// Physical constants -const double GLONASS_C_m_s = 299792458.0; //!< The speed of light, [m/s] -const double GLONASS_C_m_ms = 299792.4580; //!< The speed of light, [m/ms] -const double GLONASS_PI = 3.1415926535898; //!< Pi as (NOT) defined in ICD-GLONASS-2008 -const double GLONASS_TWO_PI = 6.283185307179586;//!< 2Pi as (NOT) defined in ICD-GLONASS-2008 -const double GLONASS_OMEGA_EARTH_DOT = 7.292115e-5; //!< Earth rotation rate, [rad/s] -const double GLONASS_GM = 3.986004418e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] -// const double F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)] - -// Geodesic constants and parameters -const double fMa = 0.35e9; //!< The Gravitational constant of atmosphere, [m^3/s^2] -const double SEMI_MAJOR_AXIS = 6378136; //!< The Semi-major axis, [m] -const double FLATTENING = 1/298.25784; //!< The Orbital Flattening -const double EQUATORIAL_GRAVITY = 978032.84; //!< The Equatorial acceleration of gravity, [mGal] -const double GRAVITY_CORRECTION = 0.87; //!< The Correction to acceleration of gravity at sea-level due to Atmosphere, [mGal] -const double SECOND_HARMONIC = 1082625.75e-9; //!< Second zonal harmonic of the geopotential (J_2^0) -const double FOURTH_HARMONIC = -2370.89e-9; //!< Fourth zonal harmonic of the geopotential (J_4^0) -const double SIXTH_HARMONIC = 6.08e-9; //!< Sixth zonal harmonic of the geopotential (J_6^0) -const double EIGHTH_HARMONIC = 1.40e-11; //!< Eighth zonal harmonic of the geopotential (J_8^0) -const double NORMAL_POTENCIAL = 62636861.4; //!< The Normal potential at surface of common terrestrial ellipsoid (U_0), [m^2/s^2] - - -// carrier and code frequencies -const double GLONASS_L1_FREQ_HZ = FREQ1_GLO; //!< L1 [Hz] -const double GLONASS_L1_CA_CODE_RATE_HZ = 0.511e6; //!< GLONASS L1 C/A code rate [chips/s] -const double GLONASS_L1_CA_CODE_LENGTH_CHIPS = 511.0; //!< GLONASS L1 C/A code length [chips] -const double GLONASS_L1_CA_CODE_PERIOD = 0.001; //!< GLONASS L1 C/A code period [seconds] -const double GLONASS_L1_CA_CHIP_PERIOD = 1.9569e-06; //!< GLONASS L1 C/A chip period [seconds] - -// GLONASS SV's orbital slots PRN = (orbital_slot - 1) -const std::map GLONASS_PRN = - {{ 0, 8,}, //For test - { 1, 1,}, //Plane 1 - { 2,-4,}, //Plane 1 - { 3, 5,}, //Plane 1 - { 4, 6,}, //Plane 1 - { 5, 1,}, //Plane 1 - { 6,-4,}, //Plane 1 - { 7, 5,}, //Plane 1 - { 8, 6,}, //Plane 1 - { 9,-2,}, //Plane 2 - {10,-7,}, //Plane 2 - {11, 0,}, //Plane 2 - {12,-1,}, //Plane 2 - {13,-2,}, //Plane 2 - {14,-7,}, //Plane 2 - {15, 0,}, //Plane 2 - {16,-1,}, //Plane 2 - {17, 4,}, //Plane 3 - {18,-3,}, //Plane 3 - {19, 3,}, //Plane 3 - {20, 2,}, //Plane 3 - {21, 4,}, //Plane 3 - {22,-3,}, //Plane 3 - {23, 3,}, //Plane 3 - {24, 2}}; //Plane 3 - - -const int GLONASS_CA_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s] - -#endif /* GNSS_SDR_GLONASS_L1_CA_H_ */