From e636bba59a58a8e6648fc425953dfc3f8cc0cd39 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Wed, 1 Nov 2017 21:05:40 -0600 Subject: [PATCH 1/5] position fix: First GLONASS position fix First GLONASS L1 C/A position fix using GNSS-SDR. Fixes bug in toe reporting for GLONASS and cleans up the code a bit. Small bug with RINEX file still present but achievement deserves its own commit. --- conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf | 2 +- .../libs/rtklib/rtklib_conversions.cc | 2 +- .../glonass_l1_ca_telemetry_decoder_cc.cc | 2 +- .../glonass_gnav_ephemeris.cc | 1 + .../glonass_gnav_navigation_message.cc | 87 +------------------ .../glonass_gnav_navigation_message.h | 57 ++++++------ 6 files changed, 34 insertions(+), 117 deletions(-) diff --git a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf index 4f5abda49..353ce620a 100644 --- a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf +++ b/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf @@ -67,7 +67,7 @@ Observables.dump_filename=/archive/glo_observables.dat ;######### PVT CONFIG ############ PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static +PVT.positioning_mode=Single PVT.output_rate_ms=100 PVT.display_rate_ms=500 PVT.trop_model=Saastamoinen diff --git a/src/algorithms/libs/rtklib/rtklib_conversions.cc b/src/algorithms/libs/rtklib/rtklib_conversions.cc index 8f267454c..4fca8081c 100644 --- a/src/algorithms/libs/rtklib/rtklib_conversions.cc +++ b/src/algorithms/libs/rtklib/rtklib_conversions.cc @@ -91,7 +91,7 @@ geph_t eph_to_rtklib(const Glonass_Gnav_Ephemeris & glonass_gnav_eph, const Glon rtklib_sat.age = static_cast(glonass_gnav_eph.d_Delta_tau_n); /* delay between L1 and L2 (s) */ // Time expressed in GPS Time but using RTKLib format - glonass_gnav_eph.glot_to_gpst(glonass_gnav_eph.d_tod, gnav_clock_model.d_tau_c, gnav_clock_model.d_tau_gps, &week, &sec); + glonass_gnav_eph.glot_to_gpst(glonass_gnav_eph.d_t_b, gnav_clock_model.d_tau_c, gnav_clock_model.d_tau_gps, &week, &sec); adj_week = adjgpsweek(static_cast(week)); rtklib_sat.toe = gpst2time(adj_week, sec); 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 34e72231b..166d6df17 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 @@ -355,7 +355,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib if (this->d_flag_preamble == true and d_nav.flag_TOW_new == true) //update TOW at the preamble instant { - d_TOW_at_current_symbol = floor((d_nav.gnav_ephemeris.d_TOW - GLONASS_GNAV_PREAMBLE_DURATION_S)*1000)/1000; + d_TOW_at_current_symbol = floor((d_nav.gnav_ephemeris.d_TOW-GLONASS_GNAV_PREAMBLE_DURATION_S)*1000)/1000; d_nav.flag_TOW_new = false; } diff --git a/src/core/system_parameters/glonass_gnav_ephemeris.cc b/src/core/system_parameters/glonass_gnav_ephemeris.cc index b1c9d2632..278cd5053 100644 --- a/src/core/system_parameters/glonass_gnav_ephemeris.cc +++ b/src/core/system_parameters/glonass_gnav_ephemeris.cc @@ -140,6 +140,7 @@ void Glonass_Gnav_Ephemeris::glot_to_gpst(double tod_offset, double glot2utc_cor sec_of_day = static_cast((glonass_time.time_of_day()).total_seconds()); total_sec = days*86400 + sec_of_day; + // GLONASST already includes leap second addition or deletion for (i = 0; GLONASS_LEAP_SECONDS[i][0]>0; i++) { if (d_yr >= GLONASS_LEAP_SECONDS[i][0]) diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index d87f49f8d..102b57dfb 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -315,78 +315,6 @@ unsigned int Glonass_Gnav_Navigation_Message::get_frame_number(unsigned int sate return frame_ID; } -double Glonass_Gnav_Navigation_Message::get_WN() -{ - double WN = 0.0; - double days = 0.0; - double total_sec = 0.0; - int i = 0; - - boost::gregorian::date gps_epoch { 1980, 1, 6 }; - // Map to UTC - boost::gregorian::date glo_date(gnav_ephemeris.d_yr, 1, 1); - boost::gregorian::days d2(gnav_ephemeris.d_N_T-1); - glo_date = glo_date + d2; - - - boost::posix_time::time_duration t(-6, 0, 0); - boost::posix_time::ptime glo_time(glo_date, t); - boost::gregorian::date utc_date = glo_time.date(); - - days = static_cast((utc_date - gps_epoch).days()); - total_sec = days*86400; - - for (i = 0; GLONASS_LEAP_SECONDS[i][0]>0; i++) - { - if (GLONASS_LEAP_SECONDS[i][0] == gnav_ephemeris.d_yr) - { - // We add the leap second when going from utc to gpst - total_sec += GLONASS_LEAP_SECONDS[i][6]; - } - } - - - WN = floor(total_sec/604800); - - return WN; -} - - -double Glonass_Gnav_Navigation_Message::get_TOW() -{ - double TOD = 0.0; - double TOW = 0.0; - double dayofweek = 0.0; - double utcsu2utc = 3*3600; - double glot2utcsu = 3*3600; - int i = 0; - - // 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 = (gnav_ephemeris.d_t_k + 10) - glot2utcsu - utcsu2utc;// + gnav_utc_model.d_tau_c + gnav_utc_model.d_tau_gps; - - - boost::gregorian::date glo_date(gnav_ephemeris.d_yr, 1, 1); - boost::gregorian::days d2(gnav_ephemeris.d_N_T); - glo_date = glo_date + d2; - - dayofweek = static_cast(glo_date.day_of_week()); - TOW = TOD + dayofweek*86400; - - for (i = 0; GLONASS_LEAP_SECONDS[i][0]>0; i++) - { - if (gnav_ephemeris.d_yr >= GLONASS_LEAP_SECONDS[i][0]) - { - // We add the leap second when going from utc to gpst - TOW += fabs(GLONASS_LEAP_SECONDS[i][6]); - } - } - // Compute the arithmetic modules to wrap around range - TOW = TOW - 604800*floor(TOW/604800); - - return TOW; -} - int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) { @@ -426,7 +354,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) { gnav_ephemeris.d_B_n = static_cast(read_navigation_unsigned(string_bits, B_N)); gnav_ephemeris.d_P_2 = static_cast(read_navigation_bool(string_bits, P2)); - gnav_ephemeris.d_t_b = static_cast(read_navigation_unsigned(string_bits, T_B)) * gnav_ephemeris.d_P_1 * 60; + gnav_ephemeris.d_t_b = static_cast(read_navigation_unsigned(string_bits, T_B)) * 15 * 60; gnav_ephemeris.d_VYn = static_cast(read_navigation_signed(string_bits, Y_N_DOT)) * TWO_N20; gnav_ephemeris.d_AYn = static_cast(read_navigation_signed(string_bits, Y_N_DOT_DOT)) * TWO_N30; gnav_ephemeris.d_Yn = static_cast(read_navigation_signed(string_bits, Y_N)) * TWO_N11; @@ -759,15 +687,6 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string) } -double Glonass_Gnav_Navigation_Message::utc_time(const double glonass_time_corrected) const -{ - double t_utc; - - t_utc = glonass_time_corrected + 3*3600 + gnav_utc_model.d_tau_c; - return t_utc; -} - - Glonass_Gnav_Ephemeris Glonass_Gnav_Navigation_Message::get_ephemeris() { return gnav_ephemeris; @@ -814,9 +733,9 @@ bool Glonass_Gnav_Navigation_Message::have_new_ephemeris() //Check if we have a bool Glonass_Gnav_Navigation_Message::have_new_utc_model() // Check if we have a new utc data set stored in the galileo navigation class { - if (flag_utc_model_valid == true) + if (flag_utc_model_str_5 == true) { - flag_utc_model_valid = false; // clear the flag + flag_utc_model_str_5 = false; // clear the flag return true; } else diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.h b/src/core/system_parameters/glonass_gnav_navigation_message.h index 062d99693..159a212f2 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.h +++ b/src/core/system_parameters/glonass_gnav_navigation_message.h @@ -65,7 +65,6 @@ public: unsigned int d_string_ID; bool flag_update_slot_number; - // satellite identification info int i_channel_ID; unsigned int i_satellite_PRN; @@ -102,17 +101,25 @@ public: bool flag_TOW_set; //!< Flag indicating when the TOW has been set bool flag_TOW_new; //!< Flag indicating when a new TOW has been computed - // Clock terms - double d_satClkCorr; // Satellite clock error - double d_dtr; // Relativistic clock correction term - double d_satClkDrift; // Satellite clock drift + double d_satClkCorr; //!< Satellite clock error + double d_dtr; //!< Relativistic clock correction term + double d_satClkDrift; //!< Satellite clock drift - // Data update parameters - double d_previous_tb; - double d_previous_Na[GLONASS_L1_CA_NBR_SATS]; + double d_previous_tb; //!< Previous iode for the Glonass_Gnav_Ephemeris object. Used to determine when new data arrives + double d_previous_Na[GLONASS_L1_CA_NBR_SATS]; //!< Previous time for almanac of the Glonass_Gnav_Almanac object + + /*! + * \brief Compute CRC for GLONASS GNAV strings + * \param bits Bits of the string message where to compute CRC + */ bool CRC_test(std::bitset bits); + /*! + * \brief Computes the frame number being decoded given the satellite slot number + * \param satellite_slot_number [in] Satellite slot number identifier + * \returns Frame number being decoded, 0 if operation was not successful. + */ unsigned int get_frame_number(unsigned int satellite_slot_number); /*! @@ -130,45 +137,35 @@ public: */ Glonass_Gnav_Utc_Model get_utc_model(); - /* - * \brief Returns a Galileo_Almanac object filled with the latest navigation data received + /*! + * \brief Returns a Glonass_Gnav_Almanac object filled with the latest navigation data received + * \param satellite_slot_number Slot number identifier for the satellite + * \returns Returns the Glonass_Gnav_Almanac object for the input slot number */ Glonass_Gnav_Almanac get_almanac(unsigned int satellite_slot_number); - /* - * \brief Returns true if new Ephemeris has arrived. The flag is set to false when the function is executed + /*! + * \brief Returns true if a new Glonass_Gnav_Ephemeris object has arrived. */ bool have_new_ephemeris(); - /* - * \brief Returns true if new UTC model has arrived. The flag is set to false when the function is executed + /*! + * \brief Returns true if new Glonass_Gnav_Utc_Model object has arrived */ bool have_new_utc_model(); - /* - * \brief Returns true if new UTC model has arrived. The flag is set to false when the function is executed + /*! + * \brief Returns true if new Glonass_Gnav_Almanac object has arrived. */ bool have_new_almanac(); /*! * \brief Decodes the GLONASS GNAV string + * \param frame_string [in] is the string message within the parsed frame + * \returns Returns the ID of the decoded string */ int string_decoder(std::string frame_string); - /*! - * \brief Gets the time of week in GPS Time - * \details This converts from GLONASS Time to GPS Time of Week based on the - * start of frame - */ - double get_TOW(); - - double get_WN(); - - /*! - * \brief Computes the Coordinated Universal Time (UTC) and returns it in [s] - */ - double utc_time(const double glonasstime_corrected) const; - /*! * Default constructor */ From 4b9c2268917c970c75160d728d790f19d53ac05a Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Fri, 3 Nov 2017 16:26:03 -0600 Subject: [PATCH 2/5] 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 --- 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 +++--- 4 files changed, 8 insertions(+), 7 deletions(-) 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 e0c72cabd..0f51c6106 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -2931,7 +2931,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; @@ -3015,6 +3015,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 1b98e7dcadec0acfcca8258167bd4749c7506ea8 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Thu, 9 Nov 2017 11:39:09 -0800 Subject: [PATCH 3/5] 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 3e4e94db8ec0bfe63147f8bad58521e4ee19b495 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Mon, 13 Nov 2017 14:18:45 -0700 Subject: [PATCH 4/5] 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 756a4b5a2ef0d0742531f01e169d15c1b09d6393 Mon Sep 17 00:00:00 2001 From: Damian Miralles Date: Mon, 13 Nov 2017 22:41:12 -0700 Subject: [PATCH 5/5] 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 ); }