1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-12 18:30:34 +00:00

Code cleaning and documentation

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@151 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2012-01-31 00:03:08 +00:00
parent 9625070ea9
commit c186828669
9 changed files with 91 additions and 81 deletions

View File

@ -170,11 +170,11 @@ gr_basic_block_sptr Channel::get_right_block()
void Channel::set_signal(Gnss_Signal gnss_signal) void Channel::set_signal(Gnss_Signal gnss_signal)
{ {
gnss_signal_=gnss_signal; gnss_signal_ = gnss_signal;
gnss_signal_.get_signal().copy(gnss_synchro_.Signal,2,0); gnss_signal_.get_signal().copy(gnss_synchro_.Signal,2,0);
gnss_synchro_.PRN=gnss_signal_.get_satellite().get_PRN(); gnss_synchro_.PRN = gnss_signal_.get_satellite().get_PRN();
gnss_synchro_.System=gnss_signal_.get_satellite().get_system_short().c_str()[0]; gnss_synchro_.System = gnss_signal_.get_satellite().get_system_short().c_str()[0];
acq_->init(); acq_->init();
nav_->set_satellite(gnss_signal_.get_satellite()); nav_->set_satellite(gnss_signal_.get_satellite());
} }
@ -240,7 +240,7 @@ void Channel::process_channel_messages()
case 1: case 1:
LOG_AT_LEVEL(INFO) << "Channel " << channel_ 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(); channel_fsm_.Event_gps_valid_acquisition();
break; break;

View File

@ -1,5 +1,5 @@
/*! /*!
* \file correlator.h * \file correlator.cc
* \brief Highly optimized vector correlator class * \brief Highly optimized vector correlator class
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \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="<<signal_length_samples<<std::endl; //std::cout<<"length="<<signal_length_samples<<std::endl;
*E_out=0; *E_out = 0;
*P_out=0; *P_out = 0;
*L_out=0; *L_out = 0;
// perform Early, Prompt and Late correlation // perform Early, Prompt and Late correlation
for(int i=0; i<signal_length_samples; ++i) for(int i=0; i < signal_length_samples; ++i)
{ {
//Perform the carrier wipe-off //Perform the carrier wipe-off
bb_signal_sample = input[i] * carrier[i]; bb_signal_sample = input[i] * carrier[i];
@ -126,14 +126,14 @@ void Correlator::cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a()
else else
{ {
std::cout << "Detected architectures in this machine for volk_32fc_x2_dot_prod_32fc_a:" << std::endl; std::cout << "Detected architectures in this machine for volk_32fc_x2_dot_prod_32fc_a:" << std::endl;
for (unsigned int i=0; i<arch_list.size(); ++i) for (unsigned int i=0; i < arch_list.size(); ++i)
{ {
std::cout << "Arch " << i << ":" << arch_list.at(i) << std::endl; std::cout << "Arch " << i << ":" << arch_list.at(i) << std::endl;
} }
// TODO: Make a test to find the best architecture // TODO: Make a test to find the best architecture
this->volk_32fc_x2_dot_prod_32fc_a_best_arch = arch_list.at(arch_list.size() - 1); this->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 "<<this->volk_32fc_x2_dot_prod_32fc_a_best_arch<<std::endl; std::cout << "Selected architecture for volk_32fc_x2_dot_prod_32fc_a is " << this->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) for (unsigned int i=0; i < arch_list.size(); ++i)
{ {
std::cout << "Arch " << i << ":" << arch_list.at(i) << std::endl; 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 // TODO: Make a test to find the best architecture
this->volk_32fc_x2_multiply_32fc_a_best_arch = arch_list.at(i); 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 "<<this->volk_32fc_x2_multiply_32fc_a_best_arch<<std::endl; std::cout << "Selected architecture for volk_32fc_x2_multiply_32fc_a_best_arch is " << this->volk_32fc_x2_multiply_32fc_a_best_arch << std::endl;
} }

View File

@ -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 class Correlator

View File

@ -63,13 +63,11 @@ Gnss_Satellite::~Gnss_Satellite()
void Gnss_Satellite::reset() void Gnss_Satellite::reset()
{ {
system_set = {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}; system_set = {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"};
satelliteSystem["GPS"] = "G"; satelliteSystem["GPS"] = "G";
satelliteSystem["GLONASS"] = "R"; satelliteSystem["GLONASS"] = "R";
satelliteSystem["SBAS"] = "S"; satelliteSystem["SBAS"] = "S";
satelliteSystem["Galileo"] = "E"; satelliteSystem["Galileo"] = "E";
satelliteSystem["Compass"] = "C"; satelliteSystem["Compass"] = "C";
PRN = 0; PRN = 0;
system = std::string(""); system = std::string("");
block = std::string(""); block = std::string("");
@ -188,6 +186,10 @@ void Gnss_Satellite::set_PRN(unsigned int PRN_)
{ {
PRN = 11; PRN = 11;
} }
else if (PRN_ == 12)
{
PRN = 12;
}
else else
{ {
DLOG(INFO) << "This PRN is not defined"; 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 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); return satelliteSystem.at(system);
} }
@ -479,6 +480,7 @@ void Gnss_Satellite::set_block(std::string system_, unsigned int PRN_ )
break; break;
case 120 : case 120 :
block = std::string("EGNOS"); // EGNOS AOR-E Broadcast satellite http://www.egnos-pro.esa.int/index.html block = std::string("EGNOS"); // EGNOS AOR-E Broadcast satellite http://www.egnos-pro.esa.int/index.html
break;
case 124 : case 124 :
block = std::string("EGNOS"); // EGNOS ESA ARTEMIS used for EGNOS Operations block = std::string("EGNOS"); // EGNOS ESA ARTEMIS used for EGNOS Operations
break; 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 block = std::string("IOV"); // PFM, the ProtoFlight Model (GSAT0101), launched from French Guiana at 10:30 GMT on October 21, 2011
break; break;
case 12 : 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: default:
block = std::string("Unknown"); block = std::string("Unknown");
} }

View File

@ -36,6 +36,8 @@
#include <set> #include <set>
#include <iostream> #include <iostream>
#include <map> #include <map>
/* /*
* \brief This class represents a GNSS satellite. * \brief This class represents a GNSS satellite.
* *
@ -45,15 +47,15 @@
class Gnss_Satellite class Gnss_Satellite
{ {
public: public:
Gnss_Satellite(); //!< Default Constructor. Gnss_Satellite(); //!< Default Constructor.
Gnss_Satellite(std::string system_, unsigned int PRN_); //!< Concrete GNSS satellite 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 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() 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"} 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 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 std::ostream& operator<<(std::ostream &, const Gnss_Satellite &); //!< operator<< for pretty printing
//Gnss_Satellite& operator=(const Gnss_Satellite &); //Gnss_Satellite& operator=(const Gnss_Satellite &);
private: private:
unsigned int PRN; unsigned int PRN;

View File

@ -32,26 +32,33 @@
Gnss_Signal::Gnss_Signal() Gnss_Signal::Gnss_Signal()
{ {
this->signal=""; this->signal = "";
} }
Gnss_Signal::Gnss_Signal(Gnss_Satellite satellite_,std::string signal_) Gnss_Signal::Gnss_Signal(Gnss_Satellite satellite_,std::string signal_)
{ {
this->satellite=satellite_; this->satellite = satellite_;
this->signal=signal_; this->signal = signal_;
} }
Gnss_Signal::~Gnss_Signal() Gnss_Signal::~Gnss_Signal()
{ {}
}
std::string Gnss_Signal::get_signal() const std::string Gnss_Signal::get_signal() const
{ {
return this->signal; return this->signal;
} }
Gnss_Satellite Gnss_Signal::get_satellite() const Gnss_Satellite Gnss_Signal::get_satellite() const
{ {
return this->satellite; return this->satellite;
} }
std::ostream& operator<<(std::ostream &out, const Gnss_Signal &sig) // output std::ostream& operator<<(std::ostream &out, const Gnss_Signal &sig) // output
{ {
//std::string psystem = sat::get_system() //std::string psystem = sat::get_system()
@ -59,6 +66,7 @@ std::ostream& operator<<(std::ostream &out, const Gnss_Signal &sig) // output
return out; return out;
} }
bool operator== (const Gnss_Signal &sig1, const Gnss_Signal &sig2) bool operator== (const Gnss_Signal &sig1, const Gnss_Signal &sig2)
{ {
bool equal = false; bool equal = false;

View File

@ -41,19 +41,17 @@
*/ */
class Gnss_Signal class Gnss_Signal
{ {
private: private:
Gnss_Satellite satellite; Gnss_Satellite satellite;
std::string signal; std::string signal;
public: public:
Gnss_Signal(); Gnss_Signal();
Gnss_Signal(Gnss_Satellite satellite_,std::string signal_); Gnss_Signal(Gnss_Satellite satellite_, std::string signal_);
~Gnss_Signal(); ~Gnss_Signal();
std::string get_signal() const; std::string get_signal() const;
Gnss_Satellite get_satellite() const; Gnss_Satellite get_satellite() const;
friend bool operator== (const Gnss_Signal &, const Gnss_Signal &); // operator== for comparison 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 friend std::ostream& operator<<(std::ostream &, const Gnss_Signal &); // operator<< for pretty printing
}; };
#endif #endif

View File

@ -33,37 +33,34 @@
Gnss_Synchro::Gnss_Synchro() Gnss_Synchro::Gnss_Synchro()
{ {
// Satellite and signal info PRN = 0;
//System=" "; // Acquisition
//Signal=" "; Acq_delay_samples = 0.0;
PRN=0; Acq_doppler_hz = 0.0;
// Acquisition Acq_samplestamp_samples = 0;
Acq_delay_samples=0.0; Flag_valid_acquisition = false;
Acq_doppler_hz=0.0; //Tracking
Acq_samplestamp_samples=0; Prompt_I = 0.0;
Flag_valid_acquisition=false; Prompt_Q = 0.0;
//Tracking Carrier_phase_rads = 0.0;
Prompt_I=0.0; Code_phase_secs = 0.0;
Prompt_Q=0.0; Tracking_timestamp_secs = 0.0;
Carrier_phase_rads=0.0; CN0_dB_hz = 0.0;
Code_phase_secs=0.0; Flag_valid_tracking = false;
Tracking_timestamp_secs=0.0; //Telemetry Decoder
CN0_dB_hz=0.0; Preamble_delay_ms = 0.0;
Flag_valid_tracking=false; Prn_delay_ms = 0.0;
//Telemetry Decoder Preamble_code_phase_ms = 0.0;
Preamble_delay_ms=0.0; Preamble_code_phase_correction_ms = 0.0;
Prn_delay_ms=0.0; Channel_ID = 0;
Preamble_code_phase_ms=0.0; Flag_valid_word = false;
Preamble_code_phase_correction_ms=0.0; Flag_preamble = false;
Channel_ID=0; // Pseudorange
Flag_valid_word=false; Pseudorange_m = 0.0;
Flag_preamble=false; Pseudorange_timestamp_ms = 0.0;
// Pseudorange Flag_valid_pseudorange = false;
Pseudorange_m=0.0;
Pseudorange_timestamp_ms=0.0;
Flag_valid_pseudorange=false;
} }
Gnss_Synchro::~Gnss_Synchro() Gnss_Synchro::~Gnss_Synchro()
{ {}
}

View File

@ -1,6 +1,6 @@
/*! /*!
* \file gnss_synchro.h * \file gnss_synchro.h
* \brief Implementation of the Gnss_Synchro class * \brief Interface of the Gnss_Synchro class
* \author * \author
* Luis Esteve, 2012. luis(at)epsilon-formacion.com * Luis Esteve, 2012. luis(at)epsilon-formacion.com
* Javier Arribas, 2012. jarribas(at)cttc.es * Javier Arribas, 2012. jarribas(at)cttc.es
@ -33,16 +33,14 @@
#include "gnss_signal.h" #include "gnss_signal.h"
#include <string> /*!
* \brief This is the class that contains the information that flows through the blocks.
class Gnss_Synchro{ */
private: class Gnss_Synchro
{
public: public:
Gnss_Synchro(); Gnss_Synchro();
~Gnss_Synchro(); ~Gnss_Synchro();
//Gnss_Signal Signal;
// Satellite and signal info // Satellite and signal info
char System; char System;
char Signal[3]; char Signal[3];
@ -72,7 +70,7 @@ public:
double Pseudorange_m; double Pseudorange_m;
double Pseudorange_timestamp_ms; double Pseudorange_timestamp_ms;
bool Flag_valid_pseudorange; bool Flag_valid_pseudorange;
}; };
#endif #endif