mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-11-04 09:13:05 +00:00 
			
		
		
		
	debug7
This commit is contained in:
		@@ -60,7 +60,6 @@ hybrid_observables_cc::hybrid_observables_cc(unsigned int nchannels_in, unsigned
 | 
			
		||||
    d_dump = dump;
 | 
			
		||||
    d_nchannels = nchannels_out;
 | 
			
		||||
    d_dump_filename = dump_filename;
 | 
			
		||||
    d_dump_filename_in = d_dump_filename;
 | 
			
		||||
    T_rx_s = 0.0;
 | 
			
		||||
    T_rx_step_s = 0.001; // 1 ms
 | 
			
		||||
    max_delta = 0.15; // 150 ms
 | 
			
		||||
@@ -90,21 +89,6 @@ hybrid_observables_cc::hybrid_observables_cc(unsigned int nchannels_in, unsigned
 | 
			
		||||
                d_dump = false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (!d_dump_in.is_open())
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                d_dump_in.exceptions (std::ifstream::failbit | std::ifstream::badbit );
 | 
			
		||||
                d_dump_filename_in.append("_in.bin");
 | 
			
		||||
                d_dump_in.open(d_dump_filename_in.c_str(), std::ios::out | std::ios::binary);
 | 
			
		||||
                LOG(INFO) << "Observables dump enabled Log file: " << d_dump_filename.c_str();
 | 
			
		||||
            }
 | 
			
		||||
            catch (const std::ifstream::failure & e)
 | 
			
		||||
            {
 | 
			
		||||
                LOG(WARNING) << "Exception opening observables dump file " << e.what();
 | 
			
		||||
                d_dump = false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -119,14 +103,6 @@ hybrid_observables_cc::~hybrid_observables_cc()
 | 
			
		||||
            LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if (d_dump_in.is_open())
 | 
			
		||||
    {
 | 
			
		||||
        try { d_dump_in.close(); }
 | 
			
		||||
        catch(const std::exception & ex)
 | 
			
		||||
        {
 | 
			
		||||
            LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if(d_dump)
 | 
			
		||||
    {
 | 
			
		||||
        std::cout << "Writing observables .mat files ...";
 | 
			
		||||
@@ -425,25 +401,30 @@ void hybrid_observables_cc::correct_TOW_and_compute_prange(std::vector<Gnss_Sync
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/////////////////////// DEBUG //////////////////////////
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
    std::vector<Gnss_Synchro>::iterator it2;
 | 
			
		||||
    double thr_ = 250.0 / 3e8;
 | 
			
		||||
    double thr_ = 250.0 / 3e8; // Maximum pseudorange difference = 250 meters
 | 
			
		||||
    for(it = data.begin(); it != (data.end() - 1); it++)
 | 
			
		||||
    {
 | 
			
		||||
        for(it2 = it + 1; it2 != data.end(); it2++)
 | 
			
		||||
        {
 | 
			
		||||
            if(it->PRN == it2->PRN)
 | 
			
		||||
            if(it->PRN == it2->PRN and it->System == it2->System)
 | 
			
		||||
            {
 | 
			
		||||
                double tow_dif_ = std::fabs(it->TOW_at_current_symbol_s - it2->TOW_at_current_symbol_s);
 | 
			
		||||
                if(tow_dif_ > thr_)
 | 
			
		||||
                {
 | 
			
		||||
                    std::cout << TEXT_RED << "L1 - L2 TOW difference in PRN " << it->PRN <<
 | 
			
		||||
                            " = " << tow_dif_ << "[ms]. Equivalent to " << tow_dif_ * 3e8 << " meters in pseudorange"
 | 
			
		||||
                            << TEXT_RESET << std::endl;
 | 
			
		||||
                    DLOG(INFO) << "System " << it->System << ". Signals " << it->Signal << " and " << it2->Signal
 | 
			
		||||
                               << ". TOW difference in PRN " << it->PRN
 | 
			
		||||
                               << " = " << tow_dif_ * 1e3 << "[ms]. Equivalent to " << tow_dif_ * 3e8
 | 
			
		||||
                               << " meters in pseudorange";
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    for(it = data.begin(); it != data.end(); it++)
 | 
			
		||||
    {
 | 
			
		||||
        if(it->TOW_at_current_symbol_s > TOW_ref) { TOW_ref = it->TOW_at_current_symbol_s; }
 | 
			
		||||
@@ -490,31 +471,12 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused)
 | 
			
		||||
                {
 | 
			
		||||
                    if(in[i][aux].Flag_valid_word)
 | 
			
		||||
                    {
 | 
			
		||||
                        bool __dump = false;
 | 
			
		||||
                        it->push_back(in[i][aux]);
 | 
			
		||||
                        it->back().RX_time = compute_T_rx_s(in[i][aux]);
 | 
			
		||||
                        __dump = true;
 | 
			
		||||
                        // Check if the last Gnss_Synchro comes from the same satellite as the previous ones
 | 
			
		||||
                        if(it->size() > 1)
 | 
			
		||||
                        {
 | 
			
		||||
                            if(it->front().PRN != it->back().PRN) { it->clear(); __dump = false; }
 | 
			
		||||
                        }
 | 
			
		||||
                        if(d_dump and __dump)
 | 
			
		||||
                        {
 | 
			
		||||
                            // MULTIPLEXED FILE RECORDING - Record results to file
 | 
			
		||||
                            try
 | 
			
		||||
                            {
 | 
			
		||||
                                int tmp_int = static_cast<int>(it->back().PRN);
 | 
			
		||||
                                d_dump_in.write(reinterpret_cast<char*>(&tmp_int), sizeof(int));
 | 
			
		||||
                                d_dump_in.write(reinterpret_cast<char*>(&it->back().RX_time), sizeof(double));
 | 
			
		||||
                                d_dump_in.write(reinterpret_cast<char*>(&it->back().TOW_at_current_symbol_s), sizeof(double));
 | 
			
		||||
                                d_dump_in.write(it->back().Signal, 3 * sizeof(char));
 | 
			
		||||
                            }
 | 
			
		||||
                            catch (const std::ifstream::failure& e)
 | 
			
		||||
                            {
 | 
			
		||||
                                LOG(WARNING) << "Exception writing observables dump file " << e.what();
 | 
			
		||||
                                d_dump = false;
 | 
			
		||||
                            }
 | 
			
		||||
                            if(it->front().PRN != it->back().PRN) { it->clear(); }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -70,6 +70,7 @@ private:
 | 
			
		||||
    double interpolate_data(const std::pair<Gnss_Synchro, Gnss_Synchro>& a, const double& ti, int parameter);
 | 
			
		||||
    std::pair<Gnss_Synchro, Gnss_Synchro> find_closest(std::deque<Gnss_Synchro>& data, const double& ti);
 | 
			
		||||
    void correct_TOW_and_compute_prange(std::vector<Gnss_Synchro>& data);
 | 
			
		||||
    int save_matfile();
 | 
			
		||||
 | 
			
		||||
    //Tracking observable history
 | 
			
		||||
    std::vector<std::deque<Gnss_Synchro>> d_gnss_synchro_history;
 | 
			
		||||
@@ -81,11 +82,8 @@ private:
 | 
			
		||||
    unsigned int d_nchannels;
 | 
			
		||||
    unsigned int d_num_valid_channels;
 | 
			
		||||
    std::string d_dump_filename;
 | 
			
		||||
    std::string d_dump_filename_in;
 | 
			
		||||
    std::ofstream d_dump_file;
 | 
			
		||||
    std::ofstream d_dump_in;
 | 
			
		||||
 | 
			
		||||
    int save_matfile();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -350,19 +350,11 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
 | 
			
		||||
            //double decoder_latency_ms=(double)(current_symbol.Tracking_sample_counter-d_symbol_history.at(0).Tracking_sample_counter)
 | 
			
		||||
            //        /(double)current_symbol.fs;
 | 
			
		||||
            // update TOW at the preamble instant (account with decoder latency)
 | 
			
		||||
            double tmp_tow = d_TOW_at_current_symbol + GPS_L1_CA_CODE_PERIOD;
 | 
			
		||||
 | 
			
		||||
            d_TOW_at_Preamble = d_GPS_FSM.d_nav.d_TOW + 2 * GPS_L1_CA_CODE_PERIOD + GPS_CA_PREAMBLE_DURATION_S;
 | 
			
		||||
            d_TOW_at_current_symbol = floor(d_TOW_at_Preamble * 1000.0) / 1000.0;
 | 
			
		||||
            flag_TOW_set = true;
 | 
			
		||||
            d_flag_new_tow_available = false;
 | 
			
		||||
            double tmp_diff = std::fabs(tmp_tow - d_TOW_at_current_symbol);
 | 
			
		||||
            if (tmp_diff > 0.000001)
 | 
			
		||||
            {
 | 
			
		||||
                std::cout << TEXT_RED <<
 | 
			
		||||
                        "GPS L1 C/A. TOW incoherence on PRN: "<< current_symbol.PRN << ". TOW difference = " <<
 | 
			
		||||
                        tmp_diff * 1000.0 << " [ms]" << TEXT_RESET << std::endl;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    else
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -155,17 +155,8 @@ int gps_l2c_telemetry_decoder_cc::general_work (int noutput_items __attribute__(
 | 
			
		||||
            //* delay by the formulae:
 | 
			
		||||
            //* \code
 | 
			
		||||
            //* symbolTime_ms = msg->tow * 6000 + *pdelay * 20 + (12 * 20); 12 symbols of the encoder's transitory
 | 
			
		||||
            double tmp_tow = d_TOW_at_current_symbol + GPS_L2_M_PERIOD;
 | 
			
		||||
            d_TOW_at_current_symbol = static_cast<double>(msg.tow) * 6.0 + static_cast<double>(delay) * GPS_L2_M_PERIOD + 12 * GPS_L2_M_PERIOD;
 | 
			
		||||
 | 
			
		||||
            //d_TOW_at_current_symbol = floor(d_TOW_at_current_symbol * 1000.0) / 1000.0;
 | 
			
		||||
            double tmp_diff = std::fabs(tmp_tow - d_TOW_at_current_symbol);
 | 
			
		||||
            if (tmp_diff > 0.000001)
 | 
			
		||||
            {
 | 
			
		||||
                std::cout << TEXT_RED <<
 | 
			
		||||
                        "GPS L2C. TOW incoherence on PRN: "<< current_synchro_data.PRN << ". TOW difference = " <<
 | 
			
		||||
                        tmp_diff * 1000.0 << " [ms]" << TEXT_RESET << std::endl;
 | 
			
		||||
            }
 | 
			
		||||
            d_flag_valid_word = true;
 | 
			
		||||
        }
 | 
			
		||||
    else
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user