From 45195917c163d3a49c9b7fc1f67666fe14628bdb Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 2 Dec 2015 18:25:06 +0100 Subject: [PATCH] fixing some gnuradio-related warnings reported by gcc, so others can be spotted easier --- .../PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc | 7 ++- .../PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc | 7 ++- .../PVT/gnuradio_blocks/hybrid_pvt_cc.cc | 7 ++- ...o_e5a_noncoherent_iq_acquisition_caf_cc.cc | 23 +++++---- .../galileo_pcps_8ms_acquisition_cc.cc | 1 + .../gnuradio_blocks/pcps_acquisition_cc.cc | 6 +-- .../pcps_acquisition_fine_doppler_cc.cc | 6 ++- .../pcps_assisted_acquisition_cc.cc | 6 ++- .../pcps_cccwsr_acquisition_cc.cc | 1 + .../pcps_multithread_acquisition_cc.cc | 1 + .../pcps_opencl_acquisition_cc.cc | 1 + .../pcps_quicksync_acquisition_cc.cc | 2 +- .../pcps_tong_acquisition_cc.cc | 1 + .../galileo_e1_observables_cc.cc | 47 ++++++++++------- .../gps_l1_ca_observables_cc.cc | 18 +++++-- .../gnuradio_blocks/hybrid_observables_cc.cc | 13 ++++- .../gnuradio_blocks/mixed_observables_cc.cc | 11 +++- .../gnuradio_blocks/signal_generator_c.cc | 9 +++- .../gnuradio_blocks/unpack_2bit_samples.cc | 8 +-- .../adapters/galileo_e1b_telemetry_decoder.cc | 6 +-- .../adapters/galileo_e5a_telemetry_decoder.cc | 6 +-- .../adapters/galileo_e5a_telemetry_decoder.h | 1 - .../adapters/gps_l1_ca_telemetry_decoder.cc | 6 +-- .../adapters/gps_l2_m_telemetry_decoder.cc | 6 +-- .../adapters/sbas_l1_telemetry_decoder.cc | 6 +-- .../galileo_e1b_telemetry_decoder_cc.cc | 21 ++++---- .../galileo_e1b_telemetry_decoder_cc.h | 15 ++---- .../galileo_e5a_telemetry_decoder_cc.cc | 21 ++++---- .../galileo_e5a_telemetry_decoder_cc.h | 18 +++---- .../gps_l1_ca_telemetry_decoder_cc.cc | 23 ++++----- .../gps_l1_ca_telemetry_decoder_cc.h | 13 ++--- .../gps_l2_m_telemetry_decoder_cc.cc | 24 ++++----- .../gps_l2_m_telemetry_decoder_cc.h | 10 ++-- .../sbas_l1_telemetry_decoder_cc.cc | 15 +++--- .../sbas_l1_telemetry_decoder_cc.h | 11 ++-- .../galileo_e1_dll_pll_veml_tracking_cc.cc | 23 ++++++--- .../galileo_e1_tcp_connector_tracking_cc.cc | 9 +++- .../galileo_e5a_dll_pll_tracking_cc.cc | 9 +++- ...alileo_volk_e1_dll_pll_veml_tracking_cc.cc | 51 +++++++++++-------- .../gps_l1_ca_dll_fll_pll_tracking_cc.cc | 9 +++- .../gps_l1_ca_dll_pll_c_aid_tracking_cc.cc | 38 +++++++------- .../gps_l1_ca_dll_pll_optim_tracking_cc.cc | 17 +++++-- .../gps_l1_ca_dll_pll_tracking_cc.cc | 34 ++++++++----- .../gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 18 ++++--- .../gps_l1_ca_tcp_connector_tracking_cc.cc | 9 +++- .../gps_l2_m_dll_pll_tracking_cc.cc | 10 +++- src/core/libs/gnss_sdr_supl_client.cc | 2 +- src/core/system_parameters/rtcm.cc | 1 - .../system_parameters/sbas_telemetry_data.cc | 4 +- .../arithmetic/tracking_loop_filter_test.cc | 44 ++++++---------- src/tests/test_main.cc | 1 + 51 files changed, 365 insertions(+), 291 deletions(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc index 8a942410b..8f196a71e 100644 --- a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc @@ -307,7 +307,12 @@ int galileo_e1_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_it } consume_each(1); //one by one - return 0; + output_items.clear(); // removes a warning + if((noutput_items == 0) || (ninput_items[0] == 0)) + { + LOG(WARNING) << "noutput_items = 0"; + } + return 1; } diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc index b7c318abe..3d72e2ca9 100644 --- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc @@ -344,7 +344,12 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite } consume_each(1); //one by one - return noutput_items; + output_items.clear(); // removes a warning + if((noutput_items == 0) || (ninput_items[0] == 0)) + { + LOG(WARNING) << "noutput_items = 0"; + } + return 1; } diff --git a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc index d26c190ed..d910c5d8d 100644 --- a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc @@ -370,7 +370,12 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items, } consume_each(1); //one by one - return noutput_items; + output_items.clear(); // removes a warning + if((noutput_items == 0) || (ninput_items[0] == 0)) + { + LOG(WARNING) << "noutput_items = 0"; + } + return 1; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc index f923caac2..2871428cb 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc @@ -647,7 +647,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items // weighting_factor = 0; // std::cout << "weighting_factor " << weighting_factor << std::endl; // Initialize first iterations - for (int doppler_index=0; doppler_index < CAF_bins_half; doppler_index++) + for (int doppler_index = 0; doppler_index < CAF_bins_half; doppler_index++) { d_CAF_vector[doppler_index] = 0; // volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], d_CAF_vector_I, CAF_bins_half+doppler_index+1); @@ -656,7 +656,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * static_cast((doppler_index - i))); } // d_CAF_vector[doppler_index] /= CAF_bins_half+doppler_index+1; - d_CAF_vector[doppler_index] /= 1 + CAF_bins_half+doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor*doppler_index*(doppler_index+1)/2; // triangles = [n*(n+1)/2] + d_CAF_vector[doppler_index] /= 1 + CAF_bins_half + doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * doppler_index * (doppler_index + 1) / 2; // triangles = [n*(n+1)/2] if (d_both_signal_components) { accum[0] = 0; @@ -671,21 +671,21 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items } } // Body loop - for (unsigned int doppler_index = CAF_bins_half;doppler_index(doppler_index + CAF_bins_half + 1); i++) { - d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1-weighting_factor * static_cast((doppler_index - i))); + d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * static_cast((doppler_index - i))); } - // d_CAF_vector[doppler_index] /= 2*CAF_bins_half+1; + // d_CAF_vector[doppler_index] /= 2*CAF_bins_half+1; d_CAF_vector[doppler_index] /= 1 + 2 * CAF_bins_half - 2 * weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2; if (d_both_signal_components) { accum[0] = 0; // volk_32f_accumulator_s32f_a(&accum[0], &d_CAF_vector_Q[doppler_index-CAF_bins_half], 2*CAF_bins_half); - for (int i = doppler_index-CAF_bins_half; i < doppler_index + CAF_bins_half + 1; i++) + for (int i = doppler_index-CAF_bins_half; i < static_cast(doppler_index + CAF_bins_half + 1); i++) { accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast((doppler_index - i))); } @@ -695,11 +695,11 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items } } // Final iterations - for (int doppler_index = d_num_doppler_bins - CAF_bins_half; doppler_index < d_num_doppler_bins; doppler_index++) + for (int doppler_index = d_num_doppler_bins - CAF_bins_half; doppler_index < static_cast(d_num_doppler_bins); doppler_index++) { d_CAF_vector[doppler_index] = 0; // volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], &d_CAF_vector_I[doppler_index-CAF_bins_half], CAF_bins_half + (d_num_doppler_bins-doppler_index)); - for (int i = doppler_index - CAF_bins_half; i < d_num_doppler_bins; i++) + for (int i = doppler_index - CAF_bins_half; i < static_cast(d_num_doppler_bins); i++) { d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * (abs(doppler_index - i))); } @@ -709,7 +709,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items { accum[0] = 0; // volk_32f_accumulator_s32f_a(&accum[0], &d_CAF_vector_Q[doppler_index-CAF_bins_half], CAF_bins_half + (d_num_doppler_bins-doppler_index)); - for (int i = doppler_index-CAF_bins_half; i < d_num_doppler_bins; i++) + for (int i = doppler_index-CAF_bins_half; i < static_cast(d_num_doppler_bins); i++) { accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * (abs(doppler_index - i))); } @@ -803,6 +803,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items } } + output_items.clear(); // removes a warning return noutput_items; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc index f6b8e8fc5..eb44a9121 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc @@ -413,5 +413,6 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items, } } + output_items.clear(); // removes a warning return noutput_items; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc index fe78e7fcb..5c951028c 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc @@ -265,10 +265,8 @@ int pcps_acquisition_cc::general_work(int noutput_items, const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer int effective_fft_size = ( d_bit_transition_flag ? d_fft_size/2 : d_fft_size ); - size_t offset = ( d_bit_transition_flag ? effective_fft_size : 0 ); - float fft_normalization_factor = static_cast(d_fft_size) - * static_cast(d_fft_size); + float fft_normalization_factor = static_cast(d_fft_size) * static_cast(d_fft_size); d_input_power = 0.0; d_mag = 0.0; @@ -442,7 +440,6 @@ int pcps_acquisition_cc::general_work(int noutput_items, d_sample_counter += d_fft_size * ninput_items[0]; // sample counter consume_each(ninput_items[0]); - acquisition_message = 2; d_channel_internal_queue->push(acquisition_message); @@ -450,6 +447,7 @@ int pcps_acquisition_cc::general_work(int noutput_items, } } + output_items.clear(); // removes a warning return noutput_items; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc index a0fed41d2..2893192d8 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc @@ -174,7 +174,10 @@ void pcps_acquisition_fine_doppler_cc::init() void pcps_acquisition_fine_doppler_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) { - ninput_items_required[0] = d_gnuradio_forecast_samples ; //set the required available samples in each call + if (noutput_items != 0) + { + ninput_items_required[0] = d_gnuradio_forecast_samples ; //set the required available samples in each call + } } @@ -519,5 +522,6 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, //DLOG(INFO)<<"d_sample_counter="<(d_nchannels)); - d_carrier_doppler_queue_hz.push_back(std::deque(d_nchannels)); - d_symbol_TOW_queue_s.push_back(std::deque(d_nchannels)); - } + for (unsigned int i = 0; i < d_nchannels; i++) + { + d_acc_carrier_phase_queue_rads.push_back(std::deque(d_nchannels)); + d_carrier_doppler_queue_hz.push_back(std::deque(d_nchannels)); + d_symbol_TOW_queue_s.push_back(std::deque(d_nchannels)); + } // ############# ENABLE DATA FILE LOG ################# if (d_dump == true) @@ -125,6 +125,10 @@ int galileo_e1_observables_cc::general_work (int noutput_items, gr_vector_int &n Gnss_Synchro current_gnss_synchro[d_nchannels]; std::map current_gnss_synchro_map; std::map::iterator gnss_synchro_iter; + if (d_nchannels != ninput_items.size()) + { + LOG(WARNING) << "The Observables block is not well connected"; + } /* * 1. Read the GNSS SYNCHRO objects from available channels @@ -214,24 +218,25 @@ int galileo_e1_observables_cc::general_work (int noutput_items, gr_vector_int &n if (d_symbol_TOW_queue_s[gnss_synchro_iter->second.Channel_ID].size()>=GPS_L1_CA_HISTORY_DEEP) { // compute interpolated observation values for Doppler and Accumulate carrier phase - symbol_TOW_vec_s=arma::vec(std::vector(d_symbol_TOW_queue_s[gnss_synchro_iter->second.Channel_ID].begin(), d_symbol_TOW_queue_s[gnss_synchro_iter->second.Channel_ID].end())); - acc_phase_vec_rads=arma::vec(std::vector(d_acc_carrier_phase_queue_rads[gnss_synchro_iter->second.Channel_ID].begin(), d_acc_carrier_phase_queue_rads[gnss_synchro_iter->second.Channel_ID].end())); - dopper_vec_hz=arma::vec(std::vector(d_carrier_doppler_queue_hz[gnss_synchro_iter->second.Channel_ID].begin(), d_carrier_doppler_queue_hz[gnss_synchro_iter->second.Channel_ID].end())); - desired_symbol_TOW[0]=symbol_TOW_vec_s[GPS_L1_CA_HISTORY_DEEP-1]+delta_rx_time_ms/1000.0; + symbol_TOW_vec_s = arma::vec(std::vector(d_symbol_TOW_queue_s[gnss_synchro_iter->second.Channel_ID].begin(), d_symbol_TOW_queue_s[gnss_synchro_iter->second.Channel_ID].end())); + acc_phase_vec_rads = arma::vec(std::vector(d_acc_carrier_phase_queue_rads[gnss_synchro_iter->second.Channel_ID].begin(), d_acc_carrier_phase_queue_rads[gnss_synchro_iter->second.Channel_ID].end())); + dopper_vec_hz = arma::vec(std::vector(d_carrier_doppler_queue_hz[gnss_synchro_iter->second.Channel_ID].begin(), d_carrier_doppler_queue_hz[gnss_synchro_iter->second.Channel_ID].end())); + desired_symbol_TOW[0] = symbol_TOW_vec_s[GPS_L1_CA_HISTORY_DEEP - 1] + delta_rx_time_ms / 1000.0; // Curve fitting to cuadratic function - arma::mat A=arma::ones (GPS_L1_CA_HISTORY_DEEP,2); - A.col(1)=symbol_TOW_vec_s; + arma::mat A = arma::ones(GPS_L1_CA_HISTORY_DEEP, 2); + A.col(1) = symbol_TOW_vec_s; //A.col(2)=symbol_TOW_vec_s % symbol_TOW_vec_s; arma::mat coef_acc_phase(1,3); - coef_acc_phase=arma::pinv(A.t()*A)*A.t()*acc_phase_vec_rads; + arma::mat pinv_A = arma::pinv(A.t() * A) * A.t(); + coef_acc_phase = pinv_A * acc_phase_vec_rads; arma::mat coef_doppler(1,3); - coef_doppler=arma::pinv(A.t()*A)*A.t()*dopper_vec_hz; + coef_doppler = pinv_A * dopper_vec_hz; arma::vec acc_phase_lin; arma::vec carrier_doppler_lin; - acc_phase_lin=coef_acc_phase[0]+coef_acc_phase[1]*desired_symbol_TOW[0];//+coef_acc_phase[2]*desired_symbol_TOW[0]*desired_symbol_TOW[0]; - carrier_doppler_lin=coef_doppler[0]+coef_doppler[1]*desired_symbol_TOW[0];//+coef_doppler[2]*desired_symbol_TOW[0]*desired_symbol_TOW[0]; - current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Carrier_phase_rads =acc_phase_lin[0]; - current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Carrier_Doppler_hz =carrier_doppler_lin[0]; + acc_phase_lin = coef_acc_phase[0] + coef_acc_phase[1] * desired_symbol_TOW[0];//+coef_acc_phase[2]*desired_symbol_TOW[0]*desired_symbol_TOW[0]; + carrier_doppler_lin = coef_doppler[0] + coef_doppler[1] * desired_symbol_TOW[0];//+coef_doppler[2]*desired_symbol_TOW[0]*desired_symbol_TOW[0]; + current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Carrier_phase_rads = acc_phase_lin[0]; + current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Carrier_Doppler_hz = carrier_doppler_lin[0]; } } } @@ -267,6 +272,10 @@ int galileo_e1_observables_cc::general_work (int noutput_items, gr_vector_int &n { *out[i] = current_gnss_synchro[i]; } - return 1; //Output the observables + if (noutput_items == 0) + { + LOG(WARNING) << "noutput_items = 0"; + } + return 1; } diff --git a/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc index fcc3c78f2..98dd56ff5 100644 --- a/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc @@ -64,7 +64,7 @@ gps_l1_ca_observables_cc::gps_l1_ca_observables_cc(unsigned int nchannels, boost d_dump_filename = dump_filename; d_flag_averaging = flag_averaging; - for (int i = 0; i < d_nchannels; i++) + for (unsigned int i = 0; i < d_nchannels; i++) { d_acc_carrier_phase_queue_rads.push_back(std::deque(d_nchannels)); d_carrier_doppler_queue_hz.push_back(std::deque(d_nchannels)); @@ -119,6 +119,11 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni Gnss_Synchro current_gnss_synchro[d_nchannels]; std::map current_gnss_synchro_map; std::map::iterator gnss_synchro_iter; + + if (d_nchannels != ninput_items.size()) + { + LOG(WARNING) << "The Observables block is not well connected"; + } /* * 1. Read the GNSS SYNCHRO objects from available channels @@ -229,9 +234,10 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni A.col(1) = symbol_TOW_vec_s; //A.col(2)=symbol_TOW_vec_s % symbol_TOW_vec_s; arma::mat coef_acc_phase(1,3); - coef_acc_phase = arma::pinv(A.t() * A) * A.t() * acc_phase_vec_rads; + arma::mat pinv_A = arma::pinv(A.t() * A) * A.t(); + coef_acc_phase = pinv_A * acc_phase_vec_rads; arma::mat coef_doppler(1,3); - coef_doppler = arma::pinv(A.t() * A) * A.t() * dopper_vec_hz; + coef_doppler = pinv_A * dopper_vec_hz; arma::vec acc_phase_lin; arma::vec carrier_doppler_lin; acc_phase_lin = coef_acc_phase[0] + coef_acc_phase[1] * desired_symbol_TOW[0];//+coef_acc_phase[2]*desired_symbol_TOW[0]*desired_symbol_TOW[0]; @@ -281,6 +287,10 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni { *out[i] = current_gnss_synchro[i]; } - return 1; // Output the observables + if (noutput_items == 0) + { + LOG(WARNING) << "noutput_items = 0"; + } + return 1; } diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc index fee182c22..bc538e0af 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc @@ -121,6 +121,11 @@ int hybrid_observables_cc::general_work (int noutput_items, gr_vector_int &ninpu std::map current_gnss_synchro_map_gps_only; std::map::iterator gnss_synchro_iter; + if (d_nchannels != ninput_items.size()) + { + LOG(WARNING) << "The Observables block is not well connected"; + } + /* * 1. Read the GNSS SYNCHRO objects from available channels */ @@ -228,7 +233,11 @@ int hybrid_observables_cc::general_work (int noutput_items, gr_vector_int &ninpu { *out[i] = current_gnss_synchro[i]; } - //todo: enable output when the hybrid algorithm is completed - return 1; //Output the observables + + if (noutput_items == 0) + { + LOG(WARNING) << "noutput_items = 0"; + } + return 1; } diff --git a/src/algorithms/observables/gnuradio_blocks/mixed_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/mixed_observables_cc.cc index 96b3203d0..29dadd4b9 100644 --- a/src/algorithms/observables/gnuradio_blocks/mixed_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/mixed_observables_cc.cc @@ -112,6 +112,11 @@ int mixed_observables_cc::general_work (int noutput_items, gr_vector_int &ninput std::map current_gnss_synchro_map; std::map::iterator gnss_synchro_iter; + if (d_nchannels != ninput_items.size()) + { + LOG(WARNING) << "The Observables block is not well connected"; + } + /* * 1. Read the GNSS SYNCHRO objects from available channels */ @@ -207,6 +212,10 @@ int mixed_observables_cc::general_work (int noutput_items, gr_vector_int &ninput { *out[i] = current_gnss_synchro[i]; } - return 1; // Output the observables + if (noutput_items == 0) + { + LOG(WARNING) << "noutput_items = 0"; + } + return 1; } 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 787a26439..68a894714 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc @@ -329,8 +329,8 @@ gr_vector_void_star &output_items) // New random data bit current_data_bit_int_[sat] = (rand()%2) == 0 ? 1 : -1; } - data_modulation_[sat] = current_data_bit_int_[sat] * (Galileo_E5a_I_SECONDARY_CODE.at((ms_counter_[sat]+delay_sec_[sat])%20)=='0' ? 1 : -1); - pilot_modulation_[sat] = (Galileo_E5a_Q_SECONDARY_CODE[PRN_[sat] - 1].at((ms_counter_[sat] + delay_sec_[sat]) % 100)=='0' ? 1 : -1); + data_modulation_[sat] = current_data_bit_int_[sat] * (Galileo_E5a_I_SECONDARY_CODE.at((ms_counter_[sat]+delay_sec_[sat]) % 20) == '0' ? 1 : -1); + pilot_modulation_[sat] = (Galileo_E5a_Q_SECONDARY_CODE[PRN_[sat] - 1].at((ms_counter_[sat] + delay_sec_[sat]) % 100) == '0' ? 1 : -1); ms_counter_[sat] = ms_counter_[sat] + static_cast(round(1e3*GALILEO_E5a_CODE_PERIOD)); @@ -384,6 +384,11 @@ gr_vector_void_star &output_items) } } + if((noutput_items == 0) || (ninput_items.size() != 0) || input_items[0] == 0) + { + // do nothing + } + // Tell runtime system how many output items we produced. return 1; } diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc index d0cda4f0a..45e80beba 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc @@ -160,7 +160,7 @@ int unpack_2bit_samples::work(int noutput_items, { if( swap_endian_bytes_ ) { - for(int i = 0; i < ninput_bytes; ++i) + for(unsigned int i = 0; i < ninput_bytes; ++i) { // Read packed input sample (1 byte = 4 samples) raw_byte.byte = in[i]; @@ -174,7 +174,7 @@ int unpack_2bit_samples::work(int noutput_items, } else { - for( int i = 0; i < ninput_bytes; ++i ) + for(unsigned int i = 0; i < ninput_bytes; ++i ) { // Read packed input sample (1 byte = 4 samples) @@ -192,7 +192,7 @@ int unpack_2bit_samples::work(int noutput_items, if( swap_endian_bytes_ ) { - for(int i = 0; i < ninput_bytes; ++i) + for(unsigned int i = 0; i < ninput_bytes; ++i) { // Read packed input sample (1 byte = 4 samples) raw_byte.byte = in[i]; @@ -206,7 +206,7 @@ int unpack_2bit_samples::work(int noutput_items, } else { - for( int i = 0; i < ninput_bytes; ++i ) + for(unsigned int i = 0; i < ninput_bytes; ++i ) { // Read packed input sample (1 byte = 4 samples) diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc index d24e49298..da9857275 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc @@ -62,14 +62,10 @@ GalileoE1BTelemetryDecoder::GalileoE1BTelemetryDecoder(ConfigurationInterface* c std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./navigation.dat"; DLOG(INFO) << "role " << role; - DLOG(INFO) << "vector length " << vector_length_; - vector_length_ = configuration->property(role + ".vector_length", 2048); dump_ = configuration->property(role + ".dump", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); - int fs_in; - fs_in = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); // make telemetry decoder object - telemetry_decoder_ = galileo_e1b_make_telemetry_decoder_cc(satellite_, 0, (long)fs_in, vector_length_, queue_, dump_); // TODO fix me + telemetry_decoder_ = galileo_e1b_make_telemetry_decoder_cc(satellite_, queue_, dump_); // TODO fix me DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; // set the navigation msg queue; telemetry_decoder_->set_ephemeris_queue(&global_galileo_ephemeris_queue); diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc index 01251f6fe..883f0fb20 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc @@ -66,14 +66,10 @@ GalileoE5aTelemetryDecoder::GalileoE5aTelemetryDecoder(ConfigurationInterface* c std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./navigation.dat"; DLOG(INFO) << "role " << role; - DLOG(INFO) << "vector length " << vector_length_; - vector_length_ = configuration->property(role + ".vector_length", 2048); dump_ = configuration->property(role + ".dump", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); - int fs_in; - fs_in = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); // make telemetry decoder object - telemetry_decoder_ = galileo_e5a_make_telemetry_decoder_cc(satellite_, 0, (long)fs_in, vector_length_, queue_, dump_); // TODO fix me + telemetry_decoder_ = galileo_e5a_make_telemetry_decoder_cc(satellite_, queue_, dump_); // TODO fix me DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; // set the navigation msg queue; telemetry_decoder_->set_ephemeris_queue(&global_galileo_ephemeris_queue); diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.h index f99513b3e..bc3921b97 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.h @@ -89,7 +89,6 @@ private: galileo_e5a_telemetry_decoder_cc_sptr telemetry_decoder_; Gnss_Satellite satellite_; int channel_; - unsigned int vector_length_; std::string item_type_; bool dump_; std::string dump_filename_; diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc index 516154965..4f57d08fb 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc @@ -61,14 +61,10 @@ GpsL1CaTelemetryDecoder::GpsL1CaTelemetryDecoder(ConfigurationInterface* configu std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./navigation.dat"; DLOG(INFO) << "role " << role; - DLOG(INFO) << "vector length " << vector_length_; - vector_length_ = configuration->property(role + ".vector_length", 2048); dump_ = configuration->property(role + ".dump", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); - int fs_in; - fs_in = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); // make telemetry decoder object - telemetry_decoder_ = gps_l1_ca_make_telemetry_decoder_cc(satellite_, 0, (long)fs_in, vector_length_, queue_, dump_); // TODO fix me + telemetry_decoder_ = gps_l1_ca_make_telemetry_decoder_cc(satellite_, queue_, dump_); // TODO fix me DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; // set the navigation msg queue; telemetry_decoder_->set_ephemeris_queue(&global_gps_ephemeris_queue); diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l2_m_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l2_m_telemetry_decoder.cc index 695515d0a..037bc77d7 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l2_m_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l2_m_telemetry_decoder.cc @@ -61,14 +61,10 @@ GpsL2MTelemetryDecoder::GpsL2MTelemetryDecoder(ConfigurationInterface* configura std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./navigation.dat"; DLOG(INFO) << "role " << role; - DLOG(INFO) << "vector length " << vector_length_; - vector_length_ = configuration->property(role + ".vector_length", 2048); dump_ = configuration->property(role + ".dump", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); - int fs_in; - fs_in = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); // make telemetry decoder object - telemetry_decoder_ = gps_l2_m_make_telemetry_decoder_cc(satellite_, 0, (long)fs_in, vector_length_, queue_, dump_); // TODO fix me + telemetry_decoder_ = gps_l2_m_make_telemetry_decoder_cc(satellite_, queue_, dump_); // TODO fix me DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; // set the navigation msg queue; telemetry_decoder_->set_ephemeris_queue(&global_gps_cnav_ephemeris_queue); diff --git a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc index 18880caa9..ee48156f1 100644 --- a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc @@ -61,14 +61,10 @@ SbasL1TelemetryDecoder::SbasL1TelemetryDecoder(ConfigurationInterface* configura std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./navigation.dat"; DLOG(INFO) << "role " << role; - DLOG(INFO) << "vector length " << vector_length_; - vector_length_ = configuration->property(role + ".vector_length", 2048); dump_ = configuration->property(role + ".dump", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); - int fs_in; - fs_in = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); // make telemetry decoder object - telemetry_decoder_ = sbas_l1_make_telemetry_decoder_cc(satellite_, 0, (long)fs_in, vector_length_, queue_, dump_); // TODO fix me + telemetry_decoder_ = sbas_l1_make_telemetry_decoder_cc(satellite_, queue_, dump_); // TODO fix me channel_ = 0; DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; // set the queues; 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 0c861fc46..757ced1ac 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 @@ -50,18 +50,19 @@ using google::LogMessage; galileo_e1b_telemetry_decoder_cc_sptr -galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump) +galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump) { - return galileo_e1b_telemetry_decoder_cc_sptr(new galileo_e1b_telemetry_decoder_cc(satellite, if_freq, - fs_in, vector_length, queue, dump)); + return galileo_e1b_telemetry_decoder_cc_sptr(new galileo_e1b_telemetry_decoder_cc(satellite, queue, dump)); } void galileo_e1b_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) { - ninput_items_required[0] = GALILEO_INAV_PAGE_SYMBOLS; // set the required sample history + if(noutput_items != 0) + { + ninput_items_required[0] = GALILEO_INAV_PAGE_SYMBOLS; // set the required sample history + } } @@ -116,10 +117,6 @@ void galileo_e1b_telemetry_decoder_cc::deinterleaver(int rows, int cols, double galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc( Gnss_Satellite satellite, - long if_freq, - long fs_in, - unsigned - int vector_length, boost::shared_ptr queue, bool dump) : gr::block("galileo_e1b_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), @@ -130,9 +127,7 @@ galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc( d_dump = dump; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); LOG(INFO) << "Initializing GALILEO E1B TELEMETRY PROCESSING"; - d_vector_length = vector_length; d_samples_per_symbol = ( Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS ) / Galileo_E1_B_SYMBOL_RATE_BPS; - d_fs_in = fs_in; // set the preamble unsigned short int preambles_bits[GALILEO_INAV_PREAMBLE_LENGTH_BITS] = GALILEO_INAV_PREAMBLE; @@ -499,6 +494,10 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector } //todo: implement averaging d_average_count++; + if((noutput_items == 0) || (ninput_items[0] == 0)) + { + LOG(WARNING) << "noutput_items = 0"; + } if (d_average_count == d_decimation_output_factor) { d_average_count = 0; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h index 9af1bd8c3..805ef1205 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h @@ -54,8 +54,7 @@ class galileo_e1b_telemetry_decoder_cc; typedef boost::shared_ptr galileo_e1b_telemetry_decoder_cc_sptr; -galileo_e1b_telemetry_decoder_cc_sptr galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump); +galileo_e1b_telemetry_decoder_cc_sptr galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); /*! * \brief This class implements a block that decodes the INAV data defined in Galileo ICD @@ -92,10 +91,8 @@ public: private: friend galileo_e1b_telemetry_decoder_cc_sptr - galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned - int vector_length, boost::shared_ptr queue, bool dump); - galileo_e1b_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump); + galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); + galileo_e1b_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); void viterbi_decoder(double *page_part_symbols, int *page_part_bits); @@ -105,7 +102,7 @@ private: unsigned short int d_preambles_bits[GALILEO_INAV_PREAMBLE_LENGTH_BITS]; - signed int *d_preambles_symbols; + int *d_preambles_symbols; unsigned int d_samples_per_symbol; int d_symbols_per_preamble; @@ -118,8 +115,6 @@ private: bool d_flag_preamble; int d_CRC_error_counter; - long d_fs_in; - // navigation message vars Galileo_Navigation_Message d_nav; @@ -133,7 +128,6 @@ private: concurrent_queue *d_almanac_queue; boost::shared_ptr d_queue; - unsigned int d_vector_length; bool d_dump; Gnss_Satellite d_satellite; int d_channel; @@ -151,7 +145,6 @@ private: bool flag_TOW_set; double delta_t; //GPS-GALILEO time offset - std::string d_dump_filename; std::ofstream d_dump_file; }; 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 6df00099a..b63ba395b 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 @@ -55,17 +55,18 @@ using google::LogMessage; galileo_e5a_telemetry_decoder_cc_sptr -galileo_e5a_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump) +galileo_e5a_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump) { - return galileo_e5a_telemetry_decoder_cc_sptr(new galileo_e5a_telemetry_decoder_cc(satellite, if_freq, - fs_in, vector_length, queue, dump)); + return galileo_e5a_telemetry_decoder_cc_sptr(new galileo_e5a_telemetry_decoder_cc(satellite, queue, dump)); } void galileo_e5a_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) { //ninput_items_required[0] = GALILEO_FNAV_SAMPLES_PER_PAGE; // set the required sample history - ninput_items_required[0] = GALILEO_FNAV_CODES_PER_PREAMBLE; + if (noutput_items != 0) + { + ninput_items_required[0] = GALILEO_FNAV_CODES_PER_PREAMBLE; + } } void galileo_e5a_telemetry_decoder_cc::viterbi_decoder(double *page_part_symbols, int *page_part_bits) @@ -192,10 +193,6 @@ void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols,int fram galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc( Gnss_Satellite satellite, - long if_freq, - long fs_in, - unsigned - int vector_length, boost::shared_ptr queue, bool dump) : gr::block("galileo_e5a_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), @@ -206,9 +203,7 @@ galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc( d_dump = dump; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); LOG(INFO) << "GALILEO E5A TELEMETRY PROCESSING: satellite " << d_satellite; - d_vector_length = vector_length; //d_samples_per_symbol = ( Galileo_E5a_CODE_CHIP_RATE_HZ / Galileo_E5a_CODE_LENGTH_CHIPS ) / Galileo_E1_B_SYMBOL_RATE_BPS; - d_fs_in = fs_in; // set the preamble //unsigned short int preambles_bits[GALILEO_FNAV_PREAMBLE_LENGTH_BITS] = GALILEO_FNAV_PREAMBLE; @@ -585,6 +580,10 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector d_sample_counter++; //count for the processed samples //3. Make the output (copy the object contents to the GNURadio reserved memory) *out[0] = current_synchro_data; + if((noutput_items == 0) || (ninput_items[0] == 0)) + { + LOG(WARNING) << "noutput_items = 0"; + } return 1; } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.h index 4edb88492..0573fe02d 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.h @@ -58,8 +58,7 @@ class galileo_e5a_telemetry_decoder_cc; typedef boost::shared_ptr galileo_e5a_telemetry_decoder_cc_sptr; -galileo_e5a_telemetry_decoder_cc_sptr galileo_e5a_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump); +galileo_e5a_telemetry_decoder_cc_sptr galileo_e5a_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); /*! @@ -90,10 +89,8 @@ public: private: friend galileo_e5a_telemetry_decoder_cc_sptr - galileo_e5a_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned - int vector_length, boost::shared_ptr queue, bool dump); - galileo_e5a_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump); + galileo_e5a_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); + galileo_e5a_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); void viterbi_decoder(double *page_part_symbols, int *page_part_bits); @@ -101,10 +98,10 @@ private: void decode_word(double *page_symbols,int frame_length); - signed int d_preamble_bits[GALILEO_FNAV_PREAMBLE_LENGTH_BITS]; -// signed int d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS]; + int d_preamble_bits[GALILEO_FNAV_PREAMBLE_LENGTH_BITS]; + // signed int d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS]; double d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS]; - // signed int *d_preamble_symbols; + // signed int *d_preamble_symbols; double d_current_symbol; long unsigned int d_symbol_counter; int d_prompt_counter; @@ -120,8 +117,6 @@ private: bool d_flag_preamble; int d_CRC_error_counter; - long d_fs_in; - // navigation message vars Galileo_Fnav_Message d_nav; @@ -135,7 +130,6 @@ private: concurrent_queue *d_almanac_queue; boost::shared_ptr d_queue; - unsigned int d_vector_length; bool d_dump; Gnss_Satellite d_satellite; int d_channel; 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 f8d3f7cb9..0105f143b 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 @@ -52,20 +52,21 @@ using google::LogMessage; * \todo name and move the magic numbers to GPS_L1_CA.h */ gps_l1_ca_telemetry_decoder_cc_sptr -gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump) +gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump) { - return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, if_freq, - fs_in, vector_length, queue, dump)); + return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, queue, dump)); } void gps_l1_ca_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) { - for (unsigned i = 0; i < 3; i++) + if (noutput_items != 0) { - ninput_items_required[i] = d_samples_per_bit * 8; //set the required sample history + for (unsigned i = 0; i < 3; i++) + { + ninput_items_required[i] = d_samples_per_bit * 8; //set the required sample history + } } } @@ -73,10 +74,6 @@ void gps_l1_ca_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc( Gnss_Satellite satellite, - long if_freq, - long fs_in, - unsigned - int vector_length, boost::shared_ptr queue, bool dump) : gr::block("gps_navigation_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), @@ -86,9 +83,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc( d_queue = queue; d_dump = dump; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); - d_vector_length = vector_length; d_samples_per_bit = ( GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS ) / GPS_CA_TELEMETRY_RATE_BITS_SECOND; - d_fs_in = fs_in; //d_preamble_duration_seconds = (1.0 / GPS_CA_TELEMETRY_RATE_BITS_SECOND) * GPS_CA_PREAMBLE_LENGTH_BITS; //std::cout<<"d_preamble_duration_seconds="< gps_l1_ca_telemetry_decoder_cc_sptr; gps_l1_ca_telemetry_decoder_cc_sptr -gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump); +gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); /*! * \brief This class implements a block that decodes the NAV data defined in IS-GPS-200E @@ -90,11 +89,9 @@ public: private: friend gps_l1_ca_telemetry_decoder_cc_sptr - gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned - int vector_length, boost::shared_ptr queue, bool dump); + gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); - gps_l1_ca_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump); + gps_l1_ca_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); bool gps_word_parityCheck(unsigned int gpsword); @@ -102,7 +99,7 @@ private: unsigned short int d_preambles_bits[GPS_CA_PREAMBLE_LENGTH_BITS]; // class private vars - signed int *d_preambles_symbols; + int *d_preambles_symbols; unsigned int d_samples_per_bit; long unsigned int d_sample_counter; long unsigned int d_preamble_index; @@ -125,14 +122,12 @@ private: int d_average_count; int d_decimation_output_factor; - long d_fs_in; //double d_preamble_duration_seconds; // navigation message vars Gps_Navigation_Message d_nav; GpsL1CaSubframeFsm d_GPS_FSM; boost::shared_ptr d_queue; - unsigned int d_vector_length; bool d_dump; Gnss_Satellite d_satellite; int d_channel; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.cc index 4dc4b07b4..44900bc4a 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.cc @@ -48,21 +48,15 @@ using google::LogMessage; gps_l2_m_telemetry_decoder_cc_sptr -gps_l2_m_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump) +gps_l2_m_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump) { - return gps_l2_m_telemetry_decoder_cc_sptr(new gps_l2_m_telemetry_decoder_cc(satellite, if_freq, - fs_in, vector_length, queue, dump)); + return gps_l2_m_telemetry_decoder_cc_sptr(new gps_l2_m_telemetry_decoder_cc(satellite, queue, dump)); } gps_l2_m_telemetry_decoder_cc::gps_l2_m_telemetry_decoder_cc( Gnss_Satellite satellite, - long if_freq, - long fs_in, - unsigned - int vector_length, boost::shared_ptr queue, bool dump) : gr::block("gps_l2_m_telemetry_decoder_cc", @@ -73,7 +67,6 @@ gps_l2_m_telemetry_decoder_cc::gps_l2_m_telemetry_decoder_cc( d_dump = dump; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); LOG(INFO) << "GPS L2C M TELEMETRY PROCESSING: satellite " << d_satellite; - d_fs_in = fs_in; d_block_size = GPS_L2_SAMPLES_PER_SYMBOL * GPS_L2_SYMBOLS_PER_BIT * GPS_L2_CNAV_DATA_PAGE_BITS * 2; // two CNAV frames d_decimation_output_factor = 0; //set_output_multiple (1); @@ -99,9 +92,12 @@ gps_l2_m_telemetry_decoder_cc::~gps_l2_m_telemetry_decoder_cc() void gps_l2_m_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) { - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = noutput_items; + if (noutput_items != 0) + { + unsigned ninputs = ninput_items_required.size (); + for (unsigned i = 0; i < ninputs; i++) + ninput_items_required[i] = noutput_items; + } //LOG(INFO) << "forecast(): " << "noutput_items=" << noutput_items << "\tninput_items_required ninput_items_required.size()=" << ninput_items_required.size(); } @@ -262,6 +258,10 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_in } d_average_count++; + if((noutput_items == 0) || (ninput_items[0] == 0)) + { + LOG(WARNING) << "noutput_items = 0"; + } if (d_average_count == d_decimation_output_factor) { d_average_count = 0; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.h index bf63bad27..e3cf010e2 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.h @@ -53,8 +53,7 @@ class gps_l2_m_telemetry_decoder_cc; typedef boost::shared_ptr gps_l2_m_telemetry_decoder_cc_sptr; gps_l2_m_telemetry_decoder_cc_sptr -gps_l2_m_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump); +gps_l2_m_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); /*! * \brief This class implements a block that decodes the SBAS integrity and corrections data defined in RTCA MOPS DO-229 @@ -87,17 +86,14 @@ public: private: friend gps_l2_m_telemetry_decoder_cc_sptr - gps_l2_m_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned - int vector_length, boost::shared_ptr queue, bool dump); - gps_l2_m_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump); + gps_l2_m_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); + gps_l2_m_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); void viterbi_decoder(double *page_part_symbols, int *page_part_bits); void align_samples(); concurrent_queue *d_iono_queue; concurrent_queue *d_ephemeris_queue; - long d_fs_in; bool d_dump; Gnss_Satellite d_satellite; 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 5ab1e3a74..eea32adeb 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 @@ -48,21 +48,15 @@ using google::LogMessage; sbas_l1_telemetry_decoder_cc_sptr -sbas_l1_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump) +sbas_l1_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump) { - return sbas_l1_telemetry_decoder_cc_sptr(new sbas_l1_telemetry_decoder_cc(satellite, if_freq, - fs_in, vector_length, queue, dump)); + return sbas_l1_telemetry_decoder_cc_sptr(new sbas_l1_telemetry_decoder_cc(satellite, queue, dump)); } sbas_l1_telemetry_decoder_cc::sbas_l1_telemetry_decoder_cc( Gnss_Satellite satellite, - long if_freq, - long fs_in, - unsigned - int vector_length, boost::shared_ptr queue, bool dump) : gr::block("sbas_l1_telemetry_decoder_cc", @@ -73,7 +67,6 @@ sbas_l1_telemetry_decoder_cc::sbas_l1_telemetry_decoder_cc( d_dump = dump; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); LOG(INFO) << "SBAS L1 TELEMETRY PROCESSING: satellite " << d_satellite; - d_fs_in = fs_in; d_block_size = d_samples_per_symbol * d_symbols_per_bit * d_block_size_in_bits; d_channel = 0; set_output_multiple (1); @@ -187,6 +180,10 @@ int sbas_l1_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int current_synchro_data[i].Flag_valid_word = false; // indicate to observable block that this synchro object isn't valid for pseudorange computation } consume_each(noutput_items); // tell scheduler input items consumed + if((noutput_items == 0) || (ninput_items[0] == 0)) + { + LOG(WARNING) << "noutput_items = 0"; + } return noutput_items; // tell scheduler output items produced } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.h index fbf2170ac..97a09ec7e 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.h @@ -49,8 +49,7 @@ class sbas_l1_telemetry_decoder_cc; typedef boost::shared_ptr sbas_l1_telemetry_decoder_cc_sptr; sbas_l1_telemetry_decoder_cc_sptr -sbas_l1_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump); +sbas_l1_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); /*! * \brief This class implements a block that decodes the SBAS integrity and corrections data defined in RTCA MOPS DO-229 @@ -83,10 +82,8 @@ public: private: friend sbas_l1_telemetry_decoder_cc_sptr - sbas_l1_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned - int vector_length, boost::shared_ptr queue, bool dump); - sbas_l1_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned - int vector_length, boost::shared_ptr queue, bool dump); + sbas_l1_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); + sbas_l1_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, bool dump); void viterbi_decoder(double *page_part_symbols, int *page_part_bits); void align_samples(); @@ -95,8 +92,6 @@ private: static const int d_symbols_per_bit = 2; static const int d_block_size_in_bits = 30; - long d_fs_in; - bool d_dump; Gnss_Satellite d_satellite; int d_channel; diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc index fed22438f..6c21126ec 100755 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc @@ -84,7 +84,10 @@ galileo_e1_dll_pll_veml_make_tracking_cc( void galileo_e1_dll_pll_veml_tracking_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) { - ninput_items_required[0] = static_cast(d_vector_length) * 2; //set the required available samples in each call + if (noutput_items != 0) + { + ninput_items_required[0] = static_cast(d_vector_length) * 2; //set the required available samples in each call + } } @@ -210,10 +213,10 @@ void galileo_e1_dll_pll_veml_tracking_cc::start_tracking() d_carrier_lock_fail_counter = 0; d_rem_code_phase_samples = 0.0; - d_rem_carr_phase_rad = 0; - d_acc_carrier_phase_rad = 0; + d_rem_carr_phase_rad = 0.0; + d_acc_carrier_phase_rad = 0.0; - d_acc_code_phase_secs = 0; + d_acc_code_phase_secs = 0.0; d_carrier_doppler_hz = d_acq_carrier_doppler_hz; d_current_prn_length_samples = d_vector_length; @@ -307,7 +310,7 @@ galileo_e1_dll_pll_veml_tracking_cc::~galileo_e1_dll_pll_veml_tracking_cc() -int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vector_int &ninput_items, +int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { double carr_error_hz = 0.0; @@ -326,7 +329,7 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect double acq_trk_shif_correction_samples; int acq_to_trk_delay_samples; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; - acq_trk_shif_correction_samples = d_current_prn_length_samples - std::fmod(static_cast(acq_to_trk_delay_samples), static_cast(d_current_prn_length_samples)); + acq_trk_shif_correction_samples = d_current_prn_length_samples - std::fmod(static_cast(acq_to_trk_delay_samples), static_cast(d_current_prn_length_samples)); samples_offset = std::round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples d_pull_in = false; @@ -394,7 +397,7 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect double T_prn_seconds; double T_prn_samples; double K_blk_samples; - // Compute the next buffer lenght based in the new period of the PRN sequence and the code phase error estimation + // Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation T_chip_seconds = 1.0 / d_code_freq_chips; T_prn_seconds = T_chip_seconds * Galileo_E1_B_CODE_LENGTH_CHIPS; T_prn_samples = T_prn_seconds * static_cast(d_fs_in); @@ -582,7 +585,11 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect } consume_each(d_current_prn_length_samples); // this is required for gr_block derivates d_sample_counter += d_current_prn_length_samples; //count for the processed samples - //std::cout<<"Galileo tracking output at sample "<(d_vector_length)*2; //set the required available samples in each call + if (noutput_items != 0) + { + ninput_items_required[0] = static_cast(d_vector_length)*2; //set the required available samples in each call + } } Galileo_E5a_Dll_Pll_Tracking_cc::Galileo_E5a_Dll_Pll_Tracking_cc( @@ -828,6 +831,10 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_ d_secondary_delay = (d_secondary_delay + 1) % Galileo_E5a_Q_SECONDARY_CODE_LENGTH; d_sample_counter += d_current_prn_length_samples; //count for the processed samples consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates + if((noutput_items == 0) || (ninput_items[0] == 0)) + { + LOG(WARNING) << "noutput_items = 0"; + } return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_volk_e1_dll_pll_veml_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_volk_e1_dll_pll_veml_tracking_cc.cc index c3c659686..12941330a 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_volk_e1_dll_pll_veml_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_volk_e1_dll_pll_veml_tracking_cc.cc @@ -85,7 +85,10 @@ galileo_volk_e1_dll_pll_veml_make_tracking_cc( void galileo_volk_e1_dll_pll_veml_tracking_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) { - ninput_items_required[0] = static_cast(d_vector_length) * 2; //set the required available samples in each call + if (noutput_items != 0) + { + ninput_items_required[0] = static_cast(d_vector_length) * 2; //set the required available samples in each call + } } @@ -135,21 +138,21 @@ gr::block("galileo_volk_e1_dll_pll_veml_tracking_cc", gr::io_signature::make(1, d_very_late_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); d_carr_sign = static_cast(volk_malloc(2*d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_very_early_code16=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); - d_early_code16=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); - d_prompt_code16=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); - d_late_code16=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); - d_very_late_code16=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); - d_carr_sign16=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); - in16=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); + d_very_early_code16 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); + d_early_code16 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); + d_prompt_code16 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); + d_late_code16 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); + d_very_late_code16 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); + d_carr_sign16 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); + in16 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_16sc_t), volk_get_alignment())); - d_very_early_code8=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); - d_early_code8=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); - d_prompt_code8=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); - d_late_code8=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); - d_very_late_code8=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); - d_carr_sign8=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); - in8=static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); + d_very_early_code8 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); + d_early_code8 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); + d_prompt_code8 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); + d_late_code8 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); + d_very_late_code8 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); + d_carr_sign8 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); + in8 = static_cast(volk_malloc(2 * d_vector_length * sizeof(lv_8sc_t), volk_get_alignment())); // correlator outputs (scalar) d_Very_Early = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); @@ -337,13 +340,13 @@ galileo_volk_e1_dll_pll_veml_tracking_cc::~galileo_volk_e1_dll_pll_veml_tracking -int galileo_volk_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vector_int &ninput_items, +int galileo_volk_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - double carr_error_hz; - double carr_error_filt_hz; - double code_error_chips; - double code_error_filt_chips; + double carr_error_hz = 0.0; + double carr_error_filt_hz = 0.0; + double code_error_chips = 0.0; + double code_error_filt_chips = 0.0; if (d_enable_tracking == true) { @@ -411,7 +414,7 @@ int galileo_volk_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr // ################## PLL ########################################################## // PLL discriminator - carr_error_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / static_cast(GPS_TWO_PI); + carr_error_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / GPS_TWO_PI; // Carrier discriminator filter carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz); // New carrier Doppler frequency estimation @@ -629,7 +632,11 @@ int galileo_volk_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr } consume_each(d_current_prn_length_samples); // this is required for gr_block derivates d_sample_counter += d_current_prn_length_samples; //count for the processed samples - //std::cout<<"Galileo tracking output at sample "<(d_vector_length) * 2; //set the required available samples in each call + if (noutput_items != 0) + { + ninput_items_required[0] = static_cast(d_vector_length) * 2; //set the required available samples in each call + } } @@ -319,21 +322,21 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec // ################# CARRIER WIPEOFF AND CORRELATORS ############################## // perform carrier wipe-off and compute Early, Prompt and Late correlation multicorrelator_cpu.set_input_output_vectors(d_correlator_outs,in); - multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad,d_carrier_phase_step_rad,d_rem_code_phase_chips,d_code_phase_step_chips,d_correlation_length_samples); + multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad, d_carrier_phase_step_rad, d_rem_code_phase_chips, d_code_phase_step_chips, d_correlation_length_samples); // UPDATE INTEGRATION TIME - CURRENT_INTEGRATION_TIME_S=(static_cast(d_correlation_length_samples)/static_cast(d_fs_in)); + CURRENT_INTEGRATION_TIME_S = static_cast(d_correlation_length_samples) / static_cast(d_fs_in); // ################## PLL ########################################################## // Update PLL discriminator [rads/Ti -> Secs/Ti] - carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(d_correlator_outs[1])/GPS_TWO_PI; //prompt output + carr_phase_error_secs_Ti = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GPS_TWO_PI; //prompt output // Carrier discriminator filter // NOTICE: The carrier loop filter includes the Carrier Doppler accumulator, as described in Kaplan //d_carrier_doppler_hz = d_acq_carrier_doppler_hz + carr_phase_error_filt_secs_ti/INTEGRATION_TIME; // Input [s/Ti] -> output [Hz] d_carrier_doppler_hz = d_carrier_loop_filter.get_carrier_error(0.0, carr_phase_error_secs_Ti, CURRENT_INTEGRATION_TIME_S); // PLL to DLL assistance [Secs/Ti] - d_pll_to_dll_assist_secs_Ti = (d_carrier_doppler_hz*CURRENT_INTEGRATION_TIME_S)/GPS_L1_FREQ_HZ; + d_pll_to_dll_assist_secs_Ti = (d_carrier_doppler_hz * CURRENT_INTEGRATION_TIME_S) / GPS_L1_FREQ_HZ; // code Doppler frequency update d_code_freq_chips = GPS_L1_CA_CODE_RATE_HZ + ((d_carrier_doppler_hz * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ); @@ -345,7 +348,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec code_error_filt_secs_Ti = code_error_filt_chips*CURRENT_INTEGRATION_TIME_S/d_code_freq_chips; // [s/Ti] // DLL code error estimation [s/Ti] // TODO: PLL carrier aid to DLL is disabled. Re-enable it and measure performance - dll_code_error_secs_Ti=-code_error_filt_secs_Ti+d_pll_to_dll_assist_secs_Ti; + dll_code_error_secs_Ti = - code_error_filt_secs_Ti + d_pll_to_dll_assist_secs_Ti; // ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT ####################### // keep alignment parameters for the next input buffer @@ -363,19 +366,17 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec old_d_rem_code_phase_samples=d_rem_code_phase_samples; d_rem_code_phase_samples = K_blk_samples - static_cast(d_correlation_length_samples); //rounding error < 1 sample - // UPDATE REMNANT CARRIER PHASE CORRECTED_INTEGRATION_TIME_S=(static_cast(d_correlation_length_samples)/static_cast(d_fs_in)); //remnant carrier phase [rad] - d_rem_carrier_phase_rad = fmod(d_rem_carrier_phase_rad + GPS_TWO_PI * d_carrier_doppler_hz * CORRECTED_INTEGRATION_TIME_S,GPS_TWO_PI); + d_rem_carrier_phase_rad = fmod(d_rem_carrier_phase_rad + GPS_TWO_PI * d_carrier_doppler_hz * CORRECTED_INTEGRATION_TIME_S, GPS_TWO_PI); // UPDATE CARRIER PHASE ACCUULATOR //carrier phase accumulator prior to update the PLL estimators (accumulated carrier in this loop depends on the old estimations!) - d_acc_carrier_phase_cycles -= d_carrier_doppler_hz*CORRECTED_INTEGRATION_TIME_S; - + d_acc_carrier_phase_cycles -= d_carrier_doppler_hz * CORRECTED_INTEGRATION_TIME_S; //################### PLL COMMANDS ################################################# //carrier phase step (NCO phase increment per sample) [rads/sample] - d_carrier_phase_step_rad=GPS_TWO_PI*d_carrier_doppler_hz/static_cast(d_fs_in); + d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); //################### DLL COMMANDS ################################################# //code phase step (Code resampler phase increment per sample) [chips/sample] @@ -383,7 +384,6 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec //remnant code phase [chips] d_rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / static_cast(d_fs_in)); - // ####### CN0 ESTIMATION AND LOCK DETECTORS ####################################### if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES) { @@ -428,7 +428,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec current_synchro_data.Tracking_timestamp_secs = (static_cast(d_sample_counter) + old_d_rem_code_phase_samples) / static_cast(d_fs_in); // This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0 current_synchro_data.Code_phase_secs = 0; - current_synchro_data.Carrier_phase_rads = GPS_TWO_PI*d_acc_carrier_phase_cycles; + current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz; current_synchro_data.Flag_valid_pseudorange = false; @@ -446,7 +446,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec d_last_seg = floor(d_sample_counter / d_fs_in); std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; DLOG(INFO) << "GPS L1 C/A Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; + << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; //if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock! } } @@ -456,7 +456,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec { d_last_seg = floor(d_sample_counter / d_fs_in); DLOG(INFO) << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; + << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; } } } @@ -544,9 +544,13 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec } } - consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates - d_sample_counter += d_correlation_length_samples; //count for the processed samples + consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates + d_sample_counter += d_correlation_length_samples; //count for the processed samples + if((noutput_items == 0) || (ninput_items[0] == 0)) + { + LOG(WARNING) << "noutput_items = 0"; + } return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc index bd5dcce0b..66ed0aa60 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_optim_tracking_cc.cc @@ -82,7 +82,10 @@ gps_l1_ca_dll_pll_make_optim_tracking_cc( void Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) { - ninput_items_required[0] = d_gnuradio_forecast_samples; //set the required available samples in each call + if (noutput_items != 0) + { + ninput_items_required[0] = d_gnuradio_forecast_samples; //set the required available samples in each call + } } @@ -338,10 +341,10 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec { // stream to collect cout calls to improve thread safety std::stringstream tmp_str_stream; - double carr_error_hz; - double carr_error_filt_hz; - double code_error_chips; - double code_error_filt_chips; + double carr_error_hz = 0.0; + double carr_error_filt_hz = 0.0; + double code_error_chips = 0.0; + double code_error_filt_chips = 0.0; if (d_enable_tracking == true) { @@ -604,6 +607,10 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec consume_each(d_current_prn_length_samples); // this is necesary in gr_block derivates d_sample_counter += d_current_prn_length_samples; //count for the processed samples + if((noutput_items == 0) || (ninput_items[0] == 0)) + { + LOG(WARNING) << "noutput_items = 0"; + } return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc index cd7bb2b5a..9baf99766 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc @@ -83,7 +83,10 @@ gps_l1_ca_dll_pll_make_tracking_cc( void Gps_L1_Ca_Dll_Pll_Tracking_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) { - ninput_items_required[0] = static_cast(d_vector_length) * 2; //set the required available samples in each call + if (noutput_items != 0) + { + ninput_items_required[0] = static_cast(d_vector_length) * 2; //set the required available samples in each call + } } @@ -204,16 +207,16 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() d_code_freq_chips = radial_velocity * GPS_L1_CA_CODE_RATE_HZ; T_chip_mod_seconds = 1/d_code_freq_chips; T_prn_mod_seconds = T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; - T_prn_mod_samples = T_prn_mod_seconds * static_cast(d_fs_in); + T_prn_mod_samples = T_prn_mod_seconds * static_cast(d_fs_in); d_current_prn_length_samples = round(T_prn_mod_samples); double T_prn_true_seconds = GPS_L1_CA_CODE_LENGTH_CHIPS / GPS_L1_CA_CODE_RATE_HZ; - double T_prn_true_samples = T_prn_true_seconds * static_cast(d_fs_in); - double T_prn_diff_seconds= T_prn_true_seconds - T_prn_mod_seconds; + double T_prn_true_samples = T_prn_true_seconds * static_cast(d_fs_in); + double T_prn_diff_seconds = T_prn_true_seconds - T_prn_mod_seconds; double N_prn_diff = acq_trk_diff_seconds / T_prn_true_seconds; double corrected_acq_phase_samples, delay_correction_samples; - corrected_acq_phase_samples = fmod((d_acq_code_phase_samples + T_prn_diff_seconds * N_prn_diff * static_cast(d_fs_in)), T_prn_true_samples); + corrected_acq_phase_samples = fmod((d_acq_code_phase_samples + T_prn_diff_seconds * N_prn_diff * static_cast(d_fs_in)), T_prn_true_samples); if (corrected_acq_phase_samples < 0) { corrected_acq_phase_samples = T_prn_mod_samples + corrected_acq_phase_samples; @@ -235,9 +238,9 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() d_carrier_lock_fail_counter = 0; d_rem_code_phase_samples = 0; - d_rem_carr_phase_rad = 0; - d_acc_carrier_phase_rad = 0; - d_acc_code_phase_secs = 0; + d_rem_carr_phase_rad = 0.0; + d_acc_carrier_phase_rad = 0.0; + d_acc_code_phase_secs = 0.0; d_code_phase_samples = d_acq_code_phase_samples; @@ -248,7 +251,6 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() std::cout << "Tracking start on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl; LOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel; - // enable tracking d_pull_in = true; d_enable_tracking = true; @@ -336,10 +338,10 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // process vars - double carr_error_hz; - double carr_error_filt_hz; - double code_error_chips; - double code_error_filt_chips; + double carr_error_hz = 0.0; + double carr_error_filt_hz = 0.0; + double code_error_chips = 0.0; + double code_error_filt_chips = 0.0; // Block input data and block output stream pointers const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment @@ -623,7 +625,11 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates d_sample_counter += d_current_prn_length_samples; //count for the processed samples - //LOG(INFO)<<"GPS tracking output end on CH="<d_channel << " SAMPLE STAMP="<(d_vector_length) * 2; //set the required available samples in each call + if (noutput_items != 0) + { + ninput_items_required[0] = static_cast(d_vector_length) * 2; //set the required available samples in each call + } } @@ -286,10 +289,10 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items, gr_vecto gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // process vars - float carr_error_hz=0.0; - float carr_error_filt_hz=0.0; - float code_error_chips=0.0; - float code_error_filt_chips=0.0; + float carr_error_hz = 0.0; + float carr_error_filt_hz = 0.0; + float code_error_chips = 0.0; + float code_error_filt_chips = 0.0; // Block input data and block output stream pointers const gr_complex* in = (gr_complex*) input_items[0]; @@ -541,7 +544,10 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items, gr_vecto consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates d_sample_counter += d_current_prn_length_samples; //count for the processed samples - //LOG(INFO)<<"GPS tracking output end on CH="<d_channel << " SAMPLE STAMP="<(d_vector_length) * 2; //set the required available samples in each call + if (noutput_items != 0) + { + ninput_items_required[0] = static_cast(d_vector_length) * 2; //set the required available samples in each call + } } @@ -627,7 +630,10 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int } consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates d_sample_counter += d_current_prn_length_samples; //count for the processed samples - //LOG(INFO)<<"GPS L2 tracking output end on CH="<d_channel << " SAMPLE STAMP="<(gps_L1_pseudorange) * 0.02 + ambiguity * 299792.458; diff --git a/src/core/system_parameters/sbas_telemetry_data.cc b/src/core/system_parameters/sbas_telemetry_data.cc index 15a504825..29c81a3ae 100644 --- a/src/core/system_parameters/sbas_telemetry_data.cc +++ b/src/core/system_parameters/sbas_telemetry_data.cc @@ -467,8 +467,8 @@ int Sbas_Telemetry_Data::getbits(const unsigned char *buff, int pos, int len) *-----------------------------------------------------------------------------*/ Sbas_Telemetry_Data::gtime_t Sbas_Telemetry_Data::epoch2time(const double *ep) { - const int doy[]={1, 32, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}; - gtime_t time = {0}; + const int doy[] = {1, 32, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}; + gtime_t time = {}; int days, sec, year = (int)ep[0], mon = (int)ep[1], day = (int)ep[2]; if (year < 1970 || 2099 < year || mon < 1 || 12 < mon) return time; diff --git a/src/tests/arithmetic/tracking_loop_filter_test.cc b/src/tests/arithmetic/tracking_loop_filter_test.cc index 10cfe97b0..a240ac09d 100644 --- a/src/tests/arithmetic/tracking_loop_filter_test.cc +++ b/src/tests/arithmetic/tracking_loop_filter_test.cc @@ -30,8 +30,6 @@ */ #include "tracking_loop_filter.h" -#include "tracking_2nd_PLL_filter.h" - #include TEST(TrackingLoopFilterTest, FirstOrderLoop) @@ -51,21 +49,21 @@ TEST(TrackingLoopFilterTest, FirstOrderLoop) EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator ); EXPECT_EQ( theFilter.get_order(), loop_order ); - std::vector< float > sample_data = { 0, 0, 1.0, 0.0, 0.0, 0.0 }; + std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 }; theFilter.initialize( 0.0 ); - float g1 = noise_bandwidth*4.0; + float g1 = noise_bandwidth * 4.0; float result = 0.0; for( unsigned int i = 0; i < sample_data.size(); ++i ) { result = theFilter.apply( sample_data[i] ); - - ASSERT_FLOAT_EQ( result, sample_data[i]*g1 ); + EXPECT_FLOAT_EQ( result, sample_data[i]*g1 ); } } + TEST(TrackingLoopFilterTest, FirstOrderLoopWithLastIntegrator) { int loop_order = 1; @@ -83,20 +81,17 @@ TEST(TrackingLoopFilterTest, FirstOrderLoopWithLastIntegrator) EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator ); EXPECT_EQ( theFilter.get_order(), loop_order ); - std::vector< float > sample_data = { 0, 0, 1.0, 0.0, 0.0, 0.0 }; + std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 }; std::vector< float > expected_out = { 0.0, 0.0, 0.01, 0.02, 0.02, 0.02 }; theFilter.initialize( 0.0 ); - float g1 = noise_bandwidth*4.0; - float result = 0.0; for( unsigned int i = 0; i < sample_data.size(); ++i ) { result = theFilter.apply( sample_data[i] ); - ASSERT_NEAR( result, expected_out[i], 1e-4 ); + EXPECT_NEAR( result, expected_out[i], 1e-4 ); } - std::cout << std::endl; } @@ -118,7 +113,7 @@ TEST(TrackingLoopFilterTest, SecondOrderLoop) EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator ); EXPECT_EQ( theFilter.get_order(), loop_order ); - std::vector< float > sample_data = { 0, 0, 1.0, 0.0, 0.0, 0.0 }; + std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 }; std::vector< float > expected_out = { 0.0, 0.0, 13.37778, 0.0889, 0.0889, 0.0889 }; theFilter.initialize( 0.0 ); @@ -127,11 +122,11 @@ TEST(TrackingLoopFilterTest, SecondOrderLoop) for( unsigned int i = 0; i < sample_data.size(); ++i ) { result = theFilter.apply( sample_data[i] ); - - ASSERT_NEAR( result, expected_out[i], 1e-4 ); + EXPECT_NEAR( result, expected_out[i], 1e-4 ); } } + TEST(TrackingLoopFilterTest, SecondOrderLoopWithLastIntegrator) { int loop_order = 2; @@ -149,21 +144,17 @@ TEST(TrackingLoopFilterTest, SecondOrderLoopWithLastIntegrator) EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator ); EXPECT_EQ( theFilter.get_order(), loop_order ); - std::vector< float > sample_data = { 0, 0, 1.0, 0.0, 0.0, 0.0 }; + std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 }; std::vector< float > expected_out = { 0.0, 0.0, 0.006689, 0.013422, 0.013511, 0.013600 }; theFilter.initialize( 0.0 ); - float g1 = noise_bandwidth*4.0; - float result = 0.0; for( unsigned int i = 0; i < sample_data.size(); ++i ) { result = theFilter.apply( sample_data[i] ); - - ASSERT_NEAR( result, expected_out[i], 1e-4 ); + EXPECT_NEAR( result, expected_out[i], 1e-4 ); } - std::cout << std::endl; } @@ -184,7 +175,7 @@ TEST(TrackingLoopFilterTest, ThirdOrderLoop) EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator ); EXPECT_EQ( theFilter.get_order(), loop_order ); - std::vector< float > sample_data = { 0, 0, 1.0, 0.0, 0.0, 0.0 }; + std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 }; std::vector< float > expected_out = { 0.0, 0.0, 15.31877, 0.04494, 0.04520, 0.04546}; theFilter.initialize( 0.0 ); @@ -193,11 +184,11 @@ TEST(TrackingLoopFilterTest, ThirdOrderLoop) for( unsigned int i = 0; i < sample_data.size(); ++i ) { result = theFilter.apply( sample_data[i] ); - - ASSERT_NEAR( result, expected_out[i], 1e-4 ); + EXPECT_NEAR( result, expected_out[i], 1e-4 ); } } + TEST(TrackingLoopFilterTest, ThirdOrderLoopWithLastIntegrator) { int loop_order = 3; @@ -215,20 +206,17 @@ TEST(TrackingLoopFilterTest, ThirdOrderLoopWithLastIntegrator) EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator ); EXPECT_EQ( theFilter.get_order(), loop_order ); - std::vector< float > sample_data = { 0, 0, 1.0, 0.0, 0.0, 0.0 }; + std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 }; std::vector< float > expected_out = { 0.0, 0.0, 0.007659, 0.015341, 0.015386, 0.015432}; theFilter.initialize( 0.0 ); - float g1 = noise_bandwidth*4.0; - float result = 0.0; for( unsigned int i = 0; i < sample_data.size(); ++i ) { result = theFilter.apply( sample_data[i] ); - ASSERT_NEAR( result, expected_out[i], 1e-4 ); + EXPECT_NEAR( result, expected_out[i], 1e-4 ); } - std::cout << std::endl; } diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 4bfa1c0d8..c9ccf105c 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -73,6 +73,7 @@ DECLARE_string(log_dir); #include "arithmetic/magnitude_squared_test.cc" #include "arithmetic/multiply_test.cc" #include "arithmetic/code_generation_test.cc" +#include "arithmetic/tracking_loop_filter_test.cc" #include "configuration/file_configuration_test.cc" #include "configuration/in_memory_configuration_test.cc" #include "control_thread/control_message_factory_test.cc"