mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-29 06:27:44 +00:00 
			
		
		
		
	Fixing some initialization problems in tracking correlators that
could cause random segmentation faults.
This commit is contained in:
		| @@ -191,7 +191,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc( | ||||
|     systemName["G"] = std::string("GPS"); | ||||
|     systemName["S"] = std::string("SBAS"); | ||||
|  | ||||
|     set_relative_rate(1.0 / (static_cast<double>(d_vector_length) * 2.0)); | ||||
|     set_relative_rate(1.0 / static_cast<double>(d_vector_length)); | ||||
|  | ||||
|     d_channel_internal_queue = 0; | ||||
|     d_acquisition_gnss_synchro = 0; | ||||
| @@ -360,7 +360,11 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri | ||||
|             // ################# 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); | ||||
|  | ||||
|             // ####### coherent intergration extension | ||||
|             // keep the last symbols | ||||
| @@ -399,9 +403,8 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri | ||||
|                                     d_code_loop_filter.set_DLL_BW(d_dll_bw_narrow_hz); | ||||
|                                     d_carrier_loop_filter.set_params(10.0, d_pll_bw_narrow_hz,2); | ||||
|                                     d_preamble_synchronized = true; | ||||
|                                     std::cout << "Enabled extended correlator for CH "<< d_channel <<" : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) | ||||
|                                     std::cout << "Enabled "<<d_extend_correlation_ms<<" [ms] extended correlator for CH "<< d_channel <<" : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) | ||||
|                                               <<" pll_bw = " << d_pll_bw_hz << " [Hz], pll_narrow_bw = " << d_pll_bw_narrow_hz << " [Hz]" << std::endl | ||||
|                                               << "Enabled extended correlator for CH "<< d_channel <<" : Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) | ||||
|                                               <<" dll_bw = " << d_dll_bw_hz << " [Hz], dll_narrow_bw = " << d_dll_bw_narrow_hz << " [Hz]" << std::endl; | ||||
|                                 } | ||||
|                             // UPDATE INTEGRATION TIME | ||||
|   | ||||
| @@ -114,6 +114,8 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( | ||||
|     d_vector_length = vector_length; | ||||
|     d_dump_filename = dump_filename; | ||||
|  | ||||
|     d_current_prn_length_samples = static_cast<int>(d_vector_length); | ||||
|  | ||||
|     // Initialize tracking  ========================================== | ||||
|     d_code_loop_filter.set_DLL_BW(dll_bw_hz); | ||||
|     d_carrier_loop_filter.set_PLL_BW(pll_bw_hz); | ||||
| @@ -138,7 +140,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( | ||||
|     d_local_code_shift_chips[1] = 0.0; | ||||
|     d_local_code_shift_chips[2] = d_early_late_spc_chips; | ||||
|  | ||||
|     multicorrelator_cpu.init(2 * d_vector_length, d_n_correlator_taps); | ||||
|     multicorrelator_cpu.init(2 * d_current_prn_length_samples, d_n_correlator_taps); | ||||
|  | ||||
|     //--- Perform initializations ------------------------------ | ||||
|     // define initial code frequency basis of NCO | ||||
| @@ -157,7 +159,6 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( | ||||
|     d_pull_in = false; | ||||
|  | ||||
|  | ||||
|     d_current_prn_length_samples = static_cast<int>(d_vector_length); | ||||
|  | ||||
|     // CN0 estimation and lock detector buffers | ||||
|     d_cn0_estimation_counter = 0; | ||||
| @@ -180,7 +181,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( | ||||
|     d_code_phase_samples = 0.0; | ||||
|     d_acc_code_phase_secs = 0.0; | ||||
|  | ||||
|     set_relative_rate(1.0/((double)d_vector_length*2)); | ||||
|     set_relative_rate(1.0 / static_cast<double>(d_vector_length)); | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -206,6 +207,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() | ||||
|     double T_prn_mod_seconds; | ||||
|     double T_prn_mod_samples; | ||||
|     d_code_freq_chips = radial_velocity * GPS_L1_CA_CODE_RATE_HZ; | ||||
|     d_code_phase_step_chips = static_cast<double>(d_code_freq_chips) / static_cast<double>(d_fs_in); | ||||
|     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<double>(d_fs_in); | ||||
| @@ -227,6 +229,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() | ||||
|     d_acq_code_phase_samples = corrected_acq_phase_samples; | ||||
|  | ||||
|     d_carrier_doppler_hz = d_acq_carrier_doppler_hz; | ||||
|     d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in); | ||||
|  | ||||
|     // DLL/PLL filter initialization | ||||
|     d_carrier_loop_filter.initialize(); // initialize the carrier filter | ||||
| @@ -244,6 +247,7 @@ 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.0; | ||||
|     d_rem_code_phase_chips = 0.0; | ||||
|     d_acc_carrier_phase_rad = 0.0; | ||||
|     d_acc_code_phase_secs = 0.0; | ||||
|  | ||||
|   | ||||
| @@ -225,6 +225,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking() | ||||
|     float T_prn_mod_seconds; | ||||
|     float T_prn_mod_samples; | ||||
|     d_code_freq_hz = radial_velocity * GPS_L1_CA_CODE_RATE_HZ; | ||||
|     d_code_phase_step_chips = static_cast<double>(d_code_freq_hz) / static_cast<double>(d_fs_in); | ||||
|     T_chip_mod_seconds = 1/d_code_freq_hz; | ||||
|     T_prn_mod_seconds = T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; | ||||
|     T_prn_mod_samples = T_prn_mod_seconds * (float)d_fs_in; | ||||
|   | ||||
| @@ -211,6 +211,7 @@ void gps_l2_m_dll_pll_tracking_cc::start_tracking() | ||||
|     double T_prn_mod_seconds; | ||||
|     double T_prn_mod_samples; | ||||
|     d_code_freq_chips = radial_velocity * GPS_L2_M_CODE_RATE_HZ; | ||||
|     d_code_phase_step_chips = static_cast<double>(d_code_freq_chips) / static_cast<double>(d_fs_in); | ||||
|     T_chip_mod_seconds = 1/d_code_freq_chips; | ||||
|     T_prn_mod_seconds = T_chip_mod_seconds * GPS_L2_M_CODE_LENGTH_CHIPS; | ||||
|     T_prn_mod_samples = T_prn_mod_seconds * static_cast<float>(d_fs_in); | ||||
| @@ -232,6 +233,7 @@ void gps_l2_m_dll_pll_tracking_cc::start_tracking() | ||||
|     //d_acq_code_phase_samples = corrected_acq_phase_samples; | ||||
|  | ||||
|     d_carrier_doppler_hz = d_acq_carrier_doppler_hz; | ||||
|     d_carrier_phase_step_rad = GPS_L2_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in); | ||||
|  | ||||
|     // DLL/PLL filter initialization | ||||
|     d_carrier_loop_filter.initialize(); // initialize the carrier filter | ||||
| @@ -249,6 +251,7 @@ void gps_l2_m_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_rem_code_phase_chips = 0.0; | ||||
|     d_acc_carrier_phase_rad = 0; | ||||
|     d_acc_code_phase_secs = 0; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Javier Arribas
					Javier Arribas