diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc index 2c2221d7d..733cc9d99 100644 --- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc @@ -77,6 +77,11 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr que b_rinex_header_writen = false; rp = new Rinex_Printer(); + + for (unsigned int i=0; id_ephemeris[nav_msg.i_channel_ID] = nav_msg; + nav_data_map[nav_msg.i_channel_ID] = nav_msg; // **** update pseudoranges clock **** if (nav_msg.i_satellite_PRN == gnss_pseudoranges_iter->second.SV_ID) @@ -166,9 +172,9 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite rp->rinex_obs_header(rp->obsFile, d_last_nav_msg); b_rinex_header_writen = true; // do not write header anymore } - if(b_rinex_header_writen) // Put here another condition to separate annotations + if(b_rinex_header_writen) // Put here another condition to separate annotations (e.g 30 s) { - rp->log_rinex_nav(rp->navFile, d_last_nav_msg); + rp->log_rinex_nav(rp->navFile, nav_data_map); rp->log_rinex_obs(rp->obsFile, d_last_nav_msg, pseudoranges); } } diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h index 1bf82a70b..4b5c56293 100644 --- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h +++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h @@ -87,6 +87,7 @@ private: double d_ephemeris_timestamp_ms; gps_l1_ca_ls_pvt *d_ls_pvt; + std::map nav_data_map; public: diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index f71d1b769..9fad9e63a 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -498,286 +498,297 @@ void Rinex_Printer::rinex_nav_header(std::ofstream& out, gps_navigation_message -void Rinex_Printer::log_rinex_nav(std::ofstream& out, gps_navigation_message nav_msg) +void Rinex_Printer::log_rinex_nav(std::ofstream& out, std::map nav_msg) { - // this has to be done for all satellites! std::string line; - - boost::posix_time::ptime p_utc_time = Rinex_Printer::compute_time(nav_msg); - std::string timestring=boost::posix_time::to_iso_string(p_utc_time); - std::string month (timestring, 4, 2); - std::string day (timestring, 6, 2); - std::string hour (timestring, 9, 2); - std::string minutes (timestring, 11, 2); - std::string seconds (timestring, 13, 2); - if (version == 2) + for (int i=0; i < (int)nav_msg.size(); i++) { - line += Rinex_Printer::rightJustify(boost::lexical_cast(nav_msg.i_satellite_PRN), 2); - line += std::string(1, ' '); - std::string year (timestring, 2, 2); - line += year; - line += std::string(1, ' '); - line += month; - line += std::string(1, ' '); - line += day; - line += std::string(1, ' '); - line += hour; - line += std::string(1, ' '); - line += minutes; - line += std::string(1, ' '); - line += seconds; - line += std::string(1, '.'); - std::string decimal = std::string("0"); - if (timestring.size() > 16) + // -------- SV / EPOCH / SV CLK + boost::posix_time::ptime p_utc_time = Rinex_Printer::compute_time(nav_msg[i]); + std::string timestring = boost::posix_time::to_iso_string(p_utc_time); + std::string month (timestring, 4, 2); + std::string day (timestring, 6, 2); + std::string hour (timestring, 9, 2); + std::string minutes (timestring, 11, 2); + std::string seconds (timestring, 13, 2); + if (version == 2) { - std::string decimal (timestring, 16, 1); + line += Rinex_Printer::rightJustify(boost::lexical_cast(nav_msg[i].i_satellite_PRN), 2); + line += std::string(1, ' '); + std::string year (timestring, 2, 2); + line += year; + line += std::string(1, ' '); + line += month; + line += std::string(1, ' '); + line += day; + line += std::string(1, ' '); + line += hour; + line += std::string(1, ' '); + line += minutes; + line += std::string(1, ' '); + 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(nav_msg[i].d_A_f0, 18, 2); + line += std::string(1, ' '); + line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2); + line += std::string(1, ' '); + line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2); + line += std::string(1, ' '); + } + if (version == 3) + { + line += satelliteSystem["GPS"]; + if (nav_msg[i].i_satellite_PRN < 10) line += std::string("0"); + line += boost::lexical_cast(nav_msg[i].i_satellite_PRN); + std::string year (timestring, 0, 4); + line += std::string(1, ' '); + line += year; + line += std::string(1, ' '); + line += month; + line += std::string(1, ' '); + line += day; + line += std::string(1, ' '); + line += hour; + line += std::string(1, ' '); + line += minutes; + line += std::string(1, ' '); + line += seconds; + line += std::string(1, ' '); + line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2); + line += std::string(1, ' '); + line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2); + line += std::string(1, ' '); + line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2); + } + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + + + + + // -------- BROADCAST ORBIT - 1 + line.clear(); + + if (version == 2) + { + line += std::string(4, ' '); + } + if (version == 3) + { + line += std::string(5, ' '); + } + if (nav_msg[i].d_IODE_SF2 == nav_msg[i].d_IODE_SF3) + { + line += Rinex_Printer::doub2for(nav_msg[i].d_IODE_SF2, 18, 2); + } + else + { + LOG_AT_LEVEL(ERROR) << "Discontinued reception of Frame 2 and 3 " << std::endl; } - line += decimal; line += std::string(1, ' '); - line += doub2for(nav_msg.d_A_f0, 18, 2); + line += Rinex_Printer::doub2for(nav_msg[i].d_Crs, 18, 2); line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_A_f0, 18, 2); + line += Rinex_Printer::doub2for(nav_msg[i].d_Delta_n, 18, 2); line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_A_f0, 18, 2); + line += Rinex_Printer::doub2for(nav_msg[i].d_M_0, 18, 2); + if (version == 2) + { + line += std::string(1, ' '); + } + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + + + // -------- BROADCAST ORBIT - 2 + line.clear(); + if (version == 2) + { + line += std::string(4, ' '); + } + if (version == 3) + { + line += std::string(5, ' '); + } + line += Rinex_Printer::doub2for(nav_msg[i].d_Cuc, 18, 2); line += std::string(1, ' '); - - } - if (version == 3) - { - line += satelliteSystem["GPS"]; - if (nav_msg.i_satellite_PRN < 10) line += std::string("0"); - line += boost::lexical_cast(nav_msg.i_satellite_PRN); - std::string year (timestring, 0, 4); + line += Rinex_Printer::doub2for(nav_msg[i].d_e_eccentricity, 18, 2); line += std::string(1, ' '); - line += year; + line += Rinex_Printer::doub2for(nav_msg[i].d_Cus, 18, 2); line += std::string(1, ' '); - line += month; + line += Rinex_Printer::doub2for(nav_msg[i].d_sqrt_A, 18, 2); + if (version == 2) + { + line += std::string(1, ' '); + } + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + + + + // -------- BROADCAST ORBIT - 3 + line.clear(); + if (version == 2) + { + line += std::string(4, ' '); + } + if (version == 3) + { + line += std::string(5, ' '); + } + line += Rinex_Printer::doub2for(nav_msg[i].d_Toe, 18, 2); line += std::string(1, ' '); - line += day; + line += Rinex_Printer::doub2for(nav_msg[i].d_Cic, 18, 2); line += std::string(1, ' '); - line += hour; + line += Rinex_Printer::doub2for(nav_msg[i].d_OMEGA0, 18, 2); line += std::string(1, ' '); - line += minutes; + line += Rinex_Printer::doub2for(nav_msg[i].d_Cis, 18, 2); + if (version == 2) + { + line += std::string(1, ' '); + } + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + + + + + // -------- BROADCAST ORBIT - 4 + line.clear(); + if (version == 2) + { + line += std::string(4, ' '); + } + if (version == 3) + { + line += std::string(5, ' '); + } + line += Rinex_Printer::doub2for(nav_msg[i].d_i_0, 18, 2); line += std::string(1, ' '); - line += seconds; + line += Rinex_Printer::doub2for(nav_msg[i].d_Crc, 18, 2); line += std::string(1, ' '); - line += doub2for(nav_msg.d_A_f0, 18, 2); + line += Rinex_Printer::doub2for(nav_msg[i].d_OMEGA, 18, 2); line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_A_f0, 18, 2); + line += Rinex_Printer::doub2for(nav_msg[i].d_OMEGA_DOT, 18, 2); + if (version == 2) + { + line += std::string(1, ' '); + } + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + + + + // -------- BROADCAST ORBIT - 5 + line.clear(); + if (version == 2) + { + line += std::string(4, ' '); + } + if (version == 3) + { + line += std::string(5, ' '); + } + line += Rinex_Printer::doub2for(nav_msg[i].d_IDOT, 18, 2); line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_A_f0, 18, 2); - } - Rinex_Printer::lengthCheck(line); - out << line << std::endl; - - - line.clear(); - - if (version == 2) - { - line += std::string(4, ' '); - } - if (version == 3) - { - line += std::string(5, ' '); - } - if (nav_msg.d_IODE_SF2 == nav_msg.d_IODE_SF3) - { - line += Rinex_Printer::doub2for(nav_msg.d_IODE_SF2, 18, 2); - } - else - { - LOG_AT_LEVEL(ERROR) << "Discontinued reception of Frame 2 and 3 " << std::endl; - } - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_Crs, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_Delta_n, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_M_0, 18, 2); - if (version == 2) - { + line += Rinex_Printer::doub2for((double)(nav_msg[i].i_code_on_L2), 18, 2); line += std::string(1, ' '); - } - Rinex_Printer::lengthCheck(line); - out << line << std::endl; - - - - line.clear(); - if (version == 2) - { - line += std::string(4, ' '); - } - if (version == 3) - { - line += std::string(5, ' '); - } - line += Rinex_Printer::doub2for(nav_msg.d_Cuc, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_e_eccentricity, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_Cus, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_sqrt_A, 18, 2); - if (version == 2) - { + line += Rinex_Printer::doub2for((double)(nav_msg[i].i_code_on_L2), 18, 2); line += std::string(1, ' '); - } - Rinex_Printer::lengthCheck(line); - out << line << std::endl; + double GPS_week_continuous_number = (double)(nav_msg[i].i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm) + line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2); + if (version == 2) + { + line += std::string(1, ' '); + } + Rinex_Printer::lengthCheck(line); + out << line << std::endl; - - line.clear(); - if (version == 2) - { - line += std::string(4, ' '); - } - if (version == 3) - { - line += std::string(5, ' '); - } - line += Rinex_Printer::doub2for(nav_msg.d_Toe, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_Cic, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_OMEGA0, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_Cis, 18, 2); - if (version == 2) - { + // -------- BROADCAST ORBIT - 6 + line.clear(); + if (version == 2) + { + line += std::string(4, ' '); + } + if (version == 3) + { + line += std::string(5, ' '); + } + line += Rinex_Printer::doub2for((double)(nav_msg[i].i_SV_accuracy), 18, 2); line += std::string(1, ' '); - } - Rinex_Printer::lengthCheck(line); - out << line << std::endl; - - - - - - line.clear(); - if (version == 2) - { - line += std::string(4, ' '); - } - if (version == 3) - { - line += std::string(5, ' '); - } - line += Rinex_Printer::doub2for(nav_msg.d_i_0, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_Crc, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_OMEGA, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_OMEGA_DOT, 18, 2); - if (version == 2) - { + line += Rinex_Printer::doub2for((double)(nav_msg[i].i_SV_health), 18, 2); line += std::string(1, ' '); - } - Rinex_Printer::lengthCheck(line); - out << line << std::endl; - - - - line.clear(); - if (version == 2) - { - line += std::string(4, ' '); - } - if (version == 3) - { - line += std::string(5, ' '); - } - line += Rinex_Printer::doub2for(nav_msg.d_IDOT, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for((double)(nav_msg.i_code_on_L2), 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for((double)(nav_msg.i_code_on_L2), 18, 2); - line += std::string(1, ' '); - double GPS_week_continuous_number = (double)(nav_msg.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm) - line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2); - if (version == 2) - { + line += Rinex_Printer::doub2for(nav_msg[i].d_TGD, 18, 2); line += std::string(1, ' '); - } - Rinex_Printer::lengthCheck(line); - out << line << std::endl; + line += Rinex_Printer::doub2for(nav_msg[i].d_IODC, 18, 2); + if (version == 2) + { + line += std::string(1, ' '); + } + Rinex_Printer::lengthCheck(line); + out << line << std::endl; - line.clear(); - if (version == 2) - { - line += std::string(4, ' '); - } - if (version == 3) - { - line += std::string(5, ' '); - } - line += Rinex_Printer::doub2for((double)(nav_msg.i_SV_accuracy), 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for((double)(nav_msg.i_SV_health), 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_TGD, 18, 2); - line += std::string(1, ' '); - line += Rinex_Printer::doub2for(nav_msg.d_IODC, 18, 2); - if (version == 2) - { + + // -------- BROADCAST ORBIT - 7 + line.clear(); + if (version == 2) + { + line += std::string(4, ' '); + } + if (version == 3) + { + line += std::string(5, ' '); + } + line += Rinex_Printer::doub2for(nav_msg[i].d_TOW, 18, 2); line += std::string(1, ' '); - } - Rinex_Printer::lengthCheck(line); - out << line << std::endl; + double curve_fit_interval = 4; + if (nav_msg[i].satelliteBlock[nav_msg[i].i_satellite_PRN].compare("IIA")) + { + // Block II/IIA (Table 20-XI IS-GPS-200E ) + if ( (nav_msg[i].d_IODC > 239) && (nav_msg[i].d_IODC < 248) ) curve_fit_interval = 8; + if ( ( (nav_msg[i].d_IODC > 247) && (nav_msg[i].d_IODC < 256) ) || (nav_msg[i].d_IODC == 496) ) curve_fit_interval = 14; + if ( (nav_msg[i].d_IODC > 496) && (nav_msg[i].d_IODC < 504) ) curve_fit_interval = 26; + if ( (nav_msg[i].d_IODC > 503) && (nav_msg[i].d_IODC < 511) ) curve_fit_interval = 50; + if ( ( (nav_msg[i].d_IODC > 751) && (nav_msg[i].d_IODC < 757) ) || (nav_msg[i].d_IODC == 511) ) curve_fit_interval = 74; + if ( (nav_msg[i].d_IODC == 757)) curve_fit_interval = 98; + } - line.clear(); - if (version == 2) - { - line += std::string(4, ' '); - } - if (version == 3) - { - line += std::string(5, ' '); - } - line += Rinex_Printer::doub2for(nav_msg.d_TOW, 18, 2); - line += std::string(1, ' '); - double curve_fit_interval = 4; - - if (nav_msg.satelliteBlock[nav_msg.i_satellite_PRN].compare("IIA")) - { - // Block II/IIA (Table 20-XI IS-GPS-200E ) - if ( (nav_msg.d_IODC > 239) && (nav_msg.d_IODC < 248) ) curve_fit_interval = 8; - if ( ( (nav_msg.d_IODC > 247) && (nav_msg.d_IODC < 256) ) || (nav_msg.d_IODC == 496) ) curve_fit_interval = 14; - if ( (nav_msg.d_IODC > 496) && (nav_msg.d_IODC < 504) ) curve_fit_interval = 26; - if ( (nav_msg.d_IODC > 503) && (nav_msg.d_IODC < 511) ) curve_fit_interval = 50; - if ( ( (nav_msg.d_IODC > 751) && (nav_msg.d_IODC < 757) ) || (nav_msg.d_IODC == 511) ) curve_fit_interval = 74; - if ( (nav_msg.d_IODC == 757)) curve_fit_interval = 98; - } - - if ((nav_msg.satelliteBlock[nav_msg.i_satellite_PRN].compare("IIR") == 0) || - (nav_msg.satelliteBlock[nav_msg.i_satellite_PRN].compare("IIR-M") == 0) || - (nav_msg.satelliteBlock[nav_msg.i_satellite_PRN].compare("IIF") == 0) || - (nav_msg.satelliteBlock[nav_msg.i_satellite_PRN].compare("IIIA") == 0) ) - { - // Block IIR/IIR-M/IIF/IIIA (Table 20-XII IS-GPS-200E ) - if ( (nav_msg.d_IODC > 239) && (nav_msg.d_IODC < 248)) curve_fit_interval = 8; - if ( ( (nav_msg.d_IODC > 247) && (nav_msg.d_IODC < 256)) || (nav_msg.d_IODC == 496) ) curve_fit_interval = 14; - if ( ( (nav_msg.d_IODC > 496) && (nav_msg.d_IODC < 504)) || ( (nav_msg.d_IODC > 1020) && (nav_msg.d_IODC < 1024) ) ) curve_fit_interval = 26; - } - line += Rinex_Printer::doub2for(curve_fit_interval, 18, 2); - line += std::string(1, ' '); - line += std::string(18, ' '); // spare - line += std::string(1, ' '); - line += std::string(18, ' '); // spare - if (version == 2) - { + if ((nav_msg[i].satelliteBlock[nav_msg[i].i_satellite_PRN].compare("IIR") == 0) || + (nav_msg[i].satelliteBlock[nav_msg[i].i_satellite_PRN].compare("IIR-M") == 0) || + (nav_msg[i].satelliteBlock[nav_msg[i].i_satellite_PRN].compare("IIF") == 0) || + (nav_msg[i].satelliteBlock[nav_msg[i].i_satellite_PRN].compare("IIIA") == 0) ) + { + // Block IIR/IIR-M/IIF/IIIA (Table 20-XII IS-GPS-200E ) + if ( (nav_msg[i].d_IODC > 239) && (nav_msg[i].d_IODC < 248)) curve_fit_interval = 8; + if ( ( (nav_msg[i].d_IODC > 247) && (nav_msg[i].d_IODC < 256)) || (nav_msg[i].d_IODC == 496) ) curve_fit_interval = 14; + if ( ( (nav_msg[i].d_IODC > 496) && (nav_msg[i].d_IODC < 504)) || ( (nav_msg[i].d_IODC > 1020) && (nav_msg[i].d_IODC < 1024) ) ) curve_fit_interval = 26; + } + line += Rinex_Printer::doub2for(curve_fit_interval, 18, 2); line += std::string(1, ' '); + line += std::string(18, ' '); // spare + line += std::string(1, ' '); + line += std::string(18, ' '); // spare + if (version == 2) + { + line += std::string(1, ' '); + } + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + line.clear(); } - Rinex_Printer::lengthCheck(line); - out << line << std::endl; - } + + void Rinex_Printer::rinex_obs_header(std::ofstream& out, gps_navigation_message nav_msg) { diff --git a/src/algorithms/PVT/libs/rinex_printer.h b/src/algorithms/PVT/libs/rinex_printer.h index c412ad22d..914396754 100644 --- a/src/algorithms/PVT/libs/rinex_printer.h +++ b/src/algorithms/PVT/libs/rinex_printer.h @@ -100,7 +100,7 @@ public: /*! * \brief Writes data from the navigation message into the RINEX file */ - void log_rinex_nav(std::ofstream& out, gps_navigation_message nav_msg); + void log_rinex_nav(std::ofstream& out, std::map nav_msg); /*! * \brief Writes observables into the RINEX file diff --git a/src/algorithms/observables/adapters/gps_l1_ca_observables.cc b/src/algorithms/observables/adapters/gps_l1_ca_observables.cc index 5b45df265..1a3dea957 100644 --- a/src/algorithms/observables/adapters/gps_l1_ca_observables.cc +++ b/src/algorithms/observables/adapters/gps_l1_ca_observables.cc @@ -53,7 +53,6 @@ GpsL1CaObservables::GpsL1CaObservables(ConfigurationInterface* configuration, out_streams_(out_streams), queue_(queue) { - int output_rate_ms; output_rate_ms = configuration->property(role + ".output_rate_ms", 500); @@ -68,7 +67,7 @@ GpsL1CaObservables::GpsL1CaObservables(ConfigurationInterface* configuration, dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); fs_in_ = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - observables_ = gps_l1_ca_make_observables_cc(in_streams_, queue_, dump_,dump_filename_,output_rate_ms,flag_averaging); + observables_ = gps_l1_ca_make_observables_cc(in_streams_, queue_, dump_, dump_filename_, output_rate_ms, flag_averaging); observables_->set_fs_in(fs_in_); DLOG(INFO) << "pseudorange(" << observables_->unique_id() << ")"; @@ -77,30 +76,41 @@ GpsL1CaObservables::GpsL1CaObservables(ConfigurationInterface* configuration, observables_->set_navigation_queue(&global_gps_nav_msg_queue); DLOG(INFO) << "global navigation message queue assigned to observables ("<< observables_->unique_id() << ")"; - } + + + GpsL1CaObservables::~GpsL1CaObservables() {} + + void GpsL1CaObservables::connect(gr_top_block_sptr top_block) { // Nothing to connect internally DLOG(INFO) << "nothing to connect internally"; } + + void GpsL1CaObservables::disconnect(gr_top_block_sptr top_block) { // Nothing to disconnect } + + gr_basic_block_sptr GpsL1CaObservables::get_left_block() { return observables_; } + + + gr_basic_block_sptr GpsL1CaObservables::get_right_block() { return observables_; diff --git a/src/algorithms/observables/adapters/gps_l1_ca_observables.h b/src/algorithms/observables/adapters/gps_l1_ca_observables.h index a1ce4055e..b1be6c382 100644 --- a/src/algorithms/observables/adapters/gps_l1_ca_observables.h +++ b/src/algorithms/observables/adapters/gps_l1_ca_observables.h @@ -70,7 +70,8 @@ public: { return; }; - // all blocks must have an intem_size() function implementation + + //!< All blocks must have an item_size() function implementation size_t item_size() { return sizeof(gr_complex); diff --git a/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc index 9261bd1fb..fd82c96f6 100644 --- a/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc @@ -71,7 +71,8 @@ gps_l1_ca_observables_cc::gps_l1_ca_observables_cc(unsigned int nchannels, gr_ms { if (d_dump_file.is_open() == false) { - try { + try + { d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit ); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); std::cout << "Observables dump enabled Log file: " << d_dump_filename.c_str() << std::endl; @@ -81,25 +82,40 @@ gps_l1_ca_observables_cc::gps_l1_ca_observables_cc(unsigned int nchannels, gr_ms } } } - } + + + gps_l1_ca_observables_cc::~gps_l1_ca_observables_cc() { d_dump_file.close(); delete[] d_history_prn_delay_ms; } + + + + bool pairCompare_gnss_synchro( std::pair a, std::pair b) { return (a.second.preamble_delay_ms) < (b.second.preamble_delay_ms); } + + + + bool pairCompare_double( std::pair a, std::pair b) { return (a.second) < (b.second); } + + + + + void clearQueue( std::deque &q ) { std::deque empty; @@ -107,6 +123,9 @@ void clearQueue( std::deque &q ) } + + + int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { @@ -117,22 +136,20 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni std::map gps_words; std::map::iterator gps_words_iter; - std::map::iterator current_prn_timestamps_ms_iter; std::map current_prn_timestamps_ms; double min_preamble_delay_ms; double max_preamble_delay_ms; - double pseudoranges_timestamp_ms; double traveltime_ms; double pseudorange_m; - int history_shift = 0; double delta_timestamp_ms; double min_delta_timestamp_ms; double actual_min_prn_delay_ms; double current_prn_delay_ms; + int history_shift = 0; int pseudoranges_reference_sat_ID = 0; unsigned int pseudoranges_reference_sat_channel_ID = 0; @@ -251,9 +268,11 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni } } - if(d_dump == true) { + if(d_dump == true) + { // MULTIPLEXED FILE RECORDING - Record results to file - try { + try + { double tmp_double; for (unsigned int i=0; ii_channel_ID==0){ - std::cout<<"tk"< word_bits; for (int i=0; i<10; i++) { - memcpy(&gps_word,&subframe[i*4], sizeof(char)*4); + memcpy(&gps_word, &subframe[i*4], sizeof(char)*4); word_bits = std::bitset<(GPS_WORD_BITS+2)>(gps_word); for (int j=0; j