From c849738da07ed5fd43a80a06f9fc48f70ab2b329 Mon Sep 17 00:00:00 2001 From: Antonio Ramos Date: Fri, 23 Feb 2018 12:00:20 +0100 Subject: [PATCH] debug7 --- .../gnuradio_blocks/hybrid_observables_cc.cc | 60 ++++--------------- .../gnuradio_blocks/hybrid_observables_cc.h | 4 +- .../gps_l1_ca_telemetry_decoder_cc.cc | 8 --- .../gps_l2c_telemetry_decoder_cc.cc | 9 --- 4 files changed, 12 insertions(+), 69 deletions(-) diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc index 4ecb8d236..beda350d3 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc @@ -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::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(it->back().PRN); - d_dump_in.write(reinterpret_cast(&tmp_int), sizeof(int)); - d_dump_in.write(reinterpret_cast(&it->back().RX_time), sizeof(double)); - d_dump_in.write(reinterpret_cast(&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(); } } } } diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h index 5f9d0722f..024e1b4c0 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h @@ -70,6 +70,7 @@ private: double interpolate_data(const std::pair& a, const double& ti, int parameter); std::pair find_closest(std::deque& data, const double& ti); void correct_TOW_and_compute_prange(std::vector& data); + int save_matfile(); //Tracking observable history std::vector> 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 diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc index 880b9b7fb..ae303a20f 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc @@ -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 { diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc index 281698845..4e046f1c4 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc @@ -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(msg.tow) * 6.0 + static_cast(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