From c1868286693e715a1ced9524c767f169d597b980 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 31 Jan 2012 00:03:08 +0000 Subject: [PATCH] Code cleaning and documentation git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@151 64b25241-fba3-4117-9849-534c7e92360d --- src/algorithms/channel/adapters/channel.cc | 12 ++-- src/algorithms/tracking/libs/correlator.cc | 18 +++--- src/algorithms/tracking/libs/correlator.h | 6 +- src/core/system_parameters/gnss_satellite.cc | 13 +++-- src/core/system_parameters/gnss_satellite.h | 12 ++-- src/core/system_parameters/gnss_signal.cc | 18 ++++-- src/core/system_parameters/gnss_signal.h | 18 +++--- src/core/system_parameters/gnss_synchro.cc | 59 ++++++++++---------- src/core/system_parameters/gnss_synchro.h | 16 +++--- 9 files changed, 91 insertions(+), 81 deletions(-) diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index d828885c4..952018ab3 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -170,11 +170,11 @@ gr_basic_block_sptr Channel::get_right_block() void Channel::set_signal(Gnss_Signal gnss_signal) { - gnss_signal_=gnss_signal; - gnss_signal_.get_signal().copy(gnss_synchro_.Signal,2,0); - gnss_synchro_.PRN=gnss_signal_.get_satellite().get_PRN(); - gnss_synchro_.System=gnss_signal_.get_satellite().get_system_short().c_str()[0]; - acq_->init(); + gnss_signal_ = gnss_signal; + gnss_signal_.get_signal().copy(gnss_synchro_.Signal,2,0); + gnss_synchro_.PRN = gnss_signal_.get_satellite().get_PRN(); + gnss_synchro_.System = gnss_signal_.get_satellite().get_system_short().c_str()[0]; + acq_->init(); nav_->set_satellite(gnss_signal_.get_satellite()); } @@ -240,7 +240,7 @@ void Channel::process_channel_messages() case 1: LOG_AT_LEVEL(INFO) << "Channel " << channel_ - << " ACQ SUCCESS satellite " << gnss_synchro_.System << " "<< gnss_synchro_.PRN; + << " ACQ SUCCESS satellite " << gnss_synchro_.System << " " << gnss_synchro_.PRN; channel_fsm_.Event_gps_valid_acquisition(); break; diff --git a/src/algorithms/tracking/libs/correlator.cc b/src/algorithms/tracking/libs/correlator.cc index be6da500b..29a24bc31 100644 --- a/src/algorithms/tracking/libs/correlator.cc +++ b/src/algorithms/tracking/libs/correlator.cc @@ -1,5 +1,5 @@ /*! - * \file correlator.h + * \file correlator.cc * \brief Highly optimized vector correlator class * \author Javier Arribas, 2011. jarribas(at)cttc.es * @@ -55,11 +55,11 @@ void Correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const //std::cout<<"length="<volk_32fc_x2_dot_prod_32fc_a_best_arch = arch_list.at(arch_list.size() - 1); } - std::cout<<"Selected architecture for volk_32fc_x2_dot_prod_32fc_a is "<volk_32fc_x2_dot_prod_32fc_a_best_arch<volk_32fc_x2_dot_prod_32fc_a_best_arch << std::endl; } @@ -165,14 +165,14 @@ void Correlator::cpu_arch_test_volk_32fc_x2_multiply_32fc_a() for (unsigned int i=0; i < arch_list.size(); ++i) { std::cout << "Arch " << i << ":" << arch_list.at(i) << std::endl; - if (arch_list.at(i).find("sse")!=std::string::npos) + if (arch_list.at(i).find("sse") != std::string::npos) { // TODO: Make a test to find the best architecture this->volk_32fc_x2_multiply_32fc_a_best_arch = arch_list.at(i); } } } - std::cout<<"Selected architecture for volk_32fc_x2_multiply_32fc_a_best_arch is "<volk_32fc_x2_multiply_32fc_a_best_arch<volk_32fc_x2_multiply_32fc_a_best_arch << std::endl; } diff --git a/src/algorithms/tracking/libs/correlator.h b/src/algorithms/tracking/libs/correlator.h index 9ae3891d9..b1057c35b 100644 --- a/src/algorithms/tracking/libs/correlator.h +++ b/src/algorithms/tracking/libs/correlator.h @@ -39,7 +39,11 @@ /*! - * \brief High optimized vector correlator class + * \brief Class that implements carrier wipe-off and correlators. + * + * Implemented versions: + * - Generic: Standard C++ implementation. + * - Volk: uses VOLK (Vector-Optimized Library of Kernels) and uses the processor's SIMD instruction sets. See http://gnuradio.org/redmine/projects/gnuradio/wiki/Volk * */ class Correlator diff --git a/src/core/system_parameters/gnss_satellite.cc b/src/core/system_parameters/gnss_satellite.cc index 355b83f8b..1b6b2477e 100644 --- a/src/core/system_parameters/gnss_satellite.cc +++ b/src/core/system_parameters/gnss_satellite.cc @@ -63,13 +63,11 @@ Gnss_Satellite::~Gnss_Satellite() void Gnss_Satellite::reset() { system_set = {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}; - satelliteSystem["GPS"] = "G"; satelliteSystem["GLONASS"] = "R"; satelliteSystem["SBAS"] = "S"; satelliteSystem["Galileo"] = "E"; satelliteSystem["Compass"] = "C"; - PRN = 0; system = std::string(""); block = std::string(""); @@ -188,6 +186,10 @@ void Gnss_Satellite::set_PRN(unsigned int PRN_) { PRN = 11; } + else if (PRN_ == 12) + { + PRN = 12; + } else { DLOG(INFO) << "This PRN is not defined"; @@ -228,8 +230,7 @@ std::string Gnss_Satellite::get_system() const std::string Gnss_Satellite::get_system_short() const { - // Get the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"} - + // Get the satellite system {"G", "R", "S", "E", "C"} return satelliteSystem.at(system); } @@ -479,6 +480,7 @@ void Gnss_Satellite::set_block(std::string system_, unsigned int PRN_ ) break; case 120 : block = std::string("EGNOS"); // EGNOS AOR-E Broadcast satellite http://www.egnos-pro.esa.int/index.html + break; case 124 : block = std::string("EGNOS"); // EGNOS ESA ARTEMIS used for EGNOS Operations break; @@ -497,7 +499,8 @@ void Gnss_Satellite::set_block(std::string system_, unsigned int PRN_ ) block = std::string("IOV"); // PFM, the ProtoFlight Model (GSAT0101), launched from French Guiana at 10:30 GMT on October 21, 2011 break; case 12 : - block =std::string("IOV"); // Galileo In-Orbit Validation (IOV) satellite FM2 (Flight Model 2) also known as GSAT0102, launched the same day + block = std::string("IOV"); // Galileo In-Orbit Validation (IOV) satellite FM2 (Flight Model 2) also known as GSAT0102, launched the same day + break; default: block = std::string("Unknown"); } diff --git a/src/core/system_parameters/gnss_satellite.h b/src/core/system_parameters/gnss_satellite.h index 0dbce2cae..4e075f34e 100644 --- a/src/core/system_parameters/gnss_satellite.h +++ b/src/core/system_parameters/gnss_satellite.h @@ -36,6 +36,8 @@ #include #include #include + + /* * \brief This class represents a GNSS satellite. * @@ -45,15 +47,15 @@ class Gnss_Satellite { public: - Gnss_Satellite(); //!< Default Constructor. + Gnss_Satellite(); //!< Default Constructor. Gnss_Satellite(std::string system_, unsigned int PRN_); //!< Concrete GNSS satellite Constructor. - ~Gnss_Satellite(); //!< Default Destructor. + ~Gnss_Satellite(); //!< Default Destructor. unsigned int get_PRN() const; //!< Gets satellite's PRN std::string get_system() const; //!< Gets the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"} - std::string get_system_short() const; //!< Gets the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"} + std::string get_system_short() const; //!< Gets the satellite system {"G", "R", "SBAS", "E", "C"} std::string get_block() const; //!< Gets the satellite block. If GPS, returns {"IIA", "IIR", "IIR-M", "IIF"} - friend bool operator== (const Gnss_Satellite &, const Gnss_Satellite &); // operator== for comparison - friend std::ostream& operator<<(std::ostream &, const Gnss_Satellite &); // operator<< for pretty printing + friend bool operator== (const Gnss_Satellite &, const Gnss_Satellite &); //!< operator== for comparison + friend std::ostream& operator<<(std::ostream &, const Gnss_Satellite &); //!< operator<< for pretty printing //Gnss_Satellite& operator=(const Gnss_Satellite &); private: unsigned int PRN; diff --git a/src/core/system_parameters/gnss_signal.cc b/src/core/system_parameters/gnss_signal.cc index e0e1e4e52..19347844a 100644 --- a/src/core/system_parameters/gnss_signal.cc +++ b/src/core/system_parameters/gnss_signal.cc @@ -32,26 +32,33 @@ Gnss_Signal::Gnss_Signal() { - this->signal=""; + this->signal = ""; } + + Gnss_Signal::Gnss_Signal(Gnss_Satellite satellite_,std::string signal_) { - this->satellite=satellite_; - this->signal=signal_; + this->satellite = satellite_; + this->signal = signal_; } + + Gnss_Signal::~Gnss_Signal() -{ -} +{} + std::string Gnss_Signal::get_signal() const { return this->signal; } + + Gnss_Satellite Gnss_Signal::get_satellite() const { return this->satellite; } + std::ostream& operator<<(std::ostream &out, const Gnss_Signal &sig) // output { //std::string psystem = sat::get_system() @@ -59,6 +66,7 @@ std::ostream& operator<<(std::ostream &out, const Gnss_Signal &sig) // output return out; } + bool operator== (const Gnss_Signal &sig1, const Gnss_Signal &sig2) { bool equal = false; diff --git a/src/core/system_parameters/gnss_signal.h b/src/core/system_parameters/gnss_signal.h index 258647c3d..33ed6f00f 100644 --- a/src/core/system_parameters/gnss_signal.h +++ b/src/core/system_parameters/gnss_signal.h @@ -41,19 +41,17 @@ */ class Gnss_Signal { - private: - Gnss_Satellite satellite; - std::string signal; + Gnss_Satellite satellite; + std::string signal; public: - Gnss_Signal(); - Gnss_Signal(Gnss_Satellite satellite_,std::string signal_); - ~Gnss_Signal(); - std::string get_signal() const; - Gnss_Satellite get_satellite() const; + Gnss_Signal(); + Gnss_Signal(Gnss_Satellite satellite_, std::string signal_); + ~Gnss_Signal(); + std::string get_signal() const; + Gnss_Satellite get_satellite() const; friend bool operator== (const Gnss_Signal &, const Gnss_Signal &); // operator== for comparison friend std::ostream& operator<<(std::ostream &, const Gnss_Signal &); // operator<< for pretty printing - - }; + #endif diff --git a/src/core/system_parameters/gnss_synchro.cc b/src/core/system_parameters/gnss_synchro.cc index c808ebe4d..86d482d33 100644 --- a/src/core/system_parameters/gnss_synchro.cc +++ b/src/core/system_parameters/gnss_synchro.cc @@ -33,37 +33,34 @@ Gnss_Synchro::Gnss_Synchro() { - // Satellite and signal info - //System=" "; - //Signal=" "; - PRN=0; - // Acquisition - Acq_delay_samples=0.0; - Acq_doppler_hz=0.0; - Acq_samplestamp_samples=0; - Flag_valid_acquisition=false; - //Tracking - Prompt_I=0.0; - Prompt_Q=0.0; - Carrier_phase_rads=0.0; - Code_phase_secs=0.0; - Tracking_timestamp_secs=0.0; - CN0_dB_hz=0.0; - Flag_valid_tracking=false; - //Telemetry Decoder - Preamble_delay_ms=0.0; - Prn_delay_ms=0.0; - Preamble_code_phase_ms=0.0; - Preamble_code_phase_correction_ms=0.0; - Channel_ID=0; - Flag_valid_word=false; - Flag_preamble=false; - // Pseudorange - Pseudorange_m=0.0; - Pseudorange_timestamp_ms=0.0; - Flag_valid_pseudorange=false; + PRN = 0; + // Acquisition + Acq_delay_samples = 0.0; + Acq_doppler_hz = 0.0; + Acq_samplestamp_samples = 0; + Flag_valid_acquisition = false; + //Tracking + Prompt_I = 0.0; + Prompt_Q = 0.0; + Carrier_phase_rads = 0.0; + Code_phase_secs = 0.0; + Tracking_timestamp_secs = 0.0; + CN0_dB_hz = 0.0; + Flag_valid_tracking = false; + //Telemetry Decoder + Preamble_delay_ms = 0.0; + Prn_delay_ms = 0.0; + Preamble_code_phase_ms = 0.0; + Preamble_code_phase_correction_ms = 0.0; + Channel_ID = 0; + Flag_valid_word = false; + Flag_preamble = false; + // Pseudorange + Pseudorange_m = 0.0; + Pseudorange_timestamp_ms = 0.0; + Flag_valid_pseudorange = false; } Gnss_Synchro::~Gnss_Synchro() -{ -} +{} + diff --git a/src/core/system_parameters/gnss_synchro.h b/src/core/system_parameters/gnss_synchro.h index 099faa3d5..68a34d5a0 100644 --- a/src/core/system_parameters/gnss_synchro.h +++ b/src/core/system_parameters/gnss_synchro.h @@ -1,6 +1,6 @@ /*! * \file gnss_synchro.h - * \brief Implementation of the Gnss_Synchro class + * \brief Interface of the Gnss_Synchro class * \author * Luis Esteve, 2012. luis(at)epsilon-formacion.com * Javier Arribas, 2012. jarribas(at)cttc.es @@ -33,16 +33,14 @@ #include "gnss_signal.h" -#include - -class Gnss_Synchro{ -private: - +/*! + * \brief This is the class that contains the information that flows through the blocks. + */ +class Gnss_Synchro +{ public: Gnss_Synchro(); ~Gnss_Synchro(); - - //Gnss_Signal Signal; // Satellite and signal info char System; char Signal[3]; @@ -72,7 +70,7 @@ public: double Pseudorange_m; double Pseudorange_timestamp_ms; bool Flag_valid_pseudorange; - }; + #endif