From 6dfacb1676a1dd66e060a55b6285782907dfbd5d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 12 Apr 2018 20:44:15 +0200 Subject: [PATCH 1/7] Fix building for clang-900.0.39.2 (OSX 10.12), tnx to michaelld --- .../volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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 d4ea0c46f..f9634c801 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -62,6 +62,7 @@ endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # Enable C++17 support in GCC >= 8.0.0 # Enable C++14 support in 8.0.0 > GCC >= 6.1.1 # Fallback to C++11 when using GCC < 6.1.1 + if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.1") set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11") @@ -75,8 +76,8 @@ if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -Wall -Wextra") #Add warning flags: For "-Wall" see http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) -# Enable C++17 support in Clang >= 6.0.0 or AppleClang >= 900 -# Enable C++14 support in 6.0.0 > Clang >= 3.5.0 or 900 > AppleClang >= 600 +# Enable C++17 support in Clang >= 6.0.0 +# Enable C++14 support in 6.0.0 > Clang >= 3.5.0 or AppleClang >= 600 # Fallback to C++11 if older version if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_SYSTEM_NAME MATCHES "Darwin") @@ -84,11 +85,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CLANG_VERSION VERSION_LESS "600") set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11") else(CLANG_VERSION VERSION_LESS "600") - if(CLANG_VERSION VERSION_LESS "900") - set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++14") - else(CLANG_VERSION VERSION_LESS "900") - set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++17") - endif(CLANG_VERSION VERSION_LESS "900") + set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++14") endif(CLANG_VERSION VERSION_LESS "600") else(CMAKE_SYSTEM_NAME MATCHES "Darwin") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5.0") From 1094e870bc7c6dadb136a115c5a8c89311e6f5ae Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 12 Apr 2018 20:45:13 +0200 Subject: [PATCH 2/7] Accessing maps is not so cheap, so doing in the constructor --- .../gnuradio_blocks/dll_pll_veml_tracking.cc | 20 ++++++++++--------- .../gnuradio_blocks/dll_pll_veml_tracking.h | 3 ++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index d10af3177..087e48199 100755 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -362,13 +362,15 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dl d_last_prompt = gr_complex(0.0, 0.0); d_state = 0; // initial state: standby - signal_pretty_name["1C"] = "L1 C/A"; - signal_pretty_name["1B"] = "E1"; - signal_pretty_name["1G"] = "L1 C/A"; - signal_pretty_name["2S"] = "L2C"; - signal_pretty_name["2G"] = "L2 C/A"; - signal_pretty_name["5X"] = "E5a"; - signal_pretty_name["L5"] = "L5"; + map_signal_pretty_name["1C"] = "L1 C/A"; + map_signal_pretty_name["1B"] = "E1"; + map_signal_pretty_name["1G"] = "L1 C/A"; + map_signal_pretty_name["2S"] = "L2C"; + map_signal_pretty_name["2G"] = "L2 C/A"; + map_signal_pretty_name["5X"] = "E5a"; + map_signal_pretty_name["L5"] = "L5"; + + signal_pretty_name = map_signal_pretty_name[signal_type]; } @@ -511,7 +513,7 @@ void dll_pll_veml_tracking::start_tracking() d_code_loop_filter.set_pdi(static_cast(d_code_period)); // DEBUG OUTPUT - std::cout << "Tracking of " << systemName << " " << signal_pretty_name[signal_type] << " signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + std::cout << "Tracking of " << systemName << " " << signal_pretty_name << " signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; LOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel; // enable tracking pull-in @@ -1263,7 +1265,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) next_state = acquire_secondary(); if (next_state) { - std::cout << systemName << " " << signal_pretty_name[signal_type] << " secondary code locked in channel " << d_channel + std::cout << systemName << " " << signal_pretty_name << " secondary code locked in channel " << d_channel << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; } diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h index 89f71a99a..0b8392d2d 100755 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h @@ -119,7 +119,8 @@ private: std::string systemName; std::string signal_type; std::string *d_secondary_code_string; - std::map signal_pretty_name; + std::map map_signal_pretty_name; + std::string signal_pretty_name; //tracking state machine int d_state; From 31e634635ce96a0ba863e91943069d8a79f01823 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 13 Apr 2018 11:07:58 +0200 Subject: [PATCH 3/7] Move general_work to the bottom of the file --- .../gnuradio_blocks/pcps_acquisition.cc | 156 ++++++++-------- .../galileo_e1b_telemetry_decoder_cc.cc | 70 ++++---- .../galileo_e5a_telemetry_decoder_cc.cc | 70 ++++---- .../glonass_l1_ca_telemetry_decoder_cc.cc | 70 ++++---- .../glonass_l2_ca_telemetry_decoder_cc.cc | 70 ++++---- .../gps_l1_ca_telemetry_decoder_cc.cc | 76 ++++---- .../gps_l2c_telemetry_decoder_cc.cc | 70 ++++---- .../gps_l5_telemetry_decoder_cc.cc | 74 ++++---- .../sbas_l1_telemetry_decoder_cc.cc | 168 +++++++++--------- 9 files changed, 411 insertions(+), 413 deletions(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 0eb0cd3dd..62e55dd31 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -335,84 +335,6 @@ void pcps_acquisition::send_negative_acquisition() } -int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), - gr_vector_int& ninput_items, gr_vector_const_void_star& input_items, - gr_vector_void_star& output_items __attribute__((unused))) -{ - /* - * By J.Arribas, L.Esteve and M.Molina - * Acquisition strategy (Kay Borre book + CFAR threshold): - * 1. Compute the input signal power estimation - * 2. Doppler serial search loop - * 3. Perform the FFT-based circular convolution (parallel time search) - * 4. Record the maximum peak and the associated synchronization parameters - * 5. Compute the test statistics and compare to the threshold - * 6. Declare positive or negative acquisition using a message port - */ - - gr::thread::scoped_lock lk(d_setlock); - if (!d_active or d_worker_active) - { - d_sample_counter += d_fft_size * ninput_items[0]; - consume_each(ninput_items[0]); - if (d_step_two) - { - d_doppler_center_step_two = static_cast(d_gnss_synchro->Acq_doppler_hz); - update_grid_doppler_wipeoffs_step2(); - d_state = 0; - d_active = true; - } - return 0; - } - - switch (d_state) - { - case 0: - { - //restart acquisition variables - d_gnss_synchro->Acq_delay_samples = 0.0; - d_gnss_synchro->Acq_doppler_hz = 0.0; - d_gnss_synchro->Acq_samplestamp_samples = 0; - d_well_count = 0; - d_mag = 0.0; - d_input_power = 0.0; - d_test_statistics = 0.0; - d_state = 1; - d_sample_counter += d_fft_size * ninput_items[0]; // sample counter - consume_each(ninput_items[0]); - break; - } - - case 1: - { - // Copy the data to the core and let it know that new data is available - if (d_cshort) - { - memcpy(d_data_buffer_sc, input_items[0], d_fft_size * sizeof(lv_16sc_t)); - } - else - { - memcpy(d_data_buffer, input_items[0], d_fft_size * sizeof(gr_complex)); - } - if (acq_parameters.blocking) - { - lk.unlock(); - acquisition_core(d_sample_counter); - } - else - { - gr::thread::thread d_worker(&pcps_acquisition::acquisition_core, this, d_sample_counter); - d_worker_active = true; - } - d_sample_counter += d_fft_size; - consume_each(1); - break; - } - } - return 0; -} - - void pcps_acquisition::acquisition_core(unsigned long int samp_count) { gr::thread::scoped_lock lk(d_setlock); @@ -686,3 +608,81 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count) } d_worker_active = false; } + + +int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), + gr_vector_int& ninput_items, gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items __attribute__((unused))) +{ + /* + * By J.Arribas, L.Esteve and M.Molina + * Acquisition strategy (Kay Borre book + CFAR threshold): + * 1. Compute the input signal power estimation + * 2. Doppler serial search loop + * 3. Perform the FFT-based circular convolution (parallel time search) + * 4. Record the maximum peak and the associated synchronization parameters + * 5. Compute the test statistics and compare to the threshold + * 6. Declare positive or negative acquisition using a message port + */ + + gr::thread::scoped_lock lk(d_setlock); + if (!d_active or d_worker_active) + { + d_sample_counter += d_fft_size * ninput_items[0]; + consume_each(ninput_items[0]); + if (d_step_two) + { + d_doppler_center_step_two = static_cast(d_gnss_synchro->Acq_doppler_hz); + update_grid_doppler_wipeoffs_step2(); + d_state = 0; + d_active = true; + } + return 0; + } + + switch (d_state) + { + case 0: + { + //restart acquisition variables + d_gnss_synchro->Acq_delay_samples = 0.0; + d_gnss_synchro->Acq_doppler_hz = 0.0; + d_gnss_synchro->Acq_samplestamp_samples = 0; + d_well_count = 0; + d_mag = 0.0; + d_input_power = 0.0; + d_test_statistics = 0.0; + d_state = 1; + d_sample_counter += d_fft_size * ninput_items[0]; // sample counter + consume_each(ninput_items[0]); + break; + } + + case 1: + { + // Copy the data to the core and let it know that new data is available + if (d_cshort) + { + memcpy(d_data_buffer_sc, input_items[0], d_fft_size * sizeof(lv_16sc_t)); + } + else + { + memcpy(d_data_buffer, input_items[0], d_fft_size * sizeof(gr_complex)); + } + if (acq_parameters.blocking) + { + lk.unlock(); + acquisition_core(d_sample_counter); + } + else + { + gr::thread::thread d_worker(&pcps_acquisition::acquisition_core, this, d_sample_counter); + d_worker_active = true; + } + d_sample_counter += d_fft_size; + consume_each(1); + break; + } + } + return 0; +} diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc index 286ca0c68..6f2242454 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc @@ -272,6 +272,41 @@ void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols, in } +void galileo_e1b_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) +{ + d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); + DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite; + DLOG(INFO) << "Navigation Satellite set to " << d_satellite; +} + + +void galileo_e1b_telemetry_decoder_cc::set_channel(int channel) +{ + d_channel = channel; + LOG(INFO) << "Navigation channel set to " << channel; + // ############# ENABLE DATA FILE LOG ################# + if (d_dump == true) + { + if (d_dump_file.is_open() == false) + { + try + { + d_dump_filename = "telemetry"; + d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(".dat"); + d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); + LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); + } + catch (const std::ifstream::failure &e) + { + LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); + } + } + } +} + + int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { @@ -467,38 +502,3 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute //std::cout<<"GPS L1 TLM output on CH="<d_channel << " SAMPLE STAMP="<(d_channel)); - d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); - d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); - LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); - } - catch (const std::ifstream::failure &e) - { - LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); - } - } - } -} diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc index 8e032956e..c828fb859 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc @@ -245,6 +245,41 @@ galileo_e5a_telemetry_decoder_cc::~galileo_e5a_telemetry_decoder_cc() } +void galileo_e5a_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) +{ + d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); + DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite; + DLOG(INFO) << "Navigation Satellite set to " << d_satellite; +} + + +void galileo_e5a_telemetry_decoder_cc::set_channel(int channel) +{ + d_channel = channel; + LOG(INFO) << "Navigation channel set to " << channel; + // ############# ENABLE DATA FILE LOG ################# + if (d_dump == true) + { + if (d_dump_file.is_open() == false) + { + try + { + d_dump_filename = "telemetry"; + d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(".dat"); + d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); + LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); + } + catch (const std::ifstream::failure &e) + { + LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); + } + } + } +} + + int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { @@ -491,38 +526,3 @@ int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute return 0; } } - - -void galileo_e5a_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) -{ - d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); - DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite; - DLOG(INFO) << "Navigation Satellite set to " << d_satellite; -} - - -void galileo_e5a_telemetry_decoder_cc::set_channel(int channel) -{ - d_channel = channel; - LOG(INFO) << "Navigation channel set to " << channel; - // ############# ENABLE DATA FILE LOG ################# - if (d_dump == true) - { - if (d_dump_file.is_open() == false) - { - try - { - d_dump_filename = "telemetry"; - d_dump_filename.append(boost::lexical_cast(d_channel)); - d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); - d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); - LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); - } - catch (const std::ifstream::failure &e) - { - LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); - } - } - } -} 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 ca6dc8681..09429a7e1 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 @@ -221,6 +221,41 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in } +void glonass_l1_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) +{ + d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); + DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite; + DLOG(INFO) << "Navigation Satellite set to " << d_satellite; +} + + +void glonass_l1_ca_telemetry_decoder_cc::set_channel(int channel) +{ + d_channel = channel; + LOG(INFO) << "Navigation channel set to " << channel; + // ############# ENABLE DATA FILE LOG ################# + if (d_dump == true) + { + if (d_dump_file.is_open() == false) + { + try + { + d_dump_filename = "telemetry"; + d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(".dat"); + d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); + LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); + } + catch (const std::ifstream::failure &e) + { + LOG(WARNING) << "channel " << d_channel << ": exception opening Glonass TLM dump file. " << e.what(); + } + } + } +} + + int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { @@ -408,38 +443,3 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu return 1; } - - -void glonass_l1_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) -{ - d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); - DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite; - DLOG(INFO) << "Navigation Satellite set to " << d_satellite; -} - - -void glonass_l1_ca_telemetry_decoder_cc::set_channel(int channel) -{ - d_channel = channel; - LOG(INFO) << "Navigation channel set to " << channel; - // ############# ENABLE DATA FILE LOG ################# - if (d_dump == true) - { - if (d_dump_file.is_open() == false) - { - try - { - d_dump_filename = "telemetry"; - d_dump_filename.append(boost::lexical_cast(d_channel)); - d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); - d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); - LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); - } - catch (const std::ifstream::failure &e) - { - LOG(WARNING) << "channel " << d_channel << ": exception opening Glonass TLM dump file. " << e.what(); - } - } - } -} diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc index e2a362974..b446b6e7e 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc @@ -220,6 +220,41 @@ void glonass_l2_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in } +void glonass_l2_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) +{ + d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); + DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite; + DLOG(INFO) << "Navigation Satellite set to " << d_satellite; +} + + +void glonass_l2_ca_telemetry_decoder_cc::set_channel(int channel) +{ + d_channel = channel; + LOG(INFO) << "Navigation channel set to " << channel; + // ############# ENABLE DATA FILE LOG ################# + if (d_dump == true) + { + if (d_dump_file.is_open() == false) + { + try + { + d_dump_filename = "telemetry"; + d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(".dat"); + d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); + LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); + } + catch (const std::ifstream::failure &e) + { + LOG(WARNING) << "channel " << d_channel << ": exception opening Glonass TLM dump file. " << e.what(); + } + } + } +} + + int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { @@ -407,38 +442,3 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu return 1; } - - -void glonass_l2_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) -{ - d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); - DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite; - DLOG(INFO) << "Navigation Satellite set to " << d_satellite; -} - - -void glonass_l2_ca_telemetry_decoder_cc::set_channel(int channel) -{ - d_channel = channel; - LOG(INFO) << "Navigation channel set to " << channel; - // ############# ENABLE DATA FILE LOG ################# - if (d_dump == true) - { - if (d_dump_file.is_open() == false) - { - try - { - d_dump_filename = "telemetry"; - d_dump_filename.append(boost::lexical_cast(d_channel)); - d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); - d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); - LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); - } - catch (const std::ifstream::failure &e) - { - LOG(WARNING) << "channel " << d_channel << ": exception opening Glonass TLM dump file. " << e.what(); - } - } - } -} diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc index 955d180d7..1070dca28 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc @@ -152,6 +152,44 @@ bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(unsigned int gpsword) } +void gps_l1_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) +{ + d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); + DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite; + d_GPS_FSM.i_satellite_PRN = d_satellite.get_PRN(); + DLOG(INFO) << "Navigation Satellite set to " << d_satellite; +} + + +void gps_l1_ca_telemetry_decoder_cc::set_channel(int channel) +{ + d_channel = channel; + d_GPS_FSM.i_channel_ID = channel; + DLOG(INFO) << "Navigation channel set to " << channel; + // ############# ENABLE DATA FILE LOG ################# + if (d_dump == true) + { + if (d_dump_file.is_open() == false) + { + try + { + d_dump_filename = "telemetry"; + d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(".dat"); + d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); + LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel + << " Log file: " << d_dump_filename.c_str(); + } + catch (const std::ifstream::failure &e) + { + LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); + } + } + } +} + + int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { @@ -411,41 +449,3 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__ return 1; } - - -void gps_l1_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) -{ - d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); - DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite; - d_GPS_FSM.i_satellite_PRN = d_satellite.get_PRN(); - DLOG(INFO) << "Navigation Satellite set to " << d_satellite; -} - - -void gps_l1_ca_telemetry_decoder_cc::set_channel(int channel) -{ - d_channel = channel; - d_GPS_FSM.i_channel_ID = channel; - DLOG(INFO) << "Navigation channel set to " << channel; - // ############# ENABLE DATA FILE LOG ################# - if (d_dump == true) - { - if (d_dump_file.is_open() == false) - { - try - { - d_dump_filename = "telemetry"; - d_dump_filename.append(boost::lexical_cast(d_channel)); - d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); - d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); - LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel - << " Log file: " << d_dump_filename.c_str(); - } - catch (const std::ifstream::failure &e) - { - LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); - } - } - } -} diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc index dee30987e..f06d19b6f 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc @@ -90,6 +90,41 @@ gps_l2c_telemetry_decoder_cc::~gps_l2c_telemetry_decoder_cc() } +void gps_l2c_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) +{ + d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); + DLOG(INFO) << "GPS L2C CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite; +} + + +void gps_l2c_telemetry_decoder_cc::set_channel(int channel) +{ + d_channel = channel; + LOG(INFO) << "GPS L2C CNAV channel set to " << channel; + // ############# ENABLE DATA FILE LOG ################# + if (d_dump == true) + { + if (d_dump_file.is_open() == false) + { + try + { + d_dump_filename = "telemetry_L2CM_"; + d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(".dat"); + d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); + LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel + << " Log file: " << d_dump_filename.c_str(); + } + catch (const std::ifstream::failure &e) + { + LOG(WARNING) << "channel " << d_channel << " Exception opening Telemetry GPS L2 dump file " << e.what(); + } + } + } +} + + int gps_l2c_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { @@ -193,38 +228,3 @@ int gps_l2c_telemetry_decoder_cc::general_work(int noutput_items __attribute__(( out[0] = current_synchro_data; return 1; } - - -void gps_l2c_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) -{ - d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); - DLOG(INFO) << "GPS L2C CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite; -} - - -void gps_l2c_telemetry_decoder_cc::set_channel(int channel) -{ - d_channel = channel; - LOG(INFO) << "GPS L2C CNAV channel set to " << channel; - // ############# ENABLE DATA FILE LOG ################# - if (d_dump == true) - { - if (d_dump_file.is_open() == false) - { - try - { - d_dump_filename = "telemetry_L2CM_"; - d_dump_filename.append(boost::lexical_cast(d_channel)); - d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); - d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); - LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel - << " Log file: " << d_dump_filename.c_str(); - } - catch (const std::ifstream::failure &e) - { - LOG(WARNING) << "channel " << d_channel << " Exception opening Telemetry GPS L2 dump file " << e.what(); - } - } - } -} diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc index 1cfd20162..0793428fa 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc @@ -100,6 +100,43 @@ gps_l5_telemetry_decoder_cc::~gps_l5_telemetry_decoder_cc() } +void gps_l5_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) +{ + d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); + LOG(INFO) << "GPS L5 CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite; + d_CNAV_Message.reset(); +} + + +void gps_l5_telemetry_decoder_cc::set_channel(int channel) +{ + d_channel = channel; + d_CNAV_Message.reset(); + LOG(INFO) << "GPS L5 CNAV channel set to " << channel; + // ############# ENABLE DATA FILE LOG ################# + if (d_dump == true) + { + if (d_dump_file.is_open() == false) + { + try + { + d_dump_filename = "telemetry_L5_"; + d_dump_filename.append(boost::lexical_cast(d_channel)); + d_dump_filename.append(".dat"); + d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); + d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); + LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel + << " Log file: " << d_dump_filename.c_str(); + } + catch (const std::ifstream::failure &e) + { + LOG(WARNING) << "channel " << d_channel << " Exception opening Telemetry GPS L5 dump file " << e.what(); + } + } + } +} + + int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { @@ -243,40 +280,3 @@ int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((u out[0] = current_synchro_data; return 1; } - - -void gps_l5_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) -{ - d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); - LOG(INFO) << "GPS L5 CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite; - d_CNAV_Message.reset(); -} - - -void gps_l5_telemetry_decoder_cc::set_channel(int channel) -{ - d_channel = channel; - d_CNAV_Message.reset(); - LOG(INFO) << "GPS L5 CNAV channel set to " << channel; - // ############# ENABLE DATA FILE LOG ################# - if (d_dump == true) - { - if (d_dump_file.is_open() == false) - { - try - { - d_dump_filename = "telemetry_L5_"; - d_dump_filename.append(boost::lexical_cast(d_channel)); - d_dump_filename.append(".dat"); - d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); - d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); - LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel - << " Log file: " << d_dump_filename.c_str(); - } - catch (const std::ifstream::failure &e) - { - LOG(WARNING) << "channel " << d_channel << " Exception opening Telemetry GPS L5 dump file " << e.what(); - } - } - } -} diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc index 194db3c11..830a02636 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc @@ -87,88 +87,6 @@ sbas_l1_telemetry_decoder_cc::~sbas_l1_telemetry_decoder_cc() } -int sbas_l1_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), - gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) -{ - VLOG(FLOW) << "general_work(): " - << "noutput_items=" << noutput_items << "\toutput_items real size=" << output_items.size() << "\tninput_items size=" << ninput_items.size() << "\tinput_items real size=" << input_items.size() << "\tninput_items[0]=" << ninput_items[0]; - // get pointers on in- and output gnss-synchro objects - Gnss_Synchro *out = reinterpret_cast(output_items[0]); // Get the output buffer pointer - const Gnss_Synchro *in = reinterpret_cast(input_items[0]); // Get the input buffer pointer - - Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block - //1. Copy the current tracking output - current_symbol = in[0]; - // copy correlation samples into samples vector - d_sample_buf.push_back(current_symbol.Prompt_I); //add new symbol to the symbol queue - - // store the time stamp of the first sample in the processed sample block - double sample_stamp = static_cast(in[0].Tracking_sample_counter) / static_cast(in[0].fs); - - // decode only if enough samples in buffer - if (d_sample_buf.size() >= d_block_size) - { - // align correlation samples in pairs - // and obtain the symbols by summing the paired correlation samples - std::vector symbols; - bool sample_alignment = d_sample_aligner.get_symbols(d_sample_buf, symbols); - - // align symbols in pairs - // and obtain the bits by decoding the symbol pairs - std::vector bits; - bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(symbols, bits); - - // search for preambles - // and extract the corresponding message candidates - std::vector msg_candidates; - d_frame_detector.get_frame_candidates(bits, msg_candidates); - - // verify checksum - // and return the valid messages - std::vector valid_msgs; - d_crc_verifier.get_valid_frames(msg_candidates, valid_msgs); - - // compute message sample stamp - // and fill messages in SBAS raw message objects - //std::vector sbas_raw_msgs; - for (std::vector::const_iterator it = valid_msgs.cbegin(); - it != valid_msgs.cend(); ++it) - { - int message_sample_offset = - (sample_alignment ? 0 : -1) + d_samples_per_symbol * (symbol_alignment ? -1 : 0) + d_samples_per_symbol * d_symbols_per_bit * it->first; - double message_sample_stamp = sample_stamp + static_cast(message_sample_offset) / 1000.0; - VLOG(EVENT) << "message_sample_stamp=" << message_sample_stamp - << " (sample_stamp=" << sample_stamp - << " sample_alignment=" << sample_alignment - << " symbol_alignment=" << symbol_alignment - << " relative_preamble_start=" << it->first - << " message_sample_offset=" << message_sample_offset - << ")"; - //Sbas_Raw_Msg sbas_raw_msg(message_sample_stamp, this->d_satellite.get_PRN(), it->second); - //sbas_raw_msgs.push_back(sbas_raw_msg); - } - - // parse messages - // and send them to the SBAS raw message queue - //for(std::vector::iterator it = sbas_raw_msgs.begin(); it != sbas_raw_msgs.end(); it++) - // { - //std::cout << "SBAS message type " << it->get_msg_type() << " from PRN" << it->get_prn() << " received" << std::endl; - //sbas_telemetry_data.update(*it); - // } - - // clear all processed samples in the input buffer - d_sample_buf.clear(); - } - - // UPDATE GNSS SYNCHRO DATA - // actually the SBAS telemetry decoder doesn't support ranging - current_symbol.Flag_valid_word = false; // indicate to observable block that this synchro object isn't valid for pseudorange computation - out[0] = current_symbol; - consume_each(1); // tell scheduler input items consumed - return 1; // tell scheduler output items produced -} - - void sbas_l1_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite) { d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); @@ -184,7 +102,6 @@ void sbas_l1_telemetry_decoder_cc::set_channel(int channel) // ### helper class for sample alignment ### - sbas_l1_telemetry_decoder_cc::sample_aligner::sample_aligner() { d_n_smpls_in_history = 3; @@ -403,12 +320,11 @@ void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const st // ### helper class for checking the CRC of the message candidates ### - - void sbas_l1_telemetry_decoder_cc::crc_verifier::reset() { } + void sbas_l1_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vector msg_candidates, std::vector &valid_msgs) { std::stringstream ss; @@ -500,3 +416,85 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_b << std::setfill('0') << std::hex << static_cast(byte) << std::setfill(' ') << std::resetiosflags(std::ios::hex); } + + +int sbas_l1_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), + gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) +{ + VLOG(FLOW) << "general_work(): " + << "noutput_items=" << noutput_items << "\toutput_items real size=" << output_items.size() << "\tninput_items size=" << ninput_items.size() << "\tinput_items real size=" << input_items.size() << "\tninput_items[0]=" << ninput_items[0]; + // get pointers on in- and output gnss-synchro objects + Gnss_Synchro *out = reinterpret_cast(output_items[0]); // Get the output buffer pointer + const Gnss_Synchro *in = reinterpret_cast(input_items[0]); // Get the input buffer pointer + + Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block + //1. Copy the current tracking output + current_symbol = in[0]; + // copy correlation samples into samples vector + d_sample_buf.push_back(current_symbol.Prompt_I); //add new symbol to the symbol queue + + // store the time stamp of the first sample in the processed sample block + double sample_stamp = static_cast(in[0].Tracking_sample_counter) / static_cast(in[0].fs); + + // decode only if enough samples in buffer + if (d_sample_buf.size() >= d_block_size) + { + // align correlation samples in pairs + // and obtain the symbols by summing the paired correlation samples + std::vector symbols; + bool sample_alignment = d_sample_aligner.get_symbols(d_sample_buf, symbols); + + // align symbols in pairs + // and obtain the bits by decoding the symbol pairs + std::vector bits; + bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(symbols, bits); + + // search for preambles + // and extract the corresponding message candidates + std::vector msg_candidates; + d_frame_detector.get_frame_candidates(bits, msg_candidates); + + // verify checksum + // and return the valid messages + std::vector valid_msgs; + d_crc_verifier.get_valid_frames(msg_candidates, valid_msgs); + + // compute message sample stamp + // and fill messages in SBAS raw message objects + //std::vector sbas_raw_msgs; + for (std::vector::const_iterator it = valid_msgs.cbegin(); + it != valid_msgs.cend(); ++it) + { + int message_sample_offset = + (sample_alignment ? 0 : -1) + d_samples_per_symbol * (symbol_alignment ? -1 : 0) + d_samples_per_symbol * d_symbols_per_bit * it->first; + double message_sample_stamp = sample_stamp + static_cast(message_sample_offset) / 1000.0; + VLOG(EVENT) << "message_sample_stamp=" << message_sample_stamp + << " (sample_stamp=" << sample_stamp + << " sample_alignment=" << sample_alignment + << " symbol_alignment=" << symbol_alignment + << " relative_preamble_start=" << it->first + << " message_sample_offset=" << message_sample_offset + << ")"; + //Sbas_Raw_Msg sbas_raw_msg(message_sample_stamp, this->d_satellite.get_PRN(), it->second); + //sbas_raw_msgs.push_back(sbas_raw_msg); + } + + // parse messages + // and send them to the SBAS raw message queue + //for(std::vector::iterator it = sbas_raw_msgs.begin(); it != sbas_raw_msgs.end(); it++) + // { + //std::cout << "SBAS message type " << it->get_msg_type() << " from PRN" << it->get_prn() << " received" << std::endl; + //sbas_telemetry_data.update(*it); + // } + + // clear all processed samples in the input buffer + d_sample_buf.clear(); + } + + // UPDATE GNSS SYNCHRO DATA + // actually the SBAS telemetry decoder doesn't support ranging + current_symbol.Flag_valid_word = false; // indicate to observable block that this synchro object isn't valid for pseudorange computation + out[0] = current_symbol; + consume_each(1); // tell scheduler input items consumed + return 1; // tell scheduler output items produced +} From c01d8d0dd90d6a8121691d849c7dc2514fa4ade7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 13 Apr 2018 11:39:05 +0200 Subject: [PATCH 4/7] Move general_work to the bottom of the file --- .../rtl_tcp_signal_source_c.cc | 70 +++++++++---------- .../unpack_spir_gss6450_samples.cc | 29 ++++---- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc index e874e8a14..4ec4420ce 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc @@ -158,41 +158,6 @@ rtl_tcp_signal_source_c::~rtl_tcp_signal_source_c() } -int rtl_tcp_signal_source_c::work(int noutput_items, - gr_vector_const_void_star & /*input_items*/, - gr_vector_void_star &output_items) -{ - gr_complex *out = reinterpret_cast(output_items[0]); - int i = 0; - if (io_service_.stopped()) - { - return -1; - } - - { - boost::mutex::scoped_lock lock(mutex_); - not_empty_.wait(lock, boost::bind(&rtl_tcp_signal_source_c::not_empty, - this)); - - for (; i < noutput_items && unread_ > 1; i++) - { - float re = buffer_[--unread_]; - float im = buffer_[--unread_]; - if (flip_iq_) - { - out[i] = gr_complex(im, re); - } - else - { - out[i] = gr_complex(re, im); - } - } - } - not_full_.notify_one(); - return i == 0 ? -1 : i; -} - - void rtl_tcp_signal_source_c::set_frequency(int frequency) { boost::system::error_code ec = @@ -359,3 +324,38 @@ void rtl_tcp_signal_source_c::handle_read(const boost::system::error_code &ec, this, _1, _2)); } } + + +int rtl_tcp_signal_source_c::work(int noutput_items, + gr_vector_const_void_star & /*input_items*/, + gr_vector_void_star &output_items) +{ + gr_complex *out = reinterpret_cast(output_items[0]); + int i = 0; + if (io_service_.stopped()) + { + return -1; + } + + { + boost::mutex::scoped_lock lock(mutex_); + not_empty_.wait(lock, boost::bind(&rtl_tcp_signal_source_c::not_empty, + this)); + + for (; i < noutput_items && unread_ > 1; i++) + { + float re = buffer_[--unread_]; + float im = buffer_[--unread_]; + if (flip_iq_) + { + out[i] = gr_complex(im, re); + } + else + { + out[i] = gr_complex(re, im); + } + } + } + not_full_.notify_one(); + return i == 0 ? -1 : i; +} diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_spir_gss6450_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_spir_gss6450_samples.cc index a5bca6ee7..bd725b219 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/unpack_spir_gss6450_samples.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_spir_gss6450_samples.cc @@ -57,6 +57,21 @@ unpack_spir_gss6450_samples::~unpack_spir_gss6450_samples() } +int unpack_spir_gss6450_samples::compute_two_complement(unsigned long data) +{ + int res = 0; + if (static_cast(data) < two_compl_thres) + { + res = static_cast(data); + } + else + { + res = static_cast(data) - adc_bits_two_pow; + } + return res; +} + + int unpack_spir_gss6450_samples::work(int noutput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items) { @@ -86,17 +101,3 @@ int unpack_spir_gss6450_samples::work(int noutput_items, } return noutput_items; } - -int unpack_spir_gss6450_samples::compute_two_complement(unsigned long data) -{ - int res = 0; - if (static_cast(data) < two_compl_thres) - { - res = static_cast(data); - } - else - { - res = static_cast(data) - adc_bits_two_pow; - } - return res; -} From 44c6d8622ce1c57a8c6274e547464a53dad6c31a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 13 Apr 2018 12:11:41 +0200 Subject: [PATCH 5/7] Make the test to correctly fail if no kml file is generated --- src/tests/system-tests/position_test.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 350055d2f..bf0925dda 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -277,8 +277,8 @@ int StaticPositionSystemTest::configure_receiver() const float dll_bw_narrow_hz = 2.0; const int extend_correlation_ms = 1; - const int display_rate_ms = 1000; - const int output_rate_ms = 1000; + const int display_rate_ms = 500; + const int output_rate_ms = 500; config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_rate_internal)); @@ -358,10 +358,10 @@ int StaticPositionSystemTest::configure_receiver() config->set_property("Tracking_1C.pll_bw_hz", std::to_string(pll_bw_hz)); config->set_property("Tracking_1C.dll_bw_hz", std::to_string(dll_bw_hz)); config->set_property("Tracking_1C.early_late_space_chips", std::to_string(early_late_space_chips)); - + config->set_property("Tracking_1Cearly_late_space_narrow_chips", std::to_string(early_late_space_chips / 5.0)); config->set_property("Tracking_1C.pll_bw_narrow_hz", std::to_string(pll_bw_narrow_hz)); config->set_property("Tracking_1C.dll_bw_narrow_hz", std::to_string(dll_bw_narrow_hz)); - config->set_property("Tracking_1C.extend_correlation_ms", std::to_string(extend_correlation_ms)); + config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(extend_correlation_ms)); // Set Telemetry config->set_property("TelemetryDecoder_1C.implementation", "GPS_L1_CA_Telemetry_Decoder"); @@ -454,6 +454,7 @@ int StaticPositionSystemTest::run_receiver() void StaticPositionSystemTest::check_results() { std::fstream myfile(StaticPositionSystemTest::generated_kml_file, std::ios_base::in); + ASSERT_TRUE(myfile.is_open()) << "No valid kml file could be opened"; std::string line; std::vector pos_e; @@ -466,6 +467,7 @@ void StaticPositionSystemTest::check_results() while (is_header) { std::getline(myfile, line); + ASSERT_FALSE(myfile.eof()) << "No valid kml file found."; std::size_t found = line.find(""); if (found != std::string::npos) is_header = false; } @@ -474,7 +476,11 @@ void StaticPositionSystemTest::check_results() //read data while (is_data) { - std::getline(myfile, line); + if (!std::getline(myfile, line)) + { + is_data = false; + break; + } std::size_t found = line.find(""); if (found != std::string::npos) is_data = false; @@ -504,6 +510,7 @@ void StaticPositionSystemTest::check_results() } } myfile.close(); + ASSERT_FALSE(pos_e.size() == 0) << "KML file is empty"; double sigma_E_2_precision = std::pow(compute_stdev_precision(pos_e), 2.0); double sigma_N_2_precision = std::pow(compute_stdev_precision(pos_n), 2.0); From 26467a0f29dfc10448166616b600f707c226182a Mon Sep 17 00:00:00 2001 From: Antonio Ramos Date: Fri, 13 Apr 2018 12:30:06 +0200 Subject: [PATCH 6/7] Increase fixed latency in order to avoid loss of observables --- .../observables/gnuradio_blocks/hybrid_observables_cc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc index 0fdd85c31..06f0efdcd 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc @@ -64,7 +64,7 @@ hybrid_observables_cc::hybrid_observables_cc(unsigned int nchannels_in, T_rx_s = 0.0; T_rx_step_s = 0.001; // 1 ms max_delta = 1.5; // 1.5 s - d_latency = 0.175; // 175 ms + d_latency = 0.3; // 300 ms valid_channels.resize(d_nchannels, false); d_num_valid_channels = 0; d_gnss_synchro_history = new Gnss_circular_deque(static_cast(max_delta * 1000.0), d_nchannels); From fec1e374075df1851bd8b0a28de227015c859c4f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 14 Apr 2018 11:19:52 +0200 Subject: [PATCH 7/7] Fix Typo --- src/tests/system-tests/position_test.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index bf0925dda..4018552bc 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -358,7 +358,7 @@ int StaticPositionSystemTest::configure_receiver() config->set_property("Tracking_1C.pll_bw_hz", std::to_string(pll_bw_hz)); config->set_property("Tracking_1C.dll_bw_hz", std::to_string(dll_bw_hz)); config->set_property("Tracking_1C.early_late_space_chips", std::to_string(early_late_space_chips)); - config->set_property("Tracking_1Cearly_late_space_narrow_chips", std::to_string(early_late_space_chips / 5.0)); + config->set_property("Tracking_1C.pll_bw_narrow_hz", std::to_string(pll_bw_narrow_hz)); config->set_property("Tracking_1C.dll_bw_narrow_hz", std::to_string(dll_bw_narrow_hz)); config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(extend_correlation_ms)); @@ -366,7 +366,6 @@ int StaticPositionSystemTest::configure_receiver() // Set Telemetry config->set_property("TelemetryDecoder_1C.implementation", "GPS_L1_CA_Telemetry_Decoder"); config->set_property("TelemetryDecoder_1C.dump", "false"); - config->set_property("TelemetryDecoder_1C.decimation_factor", std::to_string(decimation_factor)); // Set Observables config->set_property("Observables.implementation", "Hybrid_Observables");