From 4b8045163038647d54b185eb2092f56a42927f09 Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Mon, 3 Dec 2018 17:58:18 +0100 Subject: [PATCH 01/12] Adding initial functional changes for the smart acquisition resampler --- .../galileo_e1_pcps_ambiguous_acquisition.cc | 59 ++++++-- .../galileo_e1_pcps_ambiguous_acquisition.h | 2 + .../adapters/gps_l1_ca_pcps_acquisition.cc | 58 +++++-- .../adapters/gps_l1_ca_pcps_acquisition.h | 2 + .../gnuradio_blocks/pcps_acquisition.cc | 52 ++++++- .../gnuradio_blocks/pcps_acquisition.h | 4 + src/algorithms/acquisition/libs/acq_conf.cc | 3 + src/algorithms/acquisition/libs/acq_conf.h | 3 + src/algorithms/channel/adapters/channel.cc | 42 ++--- src/algorithms/channel/adapters/channel.h | 10 +- .../adapters/mmse_resampler_conditioner.cc | 2 +- src/core/interfaces/channel_interface.h | 4 + src/core/receiver/gnss_block_factory.cc | 21 +-- src/core/receiver/gnss_flowgraph.cc | 107 ++++++++++++- src/core/receiver/gnss_flowgraph.h | 2 + src/core/system_parameters/GPS_L1_CA.h | 3 + src/core/system_parameters/GPS_L2C.h | 4 + src/core/system_parameters/GPS_L5.h | 3 + src/core/system_parameters/Galileo_E1.h | 5 + src/core/system_parameters/Galileo_E5a.h | 3 + src/tests/common-files/tracking_tests_flags.h | 1 + .../tracking/tracking_pull-in_test.cc | 143 ++++++++++++++++-- 22 files changed, 438 insertions(+), 95 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index a9cf7d51a..fdd6260c8 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -88,14 +88,37 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( acq_parameters.blocking = blocking_; dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); acq_parameters.dump_filename = dump_filename_; - //--- Find number of samples per spreading code (4 ms) ----------------- - code_length_ = static_cast(std::floor(static_cast(fs_in_) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); - float samples_per_ms = static_cast(fs_in_) * 0.001; - acq_parameters.samples_per_ms = samples_per_ms; - acq_parameters.samples_per_code = acq_parameters.samples_per_ms * static_cast(Galileo_E1_CODE_PERIOD_MS); - vector_length_ = sampled_ms_ * samples_per_ms; + acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); + if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + { + LOG(WARNING) << "Galileo E1 acqisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; + acq_parameters_.use_automatic_resampler = false; + } + if (acq_parameters_.use_automatic_resampler) + { + if (acq_parameters_.fs_in > Galileo_E1_OPT_ACQ_FS_HZ) + { + acq_parameters_.resampled_fs = Galileo_E1_OPT_ACQ_FS_HZ; + acq_parameters_.resampler_ratio = static_cast(acq_parameters_.fs_in) / static_cast(acq_parameters_.resampled_fs); + } + //--- Find number of samples per spreading code (4 ms) ----------------- + code_length_ = static_cast(std::floor(static_cast(acq_parameters_.resampled_fs) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); + float samples_per_ms = static_cast(acq_parameters_.resampled_fs) * 0.001; + acq_parameters_.samples_per_ms = samples_per_ms; + acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(Galileo_E1_CODE_PERIOD_MS); + vector_length_ = sampled_ms_ * samples_per_ms; + } + else + { + //--- Find number of samples per spreading code (4 ms) ----------------- + code_length_ = static_cast(std::floor(static_cast(fs_in_) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); + float samples_per_ms = static_cast(fs_in_) * 0.001; + acq_parameters_.samples_per_ms = samples_per_ms; + acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(Galileo_E1_CODE_PERIOD_MS); + vector_length_ = sampled_ms_ * samples_per_ms; + } if (bit_transition_flag_) { vector_length_ *= 2; @@ -227,13 +250,29 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code() { //set local signal generator to Galileo E1 pilot component (1C) char pilot_signal[3] = "1C"; - galileo_e1_code_gen_complex_sampled(code, pilot_signal, - cboc, gnss_synchro_->PRN, fs_in_, 0, false); + if (acq_parameters_.use_automatic_resampler) + { + galileo_e1_code_gen_complex_sampled(code, pilot_signal, + cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false); + } + else + { + galileo_e1_code_gen_complex_sampled(code, pilot_signal, + cboc, gnss_synchro_->PRN, fs_in_, 0, false); + } } else { - galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal, - cboc, gnss_synchro_->PRN, fs_in_, 0, false); + if (acq_parameters_.use_automatic_resampler) + { + galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal, + cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false); + } + else + { + galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal, + cboc, gnss_synchro_->PRN, fs_in_, 0, false); + } } diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h index 4f4a3c657..8e7859556 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h @@ -33,6 +33,7 @@ #define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_ #include "acquisition_interface.h" +#include "acq_conf.h" #include "gnss_synchro.h" #include "pcps_acquisition.h" #include "complex_byte_to_float_x2.h" @@ -139,6 +140,7 @@ public: private: ConfigurationInterface* configuration_; + Acq_Conf acq_parameters_; pcps_acquisition_sptr acquisition_; gr::blocks::float_to_complex::sptr float_to_complex_; complex_byte_to_float_x2_sptr cbyte_to_float_x2_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 7787b34cb..c7c109672 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -84,16 +84,44 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( max_dwells_ = configuration_->property(role + ".max_dwells", 1); acq_parameters.max_dwells = max_dwells_; dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); - acq_parameters.dump_filename = dump_filename_; - acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); - acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); - acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false); - //--- Find number of samples per spreading code ------------------------- - code_length_ = static_cast(std::floor(static_cast(fs_in_) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); - acq_parameters.samples_per_ms = static_cast(fs_in_) * 0.001; - acq_parameters.samples_per_code = acq_parameters.samples_per_ms * static_cast(GPS_L1_CA_CODE_PERIOD * 1000.0); - - vector_length_ = std::floor(acq_parameters.sampled_ms * acq_parameters.samples_per_ms) * (acq_parameters.bit_transition_flag ? 2 : 1); + acq_parameters_.dump_filename = dump_filename_; + acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); + acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); + acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); + acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); + if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + { + LOG(WARNING) << "GPS L1 CA acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; + acq_parameters_.use_automatic_resampler = false; + } + if (acq_parameters_.use_automatic_resampler) + { + if (acq_parameters_.fs_in > GPS_L1_CA_OPT_ACQ_FS_HZ) + { + acq_parameters_.resampler_ratio = floor(static_cast(acq_parameters_.fs_in) / GPS_L1_CA_OPT_ACQ_FS_HZ); + uint32_t decimation = acq_parameters_.fs_in / GPS_L1_CA_OPT_ACQ_FS_HZ; + while (acq_parameters_.fs_in % decimation > 0) + { + decimation--; + }; + acq_parameters_.resampler_ratio = decimation; + acq_parameters_.resampled_fs = acq_parameters_.fs_in / static_cast(acq_parameters_.resampler_ratio); + } + //--- Find number of samples per spreading code ------------------------- + code_length_ = static_cast(std::floor(static_cast(acq_parameters_.resampled_fs) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); + acq_parameters_.samples_per_ms = static_cast(acq_parameters_.resampled_fs) * 0.001; + acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(GPS_L1_CA_CODE_PERIOD * 1000.0); + vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1); + } + else + { + acq_parameters_.resampled_fs = fs_in_; + //--- Find number of samples per spreading code ------------------------- + code_length_ = static_cast(std::floor(static_cast(fs_in_) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); + acq_parameters_.samples_per_ms = static_cast(fs_in_) * 0.001; + acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(GPS_L1_CA_CODE_PERIOD * 1000.0); + vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1); + } code_ = new gr_complex[vector_length_]; if (item_type_ == "cshort") @@ -208,8 +236,14 @@ void GpsL1CaPcpsAcquisition::set_local_code() { std::complex* code = new std::complex[code_length_]; - gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); - + if (acq_parameters_.use_automatic_resampler) + { + gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0); + } + else + { + gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); + } for (unsigned int i = 0; i < sampled_ms_; i++) { memcpy(&(code_[i * code_length_]), code, diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h index 5aee6bc7a..e5d8c4719 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h @@ -37,6 +37,7 @@ #define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_ #include "acquisition_interface.h" +#include "acq_conf.h" #include "gnss_synchro.h" #include "pcps_acquisition.h" #include "complex_byte_to_float_x2.h" @@ -144,6 +145,7 @@ public: private: ConfigurationInterface* configuration_; pcps_acquisition_sptr acquisition_; + Acq_Conf acq_parameters_; gr::blocks::float_to_complex::sptr float_to_complex_; complex_byte_to_float_x2_sptr cbyte_to_float_x2_; size_t item_size_; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index a7df810a7..33f6de205 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -283,7 +283,15 @@ bool pcps_acquisition::is_fdma() void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t correlator_length_samples, float freq) { - float phase_step_rad = GPS_TWO_PI * freq / static_cast(acq_parameters.fs_in); + float phase_step_rad; + if (acq_parameters.use_automatic_resampler) + { + phase_step_rad = GPS_TWO_PI * freq / static_cast(acq_parameters.resampled_fs); + } + else + { + phase_step_rad = GPS_TWO_PI * freq / static_cast(acq_parameters.fs_in); + } float _phase[1]; _phase[0] = 0.0; volk_gnsssdr_s32f_sincos_32fc(carrier_vector, -phase_step_rad, _phase, correlator_length_samples); @@ -719,9 +727,19 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count) { d_test_statistics = first_vs_second_peak_statistic(indext, doppler, d_num_doppler_bins, acq_parameters.doppler_max, d_doppler_step); } - d_gnss_synchro->Acq_delay_samples = static_cast(std::fmod(static_cast(indext), acq_parameters.samples_per_code)); - d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); - d_gnss_synchro->Acq_samplestamp_samples = samp_count; + if (acq_parameters.use_automatic_resampler) + { + //take into account the acquisition resampler ratio + d_gnss_synchro->Acq_delay_samples = static_cast(std::fmod(static_cast(indext), acq_parameters.samples_per_code)) * acq_parameters.resampler_ratio; + d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); + d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast(samp_count) * acq_parameters.resampler_ratio); + } + else + { + d_gnss_synchro->Acq_delay_samples = static_cast(std::fmod(static_cast(indext), acq_parameters.samples_per_code)); + d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); + d_gnss_synchro->Acq_samplestamp_samples = samp_count; + } } else { @@ -765,10 +783,22 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count) { d_test_statistics = first_vs_second_peak_statistic(indext, doppler, d_num_doppler_bins_step2, static_cast(d_doppler_center_step_two - (static_cast(d_num_doppler_bins_step2) / 2.0) * acq_parameters.doppler_step2), acq_parameters.doppler_step2); } - d_gnss_synchro->Acq_delay_samples = static_cast(std::fmod(static_cast(indext), acq_parameters.samples_per_code)); - d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); - d_gnss_synchro->Acq_samplestamp_samples = samp_count; - d_gnss_synchro->Acq_doppler_step = acq_parameters.doppler_step2; + + if (acq_parameters.use_automatic_resampler) + { + //take into account the acquisition resampler ratio + d_gnss_synchro->Acq_delay_samples = static_cast(std::fmod(static_cast(indext), acq_parameters.samples_per_code)) * acq_parameters.resampler_ratio; + d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); + d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast(samp_count) * acq_parameters.resampler_ratio); + d_gnss_synchro->Acq_doppler_step = acq_parameters.doppler_step2; + } + else + { + d_gnss_synchro->Acq_delay_samples = static_cast(std::fmod(static_cast(indext), acq_parameters.samples_per_code)); + d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); + d_gnss_synchro->Acq_samplestamp_samples = samp_count; + d_gnss_synchro->Acq_doppler_step = acq_parameters.doppler_step2; + } } lk.lock(); @@ -868,6 +898,12 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count) } } +// Called by gnuradio to enable drivers, etc for i/o devices. +bool pcps_acquisition::start() +{ + d_sample_counter = 0ULL; + return true; +} int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), gr_vector_int& ninput_items, gr_vector_const_void_star& input_items, diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h index 4e46d049b..392332e46 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h @@ -98,6 +98,9 @@ private: float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step); float max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, float input_power, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step); + bool start(); + + Acq_Conf acq_parameters; bool d_active; bool d_worker_active; @@ -233,6 +236,7 @@ public: d_doppler_step = doppler_step; } + /*! * \brief Parallel Code Phase Search Acquisition signal processing. */ diff --git a/src/algorithms/acquisition/libs/acq_conf.cc b/src/algorithms/acquisition/libs/acq_conf.cc index e98bf3bdf..0640153cf 100644 --- a/src/algorithms/acquisition/libs/acq_conf.cc +++ b/src/algorithms/acquisition/libs/acq_conf.cc @@ -53,4 +53,7 @@ Acq_Conf::Acq_Conf() dump_channel = 0U; it_size = sizeof(char); blocking_on_standby = false; + use_automatic_resampler = false; + resampler_ratio = 1.0; + resampled_fs = 0LL; } diff --git a/src/algorithms/acquisition/libs/acq_conf.h b/src/algorithms/acquisition/libs/acq_conf.h index 445fab878..7582ec9a3 100644 --- a/src/algorithms/acquisition/libs/acq_conf.h +++ b/src/algorithms/acquisition/libs/acq_conf.h @@ -56,6 +56,9 @@ public: bool blocking; bool blocking_on_standby; // enable it only for unit testing to avoid sample consume on idle status bool make_2_steps; + bool use_automatic_resampler; + float resampler_ratio; + int64_t resampled_fs; std::string dump_filename; uint32_t dump_channel; size_t it_size; diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index a3d6c9bf3..c39330521 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -38,12 +38,10 @@ using google::LogMessage; // Constructor -Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, - std::shared_ptr pass_through, std::shared_ptr acq, +Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr acq, std::shared_ptr trk, std::shared_ptr nav, std::string role, std::string implementation, gr::msg_queue::sptr queue) { - pass_through_ = std::move(pass_through); acq_ = std::move(acq); trk_ = std::move(trk); nav_ = std::move(nav); @@ -112,32 +110,15 @@ Channel::~Channel() = default; void Channel::connect(gr::top_block_sptr top_block) { - if (connected_) - { - LOG(WARNING) << "channel already connected internally"; - return; - } - if (flag_enable_fpga == false) - { - pass_through_->connect(top_block); - } acq_->connect(top_block); trk_->connect(top_block); nav_->connect(top_block); //Synchronous ports - if (flag_enable_fpga == false) - { - top_block->connect(pass_through_->get_right_block(), 0, acq_->get_left_block(), 0); - DLOG(INFO) << "pass_through_ -> acquisition"; - top_block->connect(pass_through_->get_right_block(), 0, trk_->get_left_block(), 0); - DLOG(INFO) << "pass_through_ -> tracking"; - } top_block->connect(trk_->get_right_block(), 0, nav_->get_left_block(), 0); DLOG(INFO) << "tracking -> telemetry_decoder"; // Message ports - top_block->msg_connect(acq_->get_right_block(), pmt::mp("events"), channel_msg_rx, pmt::mp("events")); top_block->msg_connect(trk_->get_right_block(), pmt::mp("events"), channel_msg_rx, pmt::mp("events")); @@ -153,17 +134,8 @@ void Channel::disconnect(gr::top_block_sptr top_block) return; } - if (flag_enable_fpga == false) - { - top_block->disconnect(pass_through_->get_right_block(), 0, acq_->get_left_block(), 0); - top_block->disconnect(pass_through_->get_right_block(), 0, trk_->get_left_block(), 0); - } top_block->disconnect(trk_->get_right_block(), 0, nav_->get_left_block(), 0); - if (flag_enable_fpga == false) - { - pass_through_->disconnect(top_block); - } acq_->disconnect(top_block); trk_->disconnect(top_block); nav_->disconnect(top_block); @@ -173,9 +145,19 @@ void Channel::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr Channel::get_left_block() { - return pass_through_->get_left_block(); + LOG(ERROR) << "Deprecated call to get_left_block() in channel interface"; + return NULL; } +gr::basic_block_sptr Channel::get_left_block_trk() +{ + return trk_->get_left_block(); +} + +gr::basic_block_sptr Channel::get_left_block_acq() +{ + return acq_->get_left_block(); +} gr::basic_block_sptr Channel::get_right_block() { diff --git a/src/algorithms/channel/adapters/channel.h b/src/algorithms/channel/adapters/channel.h index 3802ff107..c38585b69 100644 --- a/src/algorithms/channel/adapters/channel.h +++ b/src/algorithms/channel/adapters/channel.h @@ -60,16 +60,17 @@ class Channel : public ChannelInterface { public: //! Constructor - Channel(ConfigurationInterface* configuration, uint32_t channel, - std::shared_ptr pass_through, std::shared_ptr acq, + Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr acq, std::shared_ptr trk, std::shared_ptr nav, std::string role, std::string implementation, gr::msg_queue::sptr queue); //! Virtual destructor virtual ~Channel(); - void connect(gr::top_block_sptr top_block) override; + void connect(gr::top_block_sptr top_block) override; //!< connects the tracking block to the top_block and to the telemetry void disconnect(gr::top_block_sptr top_block) override; - gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_left_block() override; //!< gets the gnuradio tracking block pointer + gr::basic_block_sptr get_left_block_trk() override; //!< gets the gnuradio tracking block pointer + gr::basic_block_sptr get_left_block_acq() override; //!< gets the gnuradio tracking block pointer gr::basic_block_sptr get_right_block() override; inline std::string role() override { return role_; } @@ -88,7 +89,6 @@ public: private: channel_msg_receiver_cc_sptr channel_msg_rx; - std::shared_ptr pass_through_; std::shared_ptr acq_; std::shared_ptr trk_; std::shared_ptr nav_; diff --git a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc index 4c5119a4a..83003cc8f 100644 --- a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc @@ -69,7 +69,7 @@ MmseResamplerConditioner::MmseResamplerConditioner( std::vector taps = gr::filter::firdes::low_pass(1.0, sample_freq_in_, sample_freq_out_ / 2.1, - sample_freq_out_ / 10, + sample_freq_out_ / 5, gr::filter::firdes::win_type::WIN_HAMMING); std::cout << "Enabled fractional resampler low pass filter with " << taps.size() << " taps" << std::endl; fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(1, taps); diff --git a/src/core/interfaces/channel_interface.h b/src/core/interfaces/channel_interface.h index db449941c..d4f97aea5 100644 --- a/src/core/interfaces/channel_interface.h +++ b/src/core/interfaces/channel_interface.h @@ -51,6 +51,10 @@ class ChannelInterface : public GNSSBlockInterface { public: + virtual gr::basic_block_sptr get_left_block_trk() = 0; + virtual gr::basic_block_sptr get_left_block_acq() = 0; + virtual gr::basic_block_sptr get_left_block() = 0; + virtual gr::basic_block_sptr get_right_block() = 0; virtual Gnss_Signal get_signal() const = 0; virtual void start_acquisition() = 0; virtual void stop_channel() = 0; diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 55218ee8d..17019e48a 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -361,12 +361,11 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1C( } config->set_property("Channel.item_type", acq_item_type); - std::unique_ptr pass_through_ = GetBlock(config, "Channel", "Pass_Through", 1, 1, queue); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_1C" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_1C" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_1C" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(pass_through_), + std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(acq_), std::move(trk_), std::move(tlm_), @@ -426,12 +425,11 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2S( } config->set_property("Channel.item_type", acq_item_type); - std::unique_ptr pass_through_ = GetBlock(configuration, "Channel", "Pass_Through", 1, 1, queue); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_2S" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_2S" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_2S" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(pass_through_), + std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(acq_), std::move(trk_), std::move(tlm_), @@ -494,12 +492,11 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1B( } config->set_property("Channel.item_type", acq_item_type); - std::unique_ptr pass_through_ = GetBlock(configuration, "Channel", "Pass_Through", 1, 1, queue); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_1B" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_1B" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_1B" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(pass_through_), + std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(acq_), std::move(trk_), std::move(tlm_), @@ -562,12 +559,11 @@ std::unique_ptr GNSSBlockFactory::GetChannel_5X( } config->set_property("Channel.item_type", acq_item_type); - std::unique_ptr pass_through_ = GetBlock(configuration, "Channel", "Pass_Through", 1, 1, queue); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_5X" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_5X" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_5X" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(pass_through_), + std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(acq_), std::move(trk_), std::move(tlm_), @@ -631,12 +627,11 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1G( } config->set_property("Channel.item_type", acq_item_type); - std::unique_ptr pass_through_ = GetBlock(config, "Channel", "Pass_Through", 1, 1, queue); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_1G" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_1G" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_1G" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(pass_through_), + std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(acq_), std::move(trk_), std::move(tlm_), @@ -700,12 +695,11 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2G( } config->set_property("Channel.item_type", acq_item_type); - std::unique_ptr pass_through_ = GetBlock(config, "Channel", "Pass_Through", 1, 1, queue); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_2G" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_2G" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_2G" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(pass_through_), + std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(acq_), std::move(trk_), std::move(tlm_), @@ -768,12 +762,11 @@ std::unique_ptr GNSSBlockFactory::GetChannel_L5( } config->set_property("Channel.item_type", acq_item_type); - std::unique_ptr pass_through_ = GetBlock(configuration, "Channel", "Pass_Through", 1, 1, queue); std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_L5" + appendix1, acq, 1, 0); std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_L5" + appendix2, trk, 1, 1); std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_L5" + appendix3, tlm, 1, 1); - std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(pass_through_), + std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(acq_), std::move(trk_), std::move(tlm_), diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index bb27826bb..f722b0a48 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -32,12 +32,22 @@ * ------------------------------------------------------------------------- */ +#include "GPS_L1_CA.h" +#include "Galileo_E1.h" +#include "GPS_L2C.h" +#include "GPS_L5.h" +#include "Galileo_E5a.h" #include "gnss_flowgraph.h" #include "gnss_synchro.h" #include "configuration_interface.h" #include "gnss_block_interface.h" #include "channel_interface.h" #include "gnss_block_factory.h" +#ifdef GR_GREATER_38 +#include +#else +#include +#endif #include #include #include @@ -343,6 +353,8 @@ void GNSSFlowgraph::connect() #endif // Signal conditioner (selected_signal_source) >> channels (i) (dependent of their associated SignalSource_ID) int selected_signal_conditioner_ID = 0; + bool use_acq_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); + double fs = static_cast(configuration_->property("GNSS-SDR.internal_fs_sps", 0)); for (unsigned int i = 0; i < channels_count_; i++) { if (FPGA_enabled == false) @@ -357,8 +369,97 @@ void GNSSFlowgraph::connect() } try { - top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, - channels_.at(i)->get_left_block(), 0); + // top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, + // channels_.at(i)->get_left_block(), 0); + + // Enable automatic resampler for the acquisition, if required + if (use_acq_resampler == true) + { + //create acquisition resamplers if required + double resampler_ratio = 1.0; + double acq_fs = fs; + //find the signal associated to this channel + switch (mapStringValues_[channels_.at(i)->implementation()]) + { + case evGPS_1C: + acq_fs = GPS_L1_CA_OPT_ACQ_FS_HZ; + break; + case evGPS_2S: + acq_fs = GPS_L2C_OPT_ACQ_FS_HZ; + break; + case evGPS_L5: + acq_fs = GPS_L5_OPT_ACQ_FS_HZ; + break; + case evSBAS_1C: + acq_fs = GPS_L1_CA_OPT_ACQ_FS_HZ; + break; + case evGAL_1B: + acq_fs = Galileo_E1_OPT_ACQ_FS_HZ; + break; + case evGAL_5X: + acq_fs = fs; + break; + case evGLO_1G: + acq_fs = fs; + break; + case evGLO_2G: + acq_fs = fs; + break; + } + if (acq_fs < fs) + { + //check if the resampler is already created for the channel system/signal and for the specific RF Channel + std::string map_key = channels_.at(i)->implementation() + std::to_string(selected_signal_conditioner_ID); + + resampler_ratio = fs / acq_fs; + + gr::basic_block_sptr tmp_blk; +#ifdef GR_GREATER_38 + tmp_blk = gr::filter::mmse_resampler_cc::make(0.0, resampler_ratio); +#else + tmp_blk = gr::filter::fractional_resampler_cc::make(0.0, resampler_ratio); +#endif + + std::pair::iterator, bool> ret; + ret = acq_resamplers_.insert(std::pair(map_key, tmp_blk)); + if (ret.second == true) + { + top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, + acq_resamplers_.at(map_key), 0); + LOG(INFO) << "Created " + << channels_.at(i)->implementation() + << " acquisition resampler for RF channel " << std::to_string(signal_conditioner_ID) << " with ratio " << resampler_ratio; + } + else + { + LOG(INFO) << "Found " + << channels_.at(i)->implementation() + << " acquisition resampler for RF channel " << std::to_string(signal_conditioner_ID) << " with ratio " << resampler_ratio; + } + + + top_block_->connect(acq_resamplers_.at(map_key), 0, + channels_.at(i)->get_left_block_acq(), 0); + + top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, + channels_.at(i)->get_left_block_trk(), 0); + } + else + { + //resampler not required! + top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, + channels_.at(i)->get_left_block_acq(), 0); + top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, + channels_.at(i)->get_left_block_trk(), 0); + } + } + else + { + top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, + channels_.at(i)->get_left_block_acq(), 0); + top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, + channels_.at(i)->get_left_block_trk(), 0); + } } catch (const std::exception& e) { @@ -678,7 +779,7 @@ void GNSSFlowgraph::disconnect() try { top_block_->disconnect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, - channels_.at(i)->get_left_block(), 0); + channels_.at(i)->get_left_block_trk(), 0); } catch (const std::exception& e) { diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index b279f6f67..9ae59323d 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -55,6 +55,7 @@ #include #include #include +#include #if ENABLE_FPGA #include "gnss_sdr_fpga_sample_counter.h" @@ -166,6 +167,7 @@ private: std::shared_ptr observables_; std::shared_ptr pvt_; + std::map acq_resamplers_; std::vector> channels_; gnss_sdr_sample_counter_sptr ch_out_sample_counter; #if ENABLE_FPGA diff --git a/src/core/system_parameters/GPS_L1_CA.h b/src/core/system_parameters/GPS_L1_CA.h index 9879716e4..f14b9f2f2 100644 --- a/src/core/system_parameters/GPS_L1_CA.h +++ b/src/core/system_parameters/GPS_L1_CA.h @@ -57,6 +57,9 @@ const double GPS_L1_CA_CODE_PERIOD = 0.001; //!< GPS L1 C/A code period const uint32_t GPS_L1_CA_CODE_PERIOD_MS = 1U; //!< GPS L1 C/A code period [ms] const double GPS_L1_CA_CHIP_PERIOD = 9.7752e-07; //!< GPS L1 C/A chip period [seconds] +//optimum parameters +const uint32_t GPS_L1_CA_OPT_ACQ_FS_HZ = 2000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate + /*! * \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms * diff --git a/src/core/system_parameters/GPS_L2C.h b/src/core/system_parameters/GPS_L2C.h index b156dfe4a..28257a204 100644 --- a/src/core/system_parameters/GPS_L2C.h +++ b/src/core/system_parameters/GPS_L2C.h @@ -63,6 +63,10 @@ const double GPS_L2_L_PERIOD = 1.5; //!< GPS L2 L code period [s const int32_t GPS_L2C_HISTORY_DEEP = 5; +//optimum parameters +const uint32_t GPS_L2C_OPT_ACQ_FS_HZ = 2000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate + + const int32_t GPS_L2C_M_INIT_REG[115] = {0742417664, 0756014035, 0002747144, 0066265724, // 1:4 0601403471, 0703232733, 0124510070, 0617316361, // 5:8 diff --git a/src/core/system_parameters/GPS_L5.h b/src/core/system_parameters/GPS_L5.h index fe270f204..f12c0c14a 100644 --- a/src/core/system_parameters/GPS_L5.h +++ b/src/core/system_parameters/GPS_L5.h @@ -64,6 +64,9 @@ const double GPS_L5q_PERIOD = 0.001; //!< GPS L5 code period [secon const int32_t GPS_L5_HISTORY_DEEP = 5; +//optimum parameters +const uint32_t GPS_L5_OPT_ACQ_FS_HZ = 10000000; + const int32_t GPS_L5i_INIT_REG[210] = {266, 365, 804, 1138, 1509, 1559, 1756, 2084, diff --git a/src/core/system_parameters/Galileo_E1.h b/src/core/system_parameters/Galileo_E1.h index 7cb1ac433..333877ac3 100644 --- a/src/core/system_parameters/Galileo_E1.h +++ b/src/core/system_parameters/Galileo_E1.h @@ -63,6 +63,11 @@ const int32_t Galileo_E1_B_SAMPLES_PER_SYMBOL = 1; //!< (Galileo_E1_CODE_ const int32_t Galileo_E1_C_SECONDARY_CODE_LENGTH = 25; //!< Galileo E1-C secondary code length [chips] const int32_t Galileo_E1_NUMBER_OF_CODES = 50; + +//optimum parameters +const uint32_t Galileo_E1_OPT_ACQ_FS_HZ = 4000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate + + const double GALILEO_STARTOFFSET_ms = 68.802; //[ms] Initial sign. travel time (this cannot go here) diff --git a/src/core/system_parameters/Galileo_E5a.h b/src/core/system_parameters/Galileo_E5a.h index b8540d32c..6e37cde77 100644 --- a/src/core/system_parameters/Galileo_E5a.h +++ b/src/core/system_parameters/Galileo_E5a.h @@ -57,6 +57,9 @@ const int32_t Galileo_E5a_NUMBER_OF_CODES = 50; const int32_t GALILEO_E5A_HISTORY_DEEP = 20; const int32_t GALILEO_E5A_CRC_ERROR_LIMIT = 6; +//optimum parameters +const uint32_t Galileo_E5A_OPT_ACQ_FS_HZ = 10000000; + // F/NAV message structure const int32_t GALILEO_FNAV_PREAMBLE_LENGTH_BITS = 12; diff --git a/src/tests/common-files/tracking_tests_flags.h b/src/tests/common-files/tracking_tests_flags.h index 2ff85dabf..1724fcf68 100644 --- a/src/tests/common-files/tracking_tests_flags.h +++ b/src/tests/common-files/tracking_tests_flags.h @@ -42,6 +42,7 @@ DEFINE_double(external_signal_acquisition_threshold, 2.5, "Threshold for satelli DEFINE_int32(external_signal_acquisition_dwells, 5, "Maximum dwells count for satellite acquisition when external file is used"); DEFINE_double(external_signal_acquisition_doppler_max_hz, 5000.0, "Doppler max for satellite acquisition when external file is used"); DEFINE_double(external_signal_acquisition_doppler_step_hz, 125.0, "Doppler step for satellite acquisition when external file is used"); +DEFINE_bool(use_acquisition_resampler, false, "Reduce the sampling rate of the input signal for the acquisition in order to optimize the SNR and decrease the processor load"); DEFINE_string(signal_file, std::string("signal_out.bin"), "Path of the external signal capture file"); DEFINE_double(CN0_dBHz_start, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 start sweep value [dB-Hz]"); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc index 6b33a2c33..ba63a7f18 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc @@ -32,6 +32,10 @@ #include "GPS_L1_CA.h" +#include "Galileo_E1.h" +#include "GPS_L2C.h" +#include "GPS_L5.h" +#include "Galileo_E5a.h" #include "gnss_block_factory.h" #include "control_message_factory.h" #include "tracking_interface.h" @@ -52,6 +56,15 @@ #include "tracking_tests_flags.h" #include "acquisition_msg_rx.h" #include + +#ifdef GR_GREATER_38 +#include +#include +#else +#include +#include +#endif +#include #include #include #include @@ -126,6 +139,19 @@ TrackingPullInTest_msg_rx::~TrackingPullInTest_msg_rx() class TrackingPullInTest : public ::testing::Test { public: + enum StringValue + { + evGPS_1C, + evGPS_2S, + evGPS_L5, + evSBAS_1C, + evGAL_1B, + evGAL_5X, + evGLO_1G, + evGLO_2G + }; + std::map mapStringValues_; + std::string generator_binary; std::string p1; std::string p2; @@ -171,6 +197,13 @@ public: config = std::make_shared(); item_size = sizeof(gr_complex); gnss_synchro = Gnss_Synchro(); + mapStringValues_["1C"] = evGPS_1C; + mapStringValues_["2S"] = evGPS_2S; + mapStringValues_["L5"] = evGPS_L5; + mapStringValues_["1B"] = evGAL_1B; + mapStringValues_["5X"] = evGAL_5X; + mapStringValues_["1G"] = evGLO_1G; + mapStringValues_["2G"] = evGLO_2G; } ~TrackingPullInTest() @@ -345,8 +378,15 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) // Satellite signal definition Gnss_Synchro tmp_gnss_synchro; tmp_gnss_synchro.Channel_ID = 0; + + config = std::make_shared(); config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); + // Enable automatic resampler for the acquisition, if required + if (FLAGS_use_acquisition_resampler == true) + { + config->set_property("GNSS-SDR.use_acquisition_resampler", "true"); + } config->set_property("Acquisition.blocking_on_standby", "true"); config->set_property("Acquisition.blocking", "true"); config->set_property("Acquisition.dump", "false"); @@ -356,11 +396,12 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::shared_ptr acquisition; std::string System_and_Signal; + std::string signal; //create the correspondign acquisition block according to the desired tracking signal if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking") == 0) { tmp_gnss_synchro.System = 'G'; - std::string signal = "1C"; + signal = "1C"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -372,7 +413,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking") == 0) { tmp_gnss_synchro.System = 'E'; - std::string signal = "1B"; + signal = "1B"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -383,7 +424,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) else if (implementation.compare("GPS_L2_M_DLL_PLL_Tracking") == 0) { tmp_gnss_synchro.System = 'G'; - std::string signal = "2S"; + signal = "2S"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -394,7 +435,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) else if (implementation.compare("Galileo_E5a_DLL_PLL_Tracking_b") == 0) { tmp_gnss_synchro.System = 'E'; - std::string signal = "5X"; + signal = "5X"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -410,7 +451,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) else if (implementation.compare("Galileo_E5a_DLL_PLL_Tracking") == 0) { tmp_gnss_synchro.System = 'E'; - std::string signal = "5X"; + signal = "5X"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -421,7 +462,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) else if (implementation.compare("GPS_L5_DLL_PLL_Tracking") == 0) { tmp_gnss_synchro.System = 'G'; - std::string signal = "L5"; + signal = "L5"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -449,14 +490,83 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::string file = FLAGS_signal_file; const char* file_name = file.c_str(); file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); - file_source->seek(2 * FLAGS_skip_samples, 0); //skip head. ibyte, two bytes per complex sample + file_source->seek(2 * FLAGS_skip_samples, SEEK_SET); //skip head. ibyte, two bytes per complex sample gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); //gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration); top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); - top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); - //top_block->connect(head_samples, 0, acquisition->get_left_block(), 0); + // Enable automatic resampler for the acquisition, if required + std::vector taps; + int decimation = 1; + if (FLAGS_use_acquisition_resampler == true) + { + //create acquisition resamplers if required + double resampler_ratio = 1.0; + + double opt_fs = baseband_sampling_freq; + //find the signal associated to this channel + switch (mapStringValues_[signal]) + { + case evGPS_1C: + opt_fs = GPS_L1_CA_OPT_ACQ_FS_HZ; + break; + case evGPS_2S: + opt_fs = GPS_L2C_OPT_ACQ_FS_HZ; + break; + case evGPS_L5: + opt_fs = GPS_L5_OPT_ACQ_FS_HZ; + break; + case evSBAS_1C: + opt_fs = GPS_L1_CA_OPT_ACQ_FS_HZ; + break; + case evGAL_1B: + opt_fs = Galileo_E1_OPT_ACQ_FS_HZ; + break; + case evGAL_5X: + opt_fs = baseband_sampling_freq; + break; + case evGLO_1G: + opt_fs = baseband_sampling_freq; + break; + case evGLO_2G: + opt_fs = baseband_sampling_freq; + break; + } + if (opt_fs < baseband_sampling_freq) + { + resampler_ratio = baseband_sampling_freq / opt_fs; + decimation = floor(resampler_ratio); + while (baseband_sampling_freq % decimation > 0) + { + decimation--; + }; + double acq_fs = baseband_sampling_freq / decimation; + + //create a FIR low pass filter + taps = gr::filter::firdes::low_pass(1.0, + baseband_sampling_freq, + acq_fs / 2.1, + acq_fs / 20, + gr::filter::firdes::win_type::WIN_HAMMING); + std::cout << "Enabled decimation low pass filter with " << taps.size() << " taps and decimation factor of " << decimation << std::endl; + gr::basic_block_sptr fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(decimation, taps); + + //#ifdef GR_GREATER_38 + // gr::basic_block_sptr resampler = gr::filter::mmse_resampler_cc::make(0.0, resampler_ratio); + //#else + // gr::basic_block_sptr resampler = gr::filter::fractional_resampler_cc::make(0.0, resampler_ratio); + //#endif + top_block->connect(gr_interleaved_char_to_complex, 0, fir_filter_ccf_, 0); + // top_block->connect(fir_filter_ccf_, 0, resampler, 0); + top_block->connect(fir_filter_ccf_, 0, acquisition->get_left_block(), 0); + } + } + else + { + top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); + //top_block->connect(head_samples, 0, acquisition->get_left_block(), 0); + } boost::shared_ptr msg_rx; try { @@ -523,15 +633,24 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) { std::cout << " " << PRN << " "; doppler_measurements_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_doppler_hz)); - code_delay_measurements_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_delay_samples)); - acq_samplestamp_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_samplestamp_samples)); + + if (FLAGS_use_acquisition_resampler == true) + { + code_delay_measurements_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_delay_samples - (taps.size()) / 2)); + acq_samplestamp_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_samplestamp_samples)); + } + else + { + code_delay_measurements_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_delay_samples)); + acq_samplestamp_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_samplestamp_samples)); + } } else { std::cout << " . "; } top_block->stop(); - file_source->seek(2 * FLAGS_skip_samples, 0); //skip head. ibyte, two bytes per complex sample + file_source->seek(2 * FLAGS_skip_samples, SEEK_SET); //skip head. ibyte, two bytes per complex sample std::cout.flush(); } std::cout << "]" << std::endl; From 63b19692e7b762b06d51537f99b4a679e44296c6 Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Wed, 5 Dec 2018 16:50:32 +0100 Subject: [PATCH 02/12] Completing the smart acquisition resampler --- ...alileo_e1_pcps_8ms_ambiguous_acquisition.h | 3 + .../galileo_e1_pcps_ambiguous_acquisition.cc | 73 +++++----- .../galileo_e1_pcps_ambiguous_acquisition.h | 7 + ...lileo_e1_pcps_ambiguous_acquisition_fpga.h | 2 + ...leo_e1_pcps_cccwsr_ambiguous_acquisition.h | 2 + ..._e1_pcps_quicksync_ambiguous_acquisition.h | 2 + ...lileo_e1_pcps_tong_ambiguous_acquisition.h | 2 + ...lileo_e5a_noncoherent_iq_acquisition_caf.h | 2 + .../adapters/galileo_e5a_pcps_acquisition.cc | 89 +++++++++--- .../adapters/galileo_e5a_pcps_acquisition.h | 8 +- .../galileo_e5a_pcps_acquisition_fpga.h | 2 + .../adapters/glonass_l1_ca_pcps_acquisition.h | 2 + .../adapters/glonass_l2_ca_pcps_acquisition.h | 2 + .../adapters/gps_l1_ca_pcps_acquisition.cc | 42 +++--- .../adapters/gps_l1_ca_pcps_acquisition.h | 7 + .../gps_l1_ca_pcps_acquisition_fine_doppler.h | 2 + .../gps_l1_ca_pcps_acquisition_fpga.h | 2 + .../gps_l1_ca_pcps_assisted_acquisition.h | 2 + .../gps_l1_ca_pcps_opencl_acquisition.h | 2 + .../gps_l1_ca_pcps_quicksync_acquisition.h | 2 + .../gps_l1_ca_pcps_tong_acquisition.h | 2 + .../adapters/gps_l2_m_pcps_acquisition.cc | 99 +++++++++---- .../adapters/gps_l2_m_pcps_acquisition.h | 8 ++ .../adapters/gps_l2_m_pcps_acquisition_fpga.h | 2 + .../adapters/gps_l5i_pcps_acquisition.cc | 98 +++++++++---- .../adapters/gps_l5i_pcps_acquisition.h | 7 + .../adapters/gps_l5i_pcps_acquisition_fpga.h | 2 + .../gnuradio_blocks/pcps_acquisition.cc | 8 ++ .../gnuradio_blocks/pcps_acquisition.h | 2 + src/algorithms/acquisition/libs/acq_conf.cc | 1 + src/algorithms/acquisition/libs/acq_conf.h | 1 + src/core/interfaces/acquisition_interface.h | 1 + src/core/receiver/gnss_flowgraph.cc | 94 ++++++++----- src/core/system_parameters/GPS_L1_CA.h | 2 +- src/core/system_parameters/GPS_L2C.h | 2 +- src/core/system_parameters/GPS_L5.h | 2 +- src/core/system_parameters/Galileo_E1.h | 2 +- src/core/system_parameters/Galileo_E5a.h | 2 +- src/tests/system-tests/position_test.cc | 6 + .../observables/hybrid_observables_test.cc | 132 ++++++++++++++++-- .../tracking/tracking_pull-in_test.cc | 71 +++++----- 41 files changed, 579 insertions(+), 220 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h index 59cd5c649..92bb24be4 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h @@ -131,6 +131,9 @@ public: void set_state(int state __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + + private: ConfigurationInterface* configuration_; galileo_pcps_8ms_acquisition_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index e7a48ff9b..93dfa80eb 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -50,7 +50,6 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( in_streams_(in_streams), out_streams_(out_streams) { - Acq_Conf acq_parameters; configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./acquisition.mat"; @@ -61,33 +60,32 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - acq_parameters.fs_in = fs_in_; - acq_parameters.samples_per_chip = static_cast(ceil((1.0 / Galileo_E1_CODE_CHIP_RATE_HZ) * static_cast(acq_parameters.fs_in))); + acq_parameters_.fs_in = fs_in_; doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; - acq_parameters.doppler_max = doppler_max_; - acq_parameters.ms_per_code = 4; - sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", acq_parameters.ms_per_code); - acq_parameters.sampled_ms = sampled_ms_; - if ((acq_parameters.sampled_ms % acq_parameters.ms_per_code) != 0) + acq_parameters_.doppler_max = doppler_max_; + acq_parameters_.ms_per_code = 4; + sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", acq_parameters_.ms_per_code); + acq_parameters_.sampled_ms = sampled_ms_; + if ((acq_parameters_.sampled_ms % acq_parameters_.ms_per_code) != 0) { LOG(WARNING) << "Parameter coherent_integration_time_ms should be a multiple of 4. Setting it to 4"; - acq_parameters.sampled_ms = acq_parameters.ms_per_code; + acq_parameters_.sampled_ms = acq_parameters_.ms_per_code; } bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false); - acq_parameters.bit_transition_flag = bit_transition_flag_; + acq_parameters_.bit_transition_flag = bit_transition_flag_; use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions - acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_; + acq_parameters_.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_; acquire_pilot_ = configuration_->property(role + ".acquire_pilot", false); //will be true in future versions max_dwells_ = configuration_->property(role + ".max_dwells", 1); - acq_parameters.max_dwells = max_dwells_; + acq_parameters_.max_dwells = max_dwells_; dump_ = configuration_->property(role + ".dump", false); - acq_parameters.dump = dump_; - acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); + acq_parameters_.dump = dump_; + acq_parameters_.dump_channel = configuration_->property(role + ".dump_channel", 0); blocking_ = configuration_->property(role + ".blocking", true); - acq_parameters.blocking = blocking_; + acq_parameters_.blocking = blocking_; dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); - acq_parameters.dump_filename = dump_filename_; + acq_parameters_.dump_filename = dump_filename_; acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) @@ -99,26 +97,30 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( { if (acq_parameters_.fs_in > Galileo_E1_OPT_ACQ_FS_HZ) { - acq_parameters_.resampled_fs = Galileo_E1_OPT_ACQ_FS_HZ; - acq_parameters_.resampler_ratio = static_cast(acq_parameters_.fs_in) / static_cast(acq_parameters_.resampled_fs); + acq_parameters_.resampler_ratio = floor(static_cast(acq_parameters_.fs_in) / Galileo_E1_OPT_ACQ_FS_HZ); + uint32_t decimation = acq_parameters_.fs_in / Galileo_E1_OPT_ACQ_FS_HZ; + while (acq_parameters_.fs_in % decimation > 0) + { + decimation--; + }; + acq_parameters_.resampler_ratio = decimation; + acq_parameters_.resampled_fs = acq_parameters_.fs_in / static_cast(acq_parameters_.resampler_ratio); } - //--- Find number of samples per spreading code (4 ms) ----------------- code_length_ = static_cast(std::floor(static_cast(acq_parameters_.resampled_fs) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); - float samples_per_ms = static_cast(acq_parameters_.resampled_fs) * 0.001; - acq_parameters_.samples_per_ms = samples_per_ms; - acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(Galileo_E1_CODE_PERIOD_MS); - vector_length_ = sampled_ms_ * samples_per_ms; + acq_parameters_.samples_per_ms = static_cast(acq_parameters_.resampled_fs) * 0.001; + acq_parameters_.samples_per_chip = static_cast(ceil((1.0 / Galileo_E1_CODE_CHIP_RATE_HZ) * static_cast(acq_parameters_.resampled_fs))); } else { //--- Find number of samples per spreading code (4 ms) ----------------- code_length_ = static_cast(std::floor(static_cast(fs_in_) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); - float samples_per_ms = static_cast(fs_in_) * 0.001; - acq_parameters_.samples_per_ms = samples_per_ms; - acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(Galileo_E1_CODE_PERIOD_MS); - vector_length_ = sampled_ms_ * samples_per_ms; + acq_parameters_.samples_per_ms = static_cast(fs_in_) * 0.001; + acq_parameters_.samples_per_chip = static_cast(ceil((1.0 / Galileo_E1_CODE_CHIP_RATE_HZ) * static_cast(acq_parameters_.fs_in))); } + + acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(Galileo_E1_CODE_PERIOD_MS); + vector_length_ = sampled_ms_ * acq_parameters_.samples_per_ms; if (bit_transition_flag_) { vector_length_ *= 2; @@ -134,12 +136,12 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( { item_size_ = sizeof(gr_complex); } - acq_parameters.it_size = item_size_; - acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); - acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); - acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false); - acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); - acquisition_ = pcps_make_acquisition(acq_parameters); + acq_parameters_.it_size = item_size_; + acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); + acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); + acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); + acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); + acquisition_ = pcps_make_acquisition(acq_parameters_); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; if (item_type_ == "cbyte") @@ -393,3 +395,8 @@ gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_right_block() { return acquisition_; } + +void GalileoE1PcpsAmbiguousAcquisition::set_resampler_latency(uint32_t latency_samples) +{ + acquisition_->set_resampler_latency(latency_samples); +} diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h index 8e7859556..095f92357 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h @@ -138,6 +138,13 @@ public: */ void stop_acquisition() override; + /*! + * \brief Sets the resampler latency to account it in the acquisition code delay estimation + */ + + void set_resampler_latency(uint32_t latency_samples) override; + + private: ConfigurationInterface* configuration_; Acq_Conf acq_parameters_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h index 8ea13f0e4..06d55cea1 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h @@ -142,6 +142,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; //pcps_acquisition_sptr acquisition_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h index 9fde5d723..c1cc69e2d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h @@ -131,6 +131,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; pcps_cccwsr_acquisition_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h index 844856260..87aa38de2 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h @@ -135,6 +135,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; pcps_quicksync_acquisition_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h index 8e56c4044..b603e53a0 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h @@ -134,6 +134,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; pcps_tong_acquisition_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h index 4175a0741..b1280d63e 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h @@ -137,6 +137,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index e18e2e0a3..7f1f6e321 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -49,7 +49,6 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con in_streams_(in_streams), out_streams_(out_streams) { - Acq_Conf acq_parameters = Acq_Conf(); configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./acquisition.mat"; @@ -60,8 +59,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - acq_parameters.fs_in = fs_in_; - acq_parameters.samples_per_chip = static_cast(ceil((1.0 / Galileo_E5a_CODE_CHIP_RATE_HZ) * static_cast(acq_parameters.fs_in))); + acq_parameters_.fs_in = fs_in_; acq_pilot_ = configuration_->property(role + ".acquire_pilot", false); acq_iq_ = configuration_->property(role + ".acquire_iq", false); if (acq_iq_) @@ -69,22 +67,58 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con acq_pilot_ = false; } dump_ = configuration_->property(role + ".dump", false); - acq_parameters.dump = dump_; - acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); + acq_parameters_.dump = dump_; + acq_parameters_.dump_channel = configuration_->property(role + ".dump_channel", 0); doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; - acq_parameters.doppler_max = doppler_max_; + acq_parameters_.doppler_max = doppler_max_; sampled_ms_ = 1; max_dwells_ = configuration_->property(role + ".max_dwells", 1); - acq_parameters.max_dwells = max_dwells_; + acq_parameters_.max_dwells = max_dwells_; dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); - acq_parameters.dump_filename = dump_filename_; + acq_parameters_.dump_filename = dump_filename_; bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false); - acq_parameters.bit_transition_flag = bit_transition_flag_; + acq_parameters_.bit_transition_flag = bit_transition_flag_; use_CFAR_ = configuration_->property(role + ".use_CFAR_algorithm", false); - acq_parameters.use_CFAR_algorithm_flag = use_CFAR_; + acq_parameters_.use_CFAR_algorithm_flag = use_CFAR_; blocking_ = configuration_->property(role + ".blocking", true); - acq_parameters.blocking = blocking_; + acq_parameters_.blocking = blocking_; + + + acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); + if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + { + LOG(WARNING) << "Galileo E5a acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; + acq_parameters_.use_automatic_resampler = false; + } + if (acq_parameters_.use_automatic_resampler) + { + if (acq_parameters_.fs_in > Galileo_E5a_OPT_ACQ_FS_HZ) + { + acq_parameters_.resampler_ratio = floor(static_cast(acq_parameters_.fs_in) / Galileo_E5a_OPT_ACQ_FS_HZ); + uint32_t decimation = acq_parameters_.fs_in / Galileo_E5a_OPT_ACQ_FS_HZ; + while (acq_parameters_.fs_in % decimation > 0) + { + decimation--; + }; + acq_parameters_.resampler_ratio = decimation; + acq_parameters_.resampled_fs = acq_parameters_.fs_in / static_cast(acq_parameters_.resampler_ratio); + } + + //--- Find number of samples per spreading code ------------------------- + code_length_ = static_cast(std::floor(static_cast(acq_parameters_.resampled_fs) / (Galileo_E5a_CODE_CHIP_RATE_HZ / Galileo_E5a_CODE_LENGTH_CHIPS))); + acq_parameters_.samples_per_ms = static_cast(acq_parameters_.resampled_fs) * 0.001; + acq_parameters_.samples_per_chip = static_cast(ceil((1.0 / Galileo_E5a_CODE_CHIP_RATE_HZ) * static_cast(acq_parameters_.resampled_fs))); + } + else + { + acq_parameters_.resampled_fs = fs_in_; + //--- Find number of samples per spreading code ------------------------- + code_length_ = static_cast(std::floor(static_cast(fs_in_) / (Galileo_E5a_CODE_CHIP_RATE_HZ / Galileo_E5a_CODE_LENGTH_CHIPS))); + acq_parameters_.samples_per_ms = static_cast(fs_in_) * 0.001; + acq_parameters_.samples_per_chip = static_cast(ceil((1.0 / Galileo_E5a_CODE_CHIP_RATE_HZ) * static_cast(acq_parameters_.fs_in))); + } + //--- Find number of samples per spreading code (1ms)------------------------- code_length_ = static_cast(std::round(static_cast(fs_in_) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast(Galileo_E5a_CODE_LENGTH_CHIPS))); vector_length_ = code_length_ * sampled_ms_; @@ -104,16 +138,15 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con item_size_ = sizeof(gr_complex); LOG(WARNING) << item_type_ << " unknown acquisition item type"; } - acq_parameters.it_size = item_size_; - acq_parameters.samples_per_ms = static_cast(fs_in_) * 0.001; - acq_parameters.sampled_ms = sampled_ms_; - acq_parameters.ms_per_code = 1; - acq_parameters.samples_per_code = acq_parameters.samples_per_ms * static_cast(GALILEO_E5a_CODE_PERIOD_MS); - acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); - acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); - acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false); - acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); - acquisition_ = pcps_make_acquisition(acq_parameters); + acq_parameters_.it_size = item_size_; + acq_parameters_.sampled_ms = sampled_ms_; + acq_parameters_.ms_per_code = 1; + acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(GALILEO_E5a_CODE_PERIOD_MS); + acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); + acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); + acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); + acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); + acquisition_ = pcps_make_acquisition(acq_parameters_); channel_ = 0; threshold_ = 0.0; @@ -224,7 +257,14 @@ void GalileoE5aPcpsAcquisition::set_local_code() strcpy(signal_, "5I"); } - galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, fs_in_, 0); + if (acq_parameters_.use_automatic_resampler) + { + galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0); + } + else + { + galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, fs_in_, 0); + } for (unsigned int i = 0; i < sampled_ms_; i++) { @@ -311,3 +351,8 @@ gr::basic_block_sptr GalileoE5aPcpsAcquisition::get_right_block() { return acquisition_; } + +void GalileoE5aPcpsAcquisition::set_resampler_latency(uint32_t latency_samples) +{ + acquisition_->set_resampler_latency(latency_samples); +} diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h index 063c79ff2..5a4d71fc1 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h @@ -128,13 +128,19 @@ public: */ void stop_acquisition() override; + /*! + * \brief Sets the resampler latency to account it in the acquisition code delay estimation + */ + + void set_resampler_latency(uint32_t latency_samples) override; + private: float calculate_threshold(float pfa); ConfigurationInterface* configuration_; pcps_acquisition_sptr acquisition_; - + Acq_Conf acq_parameters_; size_t item_size_; std::string item_type_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h index 91788c733..79f0d2836 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h @@ -130,6 +130,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: //float calculate_threshold(float pfa); diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h index 3c0c14ab1..7abf3df91 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h @@ -137,6 +137,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; pcps_acquisition_sptr acquisition_; diff --git a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h index 3c093c5cd..060cd8f10 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h @@ -136,6 +136,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; pcps_acquisition_sptr acquisition_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 8f0d930c2..1729aa979 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -54,7 +54,6 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( in_streams_(in_streams), out_streams_(out_streams) { - Acq_Conf acq_parameters = Acq_Conf(); configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./acquisition.mat"; @@ -64,25 +63,24 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( item_type_ = configuration_->property(role + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - acq_parameters.fs_in = fs_in_; - acq_parameters.samples_per_chip = static_cast(ceil(GPS_L1_CA_CHIP_PERIOD * static_cast(acq_parameters.fs_in))); + acq_parameters_.fs_in = fs_in_; dump_ = configuration_->property(role + ".dump", false); - acq_parameters.dump = dump_; - acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); + acq_parameters_.dump = dump_; + acq_parameters_.dump_channel = configuration_->property(role + ".dump_channel", 0); blocking_ = configuration_->property(role + ".blocking", true); - acq_parameters.blocking = blocking_; + acq_parameters_.blocking = blocking_; doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; - acq_parameters.doppler_max = doppler_max_; + acq_parameters_.doppler_max = doppler_max_; sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1); - acq_parameters.sampled_ms = sampled_ms_; - acq_parameters.ms_per_code = 1; + acq_parameters_.sampled_ms = sampled_ms_; + acq_parameters_.ms_per_code = 1; bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false); - acq_parameters.bit_transition_flag = bit_transition_flag_; + acq_parameters_.bit_transition_flag = bit_transition_flag_; use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions - acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_; + acq_parameters_.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_; max_dwells_ = configuration_->property(role + ".max_dwells", 1); - acq_parameters.max_dwells = max_dwells_; + acq_parameters_.max_dwells = max_dwells_; dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); acq_parameters_.dump_filename = dump_filename_; acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); @@ -110,8 +108,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( //--- Find number of samples per spreading code ------------------------- code_length_ = static_cast(std::floor(static_cast(acq_parameters_.resampled_fs) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); acq_parameters_.samples_per_ms = static_cast(acq_parameters_.resampled_fs) * 0.001; - acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(GPS_L1_CA_CODE_PERIOD * 1000.0); - vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1); + acq_parameters_.samples_per_chip = static_cast(ceil(GPS_L1_CA_CHIP_PERIOD * static_cast(acq_parameters_.resampled_fs))); } else { @@ -119,9 +116,11 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( //--- Find number of samples per spreading code ------------------------- code_length_ = static_cast(std::floor(static_cast(fs_in_) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); acq_parameters_.samples_per_ms = static_cast(fs_in_) * 0.001; - acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(GPS_L1_CA_CODE_PERIOD * 1000.0); - vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1); + acq_parameters_.samples_per_chip = static_cast(ceil(GPS_L1_CA_CHIP_PERIOD * static_cast(acq_parameters_.fs_in))); } + + acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(GPS_L1_CA_CODE_PERIOD * 1000.0); + vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1); code_ = new gr_complex[vector_length_]; if (item_type_ == "cshort") @@ -133,9 +132,9 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( item_size_ = sizeof(gr_complex); } - acq_parameters.it_size = item_size_; - acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); - acquisition_ = pcps_make_acquisition(acq_parameters); + acq_parameters_.it_size = item_size_; + acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); + acquisition_ = pcps_make_acquisition(acq_parameters_); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; if (item_type_ == "cbyte") @@ -361,3 +360,8 @@ gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_right_block() { return acquisition_; } + +void GpsL1CaPcpsAcquisition::set_resampler_latency(uint32_t latency_samples) +{ + acquisition_->set_resampler_latency(latency_samples); +} diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h index e5d8c4719..ebc8ec24b 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h @@ -142,6 +142,13 @@ public: */ void stop_acquisition() override; + /*! + * \brief Sets the resampler latency to account it in the acquisition code delay estimation + */ + + void set_resampler_latency(uint32_t latency_samples) override; + + private: ConfigurationInterface* configuration_; pcps_acquisition_sptr acquisition_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h index 4a4bb9a19..ce6860db5 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h @@ -132,6 +132,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: pcps_acquisition_fine_doppler_cc_sptr acquisition_cc_; size_t item_size_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h index 4d0d7339f..015de1d39 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h @@ -140,6 +140,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; pcps_acquisition_fpga_sptr acquisition_fpga_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h index 1f6094b6d..c3a21492a 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h @@ -128,6 +128,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: pcps_assisted_acquisition_cc_sptr acquisition_cc_; size_t item_size_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h index 60c78b2e0..7e833ff89 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h @@ -130,6 +130,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; pcps_opencl_acquisition_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h index e18fb1704..d032bf837 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h @@ -136,6 +136,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; pcps_quicksync_acquisition_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h index 76cf2b8e0..1f342c31a 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h @@ -135,6 +135,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; pcps_tong_acquisition_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc index acf415635..8d914c3e5 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -52,7 +52,6 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( in_streams_(in_streams), out_streams_(out_streams) { - Acq_Conf acq_parameters = Acq_Conf(); configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./acquisition.mat"; @@ -60,42 +59,73 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( LOG(INFO) << "role " << role; item_type_ = configuration_->property(role + ".item_type", default_item_type); - //float pfa = configuration_->property(role + ".pfa", 0.0); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - acq_parameters.fs_in = fs_in_; - acq_parameters.samples_per_chip = static_cast(ceil((1.0 / GPS_L2_M_CODE_RATE_HZ) * static_cast(acq_parameters.fs_in))); + acq_parameters_.fs_in = fs_in_; dump_ = configuration_->property(role + ".dump", false); - acq_parameters.dump = dump_; - acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); + acq_parameters_.dump = dump_; + acq_parameters_.dump_channel = configuration_->property(role + ".dump_channel", 0); blocking_ = configuration_->property(role + ".blocking", true); - acq_parameters.blocking = blocking_; + acq_parameters_.blocking = blocking_; doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; - acq_parameters.doppler_max = doppler_max_; + acq_parameters_.doppler_max = doppler_max_; bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false); - acq_parameters.bit_transition_flag = bit_transition_flag_; + acq_parameters_.bit_transition_flag = bit_transition_flag_; use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions - acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_; + acq_parameters_.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_; max_dwells_ = configuration_->property(role + ".max_dwells", 1); - acq_parameters.max_dwells = max_dwells_; + acq_parameters_.max_dwells = max_dwells_; dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); - acq_parameters.dump_filename = dump_filename_; - //--- Find number of samples per spreading code ------------------------- - acq_parameters.samples_per_ms = static_cast(fs_in_) * 0.001; - acq_parameters.ms_per_code = 20; - acq_parameters.sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", acq_parameters.ms_per_code); - if ((acq_parameters.sampled_ms % acq_parameters.ms_per_code) != 0) + acq_parameters_.dump_filename = dump_filename_; + acq_parameters_.ms_per_code = 20; + acq_parameters_.sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", acq_parameters_.ms_per_code); + if ((acq_parameters_.sampled_ms % acq_parameters_.ms_per_code) != 0) { LOG(WARNING) << "Parameter coherent_integration_time_ms should be a multiple of 20. Setting it to 20"; - acq_parameters.sampled_ms = acq_parameters.ms_per_code; + acq_parameters_.sampled_ms = acq_parameters_.ms_per_code; } - code_length_ = acq_parameters.ms_per_code * acq_parameters.samples_per_ms; + acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); + acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); + acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); + acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); + acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); + if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + { + LOG(WARNING) << "GPS L2CM acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; + acq_parameters_.use_automatic_resampler = false; + } + if (acq_parameters_.use_automatic_resampler) + { + if (acq_parameters_.fs_in > GPS_L2C_OPT_ACQ_FS_HZ) + { + acq_parameters_.resampler_ratio = floor(static_cast(acq_parameters_.fs_in) / GPS_L2C_OPT_ACQ_FS_HZ); + uint32_t decimation = acq_parameters_.fs_in / GPS_L2C_OPT_ACQ_FS_HZ; + while (acq_parameters_.fs_in % decimation > 0) + { + decimation--; + }; + acq_parameters_.resampler_ratio = decimation; + acq_parameters_.resampled_fs = acq_parameters_.fs_in / static_cast(acq_parameters_.resampler_ratio); + } - vector_length_ = acq_parameters.sampled_ms * acq_parameters.samples_per_ms * (acq_parameters.bit_transition_flag ? 2 : 1); + //--- Find number of samples per spreading code ------------------------- + code_length_ = static_cast(std::floor(static_cast(acq_parameters_.resampled_fs) / (GPS_L2_M_CODE_RATE_HZ / GPS_L2_M_CODE_LENGTH_CHIPS))); + acq_parameters_.samples_per_ms = static_cast(acq_parameters_.resampled_fs) * 0.001; + acq_parameters_.samples_per_chip = static_cast(ceil((1.0 / GPS_L2_M_CODE_RATE_HZ) * static_cast(acq_parameters_.resampled_fs))); + } + else + { + acq_parameters_.resampled_fs = fs_in_; + //--- Find number of samples per spreading code ------------------------- + code_length_ = static_cast(std::floor(static_cast(fs_in_) / (GPS_L2_M_CODE_RATE_HZ / GPS_L2_M_CODE_LENGTH_CHIPS))); + acq_parameters_.samples_per_ms = static_cast(fs_in_) * 0.001; + acq_parameters_.samples_per_chip = static_cast(ceil((1.0 / GPS_L2_M_CODE_RATE_HZ) * static_cast(acq_parameters_.fs_in))); + } + acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(GPS_L2_M_PERIOD * 1000.0); + vector_length_ = acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms * (acq_parameters_.bit_transition_flag ? 2 : 1); code_ = new gr_complex[vector_length_]; if (item_type_ == "cshort") @@ -107,14 +137,8 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( item_size_ = sizeof(gr_complex); } - acq_parameters.samples_per_code = acq_parameters.samples_per_ms * static_cast(GPS_L2_M_PERIOD * 1000.0); - acq_parameters.it_size = item_size_; - - acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); - acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); - acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false); - acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); - acquisition_ = pcps_make_acquisition(acq_parameters); + acq_parameters_.it_size = item_size_; + acquisition_ = pcps_make_acquisition(acq_parameters_); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; if (item_type_ == "cbyte") @@ -127,7 +151,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = nullptr; - num_codes_ = acq_parameters.sampled_ms / acq_parameters.ms_per_code; + num_codes_ = acq_parameters_.sampled_ms / acq_parameters_.ms_per_code; if (in_streams_ > 1) { LOG(ERROR) << "This implementation only supports one input stream"; @@ -223,7 +247,16 @@ void GpsL2MPcpsAcquisition::set_local_code() { auto* code = new std::complex[code_length_]; - gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); + + if (acq_parameters_.use_automatic_resampler) + { + gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs); + } + else + { + gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); + } + for (unsigned int i = 0; i < num_codes_; i++) { @@ -341,3 +374,7 @@ gr::basic_block_sptr GpsL2MPcpsAcquisition::get_right_block() { return acquisition_; } +void GpsL2MPcpsAcquisition::set_resampler_latency(uint32_t latency_samples) +{ + acquisition_->set_resampler_latency(latency_samples); +} diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h index 4a0c96c60..a874a3585 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h @@ -139,9 +139,17 @@ public: */ void stop_acquisition() override; + /*! + * \brief Sets the resampler latency to account it in the acquisition code delay estimation + */ + + void set_resampler_latency(uint32_t latency_samples) override; + + private: ConfigurationInterface* configuration_; pcps_acquisition_sptr acquisition_; + Acq_Conf acq_parameters_; gr::blocks::float_to_complex::sptr float_to_complex_; complex_byte_to_float_x2_sptr cbyte_to_float_x2_; size_t item_size_; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h index 7effb0cf6..f60117a56 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h @@ -140,6 +140,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; //pcps_acquisition_sptr acquisition_; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc index 16066ebaa..b74f33355 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -52,7 +52,6 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( in_streams_(in_streams), out_streams_(out_streams) { - Acq_Conf acq_parameters = Acq_Conf(); configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./acquisition.mat"; @@ -63,32 +62,24 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - acq_parameters.fs_in = fs_in_; - acq_parameters.samples_per_chip = static_cast(ceil((1.0 / GPS_L5i_CODE_RATE_HZ) * static_cast(acq_parameters.fs_in))); + acq_parameters_.fs_in = fs_in_; dump_ = configuration_->property(role + ".dump", false); - acq_parameters.dump = dump_; - acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); + acq_parameters_.dump = dump_; + acq_parameters_.dump_channel = configuration_->property(role + ".dump_channel", 0); blocking_ = configuration_->property(role + ".blocking", true); - acq_parameters.blocking = blocking_; + acq_parameters_.blocking = blocking_; doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; - acq_parameters.doppler_max = doppler_max_; + acq_parameters_.doppler_max = doppler_max_; bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false); - acq_parameters.bit_transition_flag = bit_transition_flag_; + acq_parameters_.bit_transition_flag = bit_transition_flag_; use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions - acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_; + acq_parameters_.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_; max_dwells_ = configuration_->property(role + ".max_dwells", 1); - acq_parameters.max_dwells = max_dwells_; + acq_parameters_.max_dwells = max_dwells_; dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); - acq_parameters.dump_filename = dump_filename_; - acq_parameters.sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 1); - //--- Find number of samples per spreading code ------------------------- - code_length_ = static_cast(std::floor(static_cast(fs_in_) / (GPS_L5i_CODE_RATE_HZ / GPS_L5i_CODE_LENGTH_CHIPS))); - acq_parameters.samples_per_ms = static_cast(fs_in_) * 0.001; - acq_parameters.samples_per_code = acq_parameters.samples_per_ms * static_cast(GPS_L5i_PERIOD * 1000.0); - - vector_length_ = std::floor(acq_parameters.sampled_ms * acq_parameters.samples_per_ms) * (acq_parameters.bit_transition_flag ? 2 : 1); - code_ = new gr_complex[vector_length_]; + acq_parameters_.dump_filename = dump_filename_; + acq_parameters_.sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 1); if (item_type_ == "cshort") { @@ -99,14 +90,51 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( item_size_ = sizeof(gr_complex); } - acq_parameters.ms_per_code = 1; - acq_parameters.it_size = item_size_; - num_codes_ = acq_parameters.sampled_ms; - acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); - acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); - acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false); - acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); - acquisition_ = pcps_make_acquisition(acq_parameters); + acq_parameters_.ms_per_code = 1; + acq_parameters_.it_size = item_size_; + num_codes_ = acq_parameters_.sampled_ms; + acq_parameters_.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); + acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); + acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); + acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); + acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); + if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + { + LOG(WARNING) << "GPS L5 acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; + acq_parameters_.use_automatic_resampler = false; + } + if (acq_parameters_.use_automatic_resampler) + { + if (acq_parameters_.fs_in > GPS_L5_OPT_ACQ_FS_HZ) + { + acq_parameters_.resampler_ratio = floor(static_cast(acq_parameters_.fs_in) / GPS_L5_OPT_ACQ_FS_HZ); + uint32_t decimation = acq_parameters_.fs_in / GPS_L5_OPT_ACQ_FS_HZ; + while (acq_parameters_.fs_in % decimation > 0) + { + decimation--; + }; + acq_parameters_.resampler_ratio = decimation; + acq_parameters_.resampled_fs = acq_parameters_.fs_in / static_cast(acq_parameters_.resampler_ratio); + } + + //--- Find number of samples per spreading code ------------------------- + code_length_ = static_cast(std::floor(static_cast(acq_parameters_.resampled_fs) / (GPS_L5i_CODE_RATE_HZ / GPS_L5i_CODE_LENGTH_CHIPS))); + acq_parameters_.samples_per_ms = static_cast(acq_parameters_.resampled_fs) * 0.001; + acq_parameters_.samples_per_chip = static_cast(ceil((1.0 / GPS_L5i_CODE_RATE_HZ) * static_cast(acq_parameters_.resampled_fs))); + } + else + { + acq_parameters_.resampled_fs = fs_in_; + //--- Find number of samples per spreading code ------------------------- + code_length_ = static_cast(std::floor(static_cast(fs_in_) / (GPS_L5i_CODE_RATE_HZ / GPS_L5i_CODE_LENGTH_CHIPS))); + acq_parameters_.samples_per_ms = static_cast(fs_in_) * 0.001; + acq_parameters_.samples_per_chip = static_cast(ceil((1.0 / GPS_L5i_CODE_RATE_HZ) * static_cast(acq_parameters_.fs_in))); + } + + acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast(GPS_L5i_PERIOD * 1000.0); + vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1); + code_ = new gr_complex[vector_length_]; + acquisition_ = pcps_make_acquisition(acq_parameters_); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; if (item_type_ == "cbyte") @@ -114,6 +142,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( cbyte_to_float_x2_ = make_complex_byte_to_float_x2(); float_to_complex_ = gr::blocks::float_to_complex::make(); } + channel_ = 0; threshold_ = 0.0; doppler_step_ = 0; @@ -211,7 +240,15 @@ void GpsL5iPcpsAcquisition::set_local_code() { auto* code = new std::complex[code_length_]; - gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); + + if (acq_parameters_.use_automatic_resampler) + { + gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs); + } + else + { + gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_); + } for (unsigned int i = 0; i < num_codes_; i++) { @@ -329,3 +366,8 @@ gr::basic_block_sptr GpsL5iPcpsAcquisition::get_right_block() { return acquisition_; } + +void GpsL5iPcpsAcquisition::set_resampler_latency(uint32_t latency_samples) +{ + acquisition_->set_resampler_latency(latency_samples); +} diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h index c9f1cd95d..f3cf863f3 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h @@ -139,9 +139,16 @@ public: */ void stop_acquisition() override; + /*! + * \brief Sets the resampler latency to account it in the acquisition code delay estimation + */ + + void set_resampler_latency(uint32_t latency_samples) override; + private: ConfigurationInterface* configuration_; pcps_acquisition_sptr acquisition_; + Acq_Conf acq_parameters_; gr::blocks::float_to_complex::sptr float_to_complex_; complex_byte_to_float_x2_sptr cbyte_to_float_x2_; size_t item_size_; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h index 571f01193..a7d45db10 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h @@ -140,6 +140,8 @@ public: */ void stop_acquisition() override; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + private: ConfigurationInterface* configuration_; //pcps_acquisition_sptr acquisition_; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 7e666d0b3..a08bd05f2 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -221,6 +221,12 @@ pcps_acquisition::~pcps_acquisition() } +void pcps_acquisition::set_resampler_latency(uint32_t latency_samples) +{ + gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler + acq_parameters.resampler_latency_samples = latency_samples; +} + void pcps_acquisition::set_local_code(std::complex* code) { // reset the intermediate frequency @@ -731,6 +737,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count) { //take into account the acquisition resampler ratio d_gnss_synchro->Acq_delay_samples = static_cast(std::fmod(static_cast(indext), acq_parameters.samples_per_code)) * acq_parameters.resampler_ratio; + d_gnss_synchro->Acq_delay_samples -= static_cast(acq_parameters.resampler_latency_samples); //account the resampler filter latency d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast(samp_count) * acq_parameters.resampler_ratio); } @@ -788,6 +795,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count) { //take into account the acquisition resampler ratio d_gnss_synchro->Acq_delay_samples = static_cast(std::fmod(static_cast(indext), acq_parameters.samples_per_code)) * acq_parameters.resampler_ratio; + d_gnss_synchro->Acq_delay_samples -= static_cast(acq_parameters.resampler_latency_samples); //account the resampler filter latency d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast(samp_count) * acq_parameters.resampler_ratio); d_gnss_synchro->Acq_doppler_step = acq_parameters.doppler_step2; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h index 392332e46..f7089412b 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h @@ -237,6 +237,8 @@ public: } + void set_resampler_latency(uint32_t latency_samples); + /*! * \brief Parallel Code Phase Search Acquisition signal processing. */ diff --git a/src/algorithms/acquisition/libs/acq_conf.cc b/src/algorithms/acquisition/libs/acq_conf.cc index 0640153cf..8e8d48d5e 100644 --- a/src/algorithms/acquisition/libs/acq_conf.cc +++ b/src/algorithms/acquisition/libs/acq_conf.cc @@ -56,4 +56,5 @@ Acq_Conf::Acq_Conf() use_automatic_resampler = false; resampler_ratio = 1.0; resampled_fs = 0LL; + resampler_latency_samples = 0U; } diff --git a/src/algorithms/acquisition/libs/acq_conf.h b/src/algorithms/acquisition/libs/acq_conf.h index 7582ec9a3..af81d8806 100644 --- a/src/algorithms/acquisition/libs/acq_conf.h +++ b/src/algorithms/acquisition/libs/acq_conf.h @@ -59,6 +59,7 @@ public: bool use_automatic_resampler; float resampler_ratio; int64_t resampled_fs; + uint32_t resampler_latency_samples; std::string dump_filename; uint32_t dump_channel; size_t it_size; diff --git a/src/core/interfaces/acquisition_interface.h b/src/core/interfaces/acquisition_interface.h index d76e79bfc..794748175 100644 --- a/src/core/interfaces/acquisition_interface.h +++ b/src/core/interfaces/acquisition_interface.h @@ -65,6 +65,7 @@ public: virtual signed int mag() = 0; virtual void reset() = 0; virtual void stop_acquisition() = 0; + virtual void set_resampler_latency(uint32_t latency_samples) = 0; }; #endif /* GNSS_SDR_ACQUISITION_INTERFACE */ diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 96d6f565a..dcb3b4c48 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -43,11 +43,13 @@ #include "gnss_block_interface.h" #include "channel_interface.h" #include "gnss_block_factory.h" +#include "channel.h" #ifdef GR_GREATER_38 -#include +#include #else -#include +#include #endif +#include #include #include #include @@ -354,7 +356,7 @@ void GNSSFlowgraph::connect() // Signal conditioner (selected_signal_source) >> channels (i) (dependent of their associated SignalSource_ID) int selected_signal_conditioner_ID = 0; bool use_acq_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - double fs = static_cast(configuration_->property("GNSS-SDR.internal_fs_sps", 0)); + uint32_t fs = configuration_->property("GNSS-SDR.internal_fs_sps", 0); for (unsigned int i = 0; i < channels_count_; i++) { if (FPGA_enabled == false) @@ -369,9 +371,6 @@ void GNSSFlowgraph::connect() } try { - // top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, - // channels_.at(i)->get_left_block(), 0); - // Enable automatic resampler for the acquisition, if required if (use_acq_resampler == true) { @@ -397,7 +396,7 @@ void GNSSFlowgraph::connect() acq_fs = Galileo_E1_OPT_ACQ_FS_HZ; break; case evGAL_5X: - acq_fs = fs; + acq_fs = Galileo_E5a_OPT_ACQ_FS_HZ; break; case evGLO_1G: acq_fs = fs; @@ -406,47 +405,72 @@ void GNSSFlowgraph::connect() acq_fs = fs; break; } + if (acq_fs < fs) { //check if the resampler is already created for the channel system/signal and for the specific RF Channel std::string map_key = channels_.at(i)->implementation() + std::to_string(selected_signal_conditioner_ID); - - resampler_ratio = fs / acq_fs; - - gr::basic_block_sptr tmp_blk; -#ifdef GR_GREATER_38 - tmp_blk = gr::filter::mmse_resampler_cc::make(0.0, resampler_ratio); -#else - tmp_blk = gr::filter::fractional_resampler_cc::make(0.0, resampler_ratio); -#endif - - std::pair::iterator, bool> ret; - ret = acq_resamplers_.insert(std::pair(map_key, tmp_blk)); - if (ret.second == true) + resampler_ratio = static_cast(fs) / acq_fs; + int decimation = floor(resampler_ratio); + while (fs % decimation > 0) { + decimation--; + }; + double acq_fs = fs / decimation; + + if (decimation > 1) + { + //create a FIR low pass filter + std::vector taps; + taps = gr::filter::firdes::low_pass(1.0, + fs, + acq_fs / 2.1, + acq_fs / 10, + gr::filter::firdes::win_type::WIN_HAMMING); + + gr::basic_block_sptr fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(decimation, taps); + + std::pair::iterator, bool> ret; + ret = acq_resamplers_.insert(std::pair(map_key, fir_filter_ccf_)); + if (ret.second == true) + { + top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, + acq_resamplers_.at(map_key), 0); + LOG(INFO) << "Created " + << channels_.at(i)->implementation() + << " acquisition resampler for RF channel " << std::to_string(signal_conditioner_ID) << " with " << taps.size() << " taps and decimation factor of " << decimation; + } + else + { + LOG(INFO) << "Found existing " + << channels_.at(i)->implementation() + << " acquisition resampler for RF channel " << std::to_string(signal_conditioner_ID) << " with " << taps.size() << " taps and decimation factor of " << decimation; + } + + + top_block_->connect(acq_resamplers_.at(map_key), 0, + channels_.at(i)->get_left_block_acq(), 0); + top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, - acq_resamplers_.at(map_key), 0); - LOG(INFO) << "Created " - << channels_.at(i)->implementation() - << " acquisition resampler for RF channel " << std::to_string(signal_conditioner_ID) << " with ratio " << resampler_ratio; + channels_.at(i)->get_left_block_trk(), 0); + + std::shared_ptr channel_ptr; + channel_ptr = std::dynamic_pointer_cast(channels_.at(i)); + channel_ptr->acquisition()->set_resampler_latency((taps.size() - 1) / 2); } else { - LOG(INFO) << "Found " - << channels_.at(i)->implementation() - << " acquisition resampler for RF channel " << std::to_string(signal_conditioner_ID) << " with ratio " << resampler_ratio; + LOG(INFO) << "Disabled acquisition resampler because the input sampling frequency is too low"; + //resampler not required! + top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, + channels_.at(i)->get_left_block_acq(), 0); + top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, + channels_.at(i)->get_left_block_trk(), 0); } - - - top_block_->connect(acq_resamplers_.at(map_key), 0, - channels_.at(i)->get_left_block_acq(), 0); - - top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, - channels_.at(i)->get_left_block_trk(), 0); } else { - //resampler not required! + LOG(INFO) << "Disabled acquisition resampler because the input sampling frequency is too low"; top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, channels_.at(i)->get_left_block_acq(), 0); top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, diff --git a/src/core/system_parameters/GPS_L1_CA.h b/src/core/system_parameters/GPS_L1_CA.h index f14b9f2f2..8388e825a 100644 --- a/src/core/system_parameters/GPS_L1_CA.h +++ b/src/core/system_parameters/GPS_L1_CA.h @@ -58,7 +58,7 @@ const uint32_t GPS_L1_CA_CODE_PERIOD_MS = 1U; //!< GPS L1 C/A code period const double GPS_L1_CA_CHIP_PERIOD = 9.7752e-07; //!< GPS L1 C/A chip period [seconds] //optimum parameters -const uint32_t GPS_L1_CA_OPT_ACQ_FS_HZ = 2000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate +const uint32_t GPS_L1_CA_OPT_ACQ_FS_HZ = 1000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate /*! * \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms diff --git a/src/core/system_parameters/GPS_L2C.h b/src/core/system_parameters/GPS_L2C.h index 28257a204..1a148fed2 100644 --- a/src/core/system_parameters/GPS_L2C.h +++ b/src/core/system_parameters/GPS_L2C.h @@ -64,7 +64,7 @@ const double GPS_L2_L_PERIOD = 1.5; //!< GPS L2 L code period [s const int32_t GPS_L2C_HISTORY_DEEP = 5; //optimum parameters -const uint32_t GPS_L2C_OPT_ACQ_FS_HZ = 2000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate +const uint32_t GPS_L2C_OPT_ACQ_FS_HZ = 1000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate const int32_t GPS_L2C_M_INIT_REG[115] = diff --git a/src/core/system_parameters/GPS_L5.h b/src/core/system_parameters/GPS_L5.h index f12c0c14a..a78b07143 100644 --- a/src/core/system_parameters/GPS_L5.h +++ b/src/core/system_parameters/GPS_L5.h @@ -65,7 +65,7 @@ const double GPS_L5q_PERIOD = 0.001; //!< GPS L5 code period [secon const int32_t GPS_L5_HISTORY_DEEP = 5; //optimum parameters -const uint32_t GPS_L5_OPT_ACQ_FS_HZ = 10000000; +const uint32_t GPS_L5_OPT_ACQ_FS_HZ = 10000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate const int32_t GPS_L5i_INIT_REG[210] = {266, 365, 804, 1138, diff --git a/src/core/system_parameters/Galileo_E1.h b/src/core/system_parameters/Galileo_E1.h index 333877ac3..0c4c93b7a 100644 --- a/src/core/system_parameters/Galileo_E1.h +++ b/src/core/system_parameters/Galileo_E1.h @@ -65,7 +65,7 @@ const int32_t Galileo_E1_NUMBER_OF_CODES = 50; //optimum parameters -const uint32_t Galileo_E1_OPT_ACQ_FS_HZ = 4000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate +const uint32_t Galileo_E1_OPT_ACQ_FS_HZ = 2000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate const double GALILEO_STARTOFFSET_ms = 68.802; //[ms] Initial sign. travel time (this cannot go here) diff --git a/src/core/system_parameters/Galileo_E5a.h b/src/core/system_parameters/Galileo_E5a.h index 6e37cde77..7499a0d08 100644 --- a/src/core/system_parameters/Galileo_E5a.h +++ b/src/core/system_parameters/Galileo_E5a.h @@ -58,7 +58,7 @@ const int32_t GALILEO_E5A_HISTORY_DEEP = 20; const int32_t GALILEO_E5A_CRC_ERROR_LIMIT = 6; //optimum parameters -const uint32_t Galileo_E5A_OPT_ACQ_FS_HZ = 10000000; +const uint32_t Galileo_E5a_OPT_ACQ_FS_HZ = 10000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate // F/NAV message structure diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index e5efd2150..a1e550ea5 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -45,6 +45,7 @@ #include "gnuplot_i.h" #include "test_flags.h" #include "signal_generator_flags.h" +#include "tracking_tests_flags.h" //acquisition resampler #include #include #include @@ -184,6 +185,11 @@ int PositionSystemTest::configure_receiver() const int output_rate_ms = 100; config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_rate_internal)); + // Enable automatic resampler for the acquisition, if required + if (FLAGS_use_acquisition_resampler == true) + { + config->set_property("GNSS-SDR.use_acquisition_resampler", "true"); + } // Set the assistance system parameters config->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false"); diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index 4883b3c60..af18d5b28 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -30,6 +30,11 @@ * ------------------------------------------------------------------------- */ +#include "GPS_L1_CA.h" +#include "Galileo_E1.h" +#include "GPS_L2C.h" +#include "GPS_L5.h" +#include "Galileo_E5a.h" #include #include #include @@ -38,6 +43,12 @@ #include #include #include +#ifdef GR_GREATER_38 +#include +#else +#include +#endif +#include #include #include #include @@ -45,7 +56,6 @@ #include #include #include -#include "GPS_L1_CA.h" #include "gnss_satellite.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" @@ -186,6 +196,19 @@ HybridObservablesTest_tlm_msg_rx::~HybridObservablesTest_tlm_msg_rx() class HybridObservablesTest : public ::testing::Test { public: + enum StringValue + { + evGPS_1C, + evGPS_2S, + evGPS_L5, + evSBAS_1C, + evGAL_1B, + evGAL_5X, + evGLO_1G, + evGLO_2G + }; + std::map mapStringValues_; + std::string generator_binary; std::string p1; std::string p2; @@ -247,6 +270,13 @@ public: factory = std::make_shared(); config = std::make_shared(); item_size = sizeof(gr_complex); + mapStringValues_["1C"] = evGPS_1C; + mapStringValues_["2S"] = evGPS_2S; + mapStringValues_["L5"] = evGPS_L5; + mapStringValues_["1B"] = evGAL_1B; + mapStringValues_["5X"] = evGAL_5X; + mapStringValues_["1G"] = evGLO_1G; + mapStringValues_["2G"] = evGLO_2G; } ~HybridObservablesTest() @@ -328,6 +358,11 @@ bool HybridObservablesTest::acquire_signal() tmp_gnss_synchro.Channel_ID = 0; config = std::make_shared(); config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); + // Enable automatic resampler for the acquisition, if required + if (FLAGS_use_acquisition_resampler == true) + { + config->set_property("GNSS-SDR.use_acquisition_resampler", "true"); + } config->set_property("Acquisition.blocking_on_standby", "true"); config->set_property("Acquisition.blocking", "true"); config->set_property("Acquisition.dump", "false"); @@ -337,11 +372,12 @@ bool HybridObservablesTest::acquire_signal() std::shared_ptr acquisition; std::string System_and_Signal; + std::string signal; //create the correspondign acquisition block according to the desired tracking signal if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking") == 0) { tmp_gnss_synchro.System = 'G'; - std::string signal = "1C"; + signal = "1C"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -353,7 +389,7 @@ bool HybridObservablesTest::acquire_signal() else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking") == 0) { tmp_gnss_synchro.System = 'E'; - std::string signal = "1B"; + signal = "1B"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -364,7 +400,7 @@ bool HybridObservablesTest::acquire_signal() else if (implementation.compare("GPS_L2_M_DLL_PLL_Tracking") == 0) { tmp_gnss_synchro.System = 'G'; - std::string signal = "2S"; + signal = "2S"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -375,7 +411,7 @@ bool HybridObservablesTest::acquire_signal() else if (implementation.compare("Galileo_E5a_DLL_PLL_Tracking_b") == 0) { tmp_gnss_synchro.System = 'E'; - std::string signal = "5X"; + signal = "5X"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -391,7 +427,7 @@ bool HybridObservablesTest::acquire_signal() else if (implementation.compare("Galileo_E5a_DLL_PLL_Tracking") == 0) { tmp_gnss_synchro.System = 'E'; - std::string signal = "5X"; + signal = "5X"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -402,7 +438,7 @@ bool HybridObservablesTest::acquire_signal() else if (implementation.compare("GPS_L5_DLL_PLL_Tracking") == 0) { tmp_gnss_synchro.System = 'G'; - std::string signal = "L5"; + signal = "L5"; const char* str = signal.c_str(); // get a C style null terminated string std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; @@ -433,10 +469,88 @@ bool HybridObservablesTest::acquire_signal() file_source->seek(2 * FLAGS_skip_samples, 0); //skip head. ibyte, two bytes per complex sample gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); //gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration); + //top_block->connect(head_samples, 0, acquisition->get_left_block(), 0); top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); - top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); - //top_block->connect(head_samples, 0, acquisition->get_left_block(), 0); + + // Enable automatic resampler for the acquisition, if required + if (FLAGS_use_acquisition_resampler == true) + { + //create acquisition resamplers if required + double resampler_ratio = 1.0; + + double opt_fs = baseband_sampling_freq; + //find the signal associated to this channel + switch (mapStringValues_[signal]) + { + case evGPS_1C: + opt_fs = GPS_L1_CA_OPT_ACQ_FS_HZ; + break; + case evGPS_2S: + opt_fs = GPS_L2C_OPT_ACQ_FS_HZ; + break; + case evGPS_L5: + opt_fs = GPS_L5_OPT_ACQ_FS_HZ; + break; + case evSBAS_1C: + opt_fs = GPS_L1_CA_OPT_ACQ_FS_HZ; + break; + case evGAL_1B: + opt_fs = Galileo_E1_OPT_ACQ_FS_HZ; + break; + case evGAL_5X: + opt_fs = Galileo_E5a_OPT_ACQ_FS_HZ; + break; + case evGLO_1G: + opt_fs = baseband_sampling_freq; + break; + case evGLO_2G: + opt_fs = baseband_sampling_freq; + break; + } + if (opt_fs < baseband_sampling_freq) + { + resampler_ratio = baseband_sampling_freq / opt_fs; + int decimation = floor(resampler_ratio); + while (baseband_sampling_freq % decimation > 0) + { + decimation--; + }; + double acq_fs = baseband_sampling_freq / decimation; + + if (decimation > 1) + { + //create a FIR low pass filter + std::vector taps; + taps = gr::filter::firdes::low_pass(1.0, + baseband_sampling_freq, + acq_fs / 2.1, + acq_fs / 10, + gr::filter::firdes::win_type::WIN_HAMMING); + std::cout << "Enabled decimation low pass filter with " << taps.size() << " taps and decimation factor of " << decimation << std::endl; + acquisition->set_resampler_latency((taps.size() - 1) / 2); + gr::basic_block_sptr fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(decimation, taps); + top_block->connect(gr_interleaved_char_to_complex, 0, fir_filter_ccf_, 0); + top_block->connect(fir_filter_ccf_, 0, acquisition->get_left_block(), 0); + } + else + { + std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n"; + top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); + } + } + else + { + std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n"; + top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); + } + } + else + { + top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); + //top_block->connect(head_samples, 0, acquisition->get_left_block(), 0); + } + boost::shared_ptr msg_rx; try diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc index ba63a7f18..99aabdce2 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc @@ -58,10 +58,8 @@ #include #ifdef GR_GREATER_38 -#include #include #else -#include #include #endif #include @@ -322,7 +320,7 @@ void TrackingPullInTest::configure_receiver( System_and_Signal = "GPS L2CM"; signal.copy(gnss_synchro.Signal, 2, 0); config->set_property("Tracking.early_late_space_chips", "0.5"); - config->set_property("Tracking.track_pilot", "false"); + config->set_property("Tracking.track_pilot", "true"); } else if (implementation.compare("Galileo_E5a_DLL_PLL_Tracking") == 0 or implementation.compare("Galileo_E5a_DLL_PLL_Tracking_b") == 0) { @@ -335,7 +333,7 @@ void TrackingPullInTest::configure_receiver( config->supersede_property("Tracking.implementation", std::string("Galileo_E5a_DLL_PLL_Tracking")); } config->set_property("Tracking.early_late_space_chips", "0.5"); - config->set_property("Tracking.track_pilot", "false"); + config->set_property("Tracking.track_pilot", "true"); config->set_property("Tracking.order", "2"); } else if (implementation.compare("GPS_L5_DLL_PLL_Tracking") == 0) @@ -345,7 +343,7 @@ void TrackingPullInTest::configure_receiver( System_and_Signal = "GPS L5I"; signal.copy(gnss_synchro.Signal, 2, 0); config->set_property("Tracking.early_late_space_chips", "0.5"); - config->set_property("Tracking.track_pilot", "false"); + config->set_property("Tracking.track_pilot", "true"); config->set_property("Tracking.order", "2"); } else @@ -497,8 +495,6 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); // Enable automatic resampler for the acquisition, if required - std::vector taps; - int decimation = 1; if (FLAGS_use_acquisition_resampler == true) { //create acquisition resamplers if required @@ -524,7 +520,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) opt_fs = Galileo_E1_OPT_ACQ_FS_HZ; break; case evGAL_5X: - opt_fs = baseband_sampling_freq; + opt_fs = Galileo_E5a_OPT_ACQ_FS_HZ; break; case evGLO_1G: opt_fs = baseband_sampling_freq; @@ -536,30 +532,38 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) if (opt_fs < baseband_sampling_freq) { resampler_ratio = baseband_sampling_freq / opt_fs; - decimation = floor(resampler_ratio); + int decimation = floor(resampler_ratio); while (baseband_sampling_freq % decimation > 0) { decimation--; }; double acq_fs = baseband_sampling_freq / decimation; - //create a FIR low pass filter - taps = gr::filter::firdes::low_pass(1.0, - baseband_sampling_freq, - acq_fs / 2.1, - acq_fs / 20, - gr::filter::firdes::win_type::WIN_HAMMING); - std::cout << "Enabled decimation low pass filter with " << taps.size() << " taps and decimation factor of " << decimation << std::endl; - gr::basic_block_sptr fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(decimation, taps); - - //#ifdef GR_GREATER_38 - // gr::basic_block_sptr resampler = gr::filter::mmse_resampler_cc::make(0.0, resampler_ratio); - //#else - // gr::basic_block_sptr resampler = gr::filter::fractional_resampler_cc::make(0.0, resampler_ratio); - //#endif - top_block->connect(gr_interleaved_char_to_complex, 0, fir_filter_ccf_, 0); - // top_block->connect(fir_filter_ccf_, 0, resampler, 0); - top_block->connect(fir_filter_ccf_, 0, acquisition->get_left_block(), 0); + if (decimation > 1) + { + //create a FIR low pass filter + std::vector taps; + taps = gr::filter::firdes::low_pass(1.0, + baseband_sampling_freq, + acq_fs / 2.1, + acq_fs / 10, + gr::filter::firdes::win_type::WIN_HAMMING); + std::cout << "Enabled decimation low pass filter with " << taps.size() << " taps and decimation factor of " << decimation << std::endl; + acquisition->set_resampler_latency((taps.size() - 1) / 2); + gr::basic_block_sptr fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(decimation, taps); + top_block->connect(gr_interleaved_char_to_complex, 0, fir_filter_ccf_, 0); + top_block->connect(fir_filter_ccf_, 0, acquisition->get_left_block(), 0); + } + else + { + std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n"; + top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); + } + } + else + { + std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n"; + top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); } } else @@ -567,6 +571,8 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); //top_block->connect(head_samples, 0, acquisition->get_left_block(), 0); } + + boost::shared_ptr msg_rx; try { @@ -633,17 +639,8 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) { std::cout << " " << PRN << " "; doppler_measurements_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_doppler_hz)); - - if (FLAGS_use_acquisition_resampler == true) - { - code_delay_measurements_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_delay_samples - (taps.size()) / 2)); - acq_samplestamp_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_samplestamp_samples)); - } - else - { - code_delay_measurements_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_delay_samples)); - acq_samplestamp_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_samplestamp_samples)); - } + code_delay_measurements_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_delay_samples)); + acq_samplestamp_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_samplestamp_samples)); } else { From ef201c4ccd0c4c54ecfff1604010e67b3eda4d51 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Dec 2018 00:18:27 +0100 Subject: [PATCH 03/12] Add pmt and uhd to clang-format as external libraries --- .clang-format | 2 +- src/algorithms/signal_source/adapters/uhd_signal_source.cc | 4 ++-- .../glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 2 +- .../gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h | 2 +- .../glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 2 +- .../glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 2 +- .../gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h | 2 +- .../glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 2 +- .../gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h | 2 +- .../gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.clang-format b/.clang-format index de0166ea3..d917fcd0b 100644 --- a/.clang-format +++ b/.clang-format @@ -51,7 +51,7 @@ IncludeBlocks: Merge IncludeCategories: - Regex: '^.*.h"' Priority: 1 - - Regex: '^.*(boost|gflags|glog|gtest|gnuradio|volk|gnsssdr)/' + - Regex: '^.*(boost|gflags|glog|gtest|gnsssdr|gnuradio|pmt|uhd|volk)/' Priority: 2 - Regex: '^.*(armadillo|matio)' Priority: 2 diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.cc b/src/algorithms/signal_source/adapters/uhd_signal_source.cc index 11551024a..54a353837 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.cc +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.cc @@ -33,10 +33,10 @@ #include "configuration_interface.h" #include "gnss_sdr_valve.h" #include -#include -#include #include #include +#include +#include #include 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 c500cb586..77603d0aa 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 @@ -47,11 +47,11 @@ #include #include #include +#include #include #include #include #include -#include #include #include 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 c56ad5ba5..10f1064f5 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 @@ -45,10 +45,10 @@ //#include "tracking_loop_filter.h" #include "cpu_multicorrelator.h" #include +#include #include #include #include -#include #include class glonass_l1_ca_dll_pll_c_aid_tracking_cc; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index db43b94aa..96009c777 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -47,10 +47,10 @@ #include #include #include +#include #include #include #include -#include #include #include diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 7d5475fd0..0299968b3 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -45,11 +45,11 @@ #include #include #include +#include #include #include #include #include -#include #include #include diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h index 9441262ac..129e4609e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h @@ -43,10 +43,10 @@ //#include "tracking_loop_filter.h" #include "cpu_multicorrelator.h" #include +#include #include #include #include -#include #include class glonass_l2_ca_dll_pll_c_aid_tracking_cc; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index 85895f6af..ec9db011a 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -45,10 +45,10 @@ #include #include #include +#include #include #include #include -#include #include #include diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h index d2128e948..43db468ae 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h @@ -43,10 +43,10 @@ //#include "tracking_loop_filter.h" #include "cpu_multicorrelator.h" #include +#include #include #include #include -#include #include class gps_l1_ca_dll_pll_c_aid_tracking_cc; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc index 8936c7b0e..457b7e65f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -39,10 +39,10 @@ #include #include #include +#include #include #include #include -#include #include #include From ba23d698bcccad3b22db38fa69a427c0de76ce53 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Dec 2018 15:15:35 +0100 Subject: [PATCH 04/12] Apply fixes by clang-tidy --- .../adapters/galileo_e1_pcps_ambiguous_acquisition.cc | 7 ++++--- .../adapters/galileo_e1_pcps_ambiguous_acquisition.h | 4 ++-- .../acquisition/adapters/galileo_e5a_pcps_acquisition.cc | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_acquisition.cc | 7 ++++--- .../acquisition/adapters/gps_l1_ca_pcps_acquisition.h | 4 ++-- .../acquisition/adapters/gps_l2_m_pcps_acquisition.cc | 7 ++++--- .../acquisition/adapters/gps_l2_m_pcps_acquisition.h | 2 +- .../acquisition/adapters/gps_l5i_pcps_acquisition.cc | 7 ++++--- .../acquisition/adapters/gps_l5i_pcps_acquisition.h | 2 +- src/algorithms/channel/adapters/channel.cc | 2 +- .../adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc | 5 +++-- .../adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h | 2 +- .../adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc | 5 +++-- .../adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h | 2 +- .../tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc | 5 +++-- .../tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h | 2 +- src/core/receiver/gnss_flowgraph.h | 1 - .../acquisition/gps_l1_ca_pcps_acquisition_test.cc | 6 +++--- 18 files changed, 39 insertions(+), 33 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index 585b5eacb..48931acff 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -37,6 +37,7 @@ #include "gnss_sdr_flags.h" #include #include +#include using google::LogMessage; @@ -44,9 +45,9 @@ using google::LogMessage; GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( ConfigurationInterface* configuration, - const std::string& role, + std::string role, unsigned int in_streams, - unsigned int out_streams) : role_(role), + unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { @@ -88,7 +89,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( acq_parameters_.dump_filename = dump_filename_; acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "Galileo E1 acqisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h index d7a673a5f..13dd5fe4a 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h @@ -32,8 +32,8 @@ #ifndef GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_ #define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_ -#include "acquisition_interface.h" #include "acq_conf.h" +#include "acquisition_interface.h" #include "complex_byte_to_float_x2.h" #include "gnss_synchro.h" #include "pcps_acquisition.h" @@ -52,7 +52,7 @@ class GalileoE1PcpsAmbiguousAcquisition : public AcquisitionInterface { public: GalileoE1PcpsAmbiguousAcquisition(ConfigurationInterface* configuration, - const std::string& role, + std::string role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index 466e7c231..4b7abfc8f 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -86,7 +86,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "Galileo E5a acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 3cdb92ad7..0387cb10d 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -41,6 +41,7 @@ #include "gps_sdr_signal_processing.h" #include #include +#include using google::LogMessage; @@ -48,9 +49,9 @@ using google::LogMessage; GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( ConfigurationInterface* configuration, - const std::string& role, + std::string role, unsigned int in_streams, - unsigned int out_streams) : role_(role), + unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { @@ -87,7 +88,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "GPS L1 CA acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h index 2d3aac014..ed9767a81 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h @@ -36,8 +36,8 @@ #ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_ #define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_ -#include "acquisition_interface.h" #include "acq_conf.h" +#include "acquisition_interface.h" #include "complex_byte_to_float_x2.h" #include "gnss_synchro.h" #include "pcps_acquisition.h" @@ -56,7 +56,7 @@ class GpsL1CaPcpsAcquisition : public AcquisitionInterface { public: GpsL1CaPcpsAcquisition(ConfigurationInterface* configuration, - const std::string& role, + std::string role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc index 596221516..218d4849a 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -39,6 +39,7 @@ #include "gps_l2c_signal.h" #include #include +#include using google::LogMessage; @@ -46,9 +47,9 @@ using google::LogMessage; GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( ConfigurationInterface* configuration, - const std::string& role, + std::string role, unsigned int in_streams, - unsigned int out_streams) : role_(role), + unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { @@ -91,7 +92,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "GPS L2CM acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h index da1c7ef6e..f296e6304 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h @@ -53,7 +53,7 @@ class GpsL2MPcpsAcquisition : public AcquisitionInterface { public: GpsL2MPcpsAcquisition(ConfigurationInterface* configuration, - const std::string& role, + std::string role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc index 8c3636277..091b1b67c 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -39,6 +39,7 @@ #include "gps_l5_signal.h" #include #include +#include using google::LogMessage; @@ -46,9 +47,9 @@ using google::LogMessage; GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( ConfigurationInterface* configuration, - const std::string& role, + std::string role, unsigned int in_streams, - unsigned int out_streams) : role_(role), + unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { @@ -98,7 +99,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "GPS L5 acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h index af8cabb81..02f48d11d 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h @@ -53,7 +53,7 @@ class GpsL5iPcpsAcquisition : public AcquisitionInterface { public: GpsL5iPcpsAcquisition(ConfigurationInterface* configuration, - const std::string& role, + std::string role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index c39330521..946f17a65 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -146,7 +146,7 @@ void Channel::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr Channel::get_left_block() { LOG(ERROR) << "Deprecated call to get_left_block() in channel interface"; - return NULL; + return nullptr; } gr::basic_block_sptr Channel::get_left_block_trk() diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc index 30101a0ff..1ad03d4be 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc @@ -42,14 +42,15 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include +#include using google::LogMessage; GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( - ConfigurationInterface* configuration, const std::string& role, - unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) + ConfigurationInterface* configuration, std::string role, + unsigned int in_streams, unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h index d50003964..5911b4288 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h @@ -54,7 +54,7 @@ class GlonassL1CaDllPllCAidTracking : public TrackingInterface { public: GlonassL1CaDllPllCAidTracking(ConfigurationInterface* configuration, - const std::string& role, + std::string role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc index 4ddff7163..99e66c2b4 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc @@ -40,14 +40,15 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include +#include using google::LogMessage; GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( - ConfigurationInterface* configuration, const std::string& role, - unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) + ConfigurationInterface* configuration, std::string role, + unsigned int in_streams, unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h index b5659c527..5946b8713 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h @@ -52,7 +52,7 @@ class GlonassL2CaDllPllCAidTracking : public TrackingInterface { public: GlonassL2CaDllPllCAidTracking(ConfigurationInterface* configuration, - const std::string& role, + std::string role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc index 899e878e2..4b83ac9c8 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc @@ -41,14 +41,15 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include +#include using google::LogMessage; GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking( - ConfigurationInterface* configuration, const std::string& role, - unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) + ConfigurationInterface* configuration, std::string role, + unsigned int in_streams, unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) { DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h index a1c54aa46..d48474ead 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h @@ -53,7 +53,7 @@ class GpsL1CaDllPllCAidTracking : public TrackingInterface { public: GpsL1CaDllPllCAidTracking(ConfigurationInterface* configuration, - const std::string& role, + std::string role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 71b52dd6f..442fcee77 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -55,7 +55,6 @@ #include #include #include -#include #if ENABLE_FPGA #include "gnss_sdr_fpga_sample_counter.h" diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc index d93f11918..3bfa82312 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc @@ -233,14 +233,14 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() } -TEST_F(GpsL1CaPcpsAcquisitionTest, Instantiate) +TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, Instantiate /*unused*/) { init(); boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1C", 1, 0); } -TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) +TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, ConnectAndRun /*unused*/) { int fs_in = 4000000; int nsamples = 4000; @@ -273,7 +273,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) } -TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) +TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, ValidationOfResults /*unused*/) { std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0.0); From 0dc07362eda7c15821ca104921ac291e76fbebc0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Dec 2018 15:35:40 +0100 Subject: [PATCH 05/12] Add missing include --- .../signal-processing-blocks/tracking/tracking_pull-in_test.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc index 46cb20827..900950e16 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc @@ -36,6 +36,7 @@ #include "GPS_L5.h" #include "Galileo_E1.h" #include "Galileo_E5a.h" +#include "acquisition_msg_rx.h" #include "control_message_factory.h" #include "galileo_e1_pcps_ambiguous_acquisition.h" #include "galileo_e5a_noncoherent_iq_acquisition_caf.h" From 7c9f824e29c392f3b740505059abeeaaa1b609b2 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Dec 2018 18:12:14 +0100 Subject: [PATCH 06/12] Apply clang-tidy fixes --- .../adapters/galileo_e1_pcps_ambiguous_acquisition.cc | 2 +- .../acquisition/adapters/galileo_e5a_pcps_acquisition.cc | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_acquisition.cc | 2 +- .../acquisition/adapters/gps_l2_m_pcps_acquisition.cc | 2 +- src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc | 2 +- src/algorithms/channel/adapters/channel.cc | 2 +- src/tests/system-tests/position_test.cc | 1 + .../signal-processing-blocks/tracking/tracking_pull-in_test.cc | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index 585b5eacb..79e25061c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -88,7 +88,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( acq_parameters_.dump_filename = dump_filename_; acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "Galileo E1 acqisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index 466e7c231..4b7abfc8f 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -86,7 +86,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "Galileo E5a acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 3cdb92ad7..ce0ea4065 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -87,7 +87,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "GPS L1 CA acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc index 596221516..dcf663121 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -91,7 +91,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "GPS L2CM acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc index 8c3636277..f436da1d4 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -98,7 +98,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "GPS L5 acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index c39330521..946f17a65 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -146,7 +146,7 @@ void Channel::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr Channel::get_left_block() { LOG(ERROR) << "Deprecated call to get_left_block() in channel interface"; - return NULL; + return nullptr; } gr::basic_block_sptr Channel::get_left_block_trk() diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 01dca3bbb..202f31306 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -33,6 +33,7 @@ */ #include "MATH_CONSTANTS.h" +#include "acquisition_msg_rx.h" #include "concurrent_map.h" #include "concurrent_queue.h" #include "control_thread.h" diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc index 46cb20827..2d9861d6f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc @@ -30,12 +30,12 @@ * ------------------------------------------------------------------------- */ - #include "GPS_L1_CA.h" #include "GPS_L2C.h" #include "GPS_L5.h" #include "Galileo_E1.h" #include "Galileo_E5a.h" +#include "acquisition_msg_rx.h" #include "control_message_factory.h" #include "galileo_e1_pcps_ambiguous_acquisition.h" #include "galileo_e5a_noncoherent_iq_acquisition_caf.h" From d6f3cd6dd3436c95494ef43070ee2bf3bbdecfbb Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Dec 2018 18:20:45 +0100 Subject: [PATCH 07/12] Revert "Apply fixes by clang-tidy" This reverts commit ba23d698bcccad3b22db38fa69a427c0de76ce53. --- .../adapters/galileo_e1_pcps_ambiguous_acquisition.cc | 7 +++---- .../adapters/galileo_e1_pcps_ambiguous_acquisition.h | 4 ++-- .../acquisition/adapters/galileo_e5a_pcps_acquisition.cc | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_acquisition.cc | 7 +++---- .../acquisition/adapters/gps_l1_ca_pcps_acquisition.h | 4 ++-- .../acquisition/adapters/gps_l2_m_pcps_acquisition.cc | 7 +++---- .../acquisition/adapters/gps_l2_m_pcps_acquisition.h | 2 +- .../acquisition/adapters/gps_l5i_pcps_acquisition.cc | 7 +++---- .../acquisition/adapters/gps_l5i_pcps_acquisition.h | 2 +- src/algorithms/channel/adapters/channel.cc | 2 +- .../adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc | 5 ++--- .../adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h | 2 +- .../adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc | 5 ++--- .../adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h | 2 +- .../tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc | 5 ++--- .../tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h | 2 +- src/core/receiver/gnss_flowgraph.h | 1 + .../acquisition/gps_l1_ca_pcps_acquisition_test.cc | 6 +++--- 18 files changed, 33 insertions(+), 39 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index 48931acff..585b5eacb 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -37,7 +37,6 @@ #include "gnss_sdr_flags.h" #include #include -#include using google::LogMessage; @@ -45,9 +44,9 @@ using google::LogMessage; GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, - unsigned int out_streams) : role_(std::move(role)), + unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { @@ -89,7 +88,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( acq_parameters_.dump_filename = dump_filename_; acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") + if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) { LOG(WARNING) << "Galileo E1 acqisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h index 13dd5fe4a..d7a673a5f 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h @@ -32,8 +32,8 @@ #ifndef GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_ #define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_ -#include "acq_conf.h" #include "acquisition_interface.h" +#include "acq_conf.h" #include "complex_byte_to_float_x2.h" #include "gnss_synchro.h" #include "pcps_acquisition.h" @@ -52,7 +52,7 @@ class GalileoE1PcpsAmbiguousAcquisition : public AcquisitionInterface { public: GalileoE1PcpsAmbiguousAcquisition(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index 4b7abfc8f..466e7c231 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -86,7 +86,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") + if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) { LOG(WARNING) << "Galileo E5a acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 0387cb10d..3cdb92ad7 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -41,7 +41,6 @@ #include "gps_sdr_signal_processing.h" #include #include -#include using google::LogMessage; @@ -49,9 +48,9 @@ using google::LogMessage; GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, - unsigned int out_streams) : role_(std::move(role)), + unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { @@ -88,7 +87,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") + if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) { LOG(WARNING) << "GPS L1 CA acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h index ed9767a81..2d3aac014 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h @@ -36,8 +36,8 @@ #ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_ #define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_ -#include "acq_conf.h" #include "acquisition_interface.h" +#include "acq_conf.h" #include "complex_byte_to_float_x2.h" #include "gnss_synchro.h" #include "pcps_acquisition.h" @@ -56,7 +56,7 @@ class GpsL1CaPcpsAcquisition : public AcquisitionInterface { public: GpsL1CaPcpsAcquisition(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc index 218d4849a..596221516 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -39,7 +39,6 @@ #include "gps_l2c_signal.h" #include #include -#include using google::LogMessage; @@ -47,9 +46,9 @@ using google::LogMessage; GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, - unsigned int out_streams) : role_(std::move(role)), + unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { @@ -92,7 +91,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") + if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) { LOG(WARNING) << "GPS L2CM acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h index f296e6304..da1c7ef6e 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h @@ -53,7 +53,7 @@ class GpsL2MPcpsAcquisition : public AcquisitionInterface { public: GpsL2MPcpsAcquisition(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc index 091b1b67c..8c3636277 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -39,7 +39,6 @@ #include "gps_l5_signal.h" #include #include -#include using google::LogMessage; @@ -47,9 +46,9 @@ using google::LogMessage; GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, - unsigned int out_streams) : role_(std::move(role)), + unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { @@ -99,7 +98,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") + if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) { LOG(WARNING) << "GPS L5 acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h index 02f48d11d..af8cabb81 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h @@ -53,7 +53,7 @@ class GpsL5iPcpsAcquisition : public AcquisitionInterface { public: GpsL5iPcpsAcquisition(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index 946f17a65..c39330521 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -146,7 +146,7 @@ void Channel::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr Channel::get_left_block() { LOG(ERROR) << "Deprecated call to get_left_block() in channel interface"; - return nullptr; + return NULL; } gr::basic_block_sptr Channel::get_left_block_trk() diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc index 1ad03d4be..30101a0ff 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc @@ -42,15 +42,14 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include -#include using google::LogMessage; GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( - ConfigurationInterface* configuration, std::string role, - unsigned int in_streams, unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) + ConfigurationInterface* configuration, const std::string& role, + unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h index 5911b4288..d50003964 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.h @@ -54,7 +54,7 @@ class GlonassL1CaDllPllCAidTracking : public TrackingInterface { public: GlonassL1CaDllPllCAidTracking(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc index 99e66c2b4..4ddff7163 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc @@ -40,15 +40,14 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include -#include using google::LogMessage; GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( - ConfigurationInterface* configuration, std::string role, - unsigned int in_streams, unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) + ConfigurationInterface* configuration, const std::string& role, + unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h index 5946b8713..b5659c527 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.h @@ -52,7 +52,7 @@ class GlonassL2CaDllPllCAidTracking : public TrackingInterface { public: GlonassL2CaDllPllCAidTracking(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc index 4b83ac9c8..899e878e2 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc @@ -41,15 +41,14 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include -#include using google::LogMessage; GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking( - ConfigurationInterface* configuration, std::string role, - unsigned int in_streams, unsigned int out_streams) : role_(std::move(role)), in_streams_(in_streams), out_streams_(out_streams) + ConfigurationInterface* configuration, const std::string& role, + unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h index d48474ead..a1c54aa46 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.h @@ -53,7 +53,7 @@ class GpsL1CaDllPllCAidTracking : public TrackingInterface { public: GpsL1CaDllPllCAidTracking(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 442fcee77..71b52dd6f 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -55,6 +55,7 @@ #include #include #include +#include #if ENABLE_FPGA #include "gnss_sdr_fpga_sample_counter.h" diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc index 3bfa82312..d93f11918 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc @@ -233,14 +233,14 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() } -TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, Instantiate /*unused*/) +TEST_F(GpsL1CaPcpsAcquisitionTest, Instantiate) { init(); boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1C", 1, 0); } -TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, ConnectAndRun /*unused*/) +TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) { int fs_in = 4000000; int nsamples = 4000; @@ -273,7 +273,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, ConnectAndRun /*unused*/) } -TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, ValidationOfResults /*unused*/) +TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) { std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0.0); From a7b780fddcb504a5ab136b31f83ae49bc8a90d4c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Dec 2018 18:39:14 +0100 Subject: [PATCH 08/12] Apply fixes by clang-tidy --- .../adapters/galileo_e1_pcps_ambiguous_acquisition.cc | 2 +- .../adapters/galileo_e1_pcps_ambiguous_acquisition.h | 2 +- .../acquisition/adapters/galileo_e5a_pcps_acquisition.cc | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_acquisition.cc | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_acquisition.h | 2 +- .../acquisition/adapters/gps_l2_m_pcps_acquisition.cc | 2 +- src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc | 2 +- src/algorithms/channel/adapters/channel.cc | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index 585b5eacb..79e25061c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -88,7 +88,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( acq_parameters_.dump_filename = dump_filename_; acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "Galileo E1 acqisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h index d7a673a5f..ee4538022 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h @@ -32,8 +32,8 @@ #ifndef GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_ #define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_ -#include "acquisition_interface.h" #include "acq_conf.h" +#include "acquisition_interface.h" #include "complex_byte_to_float_x2.h" #include "gnss_synchro.h" #include "pcps_acquisition.h" diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index 466e7c231..4b7abfc8f 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -86,7 +86,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "Galileo E5a acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 3cdb92ad7..ce0ea4065 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -87,7 +87,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( acq_parameters_.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "GPS L1 CA acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h index 2d3aac014..efca26bdd 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h @@ -36,8 +36,8 @@ #ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_ #define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_ -#include "acquisition_interface.h" #include "acq_conf.h" +#include "acquisition_interface.h" #include "complex_byte_to_float_x2.h" #include "gnss_synchro.h" #include "pcps_acquisition.h" diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc index 596221516..dcf663121 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -91,7 +91,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "GPS L2CM acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc index 8c3636277..f436da1d4 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -98,7 +98,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( acq_parameters_.make_2_steps = configuration_->property(role + ".make_two_steps", false); acq_parameters_.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acq_parameters_.use_automatic_resampler = configuration_->property("GNSS-SDR.use_acquisition_resampler", false); - if (acq_parameters_.use_automatic_resampler == true and item_type_.compare("gr_complex") != 0) + if (acq_parameters_.use_automatic_resampler == true and item_type_ != "gr_complex") { LOG(WARNING) << "GPS L5 acquisition disabled the automatic resampler feature because its item_type is not set to gr_complex"; acq_parameters_.use_automatic_resampler = false; diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index c39330521..946f17a65 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -146,7 +146,7 @@ void Channel::disconnect(gr::top_block_sptr top_block) gr::basic_block_sptr Channel::get_left_block() { LOG(ERROR) << "Deprecated call to get_left_block() in channel interface"; - return NULL; + return nullptr; } gr::basic_block_sptr Channel::get_left_block_trk() From 3dce8934fde1303a08049bcee62008011a31f26c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Dec 2018 19:05:12 +0100 Subject: [PATCH 09/12] Apply fixes by clang-tidy --- ...ileo_e1_pcps_ambiguous_acquisition_fpga.cc | 10 +-- .../galileo_e5a_pcps_acquisition_fpga.cc | 10 +-- .../gps_l1_ca_pcps_acquisition_fpga.cc | 10 +-- .../gps_l2_m_pcps_acquisition_fpga.cc | 8 +- .../adapters/gps_l5i_pcps_acquisition_fpga.cc | 10 +-- .../gnuradio_blocks/pcps_acquisition_fpga.cc | 2 +- .../acquisition/libs/fpga_acquisition.cc | 6 +- .../libs/gnss_sdr_fpga_sample_counter.cc | 8 +- src/algorithms/libs/gnss_sdr_time_counter.cc | 4 +- .../signal_source/libs/fpga_switch.cc | 2 +- .../galileo_e5a_dll_pll_tracking_fpga.cc | 4 +- .../gps_l2_m_dll_pll_tracking_fpga.cc | 5 +- .../adapters/gps_l5_dll_pll_tracking_fpga.cc | 2 +- .../dll_pll_veml_tracking_fpga.cc | 84 +++++++++---------- .../tracking/libs/fpga_multicorrelator.cc | 16 ++-- .../gps_l1_ca_dll_pll_tracking_test_fpga.cc | 12 ++- 16 files changed, 95 insertions(+), 98 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index a4f4616e7..6097ce61d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -89,7 +89,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( // dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); // acq_parameters.dump_filename = dump_filename_; //--- Find number of samples per spreading code (4 ms) ----------------- - unsigned int code_length = static_cast(std::round(static_cast(fs_in) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); + auto code_length = static_cast(std::round(static_cast(fs_in) / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); //acq_parameters.samples_per_code = code_length_; //int samples_per_ms = static_cast(std::round(static_cast(fs_in_) * 0.001)); //acq_parameters.samples_per_ms = samples_per_ms; @@ -120,9 +120,9 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( // compute all the GALILEO E1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT - std::complex* code = new std::complex[nsamples_total]; // buffer for the local code - gr_complex* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT + auto* code = new std::complex[nsamples_total]; // buffer for the local code + auto* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_all_fft_codes_ = new lv_16sc_t[nsamples_total * Galileo_E1_NUMBER_OF_CODES]; // memory containing all the possible fft codes for PRN 0 to 32 float max; // temporary maxima search @@ -174,7 +174,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( // // fill in zero padding for (int s = code_length; s < nsamples_total; s++) { - code[s] = std::complex(static_cast(0, 0)); + code[s] = std::complex(0.0, 0.0); //code[s] = 0; } diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index a5764948b..0559ddc7e 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -89,7 +89,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf acq_pilot_ = false; } - unsigned int code_length = static_cast(std::round(static_cast(fs_in) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast(Galileo_E5a_CODE_LENGTH_CHIPS))); + auto code_length = static_cast(std::round(static_cast(fs_in) / Galileo_E5a_CODE_CHIP_RATE_HZ * static_cast(Galileo_E5a_CODE_LENGTH_CHIPS))); acq_parameters.code_length = code_length; // The FPGA can only use FFT lengths that are a power of two. float nbits = ceilf(log2f((float)code_length)); @@ -108,9 +108,9 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf // compute all the GALILEO E5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT - std::complex* code = new std::complex[nsamples_total]; // buffer for the local code - gr_complex* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT + auto* code = new std::complex[nsamples_total]; // buffer for the local code + auto* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_all_fft_codes_ = new lv_16sc_t[nsamples_total * Galileo_E5a_NUMBER_OF_CODES]; // memory containing all the possible fft codes for PRN 0 to 32 float max; // temporary maxima search @@ -141,7 +141,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf // fill in zero padding for (int s = code_length; s < nsamples_total; s++) { - code[s] = std::complex(static_cast(0, 0)); + code[s] = std::complex(0.0, 0.0); //code[s] = 0; } diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index 10d5a0551..6ddfa4616 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -74,7 +74,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( acq_parameters.doppler_max = doppler_max_; unsigned int sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 1); acq_parameters.sampled_ms = sampled_ms; - unsigned int code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); + auto code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); acq_parameters.code_length = code_length; // The FPGA can only use FFT lengths that are a power of two. float nbits = ceilf(log2f((float)code_length)); @@ -90,10 +90,10 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( // compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT + auto* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT // allocate memory to compute all the PRNs and compute all the possible codes - std::complex* code = new std::complex[nsamples_total]; // buffer for the local code - gr_complex* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* code = new std::complex[nsamples_total]; // buffer for the local code + auto* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32 float max; // temporary maxima search for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++) @@ -102,7 +102,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( // fill in zero padding for (int s = code_length; s < nsamples_total; s++) { - code[s] = std::complex(static_cast(0, 0)); + code[s] = std::complex(0.0, 0.0); //code[s] = 0; } int offset = 0; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index 089c87c9a..c3cd96275 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -104,10 +104,10 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( // compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT + auto* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT // allocate memory to compute all the PRNs and compute all the possible codes - std::complex* code = new std::complex[nsamples_total]; // buffer for the local code - gr_complex* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* code = new std::complex[nsamples_total]; // buffer for the local code + auto* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32 float max; // temporary maxima search for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++) @@ -116,7 +116,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( // fill in zero padding for (int s = code_length; s < nsamples_total; s++) { - code[s] = std::complex(static_cast(0, 0)); + code[s] = std::complex(0.0, 0.0); //code[s] = 0; } memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index d8f754755..f90c77040 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -89,7 +89,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( //dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); //acq_parameters.dump_filename = dump_filename_; //--- Find number of samples per spreading code ------------------------- - unsigned int code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L5i_CODE_RATE_HZ / static_cast(GPS_L5i_CODE_LENGTH_CHIPS)))); + auto code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L5i_CODE_RATE_HZ / static_cast(GPS_L5i_CODE_LENGTH_CHIPS)))); acq_parameters.code_length = code_length; // The FPGA can only use FFT lengths that are a power of two. float nbits = ceilf(log2f((float)code_length)); @@ -105,11 +105,11 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( //printf("L5 ACQ CLASS MID 01\n"); // compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) - gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT + auto* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT //printf("L5 ACQ CLASS MID 02\n"); - std::complex* code = new gr_complex[vector_length]; + auto* code = new gr_complex[vector_length]; //printf("L5 ACQ CLASS MID 03\n"); - gr_complex* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + auto* fft_codes_padded = static_cast(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment())); //printf("L5 ACQ CLASS MID 04\n"); d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32 @@ -124,7 +124,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( // fill in zero padding for (int s = code_length; s < nsamples_total; s++) { - code[s] = std::complex(static_cast(0, 0)); + code[s] = std::complex(0.0, 0.0); //code[s] = 0; } memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index 8014a7b22..df677dea5 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -74,7 +74,7 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) : gr::block( d_doppler_step = 0U; d_test_statistics = 0.0; d_channel = 0U; - d_gnss_synchro = 0; + d_gnss_synchro = nullptr; //printf("zzzz acq_parameters.code_length = %d\n", acq_parameters.code_length); //printf("zzzz acq_parameters.samples_per_ms = %d\n", acq_parameters.samples_per_ms); diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.cc b/src/algorithms/acquisition/libs/fpga_acquisition.cc index fc490a02b..ed0c2c4a9 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.cc +++ b/src/algorithms/acquisition/libs/fpga_acquisition.cc @@ -121,7 +121,7 @@ fpga_acquisition::fpga_acquisition(std::string device_name, LOG(WARNING) << "Cannot open deviceio" << d_device_name; std::cout << "Acq: cannot open deviceio" << d_device_name << std::endl; } - d_map_base = reinterpret_cast(mmap(NULL, PAGE_SIZE, + d_map_base = reinterpret_cast(mmap(nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, d_fd, 0)); if (d_map_base == reinterpret_cast(-1)) @@ -234,7 +234,7 @@ void fpga_acquisition::set_doppler_sweep(uint32_t num_sweeps) float phase_step_rad_int_temp; int32_t phase_step_rad_int; //int32_t doppler = static_cast(-d_doppler_max) + d_doppler_step * doppler_index; - int32_t doppler = static_cast(-d_doppler_max); + auto doppler = static_cast(-d_doppler_max); //float phase_step_rad = GPS_TWO_PI * (d_freq + doppler) / static_cast(d_fs_in); float phase_step_rad = GPS_TWO_PI * (doppler) / static_cast(d_fs_in); // The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing @@ -408,7 +408,7 @@ void fpga_acquisition::unblock_samples() void fpga_acquisition::close_device() { - uint32_t *aux = const_cast(d_map_base); + auto *aux = const_cast(d_map_base); if (munmap(static_cast(aux), PAGE_SIZE) == -1) { printf("Failed to unmap memory uio\n"); diff --git a/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc index 8c1b29617..94eb8e294 100644 --- a/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc +++ b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc @@ -33,9 +33,9 @@ #include "gnss_synchro.h" #include #include +#include #include #include // libraries used by the GIPO -#include #include #include #include // libraries used by the GIPO @@ -129,7 +129,7 @@ int gnss_sdr_fpga_sample_counter::general_work(int noutput_items __attribute__(( // variable number). sample_counter = sample_counter + samples_passed; //samples_per_output; - Gnss_Synchro *out = reinterpret_cast(output_items[0]); + auto *out = reinterpret_cast(output_items[0]); out[0] = Gnss_Synchro(); out[0].Flag_valid_symbol_output = false; out[0].Flag_valid_word = false; @@ -236,7 +236,7 @@ void gnss_sdr_fpga_sample_counter::open_device() LOG(WARNING) << "Cannot open deviceio" << device_name; std::cout << "Counter-Intr: cannot open deviceio" << device_name << std::endl; } - map_base = reinterpret_cast(mmap(NULL, PAGE_SIZE, + map_base = reinterpret_cast(mmap(nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)); if (map_base == reinterpret_cast(-1)) @@ -265,7 +265,7 @@ void gnss_sdr_fpga_sample_counter::close_device() //printf("=========================================== NOW closing device ...\n"); map_base[2] = 0; // disable the generation of the interrupt in the device - uint32_t *aux = const_cast(map_base); + auto *aux = const_cast(map_base); if (munmap(static_cast(aux), PAGE_SIZE) == -1) { printf("Failed to unmap memory uio\n"); diff --git a/src/algorithms/libs/gnss_sdr_time_counter.cc b/src/algorithms/libs/gnss_sdr_time_counter.cc index 59a0b4782..0cd06517b 100644 --- a/src/algorithms/libs/gnss_sdr_time_counter.cc +++ b/src/algorithms/libs/gnss_sdr_time_counter.cc @@ -63,8 +63,8 @@ gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter() int gnss_sdr_time_counter::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items __attribute__((unused)), gr_vector_void_star &output_items) { - Gnss_Synchro *out = reinterpret_cast(output_items[0]); - const Gnss_Synchro *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); + const auto *in = reinterpret_cast(input_items[0]); out[0] = in[0]; if ((current_T_rx_ms % report_interval_ms) == 0) { diff --git a/src/algorithms/signal_source/libs/fpga_switch.cc b/src/algorithms/signal_source/libs/fpga_switch.cc index ab6c58e77..6a4e39dc4 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.cc +++ b/src/algorithms/signal_source/libs/fpga_switch.cc @@ -108,7 +108,7 @@ unsigned fpga_switch::fpga_switch_test_register( void fpga_switch::close_device() { - unsigned *aux = const_cast(d_map_base); + auto *aux = const_cast(d_map_base); if (munmap(static_cast(aux), PAGE_SIZE) == -1) { std::cout << "Failed to unmap memory uio" << std::endl; diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index 68e510381..0c9526116 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -136,9 +136,9 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( //################# PRE-COMPUTE ALL THE CODES ################# unsigned int code_samples_per_chip = 1; - unsigned int code_length_chips = static_cast(Galileo_E5a_CODE_LENGTH_CHIPS); + auto code_length_chips = static_cast(Galileo_E5a_CODE_LENGTH_CHIPS); - gr_complex *aux_code = static_cast(volk_gnsssdr_malloc(sizeof(gr_complex) * code_length_chips * code_samples_per_chip, volk_gnsssdr_get_alignment())); + auto *aux_code = static_cast(volk_gnsssdr_malloc(sizeof(gr_complex) * code_length_chips * code_samples_per_chip, volk_gnsssdr_get_alignment())); float *tracking_code; float *data_code; diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index a79f5603d..8eeeec3bc 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -125,7 +125,7 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( //d_tracking_code = static_cast(volk_gnsssdr_malloc(2 * static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment())); d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * NUM_PRNs * sizeof(int), volk_gnsssdr_get_alignment())); - float* ca_codes_f = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment())); + auto* ca_codes_f = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment())); //################# PRE-COMPUTE ALL THE CODES ################# d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int), volk_gnsssdr_get_alignment())); @@ -168,8 +168,7 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( GpsL2MDllPllTrackingFpga::~GpsL2MDllPllTrackingFpga() -{ -} += default; void GpsL2MDllPllTrackingFpga::start_tracking() diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index cfb75786a..76631abd8 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -136,7 +136,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( //################# PRE-COMPUTE ALL THE CODES ################# unsigned int code_samples_per_chip = 1; - unsigned int code_length_chips = static_cast(GPS_L5i_CODE_LENGTH_CHIPS); + auto code_length_chips = static_cast(GPS_L5i_CODE_LENGTH_CHIPS); //printf("TRK code_length_chips = %d\n", code_length_chips); float *tracking_code; diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index 418dde9de..b683e6a15 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -103,7 +103,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & if (trk_parameters.system == 'G') { systemName = "GPS"; - if (signal_type.compare("1C") == 0) + if (signal_type == "1C") { d_signal_carrier_freq = GPS_L1_FREQ_HZ; d_code_period = GPS_L1_CA_CODE_PERIOD; @@ -124,11 +124,11 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & // preamble bits to sampled symbols d_gps_l1ca_preambles_symbols = static_cast(volk_gnsssdr_malloc(GPS_CA_PREAMBLE_LENGTH_SYMBOLS * sizeof(int32_t), volk_gnsssdr_get_alignment())); int32_t n = 0; - for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++) + for (unsigned short preambles_bit : preambles_bits) { for (uint32_t j = 0; j < GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; j++) { - if (preambles_bits[i] == 1) + if (preambles_bit == 1) { d_gps_l1ca_preambles_symbols[n] = 1; } @@ -142,7 +142,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_symbol_history.resize(GPS_CA_PREAMBLE_LENGTH_SYMBOLS); // Change fixed buffer size d_symbol_history.clear(); // Clear all the elements in the buffer } - else if (signal_type.compare("2S") == 0) + else if (signal_type == "2S") { d_signal_carrier_freq = GPS_L2_FREQ_HZ; d_code_period = GPS_L2_M_PERIOD; @@ -156,7 +156,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & trk_parameters.track_pilot = false; interchange_iq = false; } - else if (signal_type.compare("L5") == 0) + else if (signal_type == "L5") { d_signal_carrier_freq = GPS_L5_FREQ_HZ; d_code_period = GPS_L5i_PERIOD; @@ -199,7 +199,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & else if (trk_parameters.system == 'E') { systemName = "Galileo"; - if (signal_type.compare("1B") == 0) + if (signal_type == "1B") { d_signal_carrier_freq = Galileo_E1_FREQ_HZ; d_code_period = Galileo_E1_CODE_PERIOD; @@ -223,7 +223,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & } interchange_iq = false; // Note that E1-B and E1-C are in anti-phase, NOT IN QUADRATURE. See Galileo ICD. } - else if (signal_type.compare("5X") == 0) + else if (signal_type == "5X") { d_signal_carrier_freq = Galileo_E5a_FREQ_HZ; d_code_period = GALILEO_E5a_CODE_PERIOD; @@ -428,10 +428,10 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & { d_dump_filename = trk_parameters.dump_filename; std::string dump_path; - if (d_dump_filename.find_last_of("/") != std::string::npos) + if (d_dump_filename.find_last_of('/') != std::string::npos) { - std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of("/") + 1); - dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of("/")); + std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1); + dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/')); d_dump_filename = dump_filename_; } else @@ -443,9 +443,9 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_dump_filename = "trk_channel_"; } // remove extension if any - if (d_dump_filename.substr(1).find_last_of(".") != std::string::npos) + if (d_dump_filename.substr(1).find_last_of('.') != std::string::npos) { - d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of(".")); + d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of('.')); } d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename; @@ -501,15 +501,15 @@ void dll_pll_veml_tracking_fpga::start_tracking() d_carrier_loop_filter.initialize(); // initialize the carrier filter d_code_loop_filter.initialize(); // initialize the code filter - if (systemName.compare("GPS") == 0 and signal_type.compare("1C") == 0) + if (systemName == "GPS" and signal_type == "1C") { // nothing to compute : the local codes are pre-computed in the adapter class } - else if (systemName.compare("GPS") == 0 and signal_type.compare("2S") == 0) + else if (systemName == "GPS" and signal_type == "2S") { // nothing to compute : the local codes are pre-computed in the adapter class } - else if (systemName.compare("GPS") == 0 and signal_type.compare("L5") == 0) + else if (systemName == "GPS" and signal_type == "L5") { if (trk_parameters.track_pilot) { @@ -520,7 +520,7 @@ void dll_pll_veml_tracking_fpga::start_tracking() // nothing to compute : the local codes are pre-computed in the adapter class } } - else if (systemName.compare("Galileo") == 0 and signal_type.compare("1B") == 0) + else if (systemName == "Galileo" and signal_type == "1B") { if (trk_parameters.track_pilot) { @@ -533,7 +533,7 @@ void dll_pll_veml_tracking_fpga::start_tracking() // nothing to compute : the local codes are pre-computed in the adapter class } } - else if (systemName.compare("Galileo") == 0 and signal_type.compare("5X") == 0) + else if (systemName == "Galileo" and signal_type == "5X") { if (trk_parameters.track_pilot) { @@ -604,7 +604,7 @@ void dll_pll_veml_tracking_fpga::start_tracking() dll_pll_veml_tracking_fpga::~dll_pll_veml_tracking_fpga() { - if (signal_type.compare("1C") == 0) + if (signal_type == "1C") { volk_gnsssdr_free(d_gps_l1ca_preambles_symbols); } @@ -1025,26 +1025,26 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile() { return 1; } - float *abs_VE = new float[num_epoch]; - float *abs_E = new float[num_epoch]; - float *abs_P = new float[num_epoch]; - float *abs_L = new float[num_epoch]; - float *abs_VL = new float[num_epoch]; - float *Prompt_I = new float[num_epoch]; - float *Prompt_Q = new float[num_epoch]; - uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; - float *acc_carrier_phase_rad = new float[num_epoch]; - float *carrier_doppler_hz = new float[num_epoch]; - float *code_freq_chips = new float[num_epoch]; - float *carr_error_hz = new float[num_epoch]; - float *carr_error_filt_hz = new float[num_epoch]; - float *code_error_chips = new float[num_epoch]; - float *code_error_filt_chips = new float[num_epoch]; - float *CN0_SNV_dB_Hz = new float[num_epoch]; - float *carrier_lock_test = new float[num_epoch]; - float *aux1 = new float[num_epoch]; - double *aux2 = new double[num_epoch]; - uint32_t *PRN = new uint32_t[num_epoch]; + auto *abs_VE = new float[num_epoch]; + auto *abs_E = new float[num_epoch]; + auto *abs_P = new float[num_epoch]; + auto *abs_L = new float[num_epoch]; + auto *abs_VL = new float[num_epoch]; + auto *Prompt_I = new float[num_epoch]; + auto *Prompt_Q = new float[num_epoch]; + auto *PRN_start_sample_count = new uint64_t[num_epoch]; + auto *acc_carrier_phase_rad = new float[num_epoch]; + auto *carrier_doppler_hz = new float[num_epoch]; + auto *code_freq_chips = new float[num_epoch]; + auto *carr_error_hz = new float[num_epoch]; + auto *carr_error_filt_hz = new float[num_epoch]; + auto *code_error_chips = new float[num_epoch]; + auto *code_error_filt_chips = new float[num_epoch]; + auto *CN0_SNV_dB_Hz = new float[num_epoch]; + auto *carrier_lock_test = new float[num_epoch]; + auto *aux1 = new float[num_epoch]; + auto *aux2 = new double[num_epoch]; + auto *PRN = new uint32_t[num_epoch]; try { @@ -1108,8 +1108,8 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile() std::string filename = dump_filename_; filename.erase(filename.length() - 4, 4); filename.append(".mat"); - matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); + if (reinterpret_cast(matfp) != nullptr) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0); @@ -1264,7 +1264,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un { gr::thread::scoped_lock l(d_setlock); // Block input data and block output stream pointers - Gnss_Synchro **out = reinterpret_cast(&output_items[0]); + auto **out = reinterpret_cast(&output_items[0]); // GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder Gnss_Synchro current_synchro_data = Gnss_Synchro(); @@ -1297,7 +1297,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un //printf("333333 d_correlation_length_samples = %d\n", d_correlation_length_samples); uint32_t num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples - current_synchro_data.Acq_delay_samples) / d_correlation_length_samples); //printf("333333 num_frames = %d\n", num_frames); - uint64_t absolute_samples_offset = static_cast(current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples + num_frames * d_correlation_length_samples); + auto absolute_samples_offset = static_cast(current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples + num_frames * d_correlation_length_samples); //printf("333333 absolute_samples_offset = %llu\n", absolute_samples_offset); multicorrelator_fpga->set_initial_sample(absolute_samples_offset); d_absolute_samples_offset = absolute_samples_offset; diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.cc b/src/algorithms/tracking/libs/fpga_multicorrelator.cc index 38118dff2..069e37bfa 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.cc +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.cc @@ -41,20 +41,20 @@ #include // libraries used by DMA test code and GIPO test code -#include +#include +#include #include -#include #include // libraries used by DMA test code -#include -#include +#include +#include #include #include // libraries used by GPIO test code -#include -#include +#include +#include #include // logging @@ -345,7 +345,7 @@ void fpga_multicorrelator_8sc::set_channel(uint32_t channel) // std::cout << "deviceio" << device_io_name << " opened successfully" << std::endl; // // } - d_map_base = reinterpret_cast(mmap(NULL, PAGE_SIZE, + d_map_base = reinterpret_cast(mmap(nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0)); if (d_map_base == reinterpret_cast(-1)) @@ -709,7 +709,7 @@ void fpga_multicorrelator_8sc::unlock_channel(void) void fpga_multicorrelator_8sc::close_device() { - uint32_t *aux = const_cast(d_map_base); + auto *aux = const_cast(d_map_base); if (munmap(static_cast(aux), PAGE_SIZE) == -1) { printf("Failed to unmap memory uio\n"); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index 3f8cb2923..9839d7201 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -54,9 +54,9 @@ #include #include #include +#include // FPGA read input file #include #include -#include // FPGA read input file #include #ifdef GR_GREATER_38 #include @@ -151,7 +151,7 @@ void sending_thread(gr::top_block_sptr top_block, const char *file_name) // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GpsL1CADllPllTrackingTestFpga_msg_rx; -typedef boost::shared_ptr GpsL1CADllPllTrackingTestFpga_msg_rx_sptr; +using GpsL1CADllPllTrackingTestFpga_msg_rx_sptr = boost::shared_ptr; GpsL1CADllPllTrackingTestFpga_msg_rx_sptr GpsL1CADllPllTrackingTestFpga_msg_rx_make(); @@ -205,8 +205,7 @@ GpsL1CADllPllTrackingTestFpga_msg_rx::GpsL1CADllPllTrackingTestFpga_msg_rx() : g GpsL1CADllPllTrackingTestFpga_msg_rx::~GpsL1CADllPllTrackingTestFpga_msg_rx() -{ -} += default; // ########################################################### @@ -244,8 +243,7 @@ public: } ~GpsL1CADllPllTrackingTestFpga() - { - } + = default; void configure_receiver(); @@ -283,7 +281,7 @@ int GpsL1CADllPllTrackingTestFpga::generate_signal() int child_status; char *const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], - &p4[0], &p5[0], NULL}; + &p4[0], &p5[0], nullptr}; int pid; if ((pid = fork()) == -1) From 5485afd8823894e4088358090d9f6bcfc5b3c2ba Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Dec 2018 19:29:00 +0100 Subject: [PATCH 10/12] Apply fixes by clang-tidy --- .../adapters/ad9361_fpga_signal_source.cc | 3 +- .../adapters/custom_udp_signal_source.cc | 6 ++-- .../adapters/fmcomms2_signal_source.cc | 5 ++-- .../adapters/osmosdr_signal_source.cc | 10 +++---- .../adapters/plutosdr_signal_source.cc | 8 +++--- .../gr_complex_ip_packet_source.cc | 28 +++++++++---------- .../signal_source/libs/ad9361_manager.cc | 16 +++++------ 7 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index 83c8d85ff..b40598eeb 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -38,6 +38,7 @@ #include #include #include // for cout, endl +#include #ifdef __APPLE__ #include @@ -47,7 +48,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/signal_source.dat"; diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc index 0be972168..dcb91aac4 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -36,6 +36,7 @@ #include #include #include +#include using google::LogMessage; @@ -43,7 +44,7 @@ using google::LogMessage; CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { // DUMP PARAMETERS std::string empty = ""; @@ -113,8 +114,7 @@ CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configurati CustomUDPSignalSource::~CustomUDPSignalSource() -{ -} += default; void CustomUDPSignalSource::connect(gr::top_block_sptr top_block) diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc index 6256e330f..789c638a1 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -38,13 +38,14 @@ #include #include #include +#include using google::LogMessage; Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/signal_source.dat"; @@ -85,7 +86,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration std::cout << "LO frequency : " << freq_ << " Hz" << std::endl; std::cout << "sample rate: " << sample_rate_ << " Hz" << std::endl; - if (item_type_.compare("gr_complex") == 0) + if (item_type_ == "gr_complex") { if (RF_channels_ == 1) { diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index 71c5eb690..f68b0636e 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -37,6 +37,7 @@ #include #include #include +#include using google::LogMessage; @@ -44,7 +45,7 @@ using google::LogMessage; OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { // DUMP PARAMETERS std::string empty = ""; @@ -66,11 +67,11 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, osmosdr_args_ = configuration->property(role + ".osmosdr_args", std::string()); antenna_ = configuration->property(role + ".antenna", empty); - if (item_type_.compare("short") == 0) + if (item_type_ == "short") { item_size_ = sizeof(short); } - else if (item_type_.compare("gr_complex") == 0) + else if (item_type_ == "gr_complex") { item_size_ = sizeof(gr_complex); // 1. Make the driver instance @@ -158,8 +159,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, OsmosdrSignalSource::~OsmosdrSignalSource() -{ -} += default; void OsmosdrSignalSource::driver_instance() diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc index def81d2c7..b22756a55 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -34,6 +34,7 @@ #include "gnss_sdr_valve.h" #include #include +#include using google::LogMessage; @@ -41,7 +42,7 @@ using google::LogMessage; PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/signal_source.dat"; @@ -63,7 +64,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration dump_ = configuration->property(role + ".dump", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); - if (item_type_.compare("gr_complex") != 0) + if (item_type_ != "gr_complex") { std::cout << "Configuration error: item_type must be gr_complex" << std::endl; LOG(FATAL) << "Configuration error: item_type must be gr_complex!"; @@ -106,8 +107,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration PlutosdrSignalSource::~PlutosdrSignalSource() -{ -} += default; void PlutosdrSignalSource::connect(gr::top_block_sptr top_block) diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc index 034d2b488..a40a3a9bf 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -113,12 +113,12 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device, std::cout << "Start Ethernet packet capture\n"; d_n_baseband_channels = n_baseband_channels; - if (wire_sample_type.compare("cbyte") == 0) + if (wire_sample_type == "cbyte") { d_wire_sample_type = 1; d_bytes_per_sample = d_n_baseband_channels * 2; } - else if (wire_sample_type.compare("c4bits") == 0) + else if (wire_sample_type == "c4bits") { d_wire_sample_type = 2; d_bytes_per_sample = d_n_baseband_channels; @@ -142,8 +142,8 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device, d_item_size = item_size; d_IQ_swap = IQ_swap_; d_sock_raw = 0; - d_pcap_thread = NULL; - descr = NULL; + d_pcap_thread = nullptr; + descr = nullptr; memset(reinterpret_cast(&si_me), 0, sizeof(si_me)); } @@ -171,7 +171,7 @@ bool gr_complex_ip_packet_source::start() bool gr_complex_ip_packet_source::stop() { std::cout << "gr_complex_ip_packet_source STOP\n"; - if (descr != NULL) + if (descr != nullptr) { pcap_breakloop(descr); d_pcap_thread->join(); @@ -187,7 +187,7 @@ bool gr_complex_ip_packet_source::open() boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function // open device for reading descr = pcap_open_live(d_src_device.c_str(), 1500, 1, 1000, errbuf); - if (descr == NULL) + if (descr == nullptr) { std::cout << "Error opening Ethernet device " << d_src_device << std::endl; std::cout << "Fatal Error in pcap_open_live(): " << std::string(errbuf) << std::endl; @@ -220,7 +220,7 @@ bool gr_complex_ip_packet_source::open() gr_complex_ip_packet_source::~gr_complex_ip_packet_source() { - if (d_pcap_thread != NULL) + if (d_pcap_thread != nullptr) { delete d_pcap_thread; } @@ -232,7 +232,7 @@ gr_complex_ip_packet_source::~gr_complex_ip_packet_source() void gr_complex_ip_packet_source::static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet) { - gr_complex_ip_packet_source *bridge = reinterpret_cast(args); + auto *bridge = reinterpret_cast(args); bridge->pcap_callback(args, pkthdr, packet); } @@ -327,22 +327,22 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items switch (d_wire_sample_type) { case 1: // interleaved byte samples - for (long unsigned int i = 0; i < output_items.size(); i++) + for (auto & output_item : output_items) { real = fifo_buff[fifo_read_ptr++]; imag = fifo_buff[fifo_read_ptr++]; if (d_IQ_swap) { - static_cast(output_items[i])[n] = gr_complex(real, imag); + static_cast(output_item)[n] = gr_complex(real, imag); } else { - static_cast(output_items[i])[n] = gr_complex(imag, real); + static_cast(output_item)[n] = gr_complex(imag, real); } } break; case 2: // 4-bit samples - for (long unsigned int i = 0; i < output_items.size(); i++) + for (auto & output_item : output_items) { tmp_char2 = fifo_buff[fifo_read_ptr] & 0x0F; if (tmp_char2 >= 8) @@ -365,11 +365,11 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items } if (d_IQ_swap) { - static_cast(output_items[i])[n] = gr_complex(imag, real); + static_cast(output_item)[n] = gr_complex(imag, real); } else { - static_cast(output_items[i])[n] = gr_complex(real, imag); + static_cast(output_item)[n] = gr_complex(real, imag); } } break; diff --git a/src/algorithms/signal_source/libs/ad9361_manager.cc b/src/algorithms/signal_source/libs/ad9361_manager.cc index 7c9c9f3c9..6de1b0aa9 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.cc +++ b/src/algorithms/signal_source/libs/ad9361_manager.cc @@ -75,10 +75,10 @@ bool get_ad9361_stream_dev(struct iio_context *ctx, enum iodev d, struct iio_dev { case TX: *dev = iio_context_find_device(ctx, "cf-ad9361-dds-core-lpc"); - return *dev != NULL; + return *dev != nullptr; case RX: *dev = iio_context_find_device(ctx, "cf-ad9361-lpc"); - return *dev != NULL; + return *dev != nullptr; default: return false; } @@ -100,7 +100,7 @@ bool get_ad9361_stream_ch(struct iio_context *ctx __attribute__((unused)), enum name << chid; *chn = iio_device_find_channel(dev, name.str().c_str(), d == TX); } - return *chn != NULL; + return *chn != nullptr; } @@ -115,14 +115,14 @@ bool get_phy_chan(struct iio_context *ctx, enum iodev d, int chid, struct iio_ch name << "voltage"; name << chid; *chn = iio_device_find_channel(get_ad9361_phy(ctx), name.str().c_str(), false); - return *chn != NULL; + return *chn != nullptr; break; case TX: name.str(""); name << "voltage"; name << chid; *chn = iio_device_find_channel(get_ad9361_phy(ctx), name.str().c_str(), true); - return *chn != NULL; + return *chn != nullptr; break; default: return false; @@ -138,10 +138,10 @@ bool get_lo_chan(struct iio_context *ctx, enum iodev d, struct iio_channel **chn // LO chan is always output, i.e. true case RX: *chn = iio_device_find_channel(get_ad9361_phy(ctx), "altvoltage0", true); - return *chn != NULL; + return *chn != nullptr; case TX: *chn = iio_device_find_channel(get_ad9361_phy(ctx), "altvoltage1", true); - return *chn != NULL; + return *chn != nullptr; default: return false; } @@ -151,7 +151,7 @@ bool get_lo_chan(struct iio_context *ctx, enum iodev d, struct iio_channel **chn /* applies streaming configuration through IIO */ bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, enum iodev type, int chid) { - struct iio_channel *chn = NULL; + struct iio_channel *chn = nullptr; // Configure phy and lo channels //LOG(INFO)<<"* Acquiring AD9361 phy channel"< Date: Mon, 10 Dec 2018 22:59:10 +0100 Subject: [PATCH 11/12] Apply fixes by clang-tidy --- .clang-format | 4 ++-- .clang-tidy | 2 +- .../gnuradio_blocks/pcps_acquisition_fpga.cc | 7 ++++--- .../acquisition/libs/fpga_acquisition.cc | 3 ++- .../adapters/ad9361_fpga_signal_source.cc | 2 +- .../adapters/ad9361_fpga_signal_source.h | 2 +- .../adapters/custom_udp_signal_source.cc | 2 +- .../adapters/custom_udp_signal_source.h | 2 +- .../adapters/fmcomms2_signal_source.cc | 2 +- .../adapters/fmcomms2_signal_source.h | 2 +- .../adapters/osmosdr_signal_source.cc | 2 +- .../adapters/osmosdr_signal_source.h | 2 +- .../adapters/plutosdr_signal_source.cc | 2 +- .../adapters/plutosdr_signal_source.h | 2 +- .../gr_complex_ip_packet_source.cc | 13 +++++++------ .../gr_complex_ip_packet_source.h | 8 ++++---- .../signal_source/libs/ad9361_manager.cc | 18 +++++++++--------- .../signal_source/libs/ad9361_manager.h | 18 +++++++++--------- .../signal_source/libs/fpga_switch.cc | 2 +- .../signal_source/libs/fpga_switch.h | 2 +- .../galileo_e1_dll_pll_veml_tracking_fpga.cc | 2 +- .../galileo_e1_dll_pll_veml_tracking_fpga.h | 2 +- .../galileo_e5a_dll_pll_tracking_fpga.cc | 2 +- .../galileo_e5a_dll_pll_tracking_fpga.h | 2 +- .../gps_l1_ca_dll_pll_tracking_fpga.cc | 2 +- .../adapters/gps_l1_ca_dll_pll_tracking_fpga.h | 2 +- .../adapters/gps_l2_m_dll_pll_tracking_fpga.cc | 2 +- .../adapters/gps_l2_m_dll_pll_tracking_fpga.h | 2 +- .../adapters/gps_l5_dll_pll_tracking_fpga.cc | 2 +- .../adapters/gps_l5_dll_pll_tracking_fpga.h | 2 +- .../tracking/libs/fpga_multicorrelator.cc | 3 ++- src/core/libs/gnss_sdr_supl_client.cc | 2 +- src/core/receiver/control_thread.cc | 5 +++-- src/core/receiver/control_thread.h | 2 +- src/core/receiver/gnss_flowgraph.cc | 5 +++-- src/core/receiver/gnss_flowgraph.h | 2 +- src/tests/system-tests/position_test.cc | 2 +- .../observables/hybrid_observables_test.cc | 8 ++++---- .../gps_l1_ca_dll_pll_tracking_test_fpga.cc | 13 ++++++------- src/utils/rinex2assist/main.cc | 2 +- 40 files changed, 83 insertions(+), 78 deletions(-) diff --git a/.clang-format b/.clang-format index d917fcd0b..7ab3cb079 100644 --- a/.clang-format +++ b/.clang-format @@ -51,9 +51,9 @@ IncludeBlocks: Merge IncludeCategories: - Regex: '^.*.h"' Priority: 1 - - Regex: '^.*(boost|gflags|glog|gtest|gnsssdr|gnuradio|pmt|uhd|volk)/' + - Regex: '^.*(boost|gflags|glog|gnsssdr|gpstk|gtest|gnuradio|pmt|uhd|volk)/' Priority: 2 - - Regex: '^.*(armadillo|matio)' + - Regex: '^.*(armadillo|matio|pugixml)' Priority: 2 - Regex: '.*' Priority: 3 diff --git a/.clang-tidy b/.clang-tidy index 5eb3cab9e..79a8beaa6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,3 +1,3 @@ --- -Checks: '-*,boost-use-to-string,cert-dcl21-cpp,cert-dcl58-cpp,cert-env33-c,cert-err52-cpp,cert-err60-cpp,cert-flp30-c,clang-analyzer-cplusplus*,cppcoreguidelines-pro-type-static-cast-downcast,cppcoreguidelines-slicing,google-build-namespaces,google-runtime-int,google-runtime-references,llvm-header-guard,misc-misplaced-const,misc-new-delete-overloads,misc-non-copyable-objects,misc-static-assert,misc-throw-by-value-catch-by-reference,misc-uniqueptr-reset-release,modernize-deprecated-headers,modernize-loop-convert,modernize-pass-by-value,modernize-raw-string-literal,modernize-use-auto,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-noexcept,modernize-use-nullptr,modernize-use-using,performance-faster-string-find,performance-move-const-arg,readability-named-parameter,readability-string-compare' +Checks: '-*,boost-use-to-string,cert-dcl21-cpp,cert-dcl58-cpp,cert-env33-c,cert-err52-cpp,cert-err60-cpp,cert-flp30-c,clang-analyzer-cplusplus*,cppcoreguidelines-pro-type-static-cast-downcast,cppcoreguidelines-slicing,google-build-namespaces,google-runtime-int,google-runtime-references,llvm-header-guard,misc-misplaced-const,misc-new-delete-overloads,misc-non-copyable-objects,misc-static-assert,misc-throw-by-value-catch-by-reference,misc-uniqueptr-reset-release,modernize-deprecated-headers,modernize-loop-convert,modernize-pass-by-value,modernize-raw-string-literal,modernize-use-auto,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-noexcept,modernize-use-nullptr,modernize-use-using,performance-faster-string-find,performance-move-const-arg,performance-type-promotion-in-math-fn,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,readability-named-parameter,readability-string-compare' HeaderFilterRegex: '.*' diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index df677dea5..ffb4d2452 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -42,6 +42,7 @@ #include "pcps_acquisition_fpga.h" #include #include +#include #define AQ_DOWNSAMPLING_DELAY 40 // delay due to the downsampling filter in the acquisition @@ -50,7 +51,7 @@ using google::LogMessage; pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_) { - return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(conf_)); + return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(std::move(conf_))); } @@ -61,7 +62,7 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) : gr::block( // printf("acq constructor start\n"); this->message_port_register_out(pmt::mp("events")); - acq_parameters = conf_; + acq_parameters = std::move(conf_); d_sample_counter = 0ULL; // SAMPLE COUNTER d_active = false; d_state = 0; @@ -256,7 +257,7 @@ void pcps_acquisition_fpga::set_active(bool active) d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; - d_test_statistics = (d_mag / d_input_power); //* correction_factor; + d_test_statistics = (d_mag / d_input_power); // correction_factor; } // In the case of the FPGA the option of dumping the results of the acquisition to a file is not available diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.cc b/src/algorithms/acquisition/libs/fpga_acquisition.cc index ed0c2c4a9..5618d072b 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.cc +++ b/src/algorithms/acquisition/libs/fpga_acquisition.cc @@ -40,6 +40,7 @@ #include // libraries used by the GIPO #include #include // libraries used by the GIPO +#include #define PAGE_SIZE 0x10000 // default page size for the multicorrelator memory map @@ -102,7 +103,7 @@ fpga_acquisition::fpga_acquisition(std::string device_name, //printf("AAA- vector_length = %d\n ", vector_length); // initial values - d_device_name = device_name; + d_device_name = std::move(device_name); //d_freq = freq; d_fs_in = fs_in; d_vector_length = vector_length; diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index b40598eeb..a9cade7c5 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -47,7 +47,7 @@ #endif Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_item_type = "gr_complex"; diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h index 0f1287664..79ebeff3e 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -45,7 +45,7 @@ class Ad9361FpgaSignalSource : public GNSSBlockInterface { public: Ad9361FpgaSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue); ~Ad9361FpgaSignalSource(); diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc index dcb91aac4..c94859709 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -43,7 +43,7 @@ using google::LogMessage; CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { // DUMP PARAMETERS diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h index 325f4ab6d..bec7c3d73 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h @@ -54,7 +54,7 @@ class CustomUDPSignalSource : public GNSSBlockInterface { public: CustomUDPSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue); virtual ~CustomUDPSignalSource(); diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc index 789c638a1..8f3f5fa82 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -44,7 +44,7 @@ using google::LogMessage; Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_item_type = "gr_complex"; diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h index 2601d155f..820ce1a14 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h @@ -46,7 +46,7 @@ class Fmcomms2SignalSource : public GNSSBlockInterface { public: Fmcomms2SignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue); virtual ~Fmcomms2SignalSource(); diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index f68b0636e..1aab48cff 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -44,7 +44,7 @@ using google::LogMessage; OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { // DUMP PARAMETERS diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h index 04a60dd50..7a820f8fd 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h @@ -52,7 +52,7 @@ class OsmosdrSignalSource : public GNSSBlockInterface { public: OsmosdrSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue); virtual ~OsmosdrSignalSource(); diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc index b22756a55..6465b72bd 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -41,7 +41,7 @@ using google::LogMessage; PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_item_type = "gr_complex"; diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h index 178604257..4cedb3787 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h @@ -48,7 +48,7 @@ class PlutosdrSignalSource : public GNSSBlockInterface { public: PlutosdrSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, + const std::string& role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue); virtual ~PlutosdrSignalSource(); diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc index a40a3a9bf..c741dc19a 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -32,6 +32,7 @@ #include "gr_complex_ip_packet_source.h" #include +#include const int FIFO_SIZE = 1472000; @@ -76,15 +77,15 @@ typedef struct gr_udp_header gr_complex_ip_packet_source::sptr gr_complex_ip_packet_source::make(std::string src_device, - std::string origin_address, + const std::string& origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - std::string wire_sample_type, + const std::string& wire_sample_type, size_t item_size, bool IQ_swap_) { - return gnuradio::get_initial_sptr(new gr_complex_ip_packet_source(src_device, + return gnuradio::get_initial_sptr(new gr_complex_ip_packet_source(std::move(src_device), origin_address, udp_port, udp_packet_size, @@ -99,11 +100,11 @@ gr_complex_ip_packet_source::make(std::string src_device, * The private constructor */ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device, - __attribute__((unused)) std::string origin_address, + __attribute__((unused)) const std::string& origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - std::string wire_sample_type, + const std::string& wire_sample_type, size_t item_size, bool IQ_swap_) : gr::sync_block("gr_complex_ip_packet_source", @@ -129,7 +130,7 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device, exit(0); } std::cout << "d_wire_sample_type:" << d_wire_sample_type << std::endl; - d_src_device = src_device; + d_src_device = std::move(src_device); d_udp_port = udp_port; d_udp_payload_size = udp_packet_size; d_fifo_full = false; diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h index 345399730..2417534f7 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h @@ -84,19 +84,19 @@ private: public: typedef boost::shared_ptr sptr; static sptr make(std::string src_device, - std::string origin_address, + const std::string& origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - std::string wire_sample_type, + const std::string& wire_sample_type, size_t item_size, bool IQ_swap_); gr_complex_ip_packet_source(std::string src_device, - std::string origin_address, + const std::string& origin_address, int udp_port, int udp_packet_size, int n_baseband_channels, - std::string wire_sample_type, + const std::string& wire_sample_type, size_t item_size, bool IQ_swap_); ~gr_complex_ip_packet_source(); diff --git a/src/algorithms/signal_source/libs/ad9361_manager.cc b/src/algorithms/signal_source/libs/ad9361_manager.cc index 6de1b0aa9..e4d4b6db0 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.cc +++ b/src/algorithms/signal_source/libs/ad9361_manager.cc @@ -179,9 +179,9 @@ bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, en bool config_ad9361_rx_local(uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_, - std::string rf_port_select_, - std::string gain_mode_rx1_, - std::string gain_mode_rx2_, + const std::string& rf_port_select_, + const std::string& gain_mode_rx1_, + const std::string& gain_mode_rx2_, double rf_gain_rx1_, double rf_gain_rx2_) @@ -291,13 +291,13 @@ bool config_ad9361_rx_local(uint64_t bandwidth_, } -bool config_ad9361_rx_remote(std::string remote_host, +bool config_ad9361_rx_remote(const std::string& remote_host, uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_, - std::string rf_port_select_, - std::string gain_mode_rx1_, - std::string gain_mode_rx2_, + const std::string& rf_port_select_, + const std::string& gain_mode_rx1_, + const std::string& gain_mode_rx2_, double rf_gain_rx1_, double rf_gain_rx2_) { @@ -543,7 +543,7 @@ bool config_ad9361_lo_local(uint64_t bandwidth_, } -bool config_ad9361_lo_remote(std::string remote_host, +bool config_ad9361_lo_remote(const std::string& remote_host, uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_rf_tx_hz_, @@ -680,7 +680,7 @@ bool config_ad9361_lo_remote(std::string remote_host, } -bool ad9361_disable_lo_remote(std::string remote_host) +bool ad9361_disable_lo_remote(const std::string& remote_host) { std::cout << "AD9361 Acquiring IIO REMOTE context in host " << remote_host << std::endl; struct iio_context *ctx; diff --git a/src/algorithms/signal_source/libs/ad9361_manager.h b/src/algorithms/signal_source/libs/ad9361_manager.h index 875b724c0..ca34f375d 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.h +++ b/src/algorithms/signal_source/libs/ad9361_manager.h @@ -92,19 +92,19 @@ bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, en bool config_ad9361_rx_local(uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_, - std::string rf_port_select_, - std::string gain_mode_rx1_, - std::string gain_mode_rx2_, + const std::string& rf_port_select_, + const std::string& gain_mode_rx1_, + const std::string& gain_mode_rx2_, double rf_gain_rx1_, double rf_gain_rx2_); -bool config_ad9361_rx_remote(std::string remote_host, +bool config_ad9361_rx_remote(const std::string& remote_host, uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_, - std::string rf_port_select_, - std::string gain_mode_rx1_, - std::string gain_mode_rx2_, + const std::string& rf_port_select_, + const std::string& gain_mode_rx1_, + const std::string& gain_mode_rx2_, double rf_gain_rx1_, double rf_gain_rx2_); @@ -115,7 +115,7 @@ bool config_ad9361_lo_local(uint64_t bandwidth_, int64_t freq_dds_tx_hz_, double scale_dds_dbfs_); -bool config_ad9361_lo_remote(std::string remote_host, +bool config_ad9361_lo_remote(const std::string& remote_host, uint64_t bandwidth_, uint64_t sample_rate_, uint64_t freq_rf_tx_hz_, @@ -124,7 +124,7 @@ bool config_ad9361_lo_remote(std::string remote_host, double scale_dds_dbfs_); -bool ad9361_disable_lo_remote(std::string remote_host); +bool ad9361_disable_lo_remote(const std::string& remote_host); bool ad9361_disable_lo_local(); diff --git a/src/algorithms/signal_source/libs/fpga_switch.cc b/src/algorithms/signal_source/libs/fpga_switch.cc index 6a4e39dc4..d387831b1 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.cc +++ b/src/algorithms/signal_source/libs/fpga_switch.cc @@ -45,7 +45,7 @@ const size_t PAGE_SIZE = 0x10000; const unsigned int TEST_REGISTER_TRACK_WRITEVAL = 0x55AA; -fpga_switch::fpga_switch(std::string device_name) +fpga_switch::fpga_switch(const std::string& device_name) { if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) { diff --git a/src/algorithms/signal_source/libs/fpga_switch.h b/src/algorithms/signal_source/libs/fpga_switch.h index f4a755775..ce3dff3ad 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.h +++ b/src/algorithms/signal_source/libs/fpga_switch.h @@ -44,7 +44,7 @@ class fpga_switch { public: - fpga_switch(std::string device_name); + fpga_switch(const std::string& device_name); ~fpga_switch(); void set_switch_position(int switch_position); diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc index 355c0af21..31d2cbfff 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc @@ -51,7 +51,7 @@ void GalileoE1DllPllVemlTrackingFpga::stop_tracking() } GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( - ConfigurationInterface* configuration, std::string role, + ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { //dllpllconf_t trk_param; diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h index d996cae0a..794aa22d4 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h @@ -52,7 +52,7 @@ class GalileoE1DllPllVemlTrackingFpga : public TrackingInterface { public: GalileoE1DllPllVemlTrackingFpga(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index 0c9526116..cda20226f 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -51,7 +51,7 @@ void GalileoE5aDllPllTrackingFpga::stop_tracking() } GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( - ConfigurationInterface *configuration, std::string role, + ConfigurationInterface *configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { //printf("creating the E5A tracking"); diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h index 5edb90727..49c52de5e 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h @@ -52,7 +52,7 @@ class GalileoE5aDllPllTrackingFpga : public TrackingInterface { public: GalileoE5aDllPllTrackingFpga(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index 2434e82a4..e81e7a905 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -53,7 +53,7 @@ void GpsL1CaDllPllTrackingFpga::stop_tracking() } GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( - ConfigurationInterface* configuration, std::string role, + ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { Dll_Pll_Conf_Fpga trk_param_fpga = Dll_Pll_Conf_Fpga(); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h index 5fcaa5144..5cc38f230 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h @@ -53,7 +53,7 @@ class GpsL1CaDllPllTrackingFpga : public TrackingInterface { public: GpsL1CaDllPllTrackingFpga(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index 8eeeec3bc..ff46fe945 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -52,7 +52,7 @@ void GpsL2MDllPllTrackingFpga::stop_tracking() } GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( - ConfigurationInterface* configuration, std::string role, + ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { //dllpllconf_t trk_param; diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h index 2cde19cd7..7d36d1e74 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h @@ -52,7 +52,7 @@ class GpsL2MDllPllTrackingFpga : public TrackingInterface { public: GpsL2MDllPllTrackingFpga(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index 76631abd8..615fad0fb 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -52,7 +52,7 @@ void GpsL5DllPllTrackingFpga::stop_tracking() } GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( - ConfigurationInterface *configuration, std::string role, + ConfigurationInterface *configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { //printf("L5 TRK CLASS CREATED\n"); diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h index 2c3f35ef8..087f3730c 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h @@ -50,7 +50,7 @@ class GpsL5DllPllTrackingFpga : public TrackingInterface { public: GpsL5DllPllTrackingFpga(ConfigurationInterface* configuration, - std::string role, + const std::string& role, unsigned int in_streams, unsigned int out_streams); diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.cc b/src/algorithms/tracking/libs/fpga_multicorrelator.cc index 069e37bfa..add36b0a8 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.cc +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.cc @@ -62,6 +62,7 @@ // string manipulation #include +#include // constants #include "GPS_L1_CA.h" @@ -160,7 +161,7 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int32_t n_correlators, { //printf("tracking fpga class created\n"); d_n_correlators = n_correlators; - d_device_name = device_name; + d_device_name = std::move(device_name); d_device_base = device_base; d_track_pilot = track_pilot; d_device_descriptor = 0; diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index f09b02a96..46b0b0031 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -32,8 +32,8 @@ */ #include "gnss_sdr_supl_client.h" -#include #include +#include #include gnss_sdr_supl_client::gnss_sdr_supl_client() diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index a295ba018..a9ab20e54 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -67,6 +67,7 @@ #include #include #include +#include extern concurrent_map global_gps_acq_assist_map; @@ -294,14 +295,14 @@ int ControlThread::run() } -void ControlThread::set_control_queue(gr::msg_queue::sptr control_queue) +void ControlThread::set_control_queue(const gr::msg_queue::sptr& control_queue) { if (flowgraph_->running()) { LOG(WARNING) << "Unable to set control queue while flowgraph is running"; return; } - control_queue_ = control_queue; + control_queue_ = std::move(control_queue); cmd_interface_.set_msg_queue(control_queue_); } diff --git a/src/core/receiver/control_thread.h b/src/core/receiver/control_thread.h index f44ee7963..b500e43fa 100644 --- a/src/core/receiver/control_thread.h +++ b/src/core/receiver/control_thread.h @@ -93,7 +93,7 @@ public: * * \param[in] boost::shared_ptr control_queue */ - void set_control_queue(gr::msg_queue::sptr control_queue); + void set_control_queue(const gr::msg_queue::sptr& control_queue); unsigned int processed_control_messages() diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index c10fdc53b..08d47a376 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -50,6 +50,7 @@ #include #include #include +#include #ifdef GR_GREATER_38 #include #else @@ -61,12 +62,12 @@ using google::LogMessage; -GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr configuration, gr::msg_queue::sptr queue) +GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr configuration, const gr::msg_queue::sptr& queue) { connected_ = false; running_ = false; configuration_ = configuration; - queue_ = queue; + queue_ = std::move(queue); init(); } diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 71b52dd6f..929243939 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -73,7 +73,7 @@ public: /*! * \brief Constructor that initializes the receiver flow graph */ - GNSSFlowgraph(std::shared_ptr configuration, gr::msg_queue::sptr queue); + GNSSFlowgraph(std::shared_ptr configuration, const gr::msg_queue::sptr& queue); /*! * \brief Destructor diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 202f31306..b719dba55 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -837,7 +837,7 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) { boost::filesystem::path p(gnuplot_executable); boost::filesystem::path dir = p.parent_path(); - std::string gnuplot_path = dir.native(); + const std::string& gnuplot_path = dir.native(); Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("points"); diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index 24759c828..feccb8105 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -70,15 +70,15 @@ #include #include #include -#include -#include -#include -#include #include #include #include #include #include +#include +#include +#include +#include #include #ifdef GR_GREATER_38 #include diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index 9839d7201..ffaeffc76 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -58,6 +58,7 @@ #include #include #include +#include #ifdef GR_GREATER_38 #include #else @@ -69,7 +70,7 @@ #define FIVE_SECONDS 5000000 // five seconds in microseconds void send_tracking_gps_input_samples(FILE *rx_signal_file, - int num_remaining_samples, gr::top_block_sptr top_block) + int num_remaining_samples, const gr::top_block_sptr& top_block) { int num_samples_transferred = 0; // number of samples that have been transferred to the DMA so far static int flowgraph_stopped = 0; // flag to indicate if the flowgraph is stopped already @@ -142,7 +143,7 @@ void sending_thread(gr::top_block_sptr top_block, const char *file_name) usleep(FIVE_SECONDS); // wait for some time to give time to the other thread to program the device //send_tracking_gps_input_samples(dma_descr, rx_signal_file, file_length); - send_tracking_gps_input_samples(rx_signal_file, file_length, top_block); + send_tracking_gps_input_samples(rx_signal_file, file_length, std::move(top_block)); fclose(rx_signal_file); } @@ -180,7 +181,7 @@ void GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_events(pmt::pmt_t msg) { try { - int64_t message = pmt::to_long(msg); + int64_t message = pmt::to_long(std::move(msg)); rx_message = message; } catch (boost::bad_any_cast &e) @@ -204,8 +205,7 @@ GpsL1CADllPllTrackingTestFpga_msg_rx::GpsL1CADllPllTrackingTestFpga_msg_rx() : g } -GpsL1CADllPllTrackingTestFpga_msg_rx::~GpsL1CADllPllTrackingTestFpga_msg_rx() -= default; +GpsL1CADllPllTrackingTestFpga_msg_rx::~GpsL1CADllPllTrackingTestFpga_msg_rx() = default; // ########################################################### @@ -242,8 +242,7 @@ public: gnss_synchro = Gnss_Synchro(); } - ~GpsL1CADllPllTrackingTestFpga() - = default; + ~GpsL1CADllPllTrackingTestFpga() = default; void configure_receiver(); diff --git a/src/utils/rinex2assist/main.cc b/src/utils/rinex2assist/main.cc index 6dca86d30..c26b128dc 100644 --- a/src/utils/rinex2assist/main.cc +++ b/src/utils/rinex2assist/main.cc @@ -42,10 +42,10 @@ #include #include #include -#include #include #include #include +#include #include From c9f55f24919d6023de3b2e9b4ade5f1565730a80 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Dec 2018 23:01:05 +0100 Subject: [PATCH 12/12] Apply fixes by clang-tidy --- .../tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc | 2 +- .../tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc | 3 +-- .../tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index cda20226f..1a5e1cf09 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -51,7 +51,7 @@ void GalileoE5aDllPllTrackingFpga::stop_tracking() } GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( - ConfigurationInterface *configuration, const std::string& role, + ConfigurationInterface *configuration, const std::string &role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { //printf("creating the E5A tracking"); diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index ff46fe945..c133b1ea1 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -167,8 +167,7 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( } -GpsL2MDllPllTrackingFpga::~GpsL2MDllPllTrackingFpga() -= default; +GpsL2MDllPllTrackingFpga::~GpsL2MDllPllTrackingFpga() = default; void GpsL2MDllPllTrackingFpga::start_tracking() diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index 615fad0fb..effa0c5b7 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -52,7 +52,7 @@ void GpsL5DllPllTrackingFpga::stop_tracking() } GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( - ConfigurationInterface *configuration, const std::string& role, + ConfigurationInterface *configuration, const std::string &role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { //printf("L5 TRK CLASS CREATED\n");