From 5f7f6366b6cfce9c40651146482367035e705377 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 9 Sep 2019 12:10:40 +0200 Subject: [PATCH 1/2] Get elements of the circular deque without expensive bound checking --- src/algorithms/libs/gnss_circular_deque.h | 10 +++- .../gnuradio_blocks/hybrid_observables_gs.cc | 50 +++++++++---------- 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/algorithms/libs/gnss_circular_deque.h b/src/algorithms/libs/gnss_circular_deque.h index 88b8ad3cf..17ad3b9ef 100644 --- a/src/algorithms/libs/gnss_circular_deque.h +++ b/src/algorithms/libs/gnss_circular_deque.h @@ -44,7 +44,8 @@ public: Gnss_circular_deque(); //!< Default constructor Gnss_circular_deque(const unsigned int max_size, const unsigned int nchann); //!< nchann = number of channels; max_size = channel capacity unsigned int size(const unsigned int ch); //!< Returns the number of available elements in a channel - T& at(const unsigned int ch, const unsigned int pos); //!< Returns a reference to an element + T& at(const unsigned int ch, const unsigned int pos); //!< Returns a reference to an element with bount checking + T& get(const unsigned int ch, const unsigned int pos); //!< Returns a reference to an element without bound checking T& front(const unsigned int ch); //!< Returns a reference to the first element in the deque T& back(const unsigned int ch); //!< Returns a reference to the last element in the deque void push_back(const unsigned int ch, const T& new_data); //!< Inserts an element at the end of the deque @@ -100,6 +101,13 @@ T& Gnss_circular_deque::at(const unsigned int ch, const unsigned int pos) } +template +T& Gnss_circular_deque::get(const unsigned int ch, const unsigned int pos) +{ + return d_data[ch][pos]; +} + + template void Gnss_circular_deque::clear(const unsigned int ch) { diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc index bd3b10c88..967911e90 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc @@ -361,7 +361,7 @@ bool hybrid_observables_gs::interp_trk_obs(Gnss_Synchro &interpolated_obs, const int64_t old_abs_diff = std::numeric_limits::max(); for (uint32_t i = 0; i < d_gnss_synchro_history->size(ch); i++) { - abs_diff = llabs(static_cast(rx_clock) - static_cast(d_gnss_synchro_history->at(ch, i).Tracking_sample_counter)); + abs_diff = llabs(static_cast(rx_clock) - static_cast(d_gnss_synchro_history->get(ch, i).Tracking_sample_counter)); if (old_abs_diff > abs_diff) { old_abs_diff = abs_diff; @@ -371,10 +371,10 @@ bool hybrid_observables_gs::interp_trk_obs(Gnss_Synchro &interpolated_obs, const if (nearest_element != -1 and nearest_element != static_cast(d_gnss_synchro_history->size(ch))) { - if ((static_cast(old_abs_diff) / static_cast(d_gnss_synchro_history->at(ch, nearest_element).fs)) < 0.02) + if ((static_cast(old_abs_diff) / static_cast(d_gnss_synchro_history->get(ch, nearest_element).fs)) < 0.02) { int32_t neighbor_element; - if (rx_clock > d_gnss_synchro_history->at(ch, nearest_element).Tracking_sample_counter) + if (rx_clock > d_gnss_synchro_history->get(ch, nearest_element).Tracking_sample_counter) { neighbor_element = nearest_element + 1; } @@ -386,63 +386,63 @@ bool hybrid_observables_gs::interp_trk_obs(Gnss_Synchro &interpolated_obs, const { int32_t t1_idx; int32_t t2_idx; - if (rx_clock > d_gnss_synchro_history->at(ch, nearest_element).Tracking_sample_counter) + if (rx_clock > d_gnss_synchro_history->get(ch, nearest_element).Tracking_sample_counter) { - // std::cout << "S1= " << d_gnss_synchro_history->at(ch, nearest_element).Tracking_sample_counter - // << " Si=" << rx_clock << " S2=" << d_gnss_synchro_history->at(ch, neighbor_element).Tracking_sample_counter << std::endl; + // std::cout << "S1= " << d_gnss_synchro_history->get(ch, nearest_element).Tracking_sample_counter + // << " Si=" << rx_clock << " S2=" << d_gnss_synchro_history->get(ch, neighbor_element).Tracking_sample_counter << std::endl; t1_idx = nearest_element; t2_idx = neighbor_element; } else { - // std::cout << "inv S1= " << d_gnss_synchro_history->at(ch, neighbor_element).Tracking_sample_counter - // << " Si=" << rx_clock << " S2=" << d_gnss_synchro_history->at(ch, nearest_element).Tracking_sample_counter << std::endl; + // std::cout << "inv S1= " << d_gnss_synchro_history->get(ch, neighbor_element).Tracking_sample_counter + // << " Si=" << rx_clock << " S2=" << d_gnss_synchro_history->get(ch, nearest_element).Tracking_sample_counter << std::endl; t1_idx = neighbor_element; t2_idx = nearest_element; } // 1st: copy the nearest gnss_synchro data for that channel - interpolated_obs = d_gnss_synchro_history->at(ch, nearest_element); + interpolated_obs = d_gnss_synchro_history->get(ch, nearest_element); // 2nd: Linear interpolation: y(t) = y(t1) + (y(t2) - y(t1)) * (t - t1) / (t2 - t1) double T_rx_s = static_cast(rx_clock) / static_cast(interpolated_obs.fs); - double time_factor = (T_rx_s - d_gnss_synchro_history->at(ch, t1_idx).RX_time) / - (d_gnss_synchro_history->at(ch, t2_idx).RX_time - - d_gnss_synchro_history->at(ch, t1_idx).RX_time); + double time_factor = (T_rx_s - d_gnss_synchro_history->get(ch, t1_idx).RX_time) / + (d_gnss_synchro_history->get(ch, t2_idx).RX_time - + d_gnss_synchro_history->get(ch, t1_idx).RX_time); // CARRIER PHASE INTERPOLATION - interpolated_obs.Carrier_phase_rads = d_gnss_synchro_history->at(ch, t1_idx).Carrier_phase_rads + (d_gnss_synchro_history->at(ch, t2_idx).Carrier_phase_rads - d_gnss_synchro_history->at(ch, t1_idx).Carrier_phase_rads) * time_factor; + interpolated_obs.Carrier_phase_rads = d_gnss_synchro_history->get(ch, t1_idx).Carrier_phase_rads + (d_gnss_synchro_history->get(ch, t2_idx).Carrier_phase_rads - d_gnss_synchro_history->get(ch, t1_idx).Carrier_phase_rads) * time_factor; // CARRIER DOPPLER INTERPOLATION - interpolated_obs.Carrier_Doppler_hz = d_gnss_synchro_history->at(ch, t1_idx).Carrier_Doppler_hz + (d_gnss_synchro_history->at(ch, t2_idx).Carrier_Doppler_hz - d_gnss_synchro_history->at(ch, t1_idx).Carrier_Doppler_hz) * time_factor; + interpolated_obs.Carrier_Doppler_hz = d_gnss_synchro_history->get(ch, t1_idx).Carrier_Doppler_hz + (d_gnss_synchro_history->get(ch, t2_idx).Carrier_Doppler_hz - d_gnss_synchro_history->get(ch, t1_idx).Carrier_Doppler_hz) * time_factor; // TOW INTERPOLATION // check TOW rollover - if ((d_gnss_synchro_history->at(ch, t2_idx).TOW_at_current_symbol_ms - d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms) > 0) + if ((d_gnss_synchro_history->get(ch, t2_idx).TOW_at_current_symbol_ms - d_gnss_synchro_history->get(ch, t1_idx).TOW_at_current_symbol_ms) > 0) { - interpolated_obs.interp_TOW_ms = static_cast(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms) + (static_cast(d_gnss_synchro_history->at(ch, t2_idx).TOW_at_current_symbol_ms) - static_cast(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms)) * time_factor; + interpolated_obs.interp_TOW_ms = static_cast(d_gnss_synchro_history->get(ch, t1_idx).TOW_at_current_symbol_ms) + (static_cast(d_gnss_synchro_history->get(ch, t2_idx).TOW_at_current_symbol_ms) - static_cast(d_gnss_synchro_history->get(ch, t1_idx).TOW_at_current_symbol_ms)) * time_factor; } else { // TOW rollover situation - interpolated_obs.interp_TOW_ms = static_cast(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms) + (static_cast(d_gnss_synchro_history->at(ch, t2_idx).TOW_at_current_symbol_ms + 604800000) - static_cast(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms)) * time_factor; + interpolated_obs.interp_TOW_ms = static_cast(d_gnss_synchro_history->get(ch, t1_idx).TOW_at_current_symbol_ms) + (static_cast(d_gnss_synchro_history->get(ch, t2_idx).TOW_at_current_symbol_ms + 604800000) - static_cast(d_gnss_synchro_history->get(ch, t1_idx).TOW_at_current_symbol_ms)) * time_factor; } // LOG(INFO) << "Channel " << ch << " int idx: " << t1_idx << " TOW Int: " << interpolated_obs.interp_TOW_ms - // << " TOW p1 : " << d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms + // << " TOW p1 : " << d_gnss_synchro_history->get(ch, t1_idx).TOW_at_current_symbol_ms // << " TOW p2: " - // << d_gnss_synchro_history->at(ch, t2_idx).TOW_at_current_symbol_ms + // << d_gnss_synchro_history->get(ch, t2_idx).TOW_at_current_symbol_ms // << " t2-t1: " - // << d_gnss_synchro_history->at(ch, t2_idx).RX_time - d_gnss_synchro_history->at(ch, t1_idx).RX_time + // << d_gnss_synchro_history->get(ch, t2_idx).RX_time - d_gnss_synchro_history->get(ch, t1_idx).RX_time // << " trx - t1: " - // << T_rx_s - d_gnss_synchro_history->at(ch, t1_idx).RX_time; + // << T_rx_s - d_gnss_synchro_history->get(ch, t1_idx).RX_time; // std::cout << "Rx samplestamp: " << T_rx_s << " Channel " << ch << " interp buff idx " << nearest_element - // << " ,diff: " << old_abs_diff << " samples (" << static_cast(old_abs_diff) / static_cast(d_gnss_synchro_history->at(ch, nearest_element).fs) << " s)\n"; + // << " ,diff: " << old_abs_diff << " samples (" << static_cast(old_abs_diff) / static_cast(d_gnss_synchro_history->get(ch, nearest_element).fs) << " s)\n"; return true; } return false; } // std::cout << "ALERT: Channel " << ch << " interp buff idx " << nearest_element - // << " ,diff: " << old_abs_diff << " samples (" << static_cast(old_abs_diff) / static_cast(d_gnss_synchro_history->at(ch, nearest_element).fs) << " s)\n"; + // << " ,diff: " << old_abs_diff << " samples (" << static_cast(old_abs_diff) / static_cast(d_gnss_synchro_history->get(ch, nearest_element).fs) << " s)\n"; // usleep(1000); } return false; @@ -610,7 +610,7 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused) for (uint32_t n = 0; n < d_nchannels_out; n++) { - out[n][0] = epoch_data.at(n); + out[n][0] = epoch_data[n]; } // report channel status every second @@ -619,7 +619,7 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused) { for (uint32_t n = 0; n < d_nchannels_out; n++) { - std::shared_ptr gnss_synchro_sptr = std::make_shared(epoch_data.at(n)); + std::shared_ptr gnss_synchro_sptr = std::make_shared(epoch_data[n]); // publish valid gnss_synchro to the gnss_flowgraph channel status monitor this->message_port_pub(pmt::mp("status"), pmt::make_any(gnss_synchro_sptr)); } From c8cd925ba82d76a9d9b8104e83d225cc7a4b0aa3 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 9 Sep 2019 16:00:17 +0200 Subject: [PATCH 2/2] Remove bound checking when accessing elements --- .../beidou_b1i_telemetry_decoder_gs.cc | 14 +++++++------- .../beidou_b3i_telemetry_decoder_gs.cc | 14 +++++++------- .../galileo_telemetry_decoder_gs.cc | 12 ++++++------ .../glonass_l1_ca_telemetry_decoder_gs.cc | 4 ++-- .../glonass_l2_ca_telemetry_decoder_gs.cc | 4 ++-- .../gps_l1_ca_telemetry_decoder_gs.cc | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc index b2cc85c53..f3f9e7e21 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc @@ -81,7 +81,7 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( // Setting samples of preamble code for (int32_t i = 0; i < d_symbols_per_preamble; i++) { - if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') + if (BEIDOU_DNAV_PREAMBLE[i] == '1') { d_preamble_samples[i] = 1; } @@ -300,7 +300,7 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell // Setting samples of preamble code for (int32_t i = 0; i < d_symbols_per_preamble; i++) { - if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') + if (BEIDOU_DNAV_PREAMBLE[i] == '1') { d_preamble_samples[i] = 1; } @@ -325,7 +325,7 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell // Setting samples of preamble code for (int32_t i = 0; i < d_symbols_per_preamble; i++) { - if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') + if (BEIDOU_DNAV_PREAMBLE[i] == '1') { d_preamble_samples[i] = 1; } @@ -440,14 +440,14 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_ { for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) { - d_subframe_symbols[i] = d_symbol_history.at(i); + d_subframe_symbols[i] = d_symbol_history[i]; } } else // 180 deg. inverted carrier phase PLL lock { for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) { - d_subframe_symbols[i] = -d_symbol_history.at(i); + d_subframe_symbols[i] = -d_symbol_history[i]; } } @@ -497,14 +497,14 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_ { for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) { - d_subframe_symbols[i] = d_symbol_history.at(i); + d_subframe_symbols[i] = d_symbol_history[i]; } } else // 180 deg. inverted carrier phase PLL lock { for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) { - d_subframe_symbols[i] = -d_symbol_history.at(i); + d_subframe_symbols[i] = -d_symbol_history[i]; } } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc index 3c79ef4e1..b1e0035d1 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc @@ -81,7 +81,7 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs( // Setting samples of preamble code for (int32_t i = 0; i < d_symbols_per_preamble; i++) { - if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') + if (BEIDOU_DNAV_PREAMBLE[i] == '1') { d_preamble_samples[i] = 1; } @@ -318,7 +318,7 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite( // Setting samples of preamble code for (int32_t i = 0; i < d_symbols_per_preamble; i++) { - if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') + if (BEIDOU_DNAV_PREAMBLE[i] == '1') { d_preamble_samples[i] = 1; } @@ -342,7 +342,7 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite( // Setting samples of preamble code for (int32_t i = 0; i < d_symbols_per_preamble; i++) { - if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') + if (BEIDOU_DNAV_PREAMBLE[i] == '1') { d_preamble_samples[i] = 1; } @@ -466,14 +466,14 @@ int beidou_b3i_telemetry_decoder_gs::general_work( { for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) { - d_subframe_symbols[i] = d_symbol_history.at(i); + d_subframe_symbols[i] = d_symbol_history[i]; } } else // 180 deg. inverted carrier phase PLL lock { for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) { - d_subframe_symbols[i] = -d_symbol_history.at(i); + d_subframe_symbols[i] = -d_symbol_history[i]; } } @@ -526,14 +526,14 @@ int beidou_b3i_telemetry_decoder_gs::general_work( { for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) { - d_subframe_symbols[i] = d_symbol_history.at(i); + d_subframe_symbols[i] = d_symbol_history[i]; } } else // 180 deg. inverted carrier phase PLL lock { for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) { - d_subframe_symbols[i] = -d_symbol_history.at(i); + d_subframe_symbols[i] = -d_symbol_history[i]; } } 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 50674bbb6..87b7a355f 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 @@ -135,7 +135,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( { case 1: // INAV { - if (GALILEO_INAV_PREAMBLE.at(i) == '1') + if (GALILEO_INAV_PREAMBLE[i] == '1') { d_preamble_samples[i] = 1; } @@ -147,7 +147,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( } case 2: // FNAV for E5a-I { - if (GALILEO_FNAV_PREAMBLE.at(i) == '1') + if (GALILEO_FNAV_PREAMBLE[i] == '1') { d_preamble_samples[i] = 1; } @@ -571,14 +571,14 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { for (uint32_t i = 0; i < d_frame_length_symbols; i++) { - d_page_part_symbols[i] = d_symbol_history.at(i + d_samples_per_preamble); // because last symbol of the preamble is just received now! + d_page_part_symbols[i] = d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now! } } else // 180 deg. inverted carrier phase PLL lock { for (uint32_t i = 0; i < d_frame_length_symbols; i++) { - d_page_part_symbols[i] = -d_symbol_history.at(i + d_samples_per_preamble); // because last symbol of the preamble is just received now! + d_page_part_symbols[i] = -d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now! } } decode_INAV_word(d_page_part_symbols.data(), d_frame_length_symbols); @@ -592,7 +592,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { for (uint32_t i = 0; i < d_frame_length_symbols; i++) { - d_page_part_symbols[i] = d_symbol_history.at(i + d_samples_per_preamble); // because last symbol of the preamble is just received now! + d_page_part_symbols[i] = d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now! } } } @@ -602,7 +602,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { for (uint32_t i = 0; i < d_frame_length_symbols; i++) { - d_page_part_symbols[i] = -d_symbol_history.at(i + d_samples_per_preamble); // because last symbol of the preamble is just received now! + d_page_part_symbols[i] = -d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now! } } } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc index f1fb3e9ca..5e3ef08cb 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc @@ -343,11 +343,11 @@ int glonass_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu { if (corr_value > 0) { - string_symbols[i] = d_symbol_history.at(i + d_symbols_per_preamble).Prompt_I; // because last symbol of the preamble is just received now! + string_symbols[i] = d_symbol_history[i + d_symbols_per_preamble].Prompt_I; // because last symbol of the preamble is just received now! } else { - string_symbols[i] = -d_symbol_history.at(i + d_symbols_per_preamble).Prompt_I; // because last symbol of the preamble is just received now! + string_symbols[i] = -d_symbol_history[i + d_symbols_per_preamble].Prompt_I; // because last symbol of the preamble is just received now! } } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc index e49905811..a960ce236 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc @@ -343,11 +343,11 @@ int glonass_l2_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu { if (corr_value > 0) { - string_symbols[i] = d_symbol_history.at(i + d_symbols_per_preamble).Prompt_I; // because last symbol of the preamble is just received now! + string_symbols[i] = d_symbol_history[i + d_symbols_per_preamble].Prompt_I; // because last symbol of the preamble is just received now! } else { - string_symbols[i] = -d_symbol_history.at(i + d_symbols_per_preamble).Prompt_I; // because last symbol of the preamble is just received now! + string_symbols[i] = -d_symbol_history[i + d_symbols_per_preamble].Prompt_I; // because last symbol of the preamble is just received now! } } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc index f7304a0f4..7738a060c 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc @@ -87,7 +87,7 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs( int32_t n = 0; for (int32_t i = 0; i < d_bits_per_preamble; i++) { - if (GPS_CA_PREAMBLE.at(i) == '1') + if (GPS_CA_PREAMBLE[i] == '1') { d_preamble_samples[n] = 1; n++;