From 21b7a19b6a60deff17b73b23289a1834ea80800f Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Fri, 3 Nov 2017 16:26:03 -0600 Subject: [PATCH 1/8] bugfix: Fixes bugs in RINEX and RTCM generators Remove dependency of t_b in P_1 for GLONASS GNAV Ephemeris and cleaned RINEX line for nav messages generation --- CMakeLists.txt | 2 +- conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf | 2 +- src/algorithms/PVT/libs/rinex_printer.cc | 3 ++- src/core/system_parameters/rtcm.cc | 4 ++-- src/utils/matlab/plot_acq_grid_gsoc_glonass.m | 6 +++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b49ad4217..265e79ec5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -271,7 +271,7 @@ endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") # Append -O2 optimization flag for Debug builds -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2") # allow 'large' files in 32 bit builds if(UNIX) diff --git a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf index 353ce620a..4f1610ef3 100644 --- a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf +++ b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf @@ -43,7 +43,7 @@ Acquisition_1G.pfa=0.0001 Acquisition_1G.if=0 Acquisition_1G.doppler_max=10000 Acquisition_1G.doppler_step=250 -Acquisition_1G.dump=false; +Acquisition_1G.dump=true; Acquisition_1G.dump_filename=/archive/glo_acquisition.dat ;Acquisition_1G.coherent_integration_time_ms=10 diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 52863abe2..900d1c76a 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -2924,7 +2924,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::mapsecond.d_gamma_n, 18, 2); line += std::string(1, ' '); //TODO need to define this here. what is nd - line += Rinex_Printer::doub2for(glonass_gnav_ephemeris_iter->second.d_t_k + p_utc_time.date().day()*86400, 18, 2); + line += Rinex_Printer::doub2for(glonass_gnav_ephemeris_iter->second.d_t_k + p_utc_time.date().day_of_week()*86400, 18, 2); } Rinex_Printer::lengthCheck(line); out << line << std::endl; @@ -3008,6 +3008,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map(Rtcm::bin_to_uint(message_bin.substr(index, 1))); index += 1; - glonass_gnav_eph.d_t_b = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 7)))*glonass_gnav_eph.d_P_1*60.0; + glonass_gnav_eph.d_t_b = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 7)))*15*60.0; index += 7; // TODO Check for type spec for intS24 @@ -4385,7 +4385,7 @@ int Rtcm::set_DF109(const Glonass_Gnav_Ephemeris & glonass_gnav_eph) int Rtcm::set_DF110(const Glonass_Gnav_Ephemeris & glonass_gnav_eph) { - unsigned int t_b = static_cast(std::round(glonass_gnav_eph.d_t_b/(glonass_gnav_eph.d_P_1*60))); + unsigned int t_b = static_cast(std::round(glonass_gnav_eph.d_t_b/(15*60))); DF110 = std::bitset<7>(t_b); return 0; } diff --git a/src/utils/matlab/plot_acq_grid_gsoc_glonass.m b/src/utils/matlab/plot_acq_grid_gsoc_glonass.m index 385a53030..9742e5107 100644 --- a/src/utils/matlab/plot_acq_grid_gsoc_glonass.m +++ b/src/utils/matlab/plot_acq_grid_gsoc_glonass.m @@ -35,13 +35,13 @@ function plot_acq_grid_gsoc_glonass(sat) -file=['acquisition_R_1G_sat_' num2str(sat) '_doppler_0.dat']; +file=['/archive/acquisition_R_1G_sat_' num2str(sat) '_doppler_0.dat']; % sampling_freq_Hz=62316000 -sampling_freq_Hz=31.75e6 +sampling_freq_Hz=6.625e6 Doppler_max_Hz = 10000 Doppler_min_Hz = -10000 -Doppler_step_Hz = 500 +Doppler_step_Hz = 250 % read files From ac7d965d7e695de8465f51f66dbd009c23172bd8 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Thu, 9 Nov 2017 11:39:09 -0800 Subject: [PATCH 2/8] position fix: First combined GPS + GLONASS position solution First positon fix using a combination of GLONASS and GPS data in GNSS-SDR. The position solution may need further testing but initial results are looking quite promising. --- conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf | 126 ++++++++++++++++++ .../glonass_gnav_ephemeris.cc | 5 +- 2 files changed, 128 insertions(+), 3 deletions(-) create mode 100644 conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf diff --git a/conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf b/conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf new file mode 100644 index 000000000..156f52741 --- /dev/null +++ b/conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf @@ -0,0 +1,126 @@ +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 +Receiver.sources_count=2 +SignalSource.repeat=false + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=/archive/NT1065_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.item_type=ibyte +SignalSource0.sampling_frequency=6625000 +SignalSource0.samples=0 +SignalSource0.dump=false; +SignalSource0.dump_filename=/archive/signal_glonass.bin + +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource1.item_type=ibyte +SignalSource1.sampling_frequency=6625000 +SignalSource1.samples=0 +SignalSource1.dump=false; +SignalSource1.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner +DataTypeAdapter0.implementation=Ibyte_To_Complex +InputFilter0.implementation=Pass_Through +InputFilter0.item_type=gr_complex +Resampler0.implementation=Direct_Resampler +Resampler0.sample_freq_in=6625000 +Resampler0.sample_freq_out=6625000 +Resampler0.item_type=gr_complex + +SignalConditioner1.implementation=Signal_Conditioner +DataTypeAdapter1.implementation=Ibyte_To_Complex +InputFilter1.implementation=Pass_Through +InputFilter1.item_type=gr_complex +Resampler1.implementation=Direct_Resampler +Resampler1.sample_freq_in=6625000 +Resampler1.sample_freq_out=6625000 +Resampler1.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels.in_acquisition=1 +Channels_1G.count=5 +Channels_1C.count=5 + +;# Defining GLONASS satellites +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=1 +Channel6.RF_channel_ID=1 +Channel7.RF_channel_ID=1 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.0 +Acquisition_1C.pfa=0.00001 +Acquisition_1C.if=0 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false; +Acquisition_1C.dump_filename=/archive/gps_acquisition.dat +;Acquisition_1C.coherent_integration_time_ms=10 + +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.00001 +Acquisition_1G.if=0 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=false; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_1G.coherent_integration_time_ms=10 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.if=0 +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.pll_bw_hz=20.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dump=true; +Tracking_1C.dump_filename=/archive/gps_tracking_ch_ + +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.if=0 +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=25.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.dump=true; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/gnss_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/src/core/system_parameters/glonass_gnav_ephemeris.cc b/src/core/system_parameters/glonass_gnav_ephemeris.cc index 278cd5053..91a147621 100644 --- a/src/core/system_parameters/glonass_gnav_ephemeris.cc +++ b/src/core/system_parameters/glonass_gnav_ephemeris.cc @@ -113,8 +113,7 @@ void Glonass_Gnav_Ephemeris::glot_to_gpst(double tod_offset, double glot2utc_cor { double tod = 0.0; double dayofweek = 0.0; - double utcsu2utc = 3*3600; - double glot2utcsu = 3*3600; + double glot2utc = 3*3600; double days = 0.0; double total_sec = 0.0, sec_of_day = 0.0; int i = 0; @@ -123,7 +122,7 @@ void Glonass_Gnav_Ephemeris::glot_to_gpst(double tod_offset, double glot2utc_cor // tk is relative to UTC(SU) + 3.00 hrs, so we need to convert to utc and add corrections // tk plus 10 sec is the true tod since get_TOW is called when in str5 - tod = tod_offset - glot2utcsu - utcsu2utc; + tod = tod_offset - glot2utc ; boost::posix_time::time_duration t(0, 0, tod); From 28f2c1bb391bbe5662edeb82de43f19ed5795020 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Mon, 13 Nov 2017 14:18:45 -0700 Subject: [PATCH 3/8] clean up: Clean up warnings during compile process Removes unused variables from code and fix counter to include both GPS and GLONASS observations --- src/algorithms/PVT/libs/rtklib_solver.cc | 16 ++++++++-------- .../system_parameters/glonass_gnav_ephemeris.cc | 6 ++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index 30766ca0c..3898a9758 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -179,7 +179,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ { if (eph_data[i].sat == (static_cast(gnss_observables_iter->second.PRN + NSATGPS + NSATGLO))) { - obs_data[i] = insert_obs_to_rtklib(obs_data[i], + obs_data[i+glo_valid_obs] = insert_obs_to_rtklib(obs_data[i+glo_valid_obs], gnss_observables_iter->second, galileo_ephemeris_iter->second.WN_5, 2);//Band 3 (L5/E5) @@ -194,7 +194,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second); //convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0,0}, '0', '0', {}, {}, {}, {}, {}, {}}; - obs_data[valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs+glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, galileo_ephemeris_iter->second.WN_5, 2); //Band 3 (L5/E5) @@ -223,7 +223,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ eph_data[valid_obs] = eph_to_rtklib(gps_ephemeris_iter->second); //convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0,0}, '0', '0', {}, {}, {}, {}, {}, {}}; - obs_data[valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs+glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, gps_ephemeris_iter->second.i_GPS_week, 0); @@ -251,7 +251,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ if (eph_data[i].sat == static_cast(gnss_observables_iter->second.PRN)) { eph_data[i] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); - obs_data[i] = insert_obs_to_rtklib(obs_data[i], + obs_data[i+glo_valid_obs] = insert_obs_to_rtklib(obs_data[i+glo_valid_obs], gnss_observables_iter->second, gps_cnav_ephemeris_iter->second.i_GPS_week, 1);//Band 2 (L2) @@ -266,7 +266,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); //convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0,0}, '0', '0', {}, {}, {}, {}, {}, {}}; - obs_data[valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, gps_cnav_ephemeris_iter->second.i_GPS_week, 1);//Band 2 (L2) @@ -294,7 +294,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ geph_data[glo_valid_obs] = eph_to_rtklib(glonass_gnav_ephemeris_iter->second, gnav_utc); //convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0,0}, '0', '0', {}, {}, {}, {}, {}, {}}; - obs_data[glo_valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs+glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, glonass_gnav_ephemeris_iter->second.d_WN, 0);//Band 0 (L1) @@ -318,7 +318,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ { if (geph_data[i].sat == (static_cast(gnss_observables_iter->second.PRN+NSATGPS))) { - obs_data[i] = insert_obs_to_rtklib(obs_data[i], + obs_data[i+valid_obs] = insert_obs_to_rtklib(obs_data[i+valid_obs], gnss_observables_iter->second, glonass_gnav_ephemeris_iter->second.d_WN, 1);//Band 1 (L2) @@ -333,7 +333,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ geph_data[glo_valid_obs] = eph_to_rtklib(glonass_gnav_ephemeris_iter->second, gnav_utc); //convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0,0}, '0', '0', {}, {}, {}, {}, {}, {}}; - obs_data[glo_valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs+glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, glonass_gnav_ephemeris_iter->second.d_WN, 1); //Band 1 (L2) diff --git a/src/core/system_parameters/glonass_gnav_ephemeris.cc b/src/core/system_parameters/glonass_gnav_ephemeris.cc index 91a147621..c557c6a6f 100644 --- a/src/core/system_parameters/glonass_gnav_ephemeris.cc +++ b/src/core/system_parameters/glonass_gnav_ephemeris.cc @@ -97,10 +97,9 @@ boost::posix_time::ptime Glonass_Gnav_Ephemeris::compute_GLONASS_time(const doub boost::posix_time::ptime Glonass_Gnav_Ephemeris::glot_to_utc(const double offset_time, const double glot2utc_corr) const { double tod = 0.0; - double utcsu2utc = 3*3600; - double glot2utcsu = 3*3600; + double glot2utc = 3*3600; - tod = offset_time - glot2utcsu - utcsu2utc + glot2utc_corr + d_tau_n; + tod = offset_time - glot2utc + glot2utc_corr + d_tau_n; boost::posix_time::time_duration t(0, 0, tod); boost::gregorian::date d1(d_yr, 1, 1); boost::gregorian::days d2(d_N_T - 1); @@ -112,7 +111,6 @@ boost::posix_time::ptime Glonass_Gnav_Ephemeris::glot_to_utc(const double offset void Glonass_Gnav_Ephemeris::glot_to_gpst(double tod_offset, double glot2utc_corr, double glot2gpst_corr, double * wn, double * tow) const { double tod = 0.0; - double dayofweek = 0.0; double glot2utc = 3*3600; double days = 0.0; double total_sec = 0.0, sec_of_day = 0.0; From d4953ef2fde65c6c45835262a34305507282423b Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Mon, 13 Nov 2017 22:41:12 -0700 Subject: [PATCH 4/8] bugfixes: Add RTCM header creation for GLONASS satellites Added code to enable RTCM header generation when in GLONASS. Also fixes bug to allow combined observations from GPS and GLONASS. Fix some code compilation warnings and unit tests. --- conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf | 5 +- conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf | 22 ++- conf/gnss-sdr_GPS_L1_CA_ibyte.conf | 93 ++++++++++ .../PVT/gnuradio_blocks/rtklib_pvt_cc.cc | 169 ++++++++++++++++-- src/algorithms/libs/gnss_sdr_valve.cc | 2 + .../glonass_l1_ca_telemetry_decoder_cc.cc | 1 + .../glonass_l1_ca_telemetry_decoder_cc.h | 1 - .../glonass_gnav_ephemeris_test.cc | 29 +-- 8 files changed, 286 insertions(+), 36 deletions(-) create mode 100644 conf/gnss-sdr_GPS_L1_CA_ibyte.conf diff --git a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf index 4f1610ef3..d6cbbf891 100644 --- a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf +++ b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf @@ -27,7 +27,7 @@ Resampler.item_type=gr_complex ;######### CHANNELS GLOBAL CONFIG ############ Channel.signal=1G Channels.in_acquisition=1 -Channels_1G.count=5 +Channels_1G.count=8 Channel0.satellite=24 ; k= Channel1.satellite=1 ; k=1 @@ -45,7 +45,8 @@ Acquisition_1G.doppler_max=10000 Acquisition_1G.doppler_step=250 Acquisition_1G.dump=true; Acquisition_1G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_1G.coherent_integration_time_ms=10 +Acquisition_1G.coherent_integration_time_ms=1 +;Acquisition_1G.max_dwells = 5 ;######### TRACKING GLOBAL CONFIG ############ Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking diff --git a/conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf b/conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf index 156f52741..0435d6ff2 100644 --- a/conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf +++ b/conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf @@ -7,7 +7,7 @@ SignalSource.repeat=false ;######### SIGNAL_SOURCE CONFIG ############ SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/archive/NT1065_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.filename=/archive/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE SignalSource0.item_type=ibyte SignalSource0.sampling_frequency=6625000 SignalSource0.samples=0 @@ -25,8 +25,26 @@ SignalSource1.dump_filename=/archive/signal_glonass.bin ;######### SIGNAL_CONDITIONER CONFIG ############ SignalConditioner0.implementation=Signal_Conditioner DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Pass_Through +InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=6625000 +InputFilter0.IF=60000 Resampler0.implementation=Direct_Resampler Resampler0.sample_freq_in=6625000 Resampler0.sample_freq_out=6625000 diff --git a/conf/gnss-sdr_GPS_L1_CA_ibyte.conf b/conf/gnss-sdr_GPS_L1_CA_ibyte.conf new file mode 100644 index 000000000..ecb652dca --- /dev/null +++ b/conf/gnss-sdr_GPS_L1_CA_ibyte.conf @@ -0,0 +1,93 @@ +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_hz=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +;SignalSource.freq=0 +;SignalSource.samples=66250000 +SignalSource.samples=0 +SignalSource.dump=false; + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.70 +InputFilter.band2_begin=0.80 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=6625000 +InputFilter.IF=60000 +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=6625000 +Resampler.sample_freq_out=6625000 +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=1C +Channels.in_acquisition=1 +Channels_1C.count=6 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.01 +;Acquisition_1C.pfa=0.00001 +Acquisition_1C.if=0 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false; +Acquisition_1C.dump_filename=/archive/gps_acquisition.dat +;Acquisition_1C.coherent_integration_time_ms=10 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.if=60000 +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.pll_bw_hz=25.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.dump=false; +Tracking_1C.dump_filename=/archive/gps_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/gps_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc index b0c0c5666..b4a312895 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc @@ -1258,15 +1258,15 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite { if(flag_write_RTCM_1020_output == true) { - for(std::map::iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.begin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end(); glonass_gnav_ephemeris_iter++ ) + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) { d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); } } - std::map::iterator glo_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.begin(); + std::map::const_iterator glo_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); - if (glo_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) + if (glo_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) { d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glo_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); } @@ -1276,14 +1276,14 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite { if(flag_write_RTCM_1019_output == true) { - for(gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin(); gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end(); gps_ephemeris_iter++ ) + for(gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.cbegin(); gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend(); gps_ephemeris_iter++ ) { d_rtcm_printer->Print_Rtcm_MT1019(gps_ephemeris_iter->second); } } if(flag_write_RTCM_1020_output == true) { - for(std::map::iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.begin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end(); glonass_gnav_ephemeris_iter++ ) + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) { d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); } @@ -1302,7 +1302,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite { // This is a channel with valid GPS signal gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) + if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend()) { gps_channel = i; } @@ -1313,7 +1313,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite if(system.compare("R") == 0) { glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) { glo_channel = i; } @@ -1324,14 +1324,14 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite if(flag_write_RTCM_MSM_output == true) { - if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) { d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); } } if(flag_write_RTCM_MSM_output == true) { - if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) + if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend()) { d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); } @@ -1342,14 +1342,14 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite { if(flag_write_RTCM_1020_output == true) { - for(std::map::iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.begin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end(); glonass_gnav_ephemeris_iter++ ) + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) { d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); } } if(flag_write_RTCM_1045_output == true) { - for(galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.begin(); galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end(); galileo_ephemeris_iter++ ) + for(galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.cbegin(); galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend(); galileo_ephemeris_iter++ ) { d_rtcm_printer->Print_Rtcm_MT1045(galileo_ephemeris_iter->second); } @@ -1359,18 +1359,18 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite //gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); //galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); unsigned int i = 0; - for (gnss_observables_iter = gnss_observables_map.begin(); gnss_observables_iter != gnss_observables_map.end(); gnss_observables_iter++) + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) { std::string system(&gnss_observables_iter->second.System, 1); - if(gps_channel == 0) + if(gal_channel == 0) { - if(system.compare("G") == 0) + if(system.compare("E") == 0) { // This is a channel with valid GPS signal - gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) + galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend()) { - gps_channel = i; + gal_channel = i; } } } @@ -1424,7 +1424,6 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite } b_rtcm_writing_started = true; } - if((type_of_rx == 4) || (type_of_rx == 5) || (type_of_rx == 6) || (type_of_rx == 14) || (type_of_rx == 15)) // Galileo { for(std::map::const_iterator gal_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.cbegin(); gal_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend(); gal_ephemeris_iter++ ) @@ -1514,6 +1513,140 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite } b_rtcm_writing_started = true; } + if((type_of_rx == 23) || (type_of_rx == 24) || (type_of_rx == 25)) // GLONASS + { + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); + } + + std::map::const_iterator glo_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); + + if (glo_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glo_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); + } + b_rtcm_writing_started = true; + } + if(type_of_rx == 26) // GPS L1 C/A + GLONASS L1 C/A + { + if(d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for(gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.cbegin(); gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend(); gps_ephemeris_iter++ ) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_ephemeris_iter->second); + } + } + if(d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); + } + } + + //gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); + //galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); + unsigned int i = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if(gps_channel == 0) + { + if(system.compare("G") == 0) + { + // This is a channel with valid GPS signal + gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend()) + { + gps_channel = i; + } + } + } + if(glo_channel == 0) + { + if(system.compare("R") == 0) + { + glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) + { + glo_channel = i; + } + } + } + i++; + } + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); + } + + if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); + } + + b_rtcm_writing_started = true; + + } + if(type_of_rx == 27) // GLONASS L1 C/A + Galileo E1B + { + if(d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); + } + } + if(d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for(galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.cbegin(); galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend(); galileo_ephemeris_iter++ ) + { + d_rtcm_printer->Print_Rtcm_MT1045(galileo_ephemeris_iter->second); + } + } + + unsigned int i = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if(gal_channel == 0) + { + if(system.compare("E") == 0) + { + // This is a channel with valid GPS signal + galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend()) + { + gal_channel = i; + } + } + } + if(glo_channel == 0) + { + if(system.compare("R") == 0) + { + glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) + { + glo_channel = i; + } + } + } + i++; + } + if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, galileo_ephemeris_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); + } + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); + } + + + } + } } } diff --git a/src/algorithms/libs/gnss_sdr_valve.cc b/src/algorithms/libs/gnss_sdr_valve.cc index 152bdbe84..0170d6cdc 100644 --- a/src/algorithms/libs/gnss_sdr_valve.cc +++ b/src/algorithms/libs/gnss_sdr_valve.cc @@ -35,6 +35,7 @@ #include // for memcpy #include #include "control_message_factory.h" +#include gnss_sdr_valve::gnss_sdr_valve (size_t sizeof_stream_item, unsigned long long nitems, @@ -61,6 +62,7 @@ int gnss_sdr_valve::work (int noutput_items, { ControlMessageFactory* cmf = new ControlMessageFactory(); d_queue->handle(cmf->GetQueueMessage(200,0)); + LOG(INFO) << "Stoping reciver, "<< d_ncopied_items << " samples processed"; delete cmf; return -1; // Done! } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc index 166d6df17..79478ebfe 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc @@ -106,6 +106,7 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc( d_flag_parity = false; d_TOW_at_current_symbol = 0; + Flag_valid_word = false; delta_t = 0; d_CRC_error_counter = 0; d_flag_preamble = false; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h index 5e4ff6df7..f95786bcd 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h @@ -83,7 +83,6 @@ private: unsigned short int d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS]; int *d_preambles_symbols; unsigned int d_samples_per_symbol; - unsigned int d_samples_per_preamble_symbol; int d_symbols_per_preamble; //!< Storage for incoming data diff --git a/src/tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc b/src/tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc index 2a4917357..da5571399 100644 --- a/src/tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc +++ b/src/tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc @@ -74,18 +74,19 @@ TEST(GlonassGnavEphemerisTest, ConvertGlonassT2GpsT1) gnav_eph.d_yr = 2004; gnav_eph.d_N_T = 366+28; - double tod = 70200; + double glo2utc = 3600*3; + double tod = 48600; double week = 0.0; double tow = 0.0; double true_leap_sec = 13; double true_week = 1307; double true_tow = 480600+true_leap_sec; - gnav_eph.glot_to_gpst(tod, 0.0, 0.0, &week, &tow); + gnav_eph.glot_to_gpst(tod + glo2utc, 0.0, 0.0, &week, &tow); // Perform assertions of decoded fields ASSERT_TRUE(week - true_week < FLT_EPSILON ); - ASSERT_TRUE(tow - true_week < FLT_EPSILON ); + ASSERT_TRUE(tow - true_tow < FLT_EPSILON ); } /*! @@ -98,18 +99,19 @@ TEST(GlonassGnavEphemerisTest, ConvertGlonassT2GpsT2) gnav_eph.d_yr = 2016; gnav_eph.d_N_T = 268; + double glo2utc = 3600*3; double tod = 7560; double week = 0.0; double tow = 0.0; - double true_leap_sec = 13; + double true_leap_sec = 17; double true_week = 1915; - double true_tow = 480600+true_leap_sec; + double true_tow = 518400+true_leap_sec+tod; - gnav_eph.glot_to_gpst(tod, 0.0, 0.0, &week, &tow); + gnav_eph.glot_to_gpst(tod + glo2utc, 0.0, 0.0, &week, &tow); // Perform assertions of decoded fields ASSERT_TRUE(week - true_week < FLT_EPSILON ); - ASSERT_TRUE(tow - true_week < FLT_EPSILON ); + ASSERT_TRUE(tow - true_tow < FLT_EPSILON ); } /*! @@ -122,16 +124,17 @@ TEST(GlonassGnavEphemerisTest, ConvertGlonassT2GpsT3) gnav_eph.d_yr = 2016; gnav_eph.d_N_T = 62; - double tod = 7560 + 6*3600; + double glo2utc = 3600*3; + double tod = 7560; double week = 0.0; double tow = 0.0; - double true_leap_sec = 13; - double true_week = 1307; - double true_tow = 480600+true_leap_sec; + double true_leap_sec = 17; + double true_week = 1886; + double true_tow = 259200+true_leap_sec; - gnav_eph.glot_to_gpst(tod, 0.0, 0.0, &week, &tow); + gnav_eph.glot_to_gpst(tod + glo2utc, 0.0, 0.0, &week, &tow); // Perform assertions of decoded fields ASSERT_TRUE(week - true_week < FLT_EPSILON ); - ASSERT_TRUE(tow - true_week < FLT_EPSILON ); + ASSERT_TRUE(tow - true_tow < FLT_EPSILON ); } From feae8303de21bc36064c11f52e27fe23322d6f14 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Mon, 13 Nov 2017 14:18:45 -0700 Subject: [PATCH 5/8] clean up: Clean up warnings during compile process Removes unused variables from code and fix counter to include both GPS and GLONASS observations --- src/algorithms/PVT/libs/rtklib_solver.cc | 16 ++++++++-------- .../system_parameters/glonass_gnav_ephemeris.cc | 6 ++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index 30766ca0c..3898a9758 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -179,7 +179,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ { if (eph_data[i].sat == (static_cast(gnss_observables_iter->second.PRN + NSATGPS + NSATGLO))) { - obs_data[i] = insert_obs_to_rtklib(obs_data[i], + obs_data[i+glo_valid_obs] = insert_obs_to_rtklib(obs_data[i+glo_valid_obs], gnss_observables_iter->second, galileo_ephemeris_iter->second.WN_5, 2);//Band 3 (L5/E5) @@ -194,7 +194,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second); //convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0,0}, '0', '0', {}, {}, {}, {}, {}, {}}; - obs_data[valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs+glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, galileo_ephemeris_iter->second.WN_5, 2); //Band 3 (L5/E5) @@ -223,7 +223,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ eph_data[valid_obs] = eph_to_rtklib(gps_ephemeris_iter->second); //convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0,0}, '0', '0', {}, {}, {}, {}, {}, {}}; - obs_data[valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs+glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, gps_ephemeris_iter->second.i_GPS_week, 0); @@ -251,7 +251,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ if (eph_data[i].sat == static_cast(gnss_observables_iter->second.PRN)) { eph_data[i] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); - obs_data[i] = insert_obs_to_rtklib(obs_data[i], + obs_data[i+glo_valid_obs] = insert_obs_to_rtklib(obs_data[i+glo_valid_obs], gnss_observables_iter->second, gps_cnav_ephemeris_iter->second.i_GPS_week, 1);//Band 2 (L2) @@ -266,7 +266,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); //convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0,0}, '0', '0', {}, {}, {}, {}, {}, {}}; - obs_data[valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, gps_cnav_ephemeris_iter->second.i_GPS_week, 1);//Band 2 (L2) @@ -294,7 +294,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ geph_data[glo_valid_obs] = eph_to_rtklib(glonass_gnav_ephemeris_iter->second, gnav_utc); //convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0,0}, '0', '0', {}, {}, {}, {}, {}, {}}; - obs_data[glo_valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs+glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, glonass_gnav_ephemeris_iter->second.d_WN, 0);//Band 0 (L1) @@ -318,7 +318,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ { if (geph_data[i].sat == (static_cast(gnss_observables_iter->second.PRN+NSATGPS))) { - obs_data[i] = insert_obs_to_rtklib(obs_data[i], + obs_data[i+valid_obs] = insert_obs_to_rtklib(obs_data[i+valid_obs], gnss_observables_iter->second, glonass_gnav_ephemeris_iter->second.d_WN, 1);//Band 1 (L2) @@ -333,7 +333,7 @@ bool rtklib_solver::get_PVT(const std::map & gnss_observables_ geph_data[glo_valid_obs] = eph_to_rtklib(glonass_gnav_ephemeris_iter->second, gnav_utc); //convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0,0}, '0', '0', {}, {}, {}, {}, {}, {}}; - obs_data[glo_valid_obs] = insert_obs_to_rtklib(newobs, + obs_data[valid_obs+glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, glonass_gnav_ephemeris_iter->second.d_WN, 1); //Band 1 (L2) diff --git a/src/core/system_parameters/glonass_gnav_ephemeris.cc b/src/core/system_parameters/glonass_gnav_ephemeris.cc index 91a147621..c557c6a6f 100644 --- a/src/core/system_parameters/glonass_gnav_ephemeris.cc +++ b/src/core/system_parameters/glonass_gnav_ephemeris.cc @@ -97,10 +97,9 @@ boost::posix_time::ptime Glonass_Gnav_Ephemeris::compute_GLONASS_time(const doub boost::posix_time::ptime Glonass_Gnav_Ephemeris::glot_to_utc(const double offset_time, const double glot2utc_corr) const { double tod = 0.0; - double utcsu2utc = 3*3600; - double glot2utcsu = 3*3600; + double glot2utc = 3*3600; - tod = offset_time - glot2utcsu - utcsu2utc + glot2utc_corr + d_tau_n; + tod = offset_time - glot2utc + glot2utc_corr + d_tau_n; boost::posix_time::time_duration t(0, 0, tod); boost::gregorian::date d1(d_yr, 1, 1); boost::gregorian::days d2(d_N_T - 1); @@ -112,7 +111,6 @@ boost::posix_time::ptime Glonass_Gnav_Ephemeris::glot_to_utc(const double offset void Glonass_Gnav_Ephemeris::glot_to_gpst(double tod_offset, double glot2utc_corr, double glot2gpst_corr, double * wn, double * tow) const { double tod = 0.0; - double dayofweek = 0.0; double glot2utc = 3*3600; double days = 0.0; double total_sec = 0.0, sec_of_day = 0.0; From 5eab3531321e023be462c61d8fa7f0acf6180ec7 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Mon, 13 Nov 2017 22:41:12 -0700 Subject: [PATCH 6/8] bugfixes: Add RTCM header creation for GLONASS satellites Added code to enable RTCM header generation when in GLONASS. Also fixes bug to allow combined observations from GPS and GLONASS. Fix some code compilation warnings and unit tests. --- conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf | 5 +- conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf | 22 ++- conf/gnss-sdr_GPS_L1_CA_ibyte.conf | 93 ++++++++++ .../PVT/gnuradio_blocks/rtklib_pvt_cc.cc | 169 ++++++++++++++++-- src/algorithms/libs/gnss_sdr_valve.cc | 2 + .../glonass_l1_ca_telemetry_decoder_cc.cc | 1 + .../glonass_l1_ca_telemetry_decoder_cc.h | 1 - .../glonass_gnav_ephemeris_test.cc | 29 +-- 8 files changed, 286 insertions(+), 36 deletions(-) create mode 100644 conf/gnss-sdr_GPS_L1_CA_ibyte.conf diff --git a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf index 4f1610ef3..d6cbbf891 100644 --- a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf +++ b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf @@ -27,7 +27,7 @@ Resampler.item_type=gr_complex ;######### CHANNELS GLOBAL CONFIG ############ Channel.signal=1G Channels.in_acquisition=1 -Channels_1G.count=5 +Channels_1G.count=8 Channel0.satellite=24 ; k= Channel1.satellite=1 ; k=1 @@ -45,7 +45,8 @@ Acquisition_1G.doppler_max=10000 Acquisition_1G.doppler_step=250 Acquisition_1G.dump=true; Acquisition_1G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_1G.coherent_integration_time_ms=10 +Acquisition_1G.coherent_integration_time_ms=1 +;Acquisition_1G.max_dwells = 5 ;######### TRACKING GLOBAL CONFIG ############ Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking diff --git a/conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf b/conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf index 156f52741..0435d6ff2 100644 --- a/conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf +++ b/conf/gnss-sdr_GPS_GLONASS_L1_CA_ibyte.conf @@ -7,7 +7,7 @@ SignalSource.repeat=false ;######### SIGNAL_SOURCE CONFIG ############ SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/archive/NT1065_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.filename=/archive/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE SignalSource0.item_type=ibyte SignalSource0.sampling_frequency=6625000 SignalSource0.samples=0 @@ -25,8 +25,26 @@ SignalSource1.dump_filename=/archive/signal_glonass.bin ;######### SIGNAL_CONDITIONER CONFIG ############ SignalConditioner0.implementation=Signal_Conditioner DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Pass_Through +InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=6625000 +InputFilter0.IF=60000 Resampler0.implementation=Direct_Resampler Resampler0.sample_freq_in=6625000 Resampler0.sample_freq_out=6625000 diff --git a/conf/gnss-sdr_GPS_L1_CA_ibyte.conf b/conf/gnss-sdr_GPS_L1_CA_ibyte.conf new file mode 100644 index 000000000..ecb652dca --- /dev/null +++ b/conf/gnss-sdr_GPS_L1_CA_ibyte.conf @@ -0,0 +1,93 @@ +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_hz=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +;SignalSource.freq=0 +;SignalSource.samples=66250000 +SignalSource.samples=0 +SignalSource.dump=false; + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.70 +InputFilter.band2_begin=0.80 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=6625000 +InputFilter.IF=60000 +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=6625000 +Resampler.sample_freq_out=6625000 +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=1C +Channels.in_acquisition=1 +Channels_1C.count=6 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.01 +;Acquisition_1C.pfa=0.00001 +Acquisition_1C.if=0 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false; +Acquisition_1C.dump_filename=/archive/gps_acquisition.dat +;Acquisition_1C.coherent_integration_time_ms=10 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.if=60000 +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.pll_bw_hz=25.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.dump=false; +Tracking_1C.dump_filename=/archive/gps_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/gps_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc index b0c0c5666..b4a312895 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc @@ -1258,15 +1258,15 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite { if(flag_write_RTCM_1020_output == true) { - for(std::map::iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.begin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end(); glonass_gnav_ephemeris_iter++ ) + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) { d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); } } - std::map::iterator glo_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.begin(); + std::map::const_iterator glo_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); - if (glo_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) + if (glo_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) { d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glo_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); } @@ -1276,14 +1276,14 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite { if(flag_write_RTCM_1019_output == true) { - for(gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin(); gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end(); gps_ephemeris_iter++ ) + for(gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.cbegin(); gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend(); gps_ephemeris_iter++ ) { d_rtcm_printer->Print_Rtcm_MT1019(gps_ephemeris_iter->second); } } if(flag_write_RTCM_1020_output == true) { - for(std::map::iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.begin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end(); glonass_gnav_ephemeris_iter++ ) + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) { d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); } @@ -1302,7 +1302,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite { // This is a channel with valid GPS signal gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) + if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend()) { gps_channel = i; } @@ -1313,7 +1313,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite if(system.compare("R") == 0) { glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) { glo_channel = i; } @@ -1324,14 +1324,14 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite if(flag_write_RTCM_MSM_output == true) { - if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) { d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); } } if(flag_write_RTCM_MSM_output == true) { - if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) + if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend()) { d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); } @@ -1342,14 +1342,14 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite { if(flag_write_RTCM_1020_output == true) { - for(std::map::iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.begin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end(); glonass_gnav_ephemeris_iter++ ) + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) { d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); } } if(flag_write_RTCM_1045_output == true) { - for(galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.begin(); galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end(); galileo_ephemeris_iter++ ) + for(galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.cbegin(); galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend(); galileo_ephemeris_iter++ ) { d_rtcm_printer->Print_Rtcm_MT1045(galileo_ephemeris_iter->second); } @@ -1359,18 +1359,18 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite //gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); //galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); unsigned int i = 0; - for (gnss_observables_iter = gnss_observables_map.begin(); gnss_observables_iter != gnss_observables_map.end(); gnss_observables_iter++) + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) { std::string system(&gnss_observables_iter->second.System, 1); - if(gps_channel == 0) + if(gal_channel == 0) { - if(system.compare("G") == 0) + if(system.compare("E") == 0) { // This is a channel with valid GPS signal - gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) + galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend()) { - gps_channel = i; + gal_channel = i; } } } @@ -1424,7 +1424,6 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite } b_rtcm_writing_started = true; } - if((type_of_rx == 4) || (type_of_rx == 5) || (type_of_rx == 6) || (type_of_rx == 14) || (type_of_rx == 15)) // Galileo { for(std::map::const_iterator gal_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.cbegin(); gal_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend(); gal_ephemeris_iter++ ) @@ -1514,6 +1513,140 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite } b_rtcm_writing_started = true; } + if((type_of_rx == 23) || (type_of_rx == 24) || (type_of_rx == 25)) // GLONASS + { + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); + } + + std::map::const_iterator glo_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); + + if (glo_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glo_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); + } + b_rtcm_writing_started = true; + } + if(type_of_rx == 26) // GPS L1 C/A + GLONASS L1 C/A + { + if(d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for(gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.cbegin(); gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend(); gps_ephemeris_iter++ ) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_ephemeris_iter->second); + } + } + if(d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); + } + } + + //gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); + //galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); + unsigned int i = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if(gps_channel == 0) + { + if(system.compare("G") == 0) + { + // This is a channel with valid GPS signal + gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend()) + { + gps_channel = i; + } + } + } + if(glo_channel == 0) + { + if(system.compare("R") == 0) + { + glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) + { + glo_channel = i; + } + } + } + i++; + } + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); + } + + if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); + } + + b_rtcm_writing_started = true; + + } + if(type_of_rx == 27) // GLONASS L1 C/A + Galileo E1B + { + if(d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for(std::map::const_iterator glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++ ) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_ls_pvt->glonass_gnav_utc_model); + } + } + if(d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for(galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.cbegin(); galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend(); galileo_ephemeris_iter++ ) + { + d_rtcm_printer->Print_Rtcm_MT1045(galileo_ephemeris_iter->second); + } + } + + unsigned int i = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if(gal_channel == 0) + { + if(system.compare("E") == 0) + { + // This is a channel with valid GPS signal + galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend()) + { + gal_channel = i; + } + } + } + if(glo_channel == 0) + { + if(system.compare("R") == 0) + { + glonass_gnav_ephemeris_iter = d_ls_pvt->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) + { + glo_channel = i; + } + } + } + i++; + } + if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, galileo_ephemeris_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); + } + if (glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0); + } + + + } + } } } diff --git a/src/algorithms/libs/gnss_sdr_valve.cc b/src/algorithms/libs/gnss_sdr_valve.cc index 152bdbe84..0170d6cdc 100644 --- a/src/algorithms/libs/gnss_sdr_valve.cc +++ b/src/algorithms/libs/gnss_sdr_valve.cc @@ -35,6 +35,7 @@ #include // for memcpy #include #include "control_message_factory.h" +#include gnss_sdr_valve::gnss_sdr_valve (size_t sizeof_stream_item, unsigned long long nitems, @@ -61,6 +62,7 @@ int gnss_sdr_valve::work (int noutput_items, { ControlMessageFactory* cmf = new ControlMessageFactory(); d_queue->handle(cmf->GetQueueMessage(200,0)); + LOG(INFO) << "Stoping reciver, "<< d_ncopied_items << " samples processed"; delete cmf; return -1; // Done! } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc index 24917ef4b..2edfba8bf 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc @@ -106,6 +106,7 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc( d_flag_parity = false; d_TOW_at_current_symbol = 0; + Flag_valid_word = false; delta_t = 0; d_CRC_error_counter = 0; d_flag_preamble = false; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h index 2dfeca167..34bcec2b0 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h @@ -83,7 +83,6 @@ private: unsigned short int d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS]; int *d_preambles_symbols; unsigned int d_samples_per_symbol; - unsigned int d_samples_per_preamble_symbol; int d_symbols_per_preamble; //!< Storage for incoming data diff --git a/src/tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc b/src/tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc index 2a4917357..da5571399 100644 --- a/src/tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc +++ b/src/tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc @@ -74,18 +74,19 @@ TEST(GlonassGnavEphemerisTest, ConvertGlonassT2GpsT1) gnav_eph.d_yr = 2004; gnav_eph.d_N_T = 366+28; - double tod = 70200; + double glo2utc = 3600*3; + double tod = 48600; double week = 0.0; double tow = 0.0; double true_leap_sec = 13; double true_week = 1307; double true_tow = 480600+true_leap_sec; - gnav_eph.glot_to_gpst(tod, 0.0, 0.0, &week, &tow); + gnav_eph.glot_to_gpst(tod + glo2utc, 0.0, 0.0, &week, &tow); // Perform assertions of decoded fields ASSERT_TRUE(week - true_week < FLT_EPSILON ); - ASSERT_TRUE(tow - true_week < FLT_EPSILON ); + ASSERT_TRUE(tow - true_tow < FLT_EPSILON ); } /*! @@ -98,18 +99,19 @@ TEST(GlonassGnavEphemerisTest, ConvertGlonassT2GpsT2) gnav_eph.d_yr = 2016; gnav_eph.d_N_T = 268; + double glo2utc = 3600*3; double tod = 7560; double week = 0.0; double tow = 0.0; - double true_leap_sec = 13; + double true_leap_sec = 17; double true_week = 1915; - double true_tow = 480600+true_leap_sec; + double true_tow = 518400+true_leap_sec+tod; - gnav_eph.glot_to_gpst(tod, 0.0, 0.0, &week, &tow); + gnav_eph.glot_to_gpst(tod + glo2utc, 0.0, 0.0, &week, &tow); // Perform assertions of decoded fields ASSERT_TRUE(week - true_week < FLT_EPSILON ); - ASSERT_TRUE(tow - true_week < FLT_EPSILON ); + ASSERT_TRUE(tow - true_tow < FLT_EPSILON ); } /*! @@ -122,16 +124,17 @@ TEST(GlonassGnavEphemerisTest, ConvertGlonassT2GpsT3) gnav_eph.d_yr = 2016; gnav_eph.d_N_T = 62; - double tod = 7560 + 6*3600; + double glo2utc = 3600*3; + double tod = 7560; double week = 0.0; double tow = 0.0; - double true_leap_sec = 13; - double true_week = 1307; - double true_tow = 480600+true_leap_sec; + double true_leap_sec = 17; + double true_week = 1886; + double true_tow = 259200+true_leap_sec; - gnav_eph.glot_to_gpst(tod, 0.0, 0.0, &week, &tow); + gnav_eph.glot_to_gpst(tod + glo2utc, 0.0, 0.0, &week, &tow); // Perform assertions of decoded fields ASSERT_TRUE(week - true_week < FLT_EPSILON ); - ASSERT_TRUE(tow - true_week < FLT_EPSILON ); + ASSERT_TRUE(tow - true_tow < FLT_EPSILON ); } From 4a8182af26c503efcf6536807fc6f5e3f1854ae2 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Mon, 20 Nov 2017 14:52:37 -0700 Subject: [PATCH 7/8] feature: Adding code to fix coherent integration in GLONASS L1 C/A Debugs code to fix GLONASS coherent integration. Adds message handling from telemetry decoding to signal tracking modules. Bug on poor track performance stills need to be determine. --- .../gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf | 87 +++++++++++++++++++ .../glonass_l1_ca_telemetry_decoder_cc.cc | 8 ++ .../glonass_l1_ca_telemetry_decoder_cc.h | 3 + ...glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 56 +++++++++--- .../glonass_l1_ca_dll_pll_c_aid_tracking_cc.h | 3 +- .../glonass_l1_ca_dll_pll_tracking_cc.cc | 2 + 6 files changed, 148 insertions(+), 11 deletions(-) create mode 100644 conf/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf diff --git a/conf/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf b/conf/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf new file mode 100644 index 000000000..ad49d03e0 --- /dev/null +++ b/conf/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf @@ -0,0 +1,87 @@ +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +;SignalSource.freq=0 +;SignalSource.samples=66250000 +SignalSource.samples=0 +SignalSource.dump=false; +SignalSource.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=6625000 +Resampler.sample_freq_out=6625000 +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=1G +Channels.in_acquisition=1 +Channels_1G.count=8 + +Channel0.satellite=24 ; k= +Channel1.satellite=1 ; k=1 +Channel2.satellite=2 ; k=-4 +Channel3.satellite=20 ; k=-5 +Channel4.satellite=21 ; k=4 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.0001 +Acquisition_1G.if=0 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=true; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_1G.coherent_integration_time_ms=1 +;Acquisition_1G.max_dwells = 5 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.if=0 +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=25.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.pll_bw_narrow_hz = 20.0; +Tracking_1G.dll_bw_narrow_hz = 2.0; +Tracking_1G.extend_correlation_ms = 1; +Tracking_1G.dump=true; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/glo_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc index 2edfba8bf..8ba984873 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc @@ -112,6 +112,7 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc( d_flag_preamble = false; d_channel = 0; flag_TOW_set = false; + d_preamble_time_samples = 0; } @@ -274,6 +275,8 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib LOG(INFO) << "Preamble detection for GLONASS L1 C/A SAT " << this->d_satellite; // Enter into frame pre-detection status d_stat = 1; + d_preamble_time_samples = d_symbol_history.at(0).Tracking_sample_counter; // record the preamble sample stamp + } } else if (d_stat == 1) // posible preamble lock @@ -282,12 +285,17 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib { //check preamble separation preamble_diff = d_sample_counter - d_preamble_index; + // Record the PRN start sample index associated to the preamble + d_preamble_time_samples = d_symbol_history.at(0).Tracking_sample_counter; if (abs(preamble_diff - GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS) == 0) { //try to decode frame LOG(INFO) << "Starting string decoder for GLONASS L1 C/A SAT " << this->d_satellite; d_preamble_index = d_sample_counter; //record the preamble sample stamp d_stat = 2; + // send asynchronous message to tracking to inform of frame sync and extend correlation time + pmt::pmt_t value = pmt::from_double(static_cast(d_preamble_time_samples) / static_cast(d_symbol_history.at(0).fs) - 0.001); + this->message_port_pub(pmt::mp("preamble_timestamp_s"), value); } else { diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h index 34bcec2b0..8973d7d95 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h @@ -79,6 +79,9 @@ private: void decode_string(double *symbols, int frame_length); + //!< Help with coherent tracking + double d_preamble_time_samples; + //!< Preamble decoding unsigned short int d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS]; int *d_preambles_symbols; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index 3fa066e5f..cc9a1687b 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -215,6 +215,9 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc d_code_error_filt_chips_s = 0.0; d_carr_phase_error_secs_Ti = 0.0; d_preamble_timestamp_s = 0.0; + + d_carrier_frequency_hz = 0.0; + //set_min_output_buffer((long int)300); } @@ -263,10 +266,14 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_acq_code_phase_samples = corrected_acq_phase_samples; - d_carrier_doppler_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); + // d_carrier_doppler_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); // d_carrier_doppler_hz = d_acq_carrier_doppler_hz; + // d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); + d_carrier_frequency_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); + d_carrier_doppler_hz = d_acq_carrier_doppler_hz; + d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_frequency_hz / static_cast(d_fs_in); + - d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); // DLL/PLL filter initialization d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); // The carrier loop filter implements the Doppler accumulator @@ -299,8 +306,8 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking() // enable tracking d_pull_in = true; d_enable_tracking = true; - d_enable_extended_integration = true; - d_preamble_synchronized = true; + d_enable_extended_integration = false; + d_preamble_synchronized = false; LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz << " Code Phase correction [samples]=" << delay_correction_samples << " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples; @@ -309,14 +316,43 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking() glonass_l1_ca_dll_pll_c_aid_tracking_cc::~glonass_l1_ca_dll_pll_c_aid_tracking_cc() { - d_dump_file.close(); + if (d_dump_file.is_open()) + { + try + { + d_dump_file.close(); + } + catch(const std::exception & ex) + { + LOG(WARNING) << "Exception in destructor " << ex.what(); + } + } - volk_gnsssdr_free(d_local_code_shift_chips); - volk_gnsssdr_free(d_correlator_outs); - volk_gnsssdr_free(d_ca_code); + if(d_dump) + { + if(d_channel == 0) + { + std::cout << "Writing .mat files ..."; + } + //gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile(); + if(d_channel == 0) + { + std::cout << " done." << std::endl; + } + } - delete[] d_Prompt_buffer; - multicorrelator_cpu.free(); + try + { + volk_gnsssdr_free(d_local_code_shift_chips); + volk_gnsssdr_free(d_correlator_outs); + volk_gnsssdr_free(d_ca_code); + delete[] d_Prompt_buffer; + multicorrelator_cpu.free(); + } + catch(const std::exception & ex) + { + LOG(WARNING) << "Exception in destructor " << ex.what(); + } } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h index 320d51b0c..17d7eabd0 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h @@ -1,5 +1,5 @@ /*! - * \file glonass_l1_ca_dll_pll_tracking.h + * \file glonass_l1_ca_dll_pll_c_aid_tracking_cc.h * \brief Interface of an adapter of a DLL+PLL tracking loop block * for Glonass L1 C/A to a TrackingInterface * \author Gabriel Araujo, 2017. gabriel.araujo.5000(at)gmail.com @@ -157,6 +157,7 @@ private: double d_code_freq_chips; double d_code_phase_step_chips; double d_carrier_doppler_hz; + double d_carrier_frequency_hz; double d_carrier_phase_step_rad; double d_acc_carrier_phase_cycles; double d_code_phase_samples; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index a4e158ae8..f1532ac25 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -181,6 +181,8 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( d_code_phase_step_chips = 0.0; d_carrier_phase_step_rad = 0.0; + d_glonass_freq_ch = 0; + set_relative_rate(1.0 / static_cast(d_vector_length)); } From 0e938db54e5f9c692e4d2d5df6b1379f1c9bc8a4 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Fri, 24 Nov 2017 15:20:13 -0700 Subject: [PATCH 8/8] bugfix: Fixes RINEX V2.11 Nav. data record header Fixes the number of spaces used by the second field in RINEX 2.11 when logging GLONASS Navigational information --- src/algorithms/PVT/libs/rinex_printer.cc | 28 ++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 0206a4878..555ccc728 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -2881,17 +2881,23 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map(seconds) < 10) - { - line += std::string(1, ' '); - line += std::string(seconds, 1, 1); - } - else - { - line += seconds; - } - - line += std::string(1, ' '); + if(boost::lexical_cast(seconds) < 10) + { + line += std::string(1, ' '); + line += std::string(seconds, 1, 1); + } + else + { + line += seconds; + } + line += std::string(1, '.'); + std::string decimal = std::string("0"); + if (timestring.size() > 16) + { + std::string decimal (timestring, 16, 1); + } + line += decimal; + line += std::string(1, ' '); line += Rinex_Printer::doub2for(-glonass_gnav_ephemeris_iter->second.d_tau_c, 18, 2); line += std::string(1, ' '); line += Rinex_Printer::doub2for(glonass_gnav_ephemeris_iter->second.d_gamma_n, 18, 2);