From dd91ffe139b0602ef79fe612885208ce79f67d2c Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Tue, 26 Feb 2019 18:04:59 +0100 Subject: [PATCH 1/2] Bug fix that solves a random deadlock of the observables block rx time selector --- .../gnuradio_blocks/hybrid_observables_cc.cc | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc index 429931dd0..382414c44 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc @@ -570,9 +570,41 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) if (n_valid > 0) { update_TOW(epoch_data); - if (T_rx_TOW_ms % 20 != 0) + int tow_inc_loop_count = 0; + while (T_rx_TOW_ms % 20 != 0 and tow_inc_loop_count < 20) { - T_rx_TOW_offset_ms = T_rx_TOW_ms % 20; + tow_inc_loop_count++; + T_rx_TOW_offset_ms++; + T_rx_TOW_offset_ms = T_rx_TOW_offset_ms % 20; + //check if effectively the receiver TOW is now multiple of 20 ms + n_valid = 0; + epoch_data.clear(); + for (uint32_t n = 0; n < d_nchannels_out; n++) + { + Gnss_Synchro interpolated_gnss_synchro{}; + if (!interp_trk_obs(interpolated_gnss_synchro, n, d_Rx_clock_buffer.front() + T_rx_TOW_offset_ms * T_rx_clock_step_samples)) + { + // Produce an empty observation + interpolated_gnss_synchro = Gnss_Synchro(); + interpolated_gnss_synchro.Flag_valid_pseudorange = false; + interpolated_gnss_synchro.Flag_valid_word = false; + interpolated_gnss_synchro.Flag_valid_acquisition = false; + interpolated_gnss_synchro.fs = 0; + interpolated_gnss_synchro.Channel_ID = n; + } + else + { + n_valid++; + } + epoch_data.push_back(interpolated_gnss_synchro); + } + update_TOW(epoch_data); + //debug code: + // if (T_rx_TOW_ms % 20 != 0) + // { + // std::cout << "Warning: RX TOW is not multiple of 20 ms\n"; + // } + // std::cout << "T_rx_TOW_ms=" << T_rx_TOW_ms << " T_rx_TOW_offset_ms=" << T_rx_TOW_offset_ms << " ->" << T_rx_TOW_ms % 20 << std::endl; } } From fd64cdd8c29df7b41c7d7e1073dc1605c5f992e8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 28 Feb 2019 09:33:47 +0100 Subject: [PATCH 2/2] Fix program termination with some configurations This is not a robust solution but fixes termination when URSP is being used. To be improved --- src/core/receiver/control_thread.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 16c180990..67dc239c1 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -294,6 +294,7 @@ int ControlThread::run() stop_ = true; flowgraph_->disconnect(); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); // Terminate keyboard thread pthread_t id = keyboard_thread_.native_handle(); keyboard_thread_.detach();