Adding documentation and improving code formatting.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@103 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2011-12-28 21:36:45 +00:00
parent 48719c3075
commit 2ce62706af
80 changed files with 1568 additions and 1498 deletions

View File

@ -1,6 +1,7 @@
/*! /*!
* \file gps_l1_ca_pvt.cc * \file gps_l1_ca_pvt.cc
* \brief Simple Least Squares implementation for GPS L1 C/A Position Velocity and Time * \brief Implementation of an adapter of a GPS L1 C/A PVT solver block to a
* PVTInterface
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* *
@ -56,8 +57,8 @@ GpsL1CaPvt::GpsL1CaPvt(ConfigurationInterface* configuration,
DLOG(INFO) << "role " << role; DLOG(INFO) << "role " << role;
int averaging_depth; int averaging_depth;
averaging_depth=configuration->property(role + ".averaging_depth", 10); averaging_depth=configuration->property(role + ".averaging_depth", 10);
bool flag_averaging; bool flag_averaging;
flag_averaging=configuration->property(role + ".flag_averaging", false); flag_averaging=configuration->property(role + ".flag_averaging", false);
@ -65,7 +66,7 @@ GpsL1CaPvt::GpsL1CaPvt(ConfigurationInterface* configuration,
dump_ = configuration->property(role + ".dump", false); dump_ = configuration->property(role + ".dump", false);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
pvt_ = gps_l1_ca_make_pvt_cc(in_streams_, queue_, dump_, dump_filename_, averaging_depth, flag_averaging); pvt_ = gps_l1_ca_make_pvt_cc(in_streams_, queue_, dump_, dump_filename_, averaging_depth, flag_averaging);
DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")"; DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")";
// set the navigation msg queue; // set the navigation msg queue;

View File

@ -1,6 +1,8 @@
/*! /*!
* \file gps_l1_ca_pvt.h * \file gps_l1_ca_pvt.h
* \brief Simple Least Squares implementation for GPS L1 C/A Position Velocity and Time * \brief Interface of an adapter of a GPS L1 C/A PVT solver block to a
* PVTInterface
* Position Velocity and Time
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* *
@ -48,7 +50,7 @@ class GpsL1CaPvt : public PvtInterface
public: public:
GpsL1CaPvt(ConfigurationInterface* configuration, GpsL1CaPvt(ConfigurationInterface* configuration,
std::string role, std::string role,
unsigned int in_streams, unsigned int in_streams,
unsigned int out_streams, unsigned int out_streams,

View File

@ -1,6 +1,6 @@
/*! /*!
* \file gps_l1_ca_pvt_cc.cc * \file gps_l1_ca_pvt_cc.cc
* \brief Position Velocity and Time computation for GPS L1 C/A * \brief Implementation of a Position Velocity and Time computation block for GPS L1 C/A
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
@ -48,36 +48,36 @@ using google::LogMessage;
gps_l1_ca_pvt_cc_sptr gps_l1_ca_pvt_cc_sptr
gps_l1_ca_make_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging) { gps_l1_ca_make_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging) {
return gps_l1_ca_pvt_cc_sptr(new gps_l1_ca_pvt_cc(nchannels, queue, dump, dump_filename, averaging_depth, flag_averaging)); return gps_l1_ca_pvt_cc_sptr(new gps_l1_ca_pvt_cc(nchannels, queue, dump, dump_filename, averaging_depth, flag_averaging));
} }
gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging) : gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging) :
gr_block ("gps_l1_ca_pvt_cc", gr_make_io_signature (nchannels, nchannels, sizeof(gnss_pseudorange)), gr_block ("gps_l1_ca_pvt_cc", gr_make_io_signature (nchannels, nchannels, sizeof(gnss_pseudorange)),
gr_make_io_signature(1, 1, sizeof(gr_complex))) { gr_make_io_signature(1, 1, sizeof(gr_complex))) {
// initialize internal vars // initialize internal vars
d_queue = queue; d_queue = queue;
d_dump = dump; d_dump = dump;
d_nchannels = nchannels; d_nchannels = nchannels;
d_dump_filename=dump_filename; d_dump_filename=dump_filename;
std::string kml_dump_filename; std::string kml_dump_filename;
kml_dump_filename=d_dump_filename; kml_dump_filename=d_dump_filename;
kml_dump_filename.append(".kml"); kml_dump_filename.append(".kml");
d_kml_dump.set_headers(kml_dump_filename); d_kml_dump.set_headers(kml_dump_filename);
d_dump_filename.append(".dat"); d_dump_filename.append(".dat");
d_averaging_depth=averaging_depth; d_averaging_depth=averaging_depth;
d_flag_averaging=flag_averaging; d_flag_averaging=flag_averaging;
/*! /*!
* \todo Enable RINEX printer: The current RINEX printer need a complete refactoring and some bug fixing work * \todo Enable RINEX printer: The current RINEX printer need a complete refactoring and some bug fixing work
*/ */
//d_rinex_printer.set_headers("GNSS-SDR"); //d_rinex_printer.set_headers("GNSS-SDR");
d_ls_pvt=new gps_l1_ca_ls_pvt(nchannels,d_dump_filename,d_dump); d_ls_pvt=new gps_l1_ca_ls_pvt(nchannels,d_dump_filename,d_dump);
d_ls_pvt->set_averaging_depth(d_averaging_depth); d_ls_pvt->set_averaging_depth(d_averaging_depth);
d_ephemeris_clock_s=0.0; d_ephemeris_clock_s=0.0;
d_sample_counter=0; d_sample_counter=0;
} }
gps_l1_ca_pvt_cc::~gps_l1_ca_pvt_cc() { gps_l1_ca_pvt_cc::~gps_l1_ca_pvt_cc() {
@ -87,75 +87,75 @@ gps_l1_ca_pvt_cc::~gps_l1_ca_pvt_cc() {
bool pseudoranges_pairCompare_min( std::pair<int,gnss_pseudorange> a, std::pair<int,gnss_pseudorange> b) bool pseudoranges_pairCompare_min( std::pair<int,gnss_pseudorange> a, std::pair<int,gnss_pseudorange> b)
{ {
return (a.second.pseudorange_m) < (b.second.pseudorange_m); return (a.second.pseudorange_m) < (b.second.pseudorange_m);
} }
int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items, int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) {
d_sample_counter++; d_sample_counter++;
std::map<int,gnss_pseudorange> gnss_pseudoranges_map; std::map<int,gnss_pseudorange> gnss_pseudoranges_map;
std::map<int,gnss_pseudorange>::iterator gnss_pseudoranges_iter; std::map<int,gnss_pseudorange>::iterator gnss_pseudoranges_iter;
gnss_pseudorange **in = (gnss_pseudorange **) &input_items[0]; //Get the input pointer gnss_pseudorange **in = (gnss_pseudorange **) &input_items[0]; //Get the input pointer
for (unsigned int i=0;i<d_nchannels;i++) for (unsigned int i=0;i<d_nchannels;i++)
{ {
if (in[i][0].valid==true) if (in[i][0].valid==true)
{ {
gnss_pseudoranges_map.insert(std::pair<int,gnss_pseudorange>(in[i][0].SV_ID,in[i][0])); //record the valid pseudorange in a map gnss_pseudoranges_map.insert(std::pair<int,gnss_pseudorange>(in[i][0].SV_ID,in[i][0])); //record the valid pseudorange in a map
} }
} }
//debug print //debug print
std::cout << std::setprecision(16); std::cout << std::setprecision(16);
for(gnss_pseudoranges_iter = gnss_pseudoranges_map.begin(); for(gnss_pseudoranges_iter = gnss_pseudoranges_map.begin();
gnss_pseudoranges_iter != gnss_pseudoranges_map.end(); gnss_pseudoranges_iter != gnss_pseudoranges_map.end();
gnss_pseudoranges_iter++) gnss_pseudoranges_iter++)
{ {
std::cout<<"Pseudoranges(SV ID,pseudorange [m]) =("<<gnss_pseudoranges_iter->first<<","<<gnss_pseudoranges_iter->second.pseudorange_m<<")"<<std::endl; std::cout<<"Pseudoranges(SV ID,pseudorange [m]) =("<<gnss_pseudoranges_iter->first<<","<<gnss_pseudoranges_iter->second.pseudorange_m<<")"<<std::endl;
} }
// ############ 1. READ EPHEMERIS FROM QUEUE ###################### // ############ 1. READ EPHEMERIS FROM QUEUE ######################
// find the minimum index (nearest satellite, will be the reference) // find the minimum index (nearest satellite, will be the reference)
gnss_pseudoranges_iter=std::min_element(gnss_pseudoranges_map.begin(),gnss_pseudoranges_map.end(),pseudoranges_pairCompare_min); gnss_pseudoranges_iter=std::min_element(gnss_pseudoranges_map.begin(),gnss_pseudoranges_map.end(),pseudoranges_pairCompare_min);
gps_navigation_message nav_msg; gps_navigation_message nav_msg;
while (d_nav_queue->try_pop(nav_msg)==true) while (d_nav_queue->try_pop(nav_msg)==true)
{ {
std::cout<<"New ephemeris record has arrived from SAT ID "<<nav_msg.d_satellite_PRN<<std::endl; std::cout<<"New ephemeris record has arrived from SAT ID "<<nav_msg.d_satellite_PRN<<std::endl;
d_last_nav_msg=nav_msg; d_last_nav_msg=nav_msg;
d_ls_pvt->d_ephemeris[nav_msg.d_channel_ID]=nav_msg; d_ls_pvt->d_ephemeris[nav_msg.d_channel_ID]=nav_msg;
// **** update pseudoranges clock **** // **** update pseudoranges clock ****
if (nav_msg.d_satellite_PRN==gnss_pseudoranges_iter->second.SV_ID) if (nav_msg.d_satellite_PRN==gnss_pseudoranges_iter->second.SV_ID)
{ {
d_ephemeris_clock_s=d_last_nav_msg.d_TOW; d_ephemeris_clock_s=d_last_nav_msg.d_TOW;
d_ephemeris_timestamp_ms=d_last_nav_msg.d_subframe1_timestamp_ms; d_ephemeris_timestamp_ms=d_last_nav_msg.d_subframe1_timestamp_ms;
} }
// **** write ephemeris to RINES NAV file // **** write ephemeris to RINES NAV file
//d_rinex_printer.LogRinex2Nav(nav_msg); //d_rinex_printer.LogRinex2Nav(nav_msg);
} }
// ############ 2. COMPUTE THE PVT ################################ // ############ 2. COMPUTE THE PVT ################################
// write the pseudoranges to RINEX OBS file // write the pseudoranges to RINEX OBS file
// 1- need a valid clock // 1- need a valid clock
if (d_ephemeris_clock_s>0 and d_last_nav_msg.d_satellite_PRN>0) if (d_ephemeris_clock_s>0 and d_last_nav_msg.d_satellite_PRN>0)
{ {
//d_rinex_printer.LogRinex2Obs(d_last_nav_msg,d_ephemeris_clock_s+((double)pseudoranges_timestamp_ms-d_ephemeris_timestamp_ms)/1000.0,pseudoranges); //d_rinex_printer.LogRinex2Obs(d_last_nav_msg,d_ephemeris_clock_s+((double)pseudoranges_timestamp_ms-d_ephemeris_timestamp_ms)/1000.0,pseudoranges);
// compute on the fly PVT solution // compute on the fly PVT solution
//std::cout<<"diff_clock_ephemerids="<<(gnss_pseudoranges_iter->second.timestamp_ms-d_ephemeris_timestamp_ms)/1000.0<<"\r\n"; //std::cout<<"diff_clock_ephemerids="<<(gnss_pseudoranges_iter->second.timestamp_ms-d_ephemeris_timestamp_ms)/1000.0<<"\r\n";
if (d_ls_pvt->get_PVT(gnss_pseudoranges_map, if (d_ls_pvt->get_PVT(gnss_pseudoranges_map,
d_ephemeris_clock_s+(gnss_pseudoranges_iter->second.timestamp_ms-d_ephemeris_timestamp_ms)/1000.0, d_ephemeris_clock_s+(gnss_pseudoranges_iter->second.timestamp_ms-d_ephemeris_timestamp_ms)/1000.0,
d_flag_averaging)==true) d_flag_averaging)==true)
{ {
d_kml_dump.print_position(d_ls_pvt,d_flag_averaging); d_kml_dump.print_position(d_ls_pvt,d_flag_averaging);
} }
} }
consume_each(1); //one by one consume_each(1); //one by one
return 0; return 0;
} }

View File

@ -1,6 +1,6 @@
/*! /*!
* \file gps_l1_ca_pvt_cc.h * \file gps_l1_ca_pvt_cc.h
* \brief Position Velocity and Time computation for GPS L1 C/A * \brief Interface of a Position Velocity and Time computation block for GPS L1 C/A
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *

View File

@ -1,7 +1,7 @@
/*! /*!
* \file gps_l1_ca_ls_pvt.cc * \file gps_l1_ca_ls_pvt.cc
* \brief Least Squares Position, Velocity, and Time (PVT) solver, based on * \brief Implementation of a Least Squares Position, Velocity, and Time
* K.Borre Matlab receiver. * (PVT) solver, based on K.Borre's Matlab receiver.
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
@ -42,32 +42,32 @@ gps_l1_ca_ls_pvt::gps_l1_ca_ls_pvt(int nchannels,std::string dump_filename, bool
d_flag_dump_enabled=flag_dump_to_file; d_flag_dump_enabled=flag_dump_to_file;
d_averaging_depth=0; d_averaging_depth=0;
// ############# ENABLE DATA FILE LOG ################# // ############# ENABLE DATA FILE LOG #################
if (d_flag_dump_enabled==true) if (d_flag_dump_enabled==true)
{ {
if (d_dump_file.is_open()==false) if (d_dump_file.is_open()==false)
{ {
try { try {
d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit );
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
std::cout<<"PVT lib dump enabled Log file: "<<d_dump_filename.c_str()<<std::endl; std::cout<<"PVT lib dump enabled Log file: "<<d_dump_filename.c_str()<<std::endl;
} }
catch (std::ifstream::failure e) { catch (std::ifstream::failure e) {
std::cout << "Exception opening PVT lib dump file "<<e.what()<<"\r\n"; std::cout << "Exception opening PVT lib dump file "<<e.what()<<"\r\n";
} }
} }
} }
} }
void gps_l1_ca_ls_pvt::set_averaging_depth(int depth) void gps_l1_ca_ls_pvt::set_averaging_depth(int depth)
{ {
d_averaging_depth=depth; d_averaging_depth=depth;
} }
gps_l1_ca_ls_pvt::~gps_l1_ca_ls_pvt() gps_l1_ca_ls_pvt::~gps_l1_ca_ls_pvt()
{ {
d_dump_file.close(); d_dump_file.close();
delete[] d_ephemeris; delete[] d_ephemeris;
} }
@ -138,12 +138,11 @@ arma::vec gps_l1_ca_ls_pvt::leastSquarePos(arma::mat satpos, arma::vec obs, arma
az=arma::zeros(1,nmbOfSatellites); az=arma::zeros(1,nmbOfSatellites);
el=arma::zeros(1,nmbOfSatellites); el=arma::zeros(1,nmbOfSatellites);
for (int i = 0; i < nmbOfSatellites; i++) { for (int i = 0; i < nmbOfSatellites; i++) {
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
//A.set(i, j, 0.0); //ITPP A(i,j)=0.0; //Armadillo
A(i,j)=0.0; //Armadillo }
} omc(i, 0)=0.0;
omc(i, 0)=0.0; az(0, i)=0.0;
az(0, i)=0.0;
} }
el = az; el = az;
@ -156,45 +155,45 @@ arma::vec gps_l1_ca_ls_pvt::leastSquarePos(arma::mat satpos, arma::vec obs, arma
arma::vec x; arma::vec x;
//=== Iteratively find receiver position =================================== //=== Iteratively find receiver position ===================================
for (int iter = 0; iter < nmbOfIterations; iter++) { for (int iter = 0; iter < nmbOfIterations; iter++) {
for (int i = 0; i < nmbOfSatellites; i++) { for (int i = 0; i < nmbOfSatellites; i++) {
if (iter == 0) { if (iter == 0) {
//--- Initialize variables at the first iteration -------------- //--- Initialize variables at the first iteration --------------
Rot_X=X.col(i); //Armadillo Rot_X=X.col(i); //Armadillo
trop = 0.0; trop = 0.0;
} else { } else {
//--- Update equations ----------------------------------------- //--- Update equations -----------------------------------------
rho2 = (X(0, i) - pos(0))*(X(0, i) - pos(0)) + (X(1, i) - pos(1))*(X(1, i) - pos(1))+ (X(2,i) - pos(2))*(X(2,i) - pos(2)); rho2 = (X(0, i) - pos(0))*(X(0, i) - pos(0)) + (X(1, i) - pos(1))*(X(1, i) - pos(1))+ (X(2,i) - pos(2))*(X(2,i) - pos(2));
traveltime = sqrt(rho2) / GPS_C_m_s; traveltime = sqrt(rho2) / GPS_C_m_s;
//--- Correct satellite position (do to earth rotation) -------- //--- Correct satellite position (do to earth rotation) --------
Rot_X = e_r_corr(traveltime, X.col(i)); //armadillo Rot_X = e_r_corr(traveltime, X.col(i)); //armadillo
//--- Find the elevation angel of the satellite ---------------- //--- Find the elevation angel of the satellite ----------------
//[az(i), el(i), dist] = topocent(pos(1:3, :), Rot_X - pos(1:3, :)); //[az(i), el(i), dist] = topocent(pos(1:3, :), Rot_X - pos(1:3, :));
}
//--- Apply the corrections ----------------------------------------
omc(i) = (obs(i) - norm(Rot_X - pos.subvec(0,2),2) - pos(3) - trop); // Armadillo
//--- Construct the A matrix ---------------------------------------
//Armadillo
A(i,0)=(-(Rot_X(0) - pos(0))) / obs(i);
A(i,1)=(-(Rot_X(1) - pos(1))) / obs(i);
A(i,2)=(-(Rot_X(2) - pos(2))) / obs(i);
A(i,3)=1.0;
} }
//--- Apply the corrections ----------------------------------------
omc(i) = (obs(i) - norm(Rot_X - pos.subvec(0,2),2) - pos(3) - trop); // Armadillo
//--- Construct the A matrix ---------------------------------------
//Armadillo
A(i,0)=(-(Rot_X(0) - pos(0))) / obs(i);
A(i,1)=(-(Rot_X(1) - pos(1))) / obs(i);
A(i,2)=(-(Rot_X(2) - pos(2))) / obs(i);
A(i,3)=1.0;
}
// These lines allow the code to exit gracefully in case of any errors // These lines allow the code to exit gracefully in case of any errors
//if (rank(A) != 4) { //if (rank(A) != 4) {
// pos.clear(); // pos.clear();
// return pos; // return pos;
//} //}
//--- Find position update --------------------------------------------- //--- Find position update ---------------------------------------------
x = arma::solve(w*A,w*omc); // Armadillo x = arma::solve(w*A,w*omc); // Armadillo
//--- Apply position update -------------------------------------------- //--- Apply position update --------------------------------------------
pos = pos + x; pos = pos + x;
} }
return pos; return pos;
@ -210,141 +209,141 @@ bool gps_l1_ca_ls_pvt::get_PVT(std::map<int,gnss_pseudorange> gnss_pseudoranges_
int valid_obs=0; //valid observations counter int valid_obs=0; //valid observations counter
for (int i=0; i<d_nchannels; i++) for (int i=0; i<d_nchannels; i++)
{
if (d_ephemeris[i].satellite_validation()==true)
{ {
gnss_pseudoranges_iter=gnss_pseudoranges_map.find(d_ephemeris[i].d_satellite_PRN); if (d_ephemeris[i].satellite_validation()==true)
if (gnss_pseudoranges_iter!=gnss_pseudoranges_map.end()) {
{ gnss_pseudoranges_iter=gnss_pseudoranges_map.find(d_ephemeris[i].d_satellite_PRN);
/*! if (gnss_pseudoranges_iter!=gnss_pseudoranges_map.end())
* \todo Place here the satellite CN0 (power level, or weight factor) {
*/ /*!
W(i,i)=1; * \todo Place here the satellite CN0 (power level, or weight factor)
// compute the GPS master clock */
d_ephemeris[i].master_clock(GPS_current_time); W(i,i)=1;
// compute the satellite current ECEF position // compute the GPS master clock
d_ephemeris[i].satpos(); d_ephemeris[i].master_clock(GPS_current_time);
// compute the clock error including relativistic effects // compute the satellite current ECEF position
d_ephemeris[i].relativistic_clock_correction(GPS_current_time); d_ephemeris[i].satpos();
satpos(0,i)=d_ephemeris[i].d_satpos_X; // compute the clock error including relativistic effects
satpos(1,i)=d_ephemeris[i].d_satpos_Y; d_ephemeris[i].relativistic_clock_correction(GPS_current_time);
satpos(2,i)=d_ephemeris[i].d_satpos_Z; satpos(0,i)=d_ephemeris[i].d_satpos_X;
std::cout<<"ECEF satellite SV ID="<<d_ephemeris[i].d_satellite_PRN<<" X="<<d_ephemeris[i].d_satpos_X satpos(1,i)=d_ephemeris[i].d_satpos_Y;
<<" [m] Y="<<d_ephemeris[i].d_satpos_Y<<" [m] Z="<<d_ephemeris[i].d_satpos_Z<<" [m]\r\n"; satpos(2,i)=d_ephemeris[i].d_satpos_Z;
obs(i)=gnss_pseudoranges_iter->second.pseudorange_m+d_ephemeris[i].d_satClkCorr*GPS_C_m_s; std::cout<<"ECEF satellite SV ID="<<d_ephemeris[i].d_satellite_PRN<<" X="<<d_ephemeris[i].d_satpos_X
valid_obs++; <<" [m] Y="<<d_ephemeris[i].d_satpos_Y<<" [m] Z="<<d_ephemeris[i].d_satpos_Z<<" [m]\r\n";
}else{ obs(i)=gnss_pseudoranges_iter->second.pseudorange_m+d_ephemeris[i].d_satClkCorr*GPS_C_m_s;
// no valid pseudorange for the current channel valid_obs++;
W(i,i)=0; // channel de-activated }else{
obs(i)=1; // to avoid algorithm problems (divide by zero) // no valid pseudorange for the current channel
} W(i,i)=0; // channel de-activated
}else{ obs(i)=1; // to avoid algorithm problems (divide by zero)
// no valid ephemeris for the current channel }
W(i,i)=0; // channel de-activated }else{
obs(i)=1; // to avoid algorithm problems (divide by zero) // no valid ephemeris for the current channel
W(i,i)=0; // channel de-activated
obs(i)=1; // to avoid algorithm problems (divide by zero)
}
} }
}
std::cout<<"PVT: valid observations="<<valid_obs<<std::endl; std::cout<<"PVT: valid observations="<<valid_obs<<std::endl;
if (valid_obs>=4) if (valid_obs>=4)
{ {
arma::vec mypos; arma::vec mypos;
mypos=leastSquarePos(satpos,obs,W); mypos=leastSquarePos(satpos,obs,W);
std::cout << "Position at TOW="<<GPS_current_time<<" is ECEF (X,Y,Z) = " << mypos << std::endl; std::cout << "Position at TOW="<<GPS_current_time<<" is ECEF (X,Y,Z) = " << mypos << std::endl;
cart2geo(mypos(0), mypos(1), mypos(2), 4); cart2geo(mypos(0), mypos(1), mypos(2), 4);
std::cout << "Position at TOW="<<GPS_current_time<<" is Lat = " << d_latitude_d << " [¼] Long = "<< d_longitude_d <<" [¼] Height= "<<d_height_m<<" [m]" <<std::endl; std::cout << "Position at TOW="<<GPS_current_time<<" is Lat = " << d_latitude_d << " [¼] Long = "<< d_longitude_d <<" [¼] Height= "<<d_height_m<<" [m]" <<std::endl;
// ######## LOG FILE ######### // ######## LOG FILE #########
if(d_flag_dump_enabled==true) { if(d_flag_dump_enabled==true) {
// MULTIPLEXED FILE RECORDING - Record results to file // MULTIPLEXED FILE RECORDING - Record results to file
try { try {
double tmp_double; double tmp_double;
// PVT GPS time // PVT GPS time
tmp_double=GPS_current_time; tmp_double=GPS_current_time;
d_dump_file.write((char*)&tmp_double, sizeof(double)); d_dump_file.write((char*)&tmp_double, sizeof(double));
// ECEF User Position East [m] // ECEF User Position East [m]
tmp_double=mypos(0); tmp_double=mypos(0);
d_dump_file.write((char*)&tmp_double, sizeof(double)); d_dump_file.write((char*)&tmp_double, sizeof(double));
// ECEF User Position North [m] // ECEF User Position North [m]
tmp_double=mypos(1); tmp_double=mypos(1);
d_dump_file.write((char*)&tmp_double, sizeof(double)); d_dump_file.write((char*)&tmp_double, sizeof(double));
// ECEF User Position Up [m] // ECEF User Position Up [m]
tmp_double=mypos(2); tmp_double=mypos(2);
d_dump_file.write((char*)&tmp_double, sizeof(double)); d_dump_file.write((char*)&tmp_double, sizeof(double));
// User clock offset [s] // User clock offset [s]
tmp_double=mypos(3); tmp_double=mypos(3);
d_dump_file.write((char*)&tmp_double, sizeof(double)); d_dump_file.write((char*)&tmp_double, sizeof(double));
// GEO user position Latitude [deg] // GEO user position Latitude [deg]
tmp_double=d_latitude_d; tmp_double=d_latitude_d;
d_dump_file.write((char*)&tmp_double, sizeof(double)); d_dump_file.write((char*)&tmp_double, sizeof(double));
// GEO user position Longitude [deg] // GEO user position Longitude [deg]
tmp_double=d_longitude_d; tmp_double=d_longitude_d;
d_dump_file.write((char*)&tmp_double, sizeof(double)); d_dump_file.write((char*)&tmp_double, sizeof(double));
// GEO user position Height [m] // GEO user position Height [m]
tmp_double=d_height_m; tmp_double=d_height_m;
d_dump_file.write((char*)&tmp_double, sizeof(double)); d_dump_file.write((char*)&tmp_double, sizeof(double));
} }
catch (std::ifstream::failure e) { catch (std::ifstream::failure e) {
std::cout << "Exception writing PVT lib dump file "<<e.what()<<"\r\n"; std::cout << "Exception writing PVT lib dump file "<<e.what()<<"\r\n";
} }
} }
// MOVING AVERAGE PVT // MOVING AVERAGE PVT
if (flag_averaging==true) if (flag_averaging==true)
{ {
if (d_hist_longitude_d.size()==(unsigned int)d_averaging_depth) if (d_hist_longitude_d.size()==(unsigned int)d_averaging_depth)
{ {
// Pop oldest value // Pop oldest value
d_hist_longitude_d.pop_back(); d_hist_longitude_d.pop_back();
d_hist_latitude_d.pop_back(); d_hist_latitude_d.pop_back();
d_hist_height_m.pop_back(); d_hist_height_m.pop_back();
// Push new values // Push new values
d_hist_longitude_d.push_front(d_longitude_d); d_hist_longitude_d.push_front(d_longitude_d);
d_hist_latitude_d.push_front(d_latitude_d); d_hist_latitude_d.push_front(d_latitude_d);
d_hist_height_m.push_front(d_height_m); d_hist_height_m.push_front(d_height_m);
d_avg_latitude_d=0; d_avg_latitude_d=0;
d_avg_longitude_d=0; d_avg_longitude_d=0;
d_avg_height_m=0; d_avg_height_m=0;
for (unsigned int i=0;i<d_hist_longitude_d.size();i++) for (unsigned int i=0;i<d_hist_longitude_d.size();i++)
{ {
d_avg_latitude_d=d_avg_latitude_d+d_hist_latitude_d.at(i); d_avg_latitude_d=d_avg_latitude_d+d_hist_latitude_d.at(i);
d_avg_longitude_d=d_avg_longitude_d+d_hist_longitude_d.at(i); d_avg_longitude_d=d_avg_longitude_d+d_hist_longitude_d.at(i);
d_avg_height_m=d_avg_height_m+d_hist_height_m.at(i); d_avg_height_m=d_avg_height_m+d_hist_height_m.at(i);
} }
d_avg_latitude_d=d_avg_latitude_d/(double)d_averaging_depth; d_avg_latitude_d=d_avg_latitude_d/(double)d_averaging_depth;
d_avg_longitude_d=d_avg_longitude_d/(double)d_averaging_depth; d_avg_longitude_d=d_avg_longitude_d/(double)d_averaging_depth;
d_avg_height_m=d_avg_height_m/(double)d_averaging_depth; d_avg_height_m=d_avg_height_m/(double)d_averaging_depth;
return true; //indicates that the returned position is valid return true; //indicates that the returned position is valid
}else{ }else{
//int current_depth=d_hist_longitude_d.size(); //int current_depth=d_hist_longitude_d.size();
// Push new values // Push new values
d_hist_longitude_d.push_front(d_longitude_d); d_hist_longitude_d.push_front(d_longitude_d);
d_hist_latitude_d.push_front(d_latitude_d); d_hist_latitude_d.push_front(d_latitude_d);
d_hist_height_m.push_front(d_height_m); d_hist_height_m.push_front(d_height_m);
d_avg_latitude_d=d_latitude_d; d_avg_latitude_d=d_latitude_d;
d_avg_longitude_d=d_longitude_d; d_avg_longitude_d=d_longitude_d;
d_avg_height_m=d_height_m; d_avg_height_m=d_height_m;
return false;//indicates that the returned position is not valid yet return false;//indicates that the returned position is not valid yet
// output the average, although it will not have the full historic available // output the average, although it will not have the full historic available
// d_avg_latitude_d=0; // d_avg_latitude_d=0;
// d_avg_longitude_d=0; // d_avg_longitude_d=0;
// d_avg_height_m=0; // d_avg_height_m=0;
// for (unsigned int i=0;i<d_hist_longitude_d.size();i++) // for (unsigned int i=0;i<d_hist_longitude_d.size();i++)
// { // {
// d_avg_latitude_d=d_avg_latitude_d+d_hist_latitude_d.at(i); // d_avg_latitude_d=d_avg_latitude_d+d_hist_latitude_d.at(i);
// d_avg_longitude_d=d_avg_longitude_d+d_hist_longitude_d.at(i); // d_avg_longitude_d=d_avg_longitude_d+d_hist_longitude_d.at(i);
// d_avg_height_m=d_avg_height_m+d_hist_height_m.at(i); // d_avg_height_m=d_avg_height_m+d_hist_height_m.at(i);
// } // }
// d_avg_latitude_d=d_avg_latitude_d/(double)current_depth; // d_avg_latitude_d=d_avg_latitude_d/(double)current_depth;
// d_avg_longitude_d=d_avg_longitude_d/(double)current_depth; // d_avg_longitude_d=d_avg_longitude_d/(double)current_depth;
// d_avg_height_m=d_avg_height_m/(double)current_depth; // d_avg_height_m=d_avg_height_m/(double)current_depth;
} }
}else{ }else{
return true;//indicates that the returned position is valid return true;//indicates that the returned position is valid
} }
}else{ }else{
return false; return false;
} }
} }
void gps_l1_ca_ls_pvt::cart2geo(double X, double Y, double Z, int elipsoid_selection) void gps_l1_ca_ls_pvt::cart2geo(double X, double Y, double Z, int elipsoid_selection)
{ {
@ -376,16 +375,16 @@ void gps_l1_ca_ls_pvt::cart2geo(double X, double Y, double Z, int elipsoid_selec
double N; double N;
int iterations = 0; int iterations = 0;
do{ do{
oldh = h; oldh = h;
N = c/sqrt(1+ex2*(cos(phi)*cos(phi))); N = c/sqrt(1+ex2*(cos(phi)*cos(phi)));
phi = atan(Z/((sqrt(X*X+Y*Y)*(1-(2-f[elipsoid_selection])*f[elipsoid_selection]*N/(N+h))))); phi = atan(Z/((sqrt(X*X+Y*Y)*(1-(2-f[elipsoid_selection])*f[elipsoid_selection]*N/(N+h)))));
h = sqrt(X*X+Y*Y)/cos(phi)-N; h = sqrt(X*X+Y*Y)/cos(phi)-N;
iterations = iterations + 1; iterations = iterations + 1;
if (iterations > 100) if (iterations > 100)
{ {
std::cout<<"Failed to approximate h with desired precision. h-oldh= "<<h-oldh<<std::endl; std::cout<<"Failed to approximate h with desired precision. h-oldh= "<<h-oldh<<std::endl;
break; break;
} }
}while (abs(h-oldh) > 1.0e-12); }while (abs(h-oldh) > 1.0e-12);
d_latitude_d = phi*180.0/GPS_PI; d_latitude_d = phi*180.0/GPS_PI;
d_longitude_d = lambda*180/GPS_PI; d_longitude_d = lambda*180/GPS_PI;
@ -394,7 +393,7 @@ void gps_l1_ca_ls_pvt::cart2geo(double X, double Y, double Z, int elipsoid_selec
//void gps_l1_ca_ls_pvt::topocent(traveltime, X_sat) //void gps_l1_ca_ls_pvt::topocent(traveltime, X_sat)
//{ //{
/* /*
%function [Az, El, D] = topocent(X, dx) %function [Az, El, D] = topocent(X, dx)
%TOPOCENT Transformation of vector dx into topocentric coordinate %TOPOCENT Transformation of vector dx into topocentric coordinate
% system with origin at X. % system with origin at X.
@ -446,5 +445,5 @@ end
D = sqrt(dx(1)^2 + dx(2)^2 + dx(3)^2); D = sqrt(dx(1)^2 + dx(2)^2 + dx(3)^2);
%%%%%%%%% end topocent.m %%%%%%%%% %%%%%%%%% end topocent.m %%%%%%%%%
*/ */
//} //}

View File

@ -1,7 +1,7 @@
/*! /*!
* \file gps_l1_ca_ls_pvt.h * \file gps_l1_ca_ls_pvt.h
* \brief Least Squares Position, Velocity, and Time (PVT) solver, based on * \brief Interface of a Least Squares Position, Velocity, and Time (PVT)
* K.Borre Matlab receiver. * solver, based on K.Borre's Matlab receiver.
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *

View File

@ -1,6 +1,6 @@
/*! /*!
* \file kml_printer.cc * \file kml_printer.cc
* \brief Prints PVT information to a GoogleEarth kml file * \brief Implementation of a class that prints PVT information to a kml file
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* *
@ -32,95 +32,92 @@
#include "kml_printer.h" #include "kml_printer.h"
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <time.h> #include <time.h>
bool kml_printer::set_headers(std::string filename) bool kml_printer::set_headers(std::string filename)
{ {
time_t rawtime; time_t rawtime;
struct tm * timeinfo; struct tm * timeinfo;
time ( &rawtime ); time ( &rawtime );
timeinfo = localtime ( &rawtime ); timeinfo = localtime ( &rawtime );
kml_file.open(filename.c_str()); kml_file.open(filename.c_str());
if (kml_file.is_open()) if (kml_file.is_open())
{ {
DLOG(INFO)<<"KML printer writting on "<<filename.c_str(); DLOG(INFO)<<"KML printer writting on "<<filename.c_str();
kml_file<<"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" kml_file<<"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
<<"<kml xmlns=\"http://www.opengis.net/kml/2.2\">\r\n" <<"<kml xmlns=\"http://www.opengis.net/kml/2.2\">\r\n"
<<" <Document>\r\n" <<" <Document>\r\n"
<<" <name>GNSS Track</name>\r\n" <<" <name>GNSS Track</name>\r\n"
<<" <description>GNSS-SDR Receiver position log file created at "<<asctime (timeinfo) <<" <description>GNSS-SDR Receiver position log file created at "<<asctime (timeinfo)
<<" </description>\r\n" <<" </description>\r\n"
<<"<Style id=\"yellowLineGreenPoly\">\r\n" <<"<Style id=\"yellowLineGreenPoly\">\r\n"
<<" <LineStyle>\r\n" <<" <LineStyle>\r\n"
<<" <color>7f00ffff</color>\r\n" <<" <color>7f00ffff</color>\r\n"
<<" <width>1</width>\r\n" <<" <width>1</width>\r\n"
<<" </LineStyle>\r\n" <<" </LineStyle>\r\n"
<<"<PolyStyle>\r\n" <<"<PolyStyle>\r\n"
<<" <color>7f00ff00</color>\r\n" <<" <color>7f00ff00</color>\r\n"
<<"</PolyStyle>\r\n" <<"</PolyStyle>\r\n"
<<"</Style>\r\n" <<"</Style>\r\n"
<<"<Placemark>\r\n" <<"<Placemark>\r\n"
<<"<name>GNSS-SDR PVT</name>\r\n" <<"<name>GNSS-SDR PVT</name>\r\n"
<<"<description>GNSS-SDR position log</description>\r\n" <<"<description>GNSS-SDR position log</description>\r\n"
<<"<styleUrl>#yellowLineGreenPoly</styleUrl>\r\n" <<"<styleUrl>#yellowLineGreenPoly</styleUrl>\r\n"
<<"<LineString>\r\n" <<"<LineString>\r\n"
<<"<extrude>0</extrude>\r\n" <<"<extrude>0</extrude>\r\n"
<<"<tessellate>1</tessellate>\r\n" <<"<tessellate>1</tessellate>\r\n"
<<"<altitudeMode>absolute</altitudeMode>\r\n" <<"<altitudeMode>absolute</altitudeMode>\r\n"
<<"<coordinates>\r\n"; <<"<coordinates>\r\n";
return true; return true;
}else{ }else{
return false; return false;
} }
} }
bool kml_printer::print_position(gps_l1_ca_ls_pvt* position,bool print_average_values) bool kml_printer::print_position(gps_l1_ca_ls_pvt* position,bool print_average_values)
{ {
double latitude; double latitude;
double longitude; double longitude;
double height; double height;
if (print_average_values==false) if (print_average_values==false)
{ {
latitude=position->d_latitude_d; latitude=position->d_latitude_d;
longitude=position->d_longitude_d; longitude=position->d_longitude_d;
height=position->d_height_m; height=position->d_height_m;
}else{ }else{
latitude=position->d_avg_latitude_d; latitude=position->d_avg_latitude_d;
longitude=position->d_avg_longitude_d; longitude=position->d_avg_longitude_d;
height=position->d_avg_height_m; height=position->d_avg_height_m;
} }
if (kml_file.is_open()) if (kml_file.is_open())
{ {
kml_file<<longitude<<","<<latitude<<","<<height<<"\r\n"; kml_file<<longitude<<","<<latitude<<","<<height<<"\r\n";
return true; return true;
}else }else
{ {
return false; return false;
} }
} }
bool kml_printer::close_file() bool kml_printer::close_file()
{ {
if (kml_file.is_open()) if (kml_file.is_open())
{ {
kml_file<<"</coordinates>\r\n" kml_file<<"</coordinates>\r\n"
<<"</LineString>\r\n" <<"</LineString>\r\n"
<<"</Placemark>\r\n" <<"</Placemark>\r\n"
<<"</Document>\r\n" <<"</Document>\r\n"
<<"</kml>"; <<"</kml>";
kml_file.close(); kml_file.close();
return true; return true;
}else{ }else{
return false; return false;
} }
}
kml_printer::kml_printer ()
{
} }
kml_printer::~kml_printer () kml_printer::kml_printer () {}
{
} kml_printer::~kml_printer () {}

View File

@ -1,6 +1,6 @@
/*! /*!
* \file kml_printer.h * \file kml_printer.h
* \brief Prints PVT information to a GoogleEarth kml file * \brief Interface of a class that prints PVT information to a kml file
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* *

View File

@ -1,6 +1,8 @@
/*! /*!
* \file gps_l1_ca_gps_sdr_acquisition.cc * \file gps_l1_ca_gps_sdr_acquisition.cc
* \brief Brief description of the file here * \brief Implementation of an adapter of an acquisition module based
* on the method in Gregory Heckler's GPS-SDR (see http://github.com/gps-sdr/gps-sdr)
* to an AcquisitionInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2011. luis(at)epsilon-formacion.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com
* *
@ -32,19 +34,17 @@
#include "gps_l1_ca_gps_sdr_acquisition.h" #include "gps_l1_ca_gps_sdr_acquisition.h"
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_stream_to_vector.h> #include <gnuradio/gr_stream_to_vector.h>
#include <gnuradio/gr_vector_to_stream.h> #include <gnuradio/gr_vector_to_stream.h>
#include <gnuradio/gr_complex_to_interleaved_short.h> #include <gnuradio/gr_complex_to_interleaved_short.h>
#include <gnuradio/gr_interleaved_short_to_complex.h> #include <gnuradio/gr_interleaved_short_to_complex.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
using google::LogMessage; using google::LogMessage;
//! Constructor // Constructor
GpsL1CaGpsSdrAcquisition::GpsL1CaGpsSdrAcquisition( GpsL1CaGpsSdrAcquisition::GpsL1CaGpsSdrAcquisition(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams, unsigned int in_streams, unsigned int out_streams,
@ -108,11 +108,11 @@ GpsL1CaGpsSdrAcquisition::GpsL1CaGpsSdrAcquisition(
} }
//! Destructor // Destructor
GpsL1CaGpsSdrAcquisition::~GpsL1CaGpsSdrAcquisition() GpsL1CaGpsSdrAcquisition::~GpsL1CaGpsSdrAcquisition()
{} {}
//! Set satellite // Set satellite
void GpsL1CaGpsSdrAcquisition::set_satellite(unsigned int satellite) void GpsL1CaGpsSdrAcquisition::set_satellite(unsigned int satellite)
{ {
satellite_ = satellite; satellite_ = satellite;
@ -128,7 +128,7 @@ void GpsL1CaGpsSdrAcquisition::set_satellite(unsigned int satellite)
} }
//! Set channel // Set channel
void GpsL1CaGpsSdrAcquisition::set_channel(unsigned int channel) void GpsL1CaGpsSdrAcquisition::set_channel(unsigned int channel)
{ {
channel_ = channel; channel_ = channel;
@ -143,7 +143,7 @@ void GpsL1CaGpsSdrAcquisition::set_channel(unsigned int channel)
} }
} }
//! Set acquisition threshold // Set acquisition threshold
void GpsL1CaGpsSdrAcquisition::set_threshold(float threshold) void GpsL1CaGpsSdrAcquisition::set_threshold(float threshold)
{ {
threshold_ = threshold; threshold_ = threshold;
@ -158,7 +158,7 @@ void GpsL1CaGpsSdrAcquisition::set_threshold(float threshold)
} }
} }
//! Set maximum Doppler shift // Set maximum Doppler shift
void GpsL1CaGpsSdrAcquisition::set_doppler_max(unsigned int doppler_max) void GpsL1CaGpsSdrAcquisition::set_doppler_max(unsigned int doppler_max)
{ {
doppler_max_ = doppler_max; doppler_max_ = doppler_max;
@ -173,7 +173,7 @@ void GpsL1CaGpsSdrAcquisition::set_doppler_max(unsigned int doppler_max)
} }
} }
//! Set Channel Queue // Set Channel Queue
void GpsL1CaGpsSdrAcquisition::set_channel_queue( void GpsL1CaGpsSdrAcquisition::set_channel_queue(
concurrent_queue<int> *channel_internal_queue) concurrent_queue<int> *channel_internal_queue)
{ {

View File

@ -1,6 +1,8 @@
/*! /*!
* \file gps_l1_ca_gps_sdr_acquisition.h * \file gps_l1_ca_gps_sdr_acquisition.h
* \brief Brief description of the file here * \brief Interface of an adapter of an acquisition module based
* on the method in Gregory Heckler's GPS-SDR (see http://github.com/gps-sdr/gps-sdr)
* to an AcquisitionInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2011. luis(at)epsilon-formacion.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com
* *

View File

@ -1,11 +1,9 @@
/*! /*!
* \file gps_l1_ca_pcps_acquisition.cc * \file gps_l1_ca_pcps_acquisition.cc
* \brief Brief description of the file here * \brief Adapts a PCPS acquisition block for GPS L1 C/A to an AcquisitionInterface
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* Luis Esteve, 2011. luis(at)epsilon-formacion.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -40,7 +38,6 @@
#include <gnuradio/gr_vector_to_stream.h> #include <gnuradio/gr_vector_to_stream.h>
#include <gnuradio/gr_complex_to_interleaved_short.h> #include <gnuradio/gr_complex_to_interleaved_short.h>
#include <gnuradio/gr_interleaved_short_to_complex.h> #include <gnuradio/gr_interleaved_short_to_complex.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>

View File

@ -1,6 +1,6 @@
/*! /*!
* \file gps_l1_ca_pcps_acquisition.h * \file gps_l1_ca_pcps_acquisition.h
* \brief Brief description of the file here * \brief Adapts a PCPS acquisition block to an AcquisitionInterface for GPS L1 C/A
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* Luis Esteve, 2011. luis(at)epsilon-formacion.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com
* *

View File

@ -53,7 +53,7 @@ gps_l1_ca_pcps_make_acquisition_cc(unsigned int sampled_ms,
gr_msg_queue_sptr queue, bool dump, std::string dump_filename); gr_msg_queue_sptr queue, bool dump, std::string dump_filename);
/*! /*!
* \brief This class implements a PCPS acquisition block * \brief This class implements a PCPS acquisition block for GPS L1 C/A
*/ */
class gps_l1_ca_pcps_acquisition_cc: public gr_block class gps_l1_ca_pcps_acquisition_cc: public gr_block
{ {
@ -130,22 +130,27 @@ public:
} }
void set_satellite(unsigned int satellite); void set_satellite(unsigned int satellite);
void set_active(bool active) void set_active(bool active)
{ {
d_active = active; d_active = active;
} }
void set_channel(unsigned int channel) void set_channel(unsigned int channel)
{ {
d_channel = channel; d_channel = channel;
} }
void set_threshold(float threshold) void set_threshold(float threshold)
{ {
d_threshold = threshold; d_threshold = threshold;
} }
void set_doppler_max(unsigned int doppler_max) void set_doppler_max(unsigned int doppler_max)
{ {
d_doppler_max = doppler_max; d_doppler_max = doppler_max;
} }
void set_doppler_step(unsigned int doppler_step) void set_doppler_step(unsigned int doppler_step)
{ {
d_doppler_step = doppler_step; d_doppler_step = doppler_step;

View File

@ -56,9 +56,9 @@ gps_l1_ca_tong_pcps_acquisition_cc::gps_l1_ca_tong_pcps_acquisition_cc(
unsigned int sampled_ms, unsigned int doppler_max, long freq, unsigned int sampled_ms, unsigned int doppler_max, long freq,
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump, long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
std::string dump_filename) : std::string dump_filename) :
gr_block("gps_l1_ca_tong_pcps_acquisition_cc", gr_make_io_signature(1, 1, gr_block("gps_l1_ca_tong_pcps_acquisition_cc", gr_make_io_signature(1, 1,
sizeof(gr_complex) * samples_per_ms), gr_make_io_signature(0, 0, sizeof(gr_complex) * samples_per_ms), gr_make_io_signature(0, 0,
sizeof(gr_complex) * samples_per_ms)) sizeof(gr_complex) * samples_per_ms))
{ {
// SAMPLE COUNTER // SAMPLE COUNTER
@ -130,9 +130,9 @@ gps_l1_ca_tong_pcps_acquisition_cc::~gps_l1_ca_tong_pcps_acquisition_cc()
delete d_ifft; delete d_ifft;
if (d_dump) if (d_dump)
{ {
d_dump_file.close(); d_dump_file.close();
} }
} }
void gps_l1_ca_tong_pcps_acquisition_cc::set_satellite(unsigned int satellite) void gps_l1_ca_tong_pcps_acquisition_cc::set_satellite(unsigned int satellite)
@ -151,11 +151,11 @@ void gps_l1_ca_tong_pcps_acquisition_cc::set_satellite(unsigned int satellite)
//Conjugate the local code //Conjugate the local code
//! \TODO Optimize it ! Try conj() or Armadillo //! \TODO Optimize it ! Try conj() or Armadillo
for (unsigned int i = 0; i < d_samples; i++) for (unsigned int i = 0; i < d_samples; i++)
{ {
d_fft_codes[i] = std::complex<float>( d_fft_codes[i] = std::complex<float>(
d_fft_if->get_outbuf()[i].real(), d_fft_if->get_outbuf()[i].real(),
-d_fft_if->get_outbuf()[i].imag()); -d_fft_if->get_outbuf()[i].imag());
} }
} }
signed int gps_l1_ca_tong_pcps_acquisition_cc::prn_code_phase() signed int gps_l1_ca_tong_pcps_acquisition_cc::prn_code_phase()
{ {
@ -168,170 +168,170 @@ int gps_l1_ca_tong_pcps_acquisition_cc::general_work(int noutput_items,
{ {
if (!d_active) if (!d_active)
{ {
// sample counter // sample counter
d_sample_counter += d_samples * noutput_items; d_sample_counter += d_samples * noutput_items;
consume_each(noutput_items); consume_each(noutput_items);
} }
else else
{
d_sample_counter += d_samples;
// initialize acquisition algorithm
bool positive_acquisition = false;
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
//float noise_envelope = 0.0;
float vt = 20000;
//float peak = 0.0;
float magt = 0.0;
unsigned int max_freq_step = 2 * (unsigned int)(d_doppler_max
/ d_doppler_step);
unsigned int indext = 0;
// Get the input samples pointer
const gr_complex *in = (const gr_complex *)input_items[0];
// aux vars
std::stringstream filename;
//unsigned int consume_items = 1;
// complex file write
// std::streamsize n = 2 * sizeof(float) * (d_samples);
// 1 - Compute the input noise envelope estimation and the threshold vt
// sine_gen_complex( d_if_sin, d_freq + doppler, d_fs_in, d_samples );
//
// noise_envelope = calculate_envelope( in, d_aux_ca_code, d_if_sin );
// vt = noise_envelope * sqrt( -2 * log( d_pfa ) );
// 1- Compute the input signal power estimation
for (unsigned int i = 0; i < d_samples; i++)
{ {
d_noise_power += std::abs(in[i]); d_sample_counter += d_samples;
}
d_noise_power = sqrt(d_noise_power / (float)d_samples);
//2. Perform the carrier wipe-off // initialize acquisition algorithm
sine_gen_complex(d_if_sin, d_freq + d_doppler, d_fs_in, d_samples);
for (unsigned int i = 0; i < d_samples; i++)
{
d_fft_if->get_inbuf()[i] = in[i] * d_if_sin[i];
}
//3- Perform the FFT-based circular convolution (parallel time search) bool positive_acquisition = false;
d_fft_if->execute(); int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
//TODO Optimize me: use Armadillo! //float noise_envelope = 0.0;
for (unsigned int i = 0; i < d_samples; i++) float vt = 20000;
{ //float peak = 0.0;
d_ifft->get_inbuf()[i] = d_fft_if->get_outbuf()[i] float magt = 0.0;
* d_fft_codes[i]; unsigned int max_freq_step = 2 * (unsigned int)(d_doppler_max
} / d_doppler_step);
unsigned int indext = 0;
d_ifft->execute(); // Get the input samples pointer
const gr_complex *in = (const gr_complex *)input_items[0];
x86_gr_complex_mag(d_ifft->get_outbuf(), d_samples); // d_ifft->get_outbuf()=|abs(·)|^2 and the array is converted from CPX->Float // aux vars
x86_float_max((float*)d_ifft->get_outbuf(), &d_indext, &magt, std::stringstream filename;
d_samples); // find max of |abs(·)|^2 -> index and magt //unsigned int consume_items = 1;
magt = sqrt(magt) / (float)d_samples;
d_test_statistics = magt / d_noise_power;
LOG_AT_LEVEL(INFO) << "Channel: " << d_channel // complex file write
<< ", doing Tong PCSS acquisition of satellite: " // std::streamsize n = 2 * sizeof(float) * (d_samples);
<< d_satellite << ", sample stamp: " << d_sample_counter
<< ", bin_freq " << d_doppler << ", doppler_max: "
<< d_doppler_max << ", K " << d_K << ", sigma: "
<< d_noise_power << ", mag: " << d_test_statistics
<< ", vt: " << vt;
if ((d_test_statistics > vt) && (indext = d_indext)) // 1 - Compute the input noise envelope estimation and the threshold vt
{
d_K++; // sine_gen_complex( d_if_sin, d_freq + doppler, d_fs_in, d_samples );
if (d_K == d_A) //
{ // noise_envelope = calculate_envelope( in, d_aux_ca_code, d_if_sin );
d_code_phase = d_indext; // vt = noise_envelope * sqrt( -2 * log( d_pfa ) );
positive_acquisition = true;
d_doppler_freq = d_doppler;
d_acq_sample_stamp = d_sample_counter; // 1- Compute the input signal power estimation
LOG_AT_LEVEL(INFO) << "positive acquisition"; for (unsigned int i = 0; i < d_samples; i++)
LOG_AT_LEVEL(INFO) << "satellite " << d_satellite;
LOG_AT_LEVEL(INFO) << "sample_stamp " << d_sample_counter;
LOG_AT_LEVEL(INFO) << "test statistics value "
<< d_test_statistics;
LOG_AT_LEVEL(INFO) << "test statistics threshold " << vt;
LOG_AT_LEVEL(INFO) << "code phase " << d_code_phase;
LOG_AT_LEVEL(INFO) << "doppler " << d_doppler_freq;
LOG_AT_LEVEL(INFO) << "magnitude " << magt;
LOG_AT_LEVEL(INFO) << "input signal power " << d_noise_power;
d_dwells = 0;
d_active = false;
}
else d_dwells++;
}
else
{
d_K--;
if ((d_K == 0) || (d_dwells > d_max_dwells))
{
d_K = d_B;
d_dwells = 0;
d_fbins++;
if (d_fbins > max_freq_step)
{ {
d_fbins = 0; d_noise_power += std::abs(in[i]);
LOG_AT_LEVEL(INFO) << "negative acquisition";
LOG_AT_LEVEL(INFO) << "satellite " << d_satellite;
LOG_AT_LEVEL(INFO) << "sample_stamp" << d_sample_counter;
LOG_AT_LEVEL(INFO) << "test statistics value "
<< d_test_statistics;
LOG_AT_LEVEL(INFO) << "test statistics threshold " << vt;
LOG_AT_LEVEL(INFO) << "input signal power "
<< d_noise_power;
d_active = false;
} }
else d_noise_power = sqrt(d_noise_power / (float)d_samples);
//2. Perform the carrier wipe-off
sine_gen_complex(d_if_sin, d_freq + d_doppler, d_fs_in, d_samples);
for (unsigned int i = 0; i < d_samples; i++)
{ {
d_doppler = d_doppler + pow(-1, d_fbins + 1) * d_fbins d_fft_if->get_inbuf()[i] = in[i] * d_if_sin[i];
* d_doppler_step;
} }
}
else d_dwells++;
}
// Record results to files //3- Perform the FFT-based circular convolution (parallel time search)
// if( d_dump ) d_fft_if->execute();
// {
// filename.str( "" );
// filename << "./data/fft_" << doppler << "_.dat";
// std::cout << filename.str().c_str();
// std::cout << ".\n";
// d_dump_file.open( filename.str().c_str(), std::ios::out
// | std::ios::binary );
// d_dump_file.write( (char*) d_ifft->get_outbuf(), n ); //write directly |abs(·)|^2 in this Doppler bin
// d_dump_file.close();
// }
//TODO Optimize me: use Armadillo!
for (unsigned int i = 0; i < d_samples; i++)
{
d_ifft->get_inbuf()[i] = d_fft_if->get_outbuf()[i]
* d_fft_codes[i];
}
if (d_active == false) d_ifft->execute();
{
if (positive_acquisition) x86_gr_complex_mag(d_ifft->get_outbuf(), d_samples); // d_ifft->get_outbuf()=|abs(·)|^2 and the array is converted from CPX->Float
{ x86_float_max((float*)d_ifft->get_outbuf(), &d_indext, &magt,
acquisition_message = 1; d_samples); // find max of |abs(·)|^2 -> index and magt
} magt = sqrt(magt) / (float)d_samples;
d_test_statistics = magt / d_noise_power;
LOG_AT_LEVEL(INFO) << "Channel: " << d_channel
<< ", doing Tong PCSS acquisition of satellite: "
<< d_satellite << ", sample stamp: " << d_sample_counter
<< ", bin_freq " << d_doppler << ", doppler_max: "
<< d_doppler_max << ", K " << d_K << ", sigma: "
<< d_noise_power << ", mag: " << d_test_statistics
<< ", vt: " << vt;
if ((d_test_statistics > vt) && (indext = d_indext))
{
d_K++;
if (d_K == d_A)
{
d_code_phase = d_indext;
positive_acquisition = true;
d_doppler_freq = d_doppler;
d_acq_sample_stamp = d_sample_counter;
LOG_AT_LEVEL(INFO) << "positive acquisition";
LOG_AT_LEVEL(INFO) << "satellite " << d_satellite;
LOG_AT_LEVEL(INFO) << "sample_stamp " << d_sample_counter;
LOG_AT_LEVEL(INFO) << "test statistics value "
<< d_test_statistics;
LOG_AT_LEVEL(INFO) << "test statistics threshold " << vt;
LOG_AT_LEVEL(INFO) << "code phase " << d_code_phase;
LOG_AT_LEVEL(INFO) << "doppler " << d_doppler_freq;
LOG_AT_LEVEL(INFO) << "magnitude " << magt;
LOG_AT_LEVEL(INFO) << "input signal power " << d_noise_power;
d_dwells = 0;
d_active = false;
}
else d_dwells++;
}
else else
{ {
acquisition_message = 2; d_K--;
} if ((d_K == 0) || (d_dwells > d_max_dwells))
{
d_K = d_B;
d_dwells = 0;
d_fbins++;
if (d_fbins > max_freq_step)
{
d_fbins = 0;
LOG_AT_LEVEL(INFO) << "negative acquisition";
LOG_AT_LEVEL(INFO) << "satellite " << d_satellite;
LOG_AT_LEVEL(INFO) << "sample_stamp" << d_sample_counter;
LOG_AT_LEVEL(INFO) << "test statistics value "
<< d_test_statistics;
LOG_AT_LEVEL(INFO) << "test statistics threshold " << vt;
LOG_AT_LEVEL(INFO) << "input signal power "
<< d_noise_power;
d_active = false;
}
else
{
d_doppler = d_doppler + pow(-1, d_fbins + 1) * d_fbins
* d_doppler_step;
}
}
else d_dwells++;
}
d_channel_internal_queue->push(acquisition_message); // Record results to files
// if( d_dump )
// {
// filename.str( "" );
// filename << "./data/fft_" << doppler << "_.dat";
// std::cout << filename.str().c_str();
// std::cout << ".\n";
// d_dump_file.open( filename.str().c_str(), std::ios::out
// | std::ios::binary );
// d_dump_file.write( (char*) d_ifft->get_outbuf(), n ); //write directly |abs(·)|^2 in this Doppler bin
// d_dump_file.close();
// }
if (d_active == false)
{
if (positive_acquisition)
{
acquisition_message = 1;
}
else
{
acquisition_message = 2;
}
d_channel_internal_queue->push(acquisition_message);
}
consume_each(1);
} }
consume_each(1);
}
return 0; return 0;
} }
@ -344,10 +344,10 @@ float gps_l1_ca_tong_pcps_acquisition_cc::calculate_envelope(
//std::cout << "tmp_cpx " << tmp_cpx << std::endl; //std::cout << "tmp_cpx " << tmp_cpx << std::endl;
for (unsigned int i = 0; i < d_samples; i++) for (unsigned int i = 0; i < d_samples; i++)
{ {
tmp_cpx = tmp_cpx + _input_signal[i] * _local_code[i] tmp_cpx = tmp_cpx + _input_signal[i] * _local_code[i]
* _local_if_sin[i]; * _local_if_sin[i];
} }
//std::cout << "tmp_cpx " << tmp_cpx << std::endl; //std::cout << "tmp_cpx " << tmp_cpx << std::endl;
mag = abs(tmp_cpx); mag = abs(tmp_cpx);

View File

@ -44,10 +44,12 @@
#include "concurrent_queue.h" #include "concurrent_queue.h"
class gps_l1_ca_tong_pcps_acquisition_cc; class gps_l1_ca_tong_pcps_acquisition_cc;
typedef boost::shared_ptr<gps_l1_ca_tong_pcps_acquisition_cc> typedef boost::shared_ptr<gps_l1_ca_tong_pcps_acquisition_cc>
gps_l1_ca_tong_pcps_acquisition_cc_sptr; gps_l1_ca_tong_pcps_acquisition_cc_sptr;
gps_l1_ca_tong_pcps_acquisition_cc_sptr gps_l1_ca_tong_pcps_acquisition_cc_sptr
gps_l1_ca_tong_pcps_make_acquisition_cc(unsigned int sampled_ms, gps_l1_ca_tong_pcps_make_acquisition_cc(unsigned int sampled_ms,
unsigned int doppler_max, long freq, long fs_in, int samples_per_ms, unsigned int doppler_max, long freq, long fs_in, int samples_per_ms,
gr_msg_queue_sptr queue, bool dump, std::string dump_filename); gr_msg_queue_sptr queue, bool dump, std::string dump_filename);

View File

@ -4,8 +4,6 @@
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2011. luis(at)epsilon-formacion.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -32,34 +30,30 @@
*/ */
#include "channel.h" #include "channel.h"
#include "acquisition_interface.h" #include "acquisition_interface.h"
#include "tracking_interface.h" #include "tracking_interface.h"
#include "telemetry_decoder_interface.h" #include "telemetry_decoder_interface.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gnss_flowgraph.h" #include "gnss_flowgraph.h"
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_message.h> #include <gnuradio/gr_message.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
using google::LogMessage; using google::LogMessage;
//! Constructor // Constructor
Channel::Channel(ConfigurationInterface *configuration, unsigned int channel, Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
GNSSBlockInterface *pass_through, AcquisitionInterface *acq, GNSSBlockInterface *pass_through, AcquisitionInterface *acq,
TrackingInterface *trk, TelemetryDecoderInterface *nav, TrackingInterface *trk, TelemetryDecoderInterface *nav,
std::string role, std::string implementation, gr_msg_queue_sptr queue) : std::string role, std::string implementation, gr_msg_queue_sptr queue) :
pass_through_(pass_through), acq_(acq), trk_(trk), nav_(nav), pass_through_(pass_through), acq_(acq), trk_(trk), nav_(nav),
role_(role), implementation_(implementation), channel_(channel), role_(role), implementation_(implementation), channel_(channel),
queue_(queue) queue_(queue)
{ {
stop_ = false; stop_ = false;
@ -95,7 +89,7 @@ Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
} }
//! Destructor // Destructor
Channel::~Channel() Channel::~Channel()
{ {
@ -109,10 +103,10 @@ void Channel::connect(gr_top_block_sptr top_block)
{ {
if (connected_) if (connected_)
{ {
LOG_AT_LEVEL(WARNING) << "channel already connected internally"; LOG_AT_LEVEL(WARNING) << "channel already connected internally";
return; return;
} }
pass_through_->connect(top_block); pass_through_->connect(top_block);
acq_->connect(top_block); acq_->connect(top_block);
@ -140,10 +134,10 @@ void Channel::disconnect(gr_top_block_sptr top_block)
{ {
if (!connected_) if (!connected_)
{ {
LOG_AT_LEVEL(WARNING) << "Channel already disconnected internally"; LOG_AT_LEVEL(WARNING) << "Channel already disconnected internally";
return; return;
} }
top_block->disconnect(acq_->get_right_block(), 0, trk_->get_left_block(), top_block->disconnect(acq_->get_right_block(), 0, trk_->get_left_block(),
0); 0);
@ -190,15 +184,15 @@ void Channel::run()
{ {
start_acquisition(); start_acquisition();
while (!stop_) while (!stop_)
{ {
channel_internal_queue_.wait_and_pop(message_); channel_internal_queue_.wait_and_pop(message_);
process_channel_messages(); process_channel_messages();
} }
} }
/* /*
* \brief Set stop_ to true and blocks the calling thread until * Set stop_ to true and blocks the calling thread until
* the thread of the constructor has completed * the thread of the constructor has completed
*/ */
void Channel::stop() void Channel::stop()
@ -224,46 +218,46 @@ void Channel::process_channel_messages()
{ {
switch (message_) switch (message_)
{ {
case 0: case 0:
LOG_AT_LEVEL(INFO) << "Stop channel " << channel_; LOG_AT_LEVEL(INFO) << "Stop channel " << channel_;
break; break;
case 1: case 1:
LOG_AT_LEVEL(INFO) << "Channel " << channel_ LOG_AT_LEVEL(INFO) << "Channel " << channel_
<< " ACQ SUCCESS satellite " << satellite_; << " ACQ SUCCESS satellite " << satellite_;
channel_fsm_.Event_gps_valid_acquisition(); channel_fsm_.Event_gps_valid_acquisition();
break; break;
case 2: case 2:
LOG_AT_LEVEL(INFO) << "Channel " << channel_ LOG_AT_LEVEL(INFO) << "Channel " << channel_
<< " ACQ FAILED satellite " << satellite_; << " ACQ FAILED satellite " << satellite_;
if (repeat_ == true) if (repeat_ == true)
{ {
channel_fsm_.Event_gps_failed_acquisition_repeat(); channel_fsm_.Event_gps_failed_acquisition_repeat();
} }
else else
{ {
channel_fsm_.Event_gps_failed_acquisition_no_repeat(); channel_fsm_.Event_gps_failed_acquisition_no_repeat();
} }
break; break;
case 3: case 3:
LOG_AT_LEVEL(INFO) << "Channel " << channel_ LOG_AT_LEVEL(INFO) << "Channel " << channel_
<< " TRACKING FAILED satellite " << satellite_ << " TRACKING FAILED satellite " << satellite_
<< ", reacquisition."; << ", reacquisition.";
channel_fsm_.Event_gps_failed_tracking(); channel_fsm_.Event_gps_failed_tracking();
break; break;
default: default:
LOG_AT_LEVEL(WARNING) << "Default case, invalid message."; LOG_AT_LEVEL(WARNING) << "Default case, invalid message.";
break; break;
} }
} }

View File

@ -1,6 +1,6 @@
/*! /*!
* \file channel.h * \file channel.h
* \brief This class represents a GNSS channel. * \brief Interface of a GNSS channel.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2011. luis(at)epsilon-formacion.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com
* *
@ -88,6 +88,11 @@ public:
void start_acquisition(); void start_acquisition();
void set_satellite(unsigned int satellite); void set_satellite(unsigned int satellite);
void start(); void start();
/*!
* \brief Set stop_ to true and blocks the calling thread until
* the thread of the constructor has completed
*/
void stop(); void stop();
private: private:

View File

@ -1,10 +1,8 @@
/*! /*!
* \file gps_l1_ca_channel_fsm.cc * \file gps_l1_ca_channel_fsm.cc
* \briefState Machine for channel using boost::statechart * \brief Implementation of a State Machine for channel using boost::statechart
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com * \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -33,32 +31,31 @@
#include "gps_l1_ca_channel_fsm.h" #include "gps_l1_ca_channel_fsm.h"
#include "control_message_factory.h" #include "control_message_factory.h"
#include "channel.h" #include "channel.h"
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
struct Ev_gps_channel_start_acquisition: sc::event< struct Ev_gps_channel_start_acquisition: sc::event<
Ev_gps_channel_start_acquisition> Ev_gps_channel_start_acquisition>
{}; {};
struct Ev_gps_channel_valid_acquisition: sc::event< struct Ev_gps_channel_valid_acquisition: sc::event<
Ev_gps_channel_valid_acquisition> Ev_gps_channel_valid_acquisition>
{}; {};
struct Ev_gps_channel_failed_acquisition_repeat: sc::event< struct Ev_gps_channel_failed_acquisition_repeat: sc::event<
Ev_gps_channel_failed_acquisition_repeat> Ev_gps_channel_failed_acquisition_repeat>
{}; {};
struct Ev_gps_channel_failed_acquisition_no_repeat: sc::event< struct Ev_gps_channel_failed_acquisition_no_repeat: sc::event<
Ev_gps_channel_failed_acquisition_no_repeat> Ev_gps_channel_failed_acquisition_no_repeat>
{}; {};
struct Ev_gps_channel_failed_tracking: sc::event< struct Ev_gps_channel_failed_tracking: sc::event<
Ev_gps_channel_failed_tracking> Ev_gps_channel_failed_tracking>
{}; {};
struct gps_channel_idle_fsm_S0: public sc::state<gps_channel_idle_fsm_S0, struct gps_channel_idle_fsm_S0: public sc::state<gps_channel_idle_fsm_S0,
GpsL1CaChannelFsm> GpsL1CaChannelFsm>
{ {
public: public:
// sc::transition(event, next state) // sc::transition(event, next state)
@ -72,7 +69,7 @@ public:
}; };
struct gps_channel_acquiring_fsm_S1: public sc::state< struct gps_channel_acquiring_fsm_S1: public sc::state<
gps_channel_acquiring_fsm_S1, GpsL1CaChannelFsm> gps_channel_acquiring_fsm_S1, GpsL1CaChannelFsm>
{ {
public: public:
typedef mpl::list<sc::transition< typedef mpl::list<sc::transition<
@ -81,7 +78,7 @@ public:
Ev_gps_channel_failed_acquisition_repeat, Ev_gps_channel_failed_acquisition_repeat,
gps_channel_acquiring_fsm_S1>, sc::transition< gps_channel_acquiring_fsm_S1>, sc::transition<
Ev_gps_channel_valid_acquisition, gps_channel_tracking_fsm_S2> > Ev_gps_channel_valid_acquisition, gps_channel_tracking_fsm_S2> >
reactions; reactions;
gps_channel_acquiring_fsm_S1(my_context ctx) : gps_channel_acquiring_fsm_S1(my_context ctx) :
my_base(ctx) my_base(ctx)
@ -92,7 +89,7 @@ public:
}; };
struct gps_channel_tracking_fsm_S2: public sc::state< struct gps_channel_tracking_fsm_S2: public sc::state<
gps_channel_tracking_fsm_S2, GpsL1CaChannelFsm> gps_channel_tracking_fsm_S2, GpsL1CaChannelFsm>
{ {
public: public:
typedef sc::transition<Ev_gps_channel_failed_tracking, typedef sc::transition<Ev_gps_channel_failed_tracking,
@ -107,7 +104,7 @@ public:
}; };
struct gps_channel_waiting_fsm_S3: public sc::state< struct gps_channel_waiting_fsm_S3: public sc::state<
gps_channel_waiting_fsm_S3, GpsL1CaChannelFsm> gps_channel_waiting_fsm_S3, GpsL1CaChannelFsm>
{ {
public: public:
typedef sc::transition<Ev_gps_channel_start_acquisition, typedef sc::transition<Ev_gps_channel_start_acquisition,
@ -127,7 +124,7 @@ GpsL1CaChannelFsm::GpsL1CaChannelFsm()
} }
GpsL1CaChannelFsm::GpsL1CaChannelFsm(AcquisitionInterface *acquisition) : GpsL1CaChannelFsm::GpsL1CaChannelFsm(AcquisitionInterface *acquisition) :
acq_(acquisition) acq_(acquisition)
{ {
initiate(); //start the FSM initiate(); //start the FSM
} }
@ -200,9 +197,9 @@ void GpsL1CaChannelFsm::request_satellite()
{ {
ControlMessageFactory* cmf = new ControlMessageFactory(); ControlMessageFactory* cmf = new ControlMessageFactory();
if (queue_ != gr_msg_queue_sptr()) if (queue_ != gr_msg_queue_sptr())
{ {
queue_->handle(cmf->GetQueueMessage(channel_, 0)); queue_->handle(cmf->GetQueueMessage(channel_, 0));
} }
delete cmf; delete cmf;
} }

View File

@ -59,8 +59,7 @@ struct gps_channel_waiting_fsm_S3;
/*! /*!
* \brief This class implements a State Machine for channel using boost::statechart * \brief This class implements a State Machine for channel using boost::statechart
*/ */
class GpsL1CaChannelFsm: public sc::state_machine<GpsL1CaChannelFsm, class GpsL1CaChannelFsm: public sc::state_machine<GpsL1CaChannelFsm,gps_channel_idle_fsm_S0>
gps_channel_idle_fsm_S0>
{ {
public: public:

View File

@ -1,10 +1,9 @@
/*! /*!
* \file direct_resampler_conditioner.cc * \file direct_resampler_conditioner.cc
* \brief Brief description of the file here * \brief Implementation of an adapter of a direct resampler conditioner block
* to a SignalConditionerInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -31,15 +30,11 @@
*/ */
#include "direct_resampler_conditioner.h" #include "direct_resampler_conditioner.h"
// #include <gnuradio/usrp_source_c.h> // #include <gnuradio/usrp_source_c.h>
#include <gnuradio/gr_file_sink.h> #include <gnuradio/gr_file_sink.h>
#include "direct_resampler_conditioner_cc.h" #include "direct_resampler_conditioner_cc.h"
#include "direct_resampler_conditioner_ss.h" #include "direct_resampler_conditioner_ss.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
@ -48,7 +43,7 @@ using google::LogMessage;
DirectResamplerConditioner::DirectResamplerConditioner( DirectResamplerConditioner::DirectResamplerConditioner(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_stream, unsigned int out_stream) : unsigned int in_stream, unsigned int out_stream) :
role_(role), in_stream_(in_stream), out_stream_(out_stream) role_(role), in_stream_(in_stream), out_stream_(out_stream)
{ {
std::string default_item_type = "short"; std::string default_item_type = "short";
@ -65,64 +60,62 @@ DirectResamplerConditioner::DirectResamplerConditioner(
default_dump_file); default_dump_file);
if (item_type_.compare("gr_complex") == 0) if (item_type_.compare("gr_complex") == 0)
{ {
item_size_ = sizeof(gr_complex); item_size_ = sizeof(gr_complex);
resampler_ = direct_resampler_make_conditioner_cc(sample_freq_in_, resampler_ = direct_resampler_make_conditioner_cc(sample_freq_in_,
sample_freq_out_); sample_freq_out_);
} }
else if (item_type_.compare("short") == 0) else if (item_type_.compare("short") == 0)
{ {
item_size_ = sizeof(short); item_size_ = sizeof(short);
resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_, resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_,
sample_freq_out_); sample_freq_out_);
} }
else else
{ {
LOG_AT_LEVEL(WARNING) << item_type_ LOG_AT_LEVEL(WARNING) << item_type_
<< " unrecognized item type. Using short"; << " unrecognized item type. Using short";
item_size_ = sizeof(short); item_size_ = sizeof(short);
} }
if (dump_) if (dump_)
{ {
DLOG(INFO) << "Dumping output into file " << dump_filename_; DLOG(INFO) << "Dumping output into file " << dump_filename_;
file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
} }
DLOG(INFO) << "sample_freq_in " << sample_freq_in_; DLOG(INFO) << "sample_freq_in " << sample_freq_in_;
DLOG(INFO) << "sample_freq_out" << sample_freq_out_; DLOG(INFO) << "sample_freq_out" << sample_freq_out_;
DLOG(INFO) << "Item size " << item_size_; DLOG(INFO) << "Item size " << item_size_;
DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")"; DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")";
if (dump_) if (dump_)
{ {
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
} }
}
DirectResamplerConditioner::~DirectResamplerConditioner()
{
} }
DirectResamplerConditioner::~DirectResamplerConditioner() {}
void DirectResamplerConditioner::connect(gr_top_block_sptr top_block) void DirectResamplerConditioner::connect(gr_top_block_sptr top_block)
{ {
if (dump_) if (dump_)
{ {
top_block->connect(resampler_, 0, file_sink_, 0); top_block->connect(resampler_, 0, file_sink_, 0);
DLOG(INFO) << "connected resampler to file sink"; DLOG(INFO) << "connected resampler to file sink";
} }
else else
{ {
DLOG(INFO) << "nothing to connect internally"; DLOG(INFO) << "nothing to connect internally";
} }
} }
void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block) void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block)
{ {
if (dump_) if (dump_)
{ {
top_block->disconnect(resampler_, 0, file_sink_, 0); top_block->disconnect(resampler_, 0, file_sink_, 0);
} }
} }
gr_basic_block_sptr DirectResamplerConditioner::get_left_block() gr_basic_block_sptr DirectResamplerConditioner::get_left_block()

View File

@ -1,10 +1,9 @@
/*! /*!
* \file direct_resampler_conditioner.h * \file direct_resampler_conditioner.h
* \brief This class represents a direct resampler. * \brief Interface of an adapter of a direct resampler conditioner block
* to a SignalConditionerInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -42,9 +41,10 @@ class DirectResamplerConditioner: public GNSSBlockInterface
{ {
public: public:
DirectResamplerConditioner(ConfigurationInterface* configuration, DirectResamplerConditioner(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, std::string role, unsigned int in_stream,
unsigned int out_stream); unsigned int out_stream);
virtual ~DirectResamplerConditioner(); virtual ~DirectResamplerConditioner();
std::string role() std::string role()
@ -70,7 +70,6 @@ private:
std::string role_; std::string role_;
unsigned int in_stream_; unsigned int in_stream_;
unsigned int out_stream_; unsigned int out_stream_;
std::string item_type_; std::string item_type_;
size_t item_size_; size_t item_size_;
long samples_; long samples_;
@ -78,7 +77,6 @@ private:
std::string dump_filename_; std::string dump_filename_;
double sample_freq_in_; double sample_freq_in_;
double sample_freq_out_; double sample_freq_out_;
gr_block_sptr resampler_; gr_block_sptr resampler_;
gr_block_sptr file_sink_; gr_block_sptr file_sink_;
}; };

View File

@ -1,11 +1,9 @@
/*! /*!
* \file gnss_sdr_valve.h * \file gnss_sdr_valve.h
* \brief This class implements a GNU Radio block that sends a STOP message to the * \brief Interface of a GNU Radio block that sends a STOP message to the
* control queue right after a specific number of samples have passed through it. * control queue right after a specific number of samples have passed through it.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -34,8 +32,8 @@
#ifndef GNSS_SDR_VALVE_H_ #ifndef GNSS_SDR_GNSS_SDR_VALVE_H_
#define GNSS_SDR_VALVE_H_ #define GNSS_SDR_GNSS_SDR_VALVE_H_
#include <cstring> #include <cstring>
#include <gr_sync_block.h> #include <gr_sync_block.h>
@ -66,4 +64,4 @@ public:
gr_vector_void_star &output_items); gr_vector_void_star &output_items);
}; };
#endif /*GNSS_SDR_VALVE_H_*/ #endif /*GNSS_SDR_GNSS_SDR_VALVE_H_*/

View File

@ -1,6 +1,7 @@
/*! /*!
* \file pass_through.cc * \file pass_through.cc
* \brief Brief description of the file here * \brief Implementation of a block that just puts its input in its
* output.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* Detailed description of the file here if needed. * Detailed description of the file here if needed.
@ -33,14 +34,10 @@
#include "pass_through.h" #include "pass_through.h"
#include <iostream> #include <iostream>
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
#include "configuration_interface.h" #include "configuration_interface.h"
using google::LogMessage; using google::LogMessage;

View File

@ -1,6 +1,6 @@
/*! /*!
* \file pass_through.h * \file pass_through.h
* \brief This class represent a block that just puts its input in its * \brief Interface of a block that just puts its input in its
* output. * output.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
@ -33,13 +33,12 @@
#ifndef PASS_THROUGH_H_ #ifndef GNSS_SDR_PASS_THROUGH_H_
#define PASS_THROUGH_H_ #define GNSS_SDR_PASS_THROUGH_H_
#include <gr_hier_block2.h> #include <gr_hier_block2.h>
#include <gr_kludge_copy.h> #include <gr_kludge_copy.h>
#include <gr_file_sink.h> #include <gr_file_sink.h>
#include "gnss_block_interface.h" #include "gnss_block_interface.h"
class ConfigurationInterface; class ConfigurationInterface;
@ -94,4 +93,4 @@ private:
size_t item_size_; size_t item_size_;
}; };
#endif /*PASS_THROUGH_H_*/ #endif /*GNSS_SDR_PASS_THROUGH_H_*/

View File

@ -1,10 +1,9 @@
/*! /*!
* \file gps_l1_ca_observables.cc * \file gps_l1_ca_observables.cc
* \brief Brief description of the file here * \brief Implementation of an adapter of a GPS L1 C/A observables block
* to a SignalConditionerInterface
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -31,17 +30,12 @@
*/ */
#include "gps_l1_ca_observables.h" #include "gps_l1_ca_observables.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gps_l1_ca_observables_cc.h" #include "gps_l1_ca_observables_cc.h"
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_stream_to_vector.h> #include <gnuradio/gr_stream_to_vector.h>
#include <gnuradio/gr_vector_to_stream.h> #include <gnuradio/gr_vector_to_stream.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
@ -60,8 +54,8 @@ GpsL1CaObservables::GpsL1CaObservables(ConfigurationInterface* configuration,
queue_(queue) queue_(queue)
{ {
int output_rate_ms; int output_rate_ms;
output_rate_ms=configuration->property(role + ".output_rate_ms", 500); output_rate_ms=configuration->property(role + ".output_rate_ms", 500);
std::string default_dump_filename = "./observables.dat"; std::string default_dump_filename = "./observables.dat";
@ -74,8 +68,8 @@ GpsL1CaObservables::GpsL1CaObservables(ConfigurationInterface* configuration,
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
fs_in_ = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
observables_ = gps_l1_ca_make_observables_cc(in_streams_, queue_, dump_,dump_filename_,output_rate_ms,flag_averaging); observables_ = gps_l1_ca_make_observables_cc(in_streams_, queue_, dump_,dump_filename_,output_rate_ms,flag_averaging);
observables_->set_fs_in(fs_in_); observables_->set_fs_in(fs_in_);
DLOG(INFO) << "pseudorange(" << observables_->unique_id() << ")"; DLOG(INFO) << "pseudorange(" << observables_->unique_id() << ")";
// set the navigation msg queue; // set the navigation msg queue;

View File

@ -1,10 +1,9 @@
/*! /*!
* \file gps_l1_ca_observables.h * \file gps_l1_ca_observables.h
* \brief Brief description of the file here * \brief Interface of an adapter of a GPS L1 C/A observables block
* to a SignalConditionerInterface
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)

View File

@ -1,6 +1,6 @@
/*! /*!
* \file gps_l1_ca_observables_cc.cc * \file gps_l1_ca_observables_cc.cc
* \brief Pseudorange computation module for GPS L1 C/A * \brief Implementation of the pseudorange computation block for GPS L1 C/A
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
@ -32,17 +32,12 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <algorithm> #include <algorithm>
# include <bitset> #include <bitset>
#include <cmath> #include <cmath>
#include "math.h" #include "math.h"
#include "gps_l1_ca_observables_cc.h" #include "gps_l1_ca_observables_cc.h"
#include "control_message_factory.h" #include "control_message_factory.h"
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>

View File

@ -1,6 +1,6 @@
/*! /*!
* \file gps_l1_ca_observables_cc.h * \file gps_l1_ca_observables_cc.h
* \brief Interface of the pseudorange computation module for GPS L1 C/A * \brief Interface of the pseudorange computation block for GPS L1 C/A
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *

View File

@ -1,10 +1,9 @@
/*! /*!
* \file file_output_filter.cc * \file file_output_filter.cc
* \brief Brief description of the file here * \brief Implementation of an adapter of a file output filter block
* to an OutputFilterInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -30,15 +29,10 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "file_output_filter.h" #include "file_output_filter.h"
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <gr_io_signature.h> #include <gr_io_signature.h>
#include "configuration_interface.h" #include "configuration_interface.h"
using google::LogMessage; using google::LogMessage;

View File

@ -1,11 +1,10 @@
/*! /*!
* \file file_output_filter.h * \file file_output_filter.h
* \brief This class represents an output filter that sends its output * \brief Interface of an adapter of a file output filter block to an
* to a file without any change in the data format. * OutputFilterInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* *
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -41,6 +40,10 @@
class ConfigurationInterface; class ConfigurationInterface;
/*!
* \brief An output filter that sends its output
* to a file without any change in the data format.
*/
class FileOutputFilter : public GNSSBlockInterface class FileOutputFilter : public GNSSBlockInterface
{ {
@ -74,7 +77,6 @@ private:
gr_file_sink_sptr file_sink_; gr_file_sink_sptr file_sink_;
size_t item_size_; size_t item_size_;
std::string filename_; std::string filename_;
std::string item_type_; std::string item_type_;
std::string role_; std::string role_;

View File

@ -1,10 +1,9 @@
/*! /*!
* \file null_sink_output_filter.cc * \file null_sink_output_filter.cc
* \brief Brief description of the file here * \brief Implementation of an adapter of a null sink output filter block to an
* OutputFilterInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -33,12 +32,9 @@
#include "null_sink_output_filter.h" #include "null_sink_output_filter.h"
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <gr_io_signature.h> #include <gr_io_signature.h>
#include "configuration_interface.h" #include "configuration_interface.h"
using google::LogMessage; using google::LogMessage;

View File

@ -1,6 +1,7 @@
/*! /*!
* \file null_sink_output_filter.h * \file null_sink_output_filter.h
* \brief Interface of a null sink output filter * \brief Interface of an adapter of a null sink output filter block to an
* OutputFilterInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* This class represents an implementation of an output filter that * This class represents an implementation of an output filter that

View File

@ -1,11 +1,10 @@
/*! /*!
* \file file_signal_source.cc * \file file_signal_source.cc
* \brief Brief description of the file here * \brief Implementation of a class that reads signals samples from a file
* and adapts it to a SignalSourceInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Javier Arribas, 2011 jarribas(at)cttc.es * Javier Arribas, 2011 jarribas(at)cttc.es
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -32,10 +31,8 @@
*/ */
#include "file_signal_source.h" #include "file_signal_source.h"
#include "gnss_sdr_valve.h" #include "gnss_sdr_valve.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
@ -43,7 +40,6 @@
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
using google::LogMessage; using google::LogMessage;
@ -106,7 +102,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
{ {
/*! /*!
* BUG workaround: The GNURadio file source does not stop the receiver after reaching the End of File. * BUG workaround: The GNURadio file source does not stop the receiver after reaching the End of File.
* A possible solution is to compute the file lenght in samples using file size, excluding the last 100 milliseconds, and enable always the * A possible solution is to compute the file length in samples using file size, excluding the last 100 milliseconds, and enable always the
* valve block * valve block
*/ */
std::ifstream file (filename_.c_str(), std::ios::in|std::ios::binary|std::ios::ate); std::ifstream file (filename_.c_str(), std::ios::in|std::ios::binary|std::ios::ate);

View File

@ -1,10 +1,11 @@
/*! /*!
* \file file_signal_source.h * \file file_signal_source.h
* \brief This class reads signals samples from a file * \brief Interface of a class that reads signals samples from a file
* and adapts it to a SignalSourceInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* This class represents a file signal source. Internally it uses a GNU Radio's gr_file_source * This class represents a file signal source. Internally it uses a GNU Radio's
* a a connector to the data. * gr_file_source as a connector to the data.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *

View File

@ -1,10 +1,9 @@
/*! /*!
* \file gps_l1_ca_telemetry_decoder.cc * \file gps_l1_ca_telemetry_decoder.cc
* \brief This class implements a NAV data decoder for GPS L1 C/A * \brief Implementation of an adapter of a GPS L1 C/A NAV data decoder block
* to a TelemetryDecoderInterface
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -31,7 +30,6 @@
*/ */
#include "gps_l1_ca_telemetry_decoder.h" #include "gps_l1_ca_telemetry_decoder.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gps_l1_ca_telemetry_decoder_cc.h" #include "gps_l1_ca_telemetry_decoder_cc.h"

View File

@ -1,6 +1,7 @@
/*! /*!
* \file gps_l1_ca_telemetry_decoder.h * \file gps_l1_ca_telemetry_decoder.h
* \brief This class implements a NAV data decoder for GPS L1 C/A * \brief Interface of an adapter of a GPS L1 C/A NAV data decoder block
* to a TelemetryDecoderInterface
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------

View File

@ -1,6 +1,7 @@
/*! /*!
* \file gps_l1_ca_telemetry_decoder_cc.cc * \file gps_l1_ca_telemetry_decoder_cc.cc
* \brief Navigation message demodulator based on the Kay Borre book MATLAB-based GPS receiver * \brief Implementation of a NAV message demodulator block based on
* Kay Borre book MATLAB-based GPS receiver
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------

View File

@ -1,6 +1,7 @@
/*! /*!
* \file gps_l1_ca_telemetry_decoder_cc.h * \file gps_l1_ca_telemetry_decoder_cc.h
* \brief Navigation message demodulator based on the Kay Borre book MATLAB-based GPS receiver * \brief Interface of a NAV message demodulator block based on
* Kay Borre book MATLAB-based GPS receiver
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *

View File

@ -1,11 +1,13 @@
/*! /*!
* \file gps_l1_ca_dll_fll_pll_tracking.cc * \file gps_l1_ca_dll_fll_pll_tracking.cc
* \brief code DLL + carrier FLL/PLL tracking * \brief Implementation of an adapter of a code DLL + carrier FLL/PLL tracking
* loop for GPS L1 C/A to a TrackingInterface
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* This file implements the code Delay Locked Loop (DLL) + carrier Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL) stage * This file implements the code Delay Locked Loop (DLL) + carrier Phase
* according to the algorithms described in [1] * Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL)
* [1] E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and * according to the algorithms described in:
* E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* Applications, Second Edition, Artech House Publishers, 2005. * Applications, Second Edition, Artech House Publishers, 2005.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
@ -40,18 +42,21 @@
#include <boost/math/special_functions/round.hpp> #include <boost/math/special_functions/round.hpp>
#endif #endif
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
using google::LogMessage; using google::LogMessage;
GpsL1CaDllFllPllTracking::GpsL1CaDllFllPllTracking( GpsL1CaDllFllPllTracking::GpsL1CaDllFllPllTracking(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration,
unsigned int in_streams, unsigned int out_streams, std::string role,
unsigned int in_streams, unsigned int
out_streams,
gr_msg_queue_sptr queue) : gr_msg_queue_sptr queue) :
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_( role_(role),
queue) in_streams_(in_streams),
out_streams_(out_streams),
queue_(queue)
{ {
DLOG(INFO) << "role " << role; DLOG(INFO) << "role " << role;

View File

@ -1,11 +1,13 @@
/*! /*!
* \file gps_l1_ca_dll_fll_pll_tracking.h * \file gps_l1_ca_dll_fll_pll_tracking.h
* \brief code DLL + carrier FLL/PLL tracking * \brief Interface of an adapter of a code DLL + carrier FLL/PLL tracking
* loop for GPS L1 C/A to a TrackingInterface
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* This file implements the code Delay Locked Loop (DLL) + carrier Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL) stage * This is the interface of a code Delay Locked Loop (DLL) + carrier
* according to the algorithms described in [1] * Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL)
* [1] E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and * according to the algorithms described in:
* E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* Applications, Second Edition, Artech House Publishers, 2005. * Applications, Second Edition, Artech House Publishers, 2005.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------

View File

@ -1,12 +1,14 @@
/*! /*!
* \file gps_l1_ca_dll_pll_tracking.cc * \file gps_l1_ca_dll_pll_tracking.cc
* \brief code DLL + carrier PLL * \brief Implementation of an adapter of a DLL+PLL tracking loop block
* for GPS L1 C/A to a TrackingInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Javier Arribas, 2011. jarribas(at)cttc.es * Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Code DLL + carrier PLL according to the algorithms described in [1] * Code DLL + carrier PLL according to the algorithms described in:
* [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach, Birkha user, 2007 * A Software-Defined GPS and Galileo Receiver. A Single-Frequency
* Approach, Birkhauser, 2007
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
@ -40,7 +42,6 @@
#include <boost/math/special_functions/round.hpp> #include <boost/math/special_functions/round.hpp>
#endif #endif
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
@ -50,8 +51,8 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams, unsigned int in_streams, unsigned int out_streams,
gr_msg_queue_sptr queue) : gr_msg_queue_sptr queue) :
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_( role_(role), in_streams_(in_streams), out_streams_(out_streams),
queue) queue_(queue)
{ {
DLOG(INFO) << "role " << role; DLOG(INFO) << "role " << role;
@ -82,22 +83,22 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
std::string default_dump_filename = "./track_ch"; std::string default_dump_filename = "./track_ch";
dump_filename = configuration->property(role + ".dump_filename", dump_filename = configuration->property(role + ".dump_filename",
default_dump_filename); //unused! default_dump_filename); //unused!
#ifdef GNSS_SDR_USE_BOOST_ROUND #ifdef GNSS_SDR_USE_BOOST_ROUND
vector_length = round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); vector_length = round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
#else #else
vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
#endif #endif
//################# MAKE TRACKING GNURadio object ################### //################# MAKE TRACKING GNURadio object ###################
if (item_type.compare("gr_complex") == 0) if (item_type.compare("gr_complex") == 0)
{ {
item_size_ = sizeof(gr_complex); item_size_ = sizeof(gr_complex);
tracking_ = gps_l1_ca_dll_pll_make_tracking_cc(satellite_, f_if, tracking_ = gps_l1_ca_dll_pll_make_tracking_cc(satellite_, f_if,
fs_in, vector_length, queue_, dump, dump_filename, pll_bw_hz,dll_bw_hz,early_late_space_chips); fs_in, vector_length, queue_, dump, dump_filename, pll_bw_hz,dll_bw_hz,early_late_space_chips);
} }
else else
{ {
LOG_AT_LEVEL(WARNING) << item_type << " unknown tracking item type."; LOG_AT_LEVEL(WARNING) << item_type << " unknown tracking item type.";
} }
DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")";
} }
@ -111,7 +112,7 @@ void GpsL1CaDllPllTracking::start_tracking()
tracking_->start_tracking(); tracking_->start_tracking();
} }
/*! /*
* Set satellite ID * Set satellite ID
*/ */
void GpsL1CaDllPllTracking::set_satellite(unsigned int satellite) void GpsL1CaDllPllTracking::set_satellite(unsigned int satellite)
@ -121,7 +122,7 @@ void GpsL1CaDllPllTracking::set_satellite(unsigned int satellite)
DLOG(INFO) << "satellite set to " << satellite_; DLOG(INFO) << "satellite set to " << satellite_;
} }
/*! /*
* Set tracking channel unique ID * Set tracking channel unique ID
*/ */
void GpsL1CaDllPllTracking::set_channel(unsigned int channel) void GpsL1CaDllPllTracking::set_channel(unsigned int channel)
@ -130,7 +131,7 @@ void GpsL1CaDllPllTracking::set_channel(unsigned int channel)
tracking_->set_channel(channel); tracking_->set_channel(channel);
} }
/*! /*
* Set tracking channel internal queue * Set tracking channel internal queue
*/ */
void GpsL1CaDllPllTracking::set_channel_queue( void GpsL1CaDllPllTracking::set_channel_queue(
@ -141,21 +142,24 @@ void GpsL1CaDllPllTracking::set_channel_queue(
tracking_->set_channel_queue(channel_internal_queue_); tracking_->set_channel_queue(channel_internal_queue_);
} }
/*!
/*
* Set acquisition code phase in samples * Set acquisition code phase in samples
*/ */
void GpsL1CaDllPllTracking::set_prn_code_phase(signed int phase_samples) void GpsL1CaDllPllTracking::set_prn_code_phase(signed int phase_samples)
{ {
return tracking_->set_acq_code_phase((float)phase_samples); return tracking_->set_acq_code_phase((float)phase_samples);
} }
/*!
/*
* Set acquisition Doppler frequency in Hz. * Set acquisition Doppler frequency in Hz.
*/ */
void GpsL1CaDllPllTracking::set_doppler_freq_shift(float doppler_freq_hz) void GpsL1CaDllPllTracking::set_doppler_freq_shift(float doppler_freq_hz)
{ {
return tracking_->set_acq_doppler(doppler_freq_hz); return tracking_->set_acq_doppler(doppler_freq_hz);
} }
/*!
/*
* Set acquisition sample stamp in samples, in order to detect the delay between acquisition and tracking * Set acquisition sample stamp in samples, in order to detect the delay between acquisition and tracking
*/ */
void GpsL1CaDllPllTracking::set_acq_sample_stamp( void GpsL1CaDllPllTracking::set_acq_sample_stamp(
@ -163,6 +167,7 @@ void GpsL1CaDllPllTracking::set_acq_sample_stamp(
{ {
return tracking_->set_acq_sample_stamp(sample_stamp); return tracking_->set_acq_sample_stamp(sample_stamp);
} }
void GpsL1CaDllPllTracking::connect(gr_top_block_sptr top_block) void GpsL1CaDllPllTracking::connect(gr_top_block_sptr top_block)
{ {
//nothing to connect, now the tracking uses gr_sync_decimator //nothing to connect, now the tracking uses gr_sync_decimator

View File

@ -1,12 +1,14 @@
/*! /*!
* \file gps_l1_ca_dll_pll_tracking.h * \file gps_l1_ca_dll_pll_tracking.h
* \brief code DLL + carrier PLL * \brief Interface of an adapter of a DLL+PLL tracking loop block
* for GPS L1 C/A to a TrackingInterface
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Javier Arribas, 2011. jarribas(at)cttc.es * Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Code DLL + carrier PLL according to the algorithms described in [1] * Code DLL + carrier PLL according to the algorithms described in:
* [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach, Birkha user, 2007 * A Software-Defined GPS and Galileo Receiver. A Single-Frequency
* Approach, Birkha user, 2007
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
@ -76,14 +78,37 @@ public:
gr_basic_block_sptr get_left_block(); gr_basic_block_sptr get_left_block();
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
/*!
* \brief Set satellite ID
*/
void set_satellite(unsigned int satellite); void set_satellite(unsigned int satellite);
/*!
* \brief Set tracking channel unique ID
*/
void set_channel(unsigned int channel); void set_channel(unsigned int channel);
/*!
* \brief Set acquisition code phase in samples
*/
void set_prn_code_phase(signed int phase_samples); void set_prn_code_phase(signed int phase_samples);
/*!
* \brief Set acquisition Doppler frequency in Hz.
*/
void set_doppler_freq_shift(float doppler_freq_hz); void set_doppler_freq_shift(float doppler_freq_hz);
/*!
* \brief Set tracking channel internal queue
*/
void set_channel_queue(concurrent_queue<int> *channel_internal_queue); void set_channel_queue(concurrent_queue<int> *channel_internal_queue);
void start_tracking(); void start_tracking();
/*!
* \brief Set acquisition sample stamp in samples, in order to detect
* the delay between acquisition and tracking
*/
void set_acq_sample_stamp(unsigned long int sample_stamp); void set_acq_sample_stamp(unsigned long int sample_stamp);
private: private:

View File

@ -1,11 +1,12 @@
/*! /*!
* \file gps_l1_ca_dll_fll_pll_tracking_cc.cc * \file gps_l1_ca_dll_fll_pll_tracking_cc.cc
* \brief code DLL + carrier FLL/PLL tracking * \brief Implementation of a code DLL + carrier FLL/PLL tracking block
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* This file implements the code Delay Locked Loop (DLL) + carrier Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL) stage * This file implements the code Delay Locked Loop (DLL) + carrier
* according to the algorithms described in [1] * Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL)
* [1] E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and * according to the algorithms described in:
* E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* Applications, Second Edition, Artech House Publishers, 2005. * Applications, Second Edition, Artech House Publishers, 2005.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
@ -39,16 +40,13 @@
#include "tracking_discriminators.h" #include "tracking_discriminators.h"
#include "CN_estimators.h" #include "CN_estimators.h"
#include "tracking_FLL_PLL_filter.h" #include "tracking_FLL_PLL_filter.h"
#include "control_message_factory.h" #include "control_message_factory.h"
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <cmath> #include <cmath>
#include "math.h" #include "math.h"
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
@ -124,7 +122,7 @@ gps_l1_ca_dll_fll_pll_tracking_cc::gps_l1_ca_dll_fll_pll_tracking_cc(unsigned in
void gps_l1_ca_dll_fll_pll_tracking_cc::start_tracking(){ void gps_l1_ca_dll_fll_pll_tracking_cc::start_tracking(){
/*! /*
* correct the code phase according to the delay between acq and trk * correct the code phase according to the delay between acq and trk
*/ */
unsigned long int acq_trk_diff_samples; unsigned long int acq_trk_diff_samples;
@ -242,7 +240,7 @@ gps_l1_ca_dll_fll_pll_tracking_cc::~gps_l1_ca_dll_fll_pll_tracking_cc() {
delete[] d_Prompt_buffer; delete[] d_Prompt_buffer;
} }
/*! Tracking signal processing /* Tracking signal processing
* Notice that this is a class derived from gr_sync_decimator, so each of the ninput_items has vector_length samples * Notice that this is a class derived from gr_sync_decimator, so each of the ninput_items has vector_length samples
*/ */
@ -268,7 +266,7 @@ int gps_l1_ca_dll_fll_pll_tracking_cc::general_work (int noutput_items, gr_vecto
d_Late=gr_complex(0,0); d_Late=gr_complex(0,0);
if (d_enable_tracking==true){ if (d_enable_tracking==true){
/*! /*
* Receiver signal alignment * Receiver signal alignment
*/ */
if (d_pull_in==true) if (d_pull_in==true)
@ -329,7 +327,7 @@ int gps_l1_ca_dll_fll_pll_tracking_cc::general_work (int noutput_items, gr_vecto
d_Late += bb_signal_sample*d_late_code[i]; d_Late += bb_signal_sample*d_late_code[i];
} }
/*! /*
* DLL, FLL, and PLL discriminators * DLL, FLL, and PLL discriminators
*/ */
// Compute DLL error // Compute DLL error

View File

@ -1,12 +1,12 @@
/*! /*!
* \file gps_l1_ca_dll_fll_pll_tracking_cc.h * \file gps_l1_ca_dll_fll_pll_tracking_cc.h
* \brief code DLL + carrier FLL/PLL tracking * \brief Interface of a code DLL + carrier FLL/PLL tracking block
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* This file implements the code Delay Locked Loop (DLL) + * This is the interface of a code Delay Locked Loop (DLL) +
* carrier Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL) stage * carrier Phase Locked Loop (PLL) helped with a carrier Frequency Locked
* according to the algorithms described in [1] * Loop (FLL) according to the algorithms described in:
* [1] E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and * E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* Applications, Second Edition, Artech House Publishers, 2005. * Applications, Second Edition, Artech House Publishers, 2005.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------

View File

@ -1,12 +1,13 @@
/*! /*!
* \file gps_l1_ca_dll_pll_tracking_cc.cc * \file gps_l1_ca_dll_pll_tracking_cc.cc
* \brief code DLL + carrier PLL * \brief Implementation of a code DLL + carrier PLL tracking block
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Javier Arribas, 2011. jarribas(at)cttc.es * Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Code DLL + carrier PLL according to the algorithms described in [1] * Code DLL + carrier PLL according to the algorithms described in:
* [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, * [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach, Birkha user, 2007 * A Software-Defined GPS and Galileo Receiver. A Single-Frequency
* Approach, Birkha user, 2007
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
@ -139,7 +140,7 @@ gps_l1_ca_dll_pll_tracking_cc::gps_l1_ca_dll_pll_tracking_cc(unsigned int satell
} }
void gps_l1_ca_dll_pll_tracking_cc::start_tracking(){ void gps_l1_ca_dll_pll_tracking_cc::start_tracking(){
/*! /*
* correct the code phase according to the delay between acq and trk * correct the code phase according to the delay between acq and trk
*/ */
unsigned long int acq_trk_diff_samples; unsigned long int acq_trk_diff_samples;
@ -270,7 +271,7 @@ gps_l1_ca_dll_pll_tracking_cc::~gps_l1_ca_dll_pll_tracking_cc() {
delete[] d_Prompt_buffer; delete[] d_Prompt_buffer;
} }
/*! Tracking signal processing /* Tracking signal processing
* Notice that this is a class derived from gr_sync_decimator, so each of the ninput_items has vector_length samples * Notice that this is a class derived from gr_sync_decimator, so each of the ninput_items has vector_length samples
*/ */
@ -295,7 +296,7 @@ int gps_l1_ca_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_in
d_Late=gr_complex(0,0); d_Late=gr_complex(0,0);
if (d_enable_tracking==true){ if (d_enable_tracking==true){
/*! /*
* Receiver signal alignment * Receiver signal alignment
*/ */
if (d_pull_in==true) if (d_pull_in==true)

View File

@ -1,12 +1,13 @@
/*! /*!
* \file gps_l1_ca_dll_pll_tracking_cc.h * \file gps_l1_ca_dll_pll_tracking_cc.h
* \brief code DLL + carrier PLL * \brief Interface of a code DLL + carrier PLL tracking block
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Javier Arribas, 2011. jarribas(at)cttc.es * Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Code DLL + carrier PLL according to the algorithms described in [1] * Code DLL + carrier PLL according to the algorithms described in:
* [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach, Birkha user, 2007 * A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
* Birkhauser, 2007
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *

View File

@ -1,25 +1,18 @@
/*! /*!
* \file CN_estimators.cc * \file CN_estimators.cc
* \brief Library with a set of Carrier to Noise estimators and lock detectors. * \brief Implementation of a library with a set of Carrier to Noise
* SNV_CN0 is a Carrier-to-Noise (CN0) estimator based on the Signal-to-Noise Variance (SNV) estimator [1]. * estimators and lock detectors. SNV_CN0 is a Carrier-to-Noise (CN0) estimator
* * based on the Signal-to-Noise Variance (SNV) estimator [1].
* Carrier lock detector using normalised estimate of the cosine * Carrier lock detector using normalised estimate of the cosine
* of twice the carrier phase error [2]. * of twice the carrier phase error [2].
*
*
* [1] Marco Pini, Emanuela Falletti and Maurizio Fantino, "Performance * [1] Marco Pini, Emanuela Falletti and Maurizio Fantino, "Performance
* Evaluation of C/N0 Estimators using a Real Time GNSS Software Receiver," * Evaluation of C/N0 Estimators using a Real Time GNSS Software Receiver,"
* IEEE 10th International Symposium on Spread Spectrum Techniques and * IEEE 10th International Symposium on Spread Spectrum Techniques and
* Applications, pp.28-30, August 2008. * Applications, pp.28-30, August 2008.
*
*
*
* [2] Van Dierendonck, A.J. (1996), Global Positioning System: Theory and * [2] Van Dierendonck, A.J. (1996), Global Positioning System: Theory and
* Applications, * Applications,
* Volume I, Chapter 8: GPS Receivers, AJ Systems, Los Altos, CA 94024. * Volume I, Chapter 8: GPS Receivers, AJ Systems, Los Altos, CA 94024.
* Inc.: 329-407. * Inc.: 329-407.
*
*
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* *
@ -52,7 +45,7 @@
#include <gnuradio/gr_complex.h> #include <gnuradio/gr_complex.h>
#include <math.h> #include <math.h>
/*! /*
* Signal-to-Noise (SNR) (\f$\rho\f$) estimator using the Signal-to-Noise Variance (SNV) estimator: * Signal-to-Noise (SNR) (\f$\rho\f$) estimator using the Signal-to-Noise Variance (SNV) estimator:
* \f{equation} * \f{equation}
* \hat{\rho}=\frac{\hat{P}_s}{\hat{P}_n}=\frac{\hat{P}_s}{\hat{P}_{tot}-\hat{P}_s}, * \hat{\rho}=\frac{\hat{P}_s}{\hat{P}_n}=\frac{\hat{P}_s}{\hat{P}_{tot}-\hat{P}_s},
@ -66,36 +59,37 @@
* CN0_{dB}=10*log(\hat{\rho})+10*log(\frac{f_s}{2})-10*log(L_{PRN}), * CN0_{dB}=10*log(\hat{\rho})+10*log(\frac{f_s}{2})-10*log(L_{PRN}),
* \f} * \f}
* where \f$f_s\f$ is the sampling frequency and \f$L_{PRN}\f$ is the PRN sequence length. * where \f$f_s\f$ is the sampling frequency and \f$L_{PRN}\f$ is the PRN sequence length.
*
*/ */
float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in) float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in)
{ {
// estimate CN0 using buffered values // estimate CN0 using buffered values
// MATLAB CODE // MATLAB CODE
//Psig=((1/N)*sum(abs(imag(x((n-N+1):n)))))^2; //Psig=((1/N)*sum(abs(imag(x((n-N+1):n)))))^2;
//Ptot=(1/N)*sum(abs(x((n-N+1):n)).^2); //Ptot=(1/N)*sum(abs(x((n-N+1):n)).^2);
//SNR_SNV(count)=Psig/(Ptot-Psig); //SNR_SNV(count)=Psig/(Ptot-Psig);
//CN0_SNV_dB=10*log10(SNR_SNV)+10*log10(BW)-10*log10(PRN_length); //CN0_SNV_dB=10*log10(SNR_SNV)+10*log10(BW)-10*log10(PRN_length);
float SNR, SNR_dB_Hz; float SNR, SNR_dB_Hz;
float tmp_abs_I,tmp_abs_Q; float tmp_abs_I,tmp_abs_Q;
float Psig,Ptot; float Psig,Ptot;
//float M2,M4; //float M2,M4;
Psig=0; Psig=0;
Ptot=0; Ptot=0;
for (int i=0;i<length;i++) for (int i=0;i<length;i++)
{ {
tmp_abs_I=std::abs(Prompt_buffer[i].imag()); tmp_abs_I=std::abs(Prompt_buffer[i].imag());
tmp_abs_Q=std::abs(Prompt_buffer[i].real()); tmp_abs_Q=std::abs(Prompt_buffer[i].real());
Psig+=tmp_abs_I; Psig+=tmp_abs_I;
Ptot+=Prompt_buffer[i].imag()*Prompt_buffer[i].imag()+Prompt_buffer[i].real()*Prompt_buffer[i].real(); Ptot+=Prompt_buffer[i].imag()*Prompt_buffer[i].imag()+Prompt_buffer[i].real()*Prompt_buffer[i].real();
} }
Psig=Psig/(float)length; Psig=Psig/(float)length;
Psig=Psig*Psig; Psig=Psig*Psig;
SNR=Psig/(Ptot/(float)length-Psig); SNR=Psig/(Ptot/(float)length-Psig);
SNR_dB_Hz=10*log10(SNR)+10*log10(fs_in/2)-10*log10(GPS_L1_CA_CODE_LENGTH_CHIPS); SNR_dB_Hz=10*log10(SNR)+10*log10(fs_in/2)-10*log10(GPS_L1_CA_CODE_LENGTH_CHIPS);
return SNR_dB_Hz; return SNR_dB_Hz;
} }
/*! /*
* The Carrier Phase Lock Detector block uses the normalised estimate of the cosine of twice the carrier phase error is given by * The Carrier Phase Lock Detector block uses the normalised estimate of the cosine of twice the carrier phase error is given by
* \f{equation} * \f{equation}
* C2\phi=\frac{NBD}{NBP}, * C2\phi=\frac{NBD}{NBP},
@ -104,38 +98,37 @@ float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in)
* \f$NBP=\sum^{N-1}_{i=0}Im(Pc(i))^2-\sum^{N-1}_{i=0}Re(Pc(i))^2\f$, and * \f$NBP=\sum^{N-1}_{i=0}Im(Pc(i))^2-\sum^{N-1}_{i=0}Re(Pc(i))^2\f$, and
* \f$Pc(i)\f$ is the prompt correlator output for the sample index i. * \f$Pc(i)\f$ is the prompt correlator output for the sample index i.
*/ */
float carrier_lock_detector(gr_complex* Prompt_buffer, int length) float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
{ {
/*! /*!
* \todo Code lock detector * \todo Code lock detector
*/ */
// estimate using buffered values // estimate using buffered values
// MATLAB CODE // MATLAB CODE
// lock detector operation // lock detector operation
//NBD=sum(abs(imag(x((n-N+1):n))))^2 + sum(abs(real(x((n-N+1):n))))^2; //NBD=sum(abs(imag(x((n-N+1):n))))^2 + sum(abs(real(x((n-N+1):n))))^2;
//NBP=sum(imag(x((n-N+1):n)).^2) - sum(real(x((n-N+1):n)).^2); //NBP=sum(imag(x((n-N+1):n)).^2) - sum(real(x((n-N+1):n)).^2);
//LOCK(count)=NBD/NBP; //LOCK(count)=NBD/NBP;
float tmp_abs_I,tmp_abs_Q; float tmp_abs_I,tmp_abs_Q;
float tmp_sum_abs_I,tmp_sum_abs_Q; float tmp_sum_abs_I,tmp_sum_abs_Q;
float tmp_sum_sqr_I,tmp_sum_sqr_Q; float tmp_sum_sqr_I,tmp_sum_sqr_Q;
tmp_sum_abs_I=0; tmp_sum_abs_I=0;
tmp_sum_abs_Q=0; tmp_sum_abs_Q=0;
tmp_sum_sqr_I=0; tmp_sum_sqr_I=0;
tmp_sum_sqr_Q=0; tmp_sum_sqr_Q=0;
float NBD,NBP; float NBD,NBP;
for (int i=0;i<length;i++) for (int i=0;i<length;i++)
{ {
tmp_abs_I=std::abs(Prompt_buffer[i].imag()); tmp_abs_I=std::abs(Prompt_buffer[i].imag());
tmp_abs_Q=std::abs(Prompt_buffer[i].real()); tmp_abs_Q=std::abs(Prompt_buffer[i].real());
tmp_sum_abs_I+=tmp_abs_I; tmp_sum_abs_I+=tmp_abs_I;
tmp_sum_abs_Q+=tmp_abs_Q; tmp_sum_abs_Q+=tmp_abs_Q;
tmp_sum_sqr_I+=(Prompt_buffer[i].imag()*Prompt_buffer[i].imag()); tmp_sum_sqr_I+=(Prompt_buffer[i].imag()*Prompt_buffer[i].imag());
tmp_sum_sqr_Q+=(Prompt_buffer[i].real()*Prompt_buffer[i].real()); tmp_sum_sqr_Q+=(Prompt_buffer[i].real()*Prompt_buffer[i].real());
} }
NBD=tmp_sum_abs_I*tmp_sum_abs_I+tmp_sum_abs_Q*tmp_sum_abs_Q; NBD=tmp_sum_abs_I*tmp_sum_abs_I+tmp_sum_abs_Q*tmp_sum_abs_Q;
NBP=tmp_sum_sqr_I-tmp_sum_sqr_Q; NBP=tmp_sum_sqr_I-tmp_sum_sqr_Q;
return NBD/NBP; return NBD/NBP;
} }

View File

@ -1,10 +1,9 @@
/*! /*!
* \file CN_estimators.h * \file CN_estimators.h
* \brief Library with a set of Carrier to Noise estimators and lock detectors * \brief Interface of a library with a set of Carrier to Noise
* estimators and lock detectors.
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Library with a set of Carrier to Noise estimators and lock detectors
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -35,8 +34,43 @@
#include <gnuradio/gr_complex.h> #include <gnuradio/gr_complex.h>
/*! brief SNV_CN0 is a Carrier-to-Noise (CN0) estimator
* based on the Signal-to-Noise Variance (SNV) estimator
*
* Signal-to-Noise (SNR) (\f$\rho\f$) estimator using the Signal-to-Noise Variance (SNV) estimator:
* \f{equation}
* \hat{\rho}=\frac{\hat{P}_s}{\hat{P}_n}=\frac{\hat{P}_s}{\hat{P}_{tot}-\hat{P}_s},
* \f}
* where \f$\hat{P}_s=\left(\frac{1}{N}\sum^{N-1}_{i=0}|Re(Pc(i))|\right)^2\f$ is the estimation of the signal power,
* \f$\hat{P}_{tot}=\frac{1}{N}\sum^{N-1}_{i=0}|Pc(i)|^2\f$ is the estimator of the total power, \f$|\cdot|\f$ is the absolute value,
* \f$Re(\cdot)\f$ stands for the real part of the value, and \f$Pc(i)\f$ is the prompt correlator output for the sample index i.
*
* The SNR value is converted to CN0 [dB-Hz], taking to account the receiver bandwidth and the PRN code gain, using the following formula:
* \f{equation}
* CN0_{dB}=10*log(\hat{\rho})+10*log(\frac{f_s}{2})-10*log(L_{PRN}),
* \f}
* where \f$f_s\f$ is the sampling frequency and \f$L_{PRN}\f$ is the PRN sequence length.
* Ref: Marco Pini, Emanuela Falletti and Maurizio Fantino, "Performance
* Evaluation of C/N0 Estimators using a Real Time GNSS Software Receiver,"
* IEEE 10th International Symposium on Spread Spectrum Techniques and
* Applications, pp.28-30, August 2008.
*/
float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in); float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in);
/*! \brief A carrier lock detector
*
* The Carrier Phase Lock Detector block uses the normalised estimate of the cosine of twice the carrier phase error is given by
* \f{equation}
* C2\phi=\frac{NBD}{NBP},
* \f}
* where \f$NBD=(\sum^{N-1}_{i=0}|Im(Pc(i))|)^2+(\sum^{N-1}_{i=0}|Re(Pc(i))|)^2\f$,
* \f$NBP=\sum^{N-1}_{i=0}Im(Pc(i))^2-\sum^{N-1}_{i=0}Re(Pc(i))^2\f$, and
* \f$Pc(i)\f$ is the prompt correlator output for the sample index i.
* Ref: Van Dierendonck, A.J. (1996), Global Positioning System: Theory and
* Applications,
* Volume I, Chapter 8: GPS Receivers, AJ Systems, Los Altos, CA 94024.
* Inc.: 329-407.
*/
float carrier_lock_detector(gr_complex* Prompt_buffer, int length); float carrier_lock_detector(gr_complex* Prompt_buffer, int length);
#endif #endif

View File

@ -1,11 +1,12 @@
/*! /*!
* \file tracking_2nd_DLL_filter.cc * \file tracking_2nd_DLL_filter.cc
* \brief Class that implements 2 order DLL filter for code tracking loop. * \brief Implementation of a 2nd order DLL filter for code tracking loop.
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Class that implements 2 order PLL filter for code tracking loop. The algorithm is described in [1] * Class that implements 2 order PLL filter for code tracking loop.
* * The algorithm is described in :
* [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.~H.~Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach, * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.~H.~Jensen, A Software-Defined
* GPS and Galileo Receiver. A Single-Frequency Approach,
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis. * Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
@ -38,19 +39,19 @@
void tracking_2nd_DLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k){ void tracking_2nd_DLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k){
// Solve natural frequency // Solve natural frequency
float Wn; float Wn;
Wn = lbw*8*zeta / (4*zeta*zeta + 1); Wn = lbw*8*zeta / (4*zeta*zeta + 1);
// solve for t1 & t2 // solve for t1 & t2
*tau1 = k / (Wn * Wn); *tau1 = k / (Wn * Wn);
*tau2 = (2.0 * zeta) / Wn; *tau2 = (2.0 * zeta) / Wn;
} }
void tracking_2nd_DLL_filter::set_DLL_BW(float dll_bw_hz) void tracking_2nd_DLL_filter::set_DLL_BW(float dll_bw_hz)
{ {
//Calculate filter coefficient values //Calculate filter coefficient values
d_dllnoisebandwidth=dll_bw_hz; d_dllnoisebandwidth=dll_bw_hz;
calculate_lopp_coef(&d_tau1_code, &d_tau2_code, d_dllnoisebandwidth, d_dlldampingratio,1.0);// Calculate filter coefficient values calculate_lopp_coef(&d_tau1_code, &d_tau2_code, d_dllnoisebandwidth, d_dlldampingratio,1.0);// Calculate filter coefficient values
} }
void tracking_2nd_DLL_filter::initialize(float d_acq_code_phase_samples) void tracking_2nd_DLL_filter::initialize(float d_acq_code_phase_samples)
{ {
@ -62,17 +63,17 @@ void tracking_2nd_DLL_filter::initialize(float d_acq_code_phase_samples)
float tracking_2nd_DLL_filter::get_code_nco(float DLL_discriminator) float tracking_2nd_DLL_filter::get_code_nco(float DLL_discriminator)
{ {
float code_nco; float code_nco;
code_nco = d_old_code_nco + (d_tau2_code/d_tau1_code)*(DLL_discriminator - d_old_code_error) + DLL_discriminator * (d_pdi_code/d_tau1_code); code_nco = d_old_code_nco + (d_tau2_code/d_tau1_code)*(DLL_discriminator - d_old_code_error) + DLL_discriminator * (d_pdi_code/d_tau1_code);
d_old_code_nco = code_nco; d_old_code_nco = code_nco;
d_old_code_error = DLL_discriminator; //[chips] d_old_code_error = DLL_discriminator; //[chips]
return code_nco; return code_nco;
} }
tracking_2nd_DLL_filter::tracking_2nd_DLL_filter () tracking_2nd_DLL_filter::tracking_2nd_DLL_filter ()
{ {
d_pdi_code = 0.001;// Summation interval for code d_pdi_code = 0.001;// Summation interval for code
d_dlldampingratio=0.7; d_dlldampingratio=0.7;
} }
tracking_2nd_DLL_filter::~tracking_2nd_DLL_filter () tracking_2nd_DLL_filter::~tracking_2nd_DLL_filter ()

View File

@ -1,10 +1,12 @@
/*! /*!
* \file tracking_2nd_DLL_filter.h * \file tracking_2nd_DLL_filter.h
* \brief Class that implements 2 order DLL filter for code tracking loop. * \brief Interface of a 2nd order DLL filter for code tracking loop.
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Class that implements 2 order PLL filter for code tracking loop. The algorithm is described in: * Class that implements a 2nd order PLL filter for code tracking loop.
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S. H. Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach, * The algorithm is described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S. H. Jensen,
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis. * Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------

View File

@ -1,11 +1,12 @@
/*! /*!
* \file tracking_2nd_PLL_filter.cc * \file tracking_2nd_PLL_filter.cc
* \brief Class that implements 2 order PLL filter for tracking carrier loop. * \brief Implementation of a 2nd order PLL filter for tracking carrier loop.
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Class that implements 2 order PLL filter for tracking carrier loop. The algorithm is described in [1] * Class that implements 2 order PLL filter for tracking carrier loop. The algorithm
* * is described in:
* [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.~H.~Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach, * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.~H.~Jensen, A Software-Defined
* GPS and Galileo Receiver. A Single-Frequency Approach,
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis. * Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------

View File

@ -1,10 +1,12 @@
/*! /*!
* \file tracking_2nd_PLL_filter.h * \file tracking_2nd_PLL_filter.h
* \brief Class that implements 2 order PLL filter for carrier tracking loop * \brief Interface of a 2nd order PLL filter for carrier tracking loop
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Class that implements 2 order PLL filter for tracking carrier loop. The algorithm is described in * Class that implements 2 order PLL filter for tracking carrier loop.
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.~H.~Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach, * The algorithm is described in
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H. Jensen,
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis. * Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
/*! /*!
* \file tracking_FLL_PLL_filter.cc * \file tracking_FLL_PLL_filter.cc
* \brief Class that implements hybrid FLL and PLL filter for tracking carrier loop * \brief Implementation of a hybrid FLL and PLL filter for tracking carrier loop
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Class that implements hybrid FLL and PLL filter for tracking carrier loop * Class that implements hybrid FLL and PLL filter for tracking carrier loop
@ -36,76 +36,76 @@
void tracking_FLL_PLL_filter::set_params(float fll_bw_hz,float pll_bw_hz, int order) void tracking_FLL_PLL_filter::set_params(float fll_bw_hz,float pll_bw_hz, int order)
{ {
/*! /*
* Filter design (Kaplan 2nd ed., Pag. 181 Fig. 181) * Filter design (Kaplan 2nd ed., Pag. 181 Fig. 181)
*/ */
d_order=order; d_order=order;
if (d_order==3) if (d_order==3)
{ {
/*! /*
* 3rd order PLL with 2nd order FLL assist * 3rd order PLL with 2nd order FLL assist
*/ */
d_pll_b3 = 2.400; d_pll_b3 = 2.400;
d_pll_a3 = 1.100; d_pll_a3 = 1.100;
d_pll_a2 = 1.414; d_pll_a2 = 1.414;
d_pll_w0p = pll_bw_hz/0.7845; d_pll_w0p = pll_bw_hz/0.7845;
d_pll_w0p2 = d_pll_w0p*d_pll_w0p; d_pll_w0p2 = d_pll_w0p*d_pll_w0p;
d_pll_w0p3 = d_pll_w0p2*d_pll_w0p; d_pll_w0p3 = d_pll_w0p2*d_pll_w0p;
d_pll_w0f = fll_bw_hz/0.53; d_pll_w0f = fll_bw_hz/0.53;
d_pll_w0f2 = d_pll_w0f*d_pll_w0f; d_pll_w0f2 = d_pll_w0f*d_pll_w0f;
}else }else
{ {
/*! /*
* 2rd order PLL with 1st order FLL assist * 2nd order PLL with 1st order FLL assist
*/ */
d_pll_a2 = 1.414; d_pll_a2 = 1.414;
d_pll_w0p = pll_bw_hz/0.53; d_pll_w0p = pll_bw_hz/0.53;
d_pll_w0p2 = d_pll_w0p*d_pll_w0p; d_pll_w0p2 = d_pll_w0p*d_pll_w0p;
d_pll_w0f = fll_bw_hz/0.25; d_pll_w0f = fll_bw_hz/0.25;
} }
} }
void tracking_FLL_PLL_filter::initialize(float d_acq_carrier_doppler_hz) void tracking_FLL_PLL_filter::initialize(float d_acq_carrier_doppler_hz)
{ {
if (d_order==3) if (d_order==3)
{ {
d_pll_x = 2.0*d_acq_carrier_doppler_hz; d_pll_x = 2.0*d_acq_carrier_doppler_hz;
d_pll_w = 0; d_pll_w = 0;
}else{ }else{
d_pll_w = d_acq_carrier_doppler_hz; d_pll_w = d_acq_carrier_doppler_hz;
d_pll_x = 0; d_pll_x = 0;
} }
} }
float tracking_FLL_PLL_filter::get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s) float tracking_FLL_PLL_filter::get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s)
{ {
float carrier_error_hz; float carrier_error_hz;
if (d_order==3) if (d_order==3)
{ {
/*! /*
* 3rd order PLL with 2nd order FLL assist * 3rd order PLL with 2nd order FLL assist
*/ */
d_pll_w = d_pll_w + correlation_time_s * (d_pll_w0p3 * PLL_discriminator + d_pll_w0f2 * FLL_discriminator); d_pll_w = d_pll_w + correlation_time_s * (d_pll_w0p3 * PLL_discriminator + d_pll_w0f2 * FLL_discriminator);
d_pll_x = d_pll_x + correlation_time_s * (0.5*d_pll_w + d_pll_a2 * d_pll_w0f * FLL_discriminator + d_pll_a3 * d_pll_w0p2 * PLL_discriminator); d_pll_x = d_pll_x + correlation_time_s * (0.5*d_pll_w + d_pll_a2 * d_pll_w0f * FLL_discriminator + d_pll_a3 * d_pll_w0p2 * PLL_discriminator);
carrier_error_hz = 0.5*d_pll_x + d_pll_b3 * d_pll_w0p * PLL_discriminator; carrier_error_hz = 0.5*d_pll_x + d_pll_b3 * d_pll_w0p * PLL_discriminator;
}else }else
{ {
/*! /*
* 2rd order PLL with 1st order FLL assist * 2nd order PLL with 1st order FLL assist
*/ */
float pll_w_new; float pll_w_new;
pll_w_new = d_pll_w + PLL_discriminator*d_pll_w0p2*correlation_time_s + FLL_discriminator*d_pll_w0f*correlation_time_s ; pll_w_new = d_pll_w + PLL_discriminator*d_pll_w0p2*correlation_time_s + FLL_discriminator*d_pll_w0f*correlation_time_s ;
carrier_error_hz = 0.5*(pll_w_new + d_pll_w)+d_pll_a2 * d_pll_w0p*PLL_discriminator; carrier_error_hz = 0.5*(pll_w_new + d_pll_w)+d_pll_a2 * d_pll_w0p*PLL_discriminator;
d_pll_w =pll_w_new; d_pll_w =pll_w_new;
/*std::cout<<" d_pll_w = "<<carrier_error_hz<< /*std::cout<<" d_pll_w = "<<carrier_error_hz<<
", pll_w_new = "<<pll_w_new ", pll_w_new = "<<pll_w_new
<<", PLL_discriminator=" <<PLL_discriminator <<", PLL_discriminator=" <<PLL_discriminator
<<" FLL_discriminator ="<<FLL_discriminator <<" FLL_discriminator ="<<FLL_discriminator
<<" correlation_time_s = "<<correlation_time_s<<"\r\n";*/ <<" correlation_time_s = "<<correlation_time_s<<"\r\n";*/
} }
return carrier_error_hz; return carrier_error_hz;
} }

View File

@ -1,10 +1,8 @@
/*! /*!
* \file tracking_FLL_PLL_filter.h * \file tracking_FLL_PLL_filter.h
* \brief Class that implements hybrid FLL and PLL filter for tracking carrier loop * \brief Interface of a hybrid FLL and PLL filter for tracking carrier loop
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Class that implements hybrid FLL and PLL filter for tracking carrier loop
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)

View File

@ -1,6 +1,7 @@
/*! /*!
* \file tracking_discriminators.cc * \file tracking_discriminators.cc
* \brief Library with a set of code tracking and carrier tracking discriminators that is used by the tracking algorithms * \brief Implementation of a library with a set of code tracking
* and carrier tracking discriminators that is used by the tracking algorithms.
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* *
@ -33,7 +34,7 @@
#include <math.h> #include <math.h>
// All the outputs are in RADIANS // All the outputs are in RADIANS
/*! /*
* FLL four quadrant arctan discriminator: * FLL four quadrant arctan discriminator:
* \f{equation} * \f{equation}
* \frac{\phi_2-\phi_1}{t_2-t1}=\frac{ATAN2(cross,dot)}{t_1-t_2}, * \frac{\phi_2-\phi_1}{t_2-t1}=\frac{ATAN2(cross,dot)}{t_1-t_2},
@ -45,13 +46,14 @@
float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2,float t1, float t2) float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2,float t1, float t2)
{ {
float cross,dot; float cross,dot;
dot=prompt_s1.imag()*prompt_s2.imag()+prompt_s1.real()*prompt_s2.real(); dot=prompt_s1.imag()*prompt_s2.imag()+prompt_s1.real()*prompt_s2.real();
cross=prompt_s1.imag()*prompt_s2.real()-prompt_s2.imag()*prompt_s1.real(); cross=prompt_s1.imag()*prompt_s2.real()-prompt_s2.imag()*prompt_s1.real();
return atan2(cross,dot)/(t2-t1); return atan2(cross,dot)/(t2-t1);
} }
/*!
/*
* PLL four quadrant arctan discriminator: * PLL four quadrant arctan discriminator:
* \f{equation} * \f{equation}
* \phi=ATAN2(Q_{PS},I_{PS}), * \phi=ATAN2(Q_{PS},I_{PS}),
@ -60,27 +62,29 @@ float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2,float t1
*/ */
float pll_four_quadrant_atan(gr_complex prompt_s1) float pll_four_quadrant_atan(gr_complex prompt_s1)
{ {
return atan2(prompt_s1.real(),prompt_s1.imag()); return atan2(prompt_s1.real(),prompt_s1.imag());
} }
/*!
/*
* PLL Costas loop two quadrant arctan discriminator: * PLL Costas loop two quadrant arctan discriminator:
* \f{equation} * \f{equation}
* \phi=ATAN\left(\frac{Q_{PS}}{I_{PS}}\right), * \phi=ATAN\left(\frac{Q_{PS}}{I_{PS}}\right),
* \f} * \f}
* where \f$I_{PS1},Q_{PS1}\f$ are the inphase and quadrature prompt correlator outputs respectively. The output is in [radians]. * where \f$I_{PS1},Q_{PS1}\f$ are the inphase and quadrature prompt correlator outputs respectively. The output is in [radians].
*/ */
float pll_cloop_two_quadrant_atan(gr_complex prompt_s1) float pll_cloop_two_quadrant_atan(gr_complex prompt_s1)
{ {
if (prompt_s1.imag()!=0.0) if (prompt_s1.imag()!=0.0)
{ {
return atan(prompt_s1.real()/prompt_s1.imag()); return atan(prompt_s1.real()/prompt_s1.imag());
}else{ }else{
return 0; return 0;
} }
} }
/*!
/*
* DLL Noncoherent Early minus Late envelope normalized discriminator: * DLL Noncoherent Early minus Late envelope normalized discriminator:
* \f{equation} * \f{equation}
* error=\frac{E-L}{E+L}, * error=\frac{E-L}{E+L},
@ -90,8 +94,8 @@ float pll_cloop_two_quadrant_atan(gr_complex prompt_s1)
*/ */
float dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1) float dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1)
{ {
float P_early, P_late; float P_early, P_late;
P_early=std::abs(early_s1); P_early=std::abs(early_s1);
P_late=std::abs(late_s1); P_late=std::abs(late_s1);
return (P_early-P_late)/((P_early+P_late)); return (P_early-P_late)/((P_early+P_late));
} }

View File

@ -1,9 +1,11 @@
/*! /*!
* \file tracking_discriminators.h * \file tracking_discriminators.h
* \brief Library with a set of code tracking and carrier tracking disctiminators * \brief Interface of a library with a set of code tracking and carrier
* tracking discriminators.
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Library with a set of code tracking and carrier tracking disctiminators that is used by the tracking algorithms * Library with a set of code tracking and carrier tracking discriminators
* that is used by the tracking algorithms.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
@ -35,12 +37,50 @@
#include <gnuradio/gr_complex.h> #include <gnuradio/gr_complex.h>
/*! brief FLL four quadrant arctan discriminator
*
* FLL four quadrant arctan discriminator:
* \f{equation}
* \frac{\phi_2-\phi_1}{t_2-t1}=\frac{ATAN2(cross,dot)}{t_1-t_2},
* \f}
* where \f$cross=I_{PS1}Q_{PS2}-I_{PS2}Q_{PS1}\f$ and \f$dot=I_{PS1}I_{PS2}+Q_{PS1}Q_{PS2}\f$,
* \f$I_{PS1},Q_{PS1}\f$ are the inphase and quadrature prompt correlator outputs respectively at sample time \f$t_1\f$, and
* \f$I_{PS2},Q_{PS2}\f$ are the inphase and quadrature prompt correlator outputs respectively at sample time \f$t_2\f$. The output is in [radians/second].
*/
float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2,float t1, float t2); float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2,float t1, float t2);
/*! \brief PLL four quadrant arctan discriminator
*
* PLL four quadrant arctan discriminator:
* \f{equation}
* \phi=ATAN2(Q_{PS},I_{PS}),
* \f}
* where \f$I_{PS1},Q_{PS1}\f$ are the inphase and quadrature prompt correlator outputs respectively. The output is in [radians].
*/
float pll_four_quadrant_atan(gr_complex prompt_s1); float pll_four_quadrant_atan(gr_complex prompt_s1);
/*! \brief PLL Costas loop two quadrant arctan discriminator
*
* PLL Costas loop two quadrant arctan discriminator:
* \f{equation}
* \phi=ATAN\left(\frac{Q_{PS}}{I_{PS}}\right),
* \f}
* where \f$I_{PS1},Q_{PS1}\f$ are the inphase and quadrature prompt correlator outputs respectively. The output is in [radians].
*/
float pll_cloop_two_quadrant_atan(gr_complex prompt_s1); float pll_cloop_two_quadrant_atan(gr_complex prompt_s1);
/*! \brief DLL Noncoherent Early minus Late envelope normalized discriminator
*
* DLL Noncoherent Early minus Late envelope normalized discriminator:
* \f{equation}
* error=\frac{E-L}{E+L},
* \f}
* where \f$E=\sqrt{I_{ES}^2,Q_{ES}^2}\f$ is the Early correlator output absolute value and
* \f$L=\sqrt{I_{LS}^2,Q_{LS}^2}\f$ is the Late correlator output absolute value. The output is in [chips].
*/
float dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1); float dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1);

View File

@ -47,7 +47,6 @@
* instantiated directly if all inherited pure virtual methods have been * instantiated directly if all inherited pure virtual methods have been
* implemented by that class or a parent class. * implemented by that class or a parent class.
*/ */
class ChannelInterface: public GNSSBlockInterface class ChannelInterface: public GNSSBlockInterface
{ {

View File

@ -6,10 +6,6 @@
* The interface defines an accessor method that gets a parameter name as input * The interface defines an accessor method that gets a parameter name as input
* and returns the value of this parameter, a string, as output. * and returns the value of this parameter, a string, as output.
* Property names are defined here. This is an abstract class for interfaces. * Property names are defined here. This is an abstract class for interfaces.
* Since all its methods are virtual,
* this class cannot be instantiated directly, and a subclass can only be
* instantiated directly if all inherited pure virtual methods have been
* implemented by that class or a parent class.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
@ -69,7 +65,6 @@ public:
unsigned int default_value) = 0; unsigned int default_value) = 0;
virtual float property(std::string property_name, float default_value) = 0; virtual float property(std::string property_name, float default_value) = 0;
virtual double property(std::string property_name, double default_value) = 0; virtual double property(std::string property_name, double default_value) = 0;
virtual void set_property(std::string property_name, std::string value) = 0; virtual void set_property(std::string property_name, std::string value) = 0;
}; };

View File

@ -59,7 +59,6 @@ public:
virtual std::string role() = 0; virtual std::string role() = 0;
virtual std::string implementation() = 0; virtual std::string implementation() = 0;
virtual size_t item_size() = 0; virtual size_t item_size() = 0;
virtual void connect(gr_top_block_sptr top_block) = 0; virtual void connect(gr_top_block_sptr top_block) = 0;
virtual void disconnect(gr_top_block_sptr top_block) = 0; virtual void disconnect(gr_top_block_sptr top_block) = 0;
virtual gr_basic_block_sptr get_left_block() = 0; virtual gr_basic_block_sptr get_left_block() = 0;

View File

@ -1,9 +1,9 @@
/*! /*!
* \file pseudorange_interface.h * \file pseudorange_interface.h
* \brief This class represents an interface to a navigation gnss block. * \brief This class represents an interface to an Observables block.
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Abstract class for pseudorange_intefaces. Since all its methods are virtual, * Abstract class for Observables modules. Since all its methods are virtual,
* this class cannot be instantiated directly, and a subclass can only be * this class cannot be instantiated directly, and a subclass can only be
* instantiated directly if all inherited pure virtual methods have been * instantiated directly if all inherited pure virtual methods have been
* implemented by that class or a parent class. * implemented by that class or a parent class.

View File

@ -1,9 +1,9 @@
/*! /*!
* \file pvt_interface.h * \file pvt_interface.h
* \brief This class represents an interface to a PVT gnss block. * \brief This class represents an interface to a PVT block.
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Abstract class for pseudorange_intefaces. Since all its methods are virtual, * Abstract class for PVT solvers. Since all its methods are virtual,
* this class cannot be instantiated directly, and a subclass can only be * this class cannot be instantiated directly, and a subclass can only be
* instantiated directly if all inherited pure virtual methods have been * instantiated directly if all inherited pure virtual methods have been
* implemented by that class or a parent class. * implemented by that class or a parent class.
@ -40,9 +40,9 @@
#include "gnss_block_interface.h" #include "gnss_block_interface.h"
/*! /*!
* \brief This class represents an interface to a PVT gnss block. * \brief This class represents an interface to a PVT block.
* *
* Abstract class for PVT intefaces, derived from GNSSBlockInterface. * Abstract class for PVT interfaces, derived from GNSSBlockInterface.
* Since all its methods are virtual, * Since all its methods are virtual,
* this class cannot be instantiated directly, and a subclass can only be * this class cannot be instantiated directly, and a subclass can only be
* instantiated directly if all inherited pure virtual methods have been * instantiated directly if all inherited pure virtual methods have been

View File

@ -1,9 +1,9 @@
/*! /*!
* \file navigation_interface.h * \file navigation_interface.h
* \brief This class represents an interface to a navigation GNSS block. * \brief This class represents an interface to a telemetry decoder block.
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* Abstract class for navigation interfaces. Since all its methods are virtual, * Abstract class for telemetry decoders. Since all its methods are virtual,
* this class cannot be instantiated directly, and a subclass can only be * this class cannot be instantiated directly, and a subclass can only be
* instantiated directly if all inherited pure virtual methods have been * instantiated directly if all inherited pure virtual methods have been
* implemented by that class or a parent class. * implemented by that class or a parent class.

View File

@ -1,6 +1,6 @@
/*! /*!
* \file tracking_interface.h * \file tracking_interface.h
* \brief This class represents an interface to an tracking GNSS block. * \brief This class represents an interface to a tracking block.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* Abstract class for tracking interfaces. Since all its methods are virtual, * Abstract class for tracking interfaces. Since all its methods are virtual,

View File

@ -1,7 +1,7 @@
/*! /*!
* \file string_converter.cc * \file string_converter.cc
* \brief This class interprets the contents of a string and converts it into * \brief Implementation of a class that interprets the contents of a string
* different types. * and converts it into different types.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
@ -29,8 +29,8 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "string_converter.h"
#include "string_converter.h"
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
@ -42,82 +42,84 @@ StringConverter::~StringConverter() {
bool StringConverter::convert(std::string value, bool default_value) { bool StringConverter::convert(std::string value, bool default_value) {
if(value.compare("true") == 0) { if(value.compare("true") == 0) {
return true; return true;
} else if(value.compare("false") == 0) { } else if(value.compare("false") == 0) {
return false; return false;
} else { } else {
return default_value; return default_value;
} }
} }
long StringConverter::convert(std::string value, long default_value) { long StringConverter::convert(std::string value, long default_value) {
std::stringstream stream(value); std::stringstream stream(value);
long result; long result;
stream >> result; stream >> result;
if(stream.fail()) { if(stream.fail()) {
return default_value; return default_value;
} else { } else {
return result; return result;
} }
} }
int StringConverter::convert(std::string value, int default_value) { int StringConverter::convert(std::string value, int default_value) {
std::stringstream stream(value); std::stringstream stream(value);
int result; int result;
stream >> result; stream >> result;
if(stream.fail()) { if(stream.fail()) {
return default_value; return default_value;
} else { } else {
return result; return result;
} }
} }
unsigned int StringConverter::convert(std::string value, unsigned int default_value) { unsigned int StringConverter::convert(std::string value, unsigned int default_value) {
std::stringstream stream(value); std::stringstream stream(value);
unsigned int result; unsigned int result;
stream >> result; stream >> result;
if(stream.fail()) { if(stream.fail()) {
return default_value; return default_value;
} else { } else {
return result; return result;
} }
} }
float StringConverter::convert(std::string value, float default_value) { float StringConverter::convert(std::string value, float default_value) {
std::stringstream stream(value); std::stringstream stream(value);
float result; float result;
stream >> result; stream >> result;
if(stream.fail()) { if(stream.fail()) {
return default_value; return default_value;
} else { } else {
return result; return result;
} }
} }
double StringConverter::convert(std::string value, double default_value) { double StringConverter::convert(std::string value, double default_value) {
std::stringstream stream(value); std::stringstream stream(value);
double result; double result;
stream >> result; stream >> result;
if(stream.fail()) { if(stream.fail()) {
return default_value; return default_value;
} else { } else {
return result; return result;
} }
} }

View File

@ -1,7 +1,7 @@
/*! /*!
* \file string_converter.h * \file string_converter.h
* \brief This class interprets the contents of a string and converts it into * \brief Interface of a class that interprets the contents of a string
* different types. * and converts it into different types.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
@ -30,23 +30,23 @@
*/ */
#ifndef STRING_CONVERTER_H_ #ifndef GNSS_SDR_STRING_CONVERTER_H_
#define STRING_CONVERTER_H_ #define GNSS_SDR_STRING_CONVERTER_H_
#include <string> #include <string>
class StringConverter { class StringConverter {
public: public:
StringConverter(); StringConverter();
virtual ~StringConverter(); virtual ~StringConverter();
bool convert(std::string value, bool default_value); bool convert(std::string value, bool default_value);
long convert(std::string value, long default_value); long convert(std::string value, long default_value);
int convert(std::string value, int default_value); int convert(std::string value, int default_value);
unsigned int convert(std::string value, unsigned int default_value); unsigned int convert(std::string value, unsigned int default_value);
float convert(std::string value, float default_value); float convert(std::string value, float default_value);
double convert(std::string value, double default_value); double convert(std::string value, double default_value);
}; };
#endif /*STRING_CONVERTER_H_*/ #endif /*GNSS_SDR_STRING_CONVERTER_H_*/

View File

@ -1,6 +1,6 @@
/*! /*!
* \file concurrent_queue.h * \file concurrent_queue.h
* \brief This class implements a thread-safe std::queue * \brief Interface of a thread-safe std::queue
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2011. jarribas(at)cttc.es
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
@ -65,9 +65,9 @@ public:
{ {
boost::mutex::scoped_lock lock(the_mutex); boost::mutex::scoped_lock lock(the_mutex);
if(the_queue.empty()) if(the_queue.empty())
{ {
return false; return false;
} }
popped_value=the_queue.front(); popped_value=the_queue.front();
the_queue.pop(); the_queue.pop();
@ -78,9 +78,9 @@ public:
{ {
boost::mutex::scoped_lock lock(the_mutex); boost::mutex::scoped_lock lock(the_mutex);
while(the_queue.empty()) while(the_queue.empty())
{ {
the_condition_variable.wait(lock); the_condition_variable.wait(lock);
} }
popped_value=the_queue.front(); popped_value=the_queue.front();
the_queue.pop(); the_queue.pop();

View File

@ -1,6 +1,6 @@
/*! /*!
* \file control_message.h * \file control_message.h
* \brief This class represents the different control messages. * \brief Interface for the different control messages.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------

View File

@ -29,55 +29,52 @@
*/ */
#include "control_message_factory.h" #include "control_message_factory.h"
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <vector> #include <vector>
#include "string.h" #include "string.h"
using google::LogMessage; using google::LogMessage;
//! Constructor // Constructor
ControlMessageFactory::ControlMessageFactory() ControlMessageFactory::ControlMessageFactory()
{} {}
//! Destructor // Destructor
ControlMessageFactory::~ControlMessageFactory() ControlMessageFactory::~ControlMessageFactory()
{} {}
gr_message_sptr ControlMessageFactory::GetQueueMessage(unsigned int who, unsigned int what) { gr_message_sptr ControlMessageFactory::GetQueueMessage(unsigned int who, unsigned int what) {
ControlMessage *control_message = new ControlMessage; ControlMessage *control_message = new ControlMessage;
control_message->who = who; control_message->who = who;
control_message->what = what; control_message->what = what;
gr_message_sptr queue_message = gr_make_message(0, 0, 0, sizeof(ControlMessage)); gr_message_sptr queue_message = gr_make_message(0, 0, 0, sizeof(ControlMessage));
memcpy(queue_message->msg(), control_message, sizeof(ControlMessage)); memcpy(queue_message->msg(), control_message, sizeof(ControlMessage));
delete control_message; delete control_message;
return queue_message; return queue_message;
} }
std::vector<ControlMessage*>* ControlMessageFactory::GetControlMessages(gr_message_sptr queue_message) { std::vector<ControlMessage*>* ControlMessageFactory::GetControlMessages(gr_message_sptr queue_message) {
std::vector<ControlMessage*>* control_messages = new std::vector<ControlMessage*>(); std::vector<ControlMessage*>* control_messages = new std::vector<ControlMessage*>();
unsigned int control_messages_count = queue_message->length() / sizeof(ControlMessage); unsigned int control_messages_count = queue_message->length() / sizeof(ControlMessage);
if(queue_message->length() % sizeof(ControlMessage) != 0) { if(queue_message->length() % sizeof(ControlMessage) != 0) {
LOG_AT_LEVEL(WARNING) << "Queue message has size " << queue_message->length() << " which is not" << LOG_AT_LEVEL(WARNING) << "Queue message has size " << queue_message->length() << " which is not" <<
" multiple of control message size " << sizeof(ControlMessage); " multiple of control message size " << sizeof(ControlMessage);
LOG_AT_LEVEL(WARNING) << "Ignoring this queue message to prevent unexpected results."; LOG_AT_LEVEL(WARNING) << "Ignoring this queue message to prevent unexpected results.";
return control_messages; return control_messages;
} }
for(unsigned int i=0;i<control_messages_count;i++) { for(unsigned int i=0;i<control_messages_count;i++) {
control_messages->push_back(new ControlMessage); control_messages->push_back(new ControlMessage);
memcpy(control_messages->at(i), queue_message->msg() + (i*sizeof(ControlMessage)), sizeof(ControlMessage)); memcpy(control_messages->at(i), queue_message->msg() + (i*sizeof(ControlMessage)), sizeof(ControlMessage));
} }
return control_messages; return control_messages;
} }

View File

@ -1,6 +1,6 @@
/*! /*!
* \file control_message_factory.h * \file control_message_factory.h
* \brief This class implements a factory for control messages. * \brief Interface of a factory for control messages.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------

View File

@ -82,33 +82,33 @@ void ControlThread::run()
flowgraph_->connect(); flowgraph_->connect();
if (flowgraph_->connected()) if (flowgraph_->connected())
{ {
LOG_AT_LEVEL(INFO) << "Flowgraph connected"; LOG_AT_LEVEL(INFO) << "Flowgraph connected";
} }
else else
{ {
LOG_AT_LEVEL(ERROR) << "Unable to connect flowgraph"; LOG_AT_LEVEL(ERROR) << "Unable to connect flowgraph";
return; return;
} }
flowgraph_->start(); flowgraph_->start();
if (flowgraph_->running()) if (flowgraph_->running())
{ {
LOG_AT_LEVEL(INFO) << "Flowgraph started"; LOG_AT_LEVEL(INFO) << "Flowgraph started";
} }
else else
{ {
LOG_AT_LEVEL(ERROR) << "Unable to start flowgraph"; LOG_AT_LEVEL(ERROR) << "Unable to start flowgraph";
return; return;
} }
// Main loop to read and process the control messages // Main loop to read and process the control messages
while (flowgraph_->running() && !stop_) while (flowgraph_->running() && !stop_)
{ {
//TODO re-enable the blocking read messages functions and fork the process //TODO re-enable the blocking read messages functions and fork the process
read_control_messages(); read_control_messages();
if (control_messages_ != 0) process_control_messages(); if (control_messages_ != 0) process_control_messages();
} }
flowgraph_->stop(); flowgraph_->stop();
@ -118,11 +118,11 @@ void ControlThread::run()
void ControlThread::set_control_queue(gr_msg_queue_sptr control_queue) void ControlThread::set_control_queue(gr_msg_queue_sptr control_queue)
{ {
if (flowgraph_->running()) if (flowgraph_->running())
{ {
LOG_AT_LEVEL(WARNING) LOG_AT_LEVEL(WARNING)
<< "Unable to set control queue while flowgraph is running"; << "Unable to set control queue while flowgraph is running";
return; return;
} }
control_queue_ = control_queue; control_queue_ = control_queue;
} }
@ -130,7 +130,7 @@ void ControlThread::set_control_queue(gr_msg_queue_sptr control_queue)
void ControlThread::init() void ControlThread::init()
{ {
// Instantiates a control queue, a GNSS flowgraph, and a control message factory // Instantiates a control queue, a GNSS flowgraph, and a control message factory
control_queue_ = gr_make_msg_queue(0); control_queue_ = gr_make_msg_queue(0);
flowgraph_ = new GNSSFlowgraph(configuration_, control_queue_); flowgraph_ = new GNSSFlowgraph(configuration_, control_queue_);
control_message_factory_ = new ControlMessageFactory(); control_message_factory_ = new ControlMessageFactory();
@ -145,14 +145,14 @@ void ControlThread::read_control_messages()
DLOG(INFO) << "Reading control messages from queue"; DLOG(INFO) << "Reading control messages from queue";
gr_message_sptr queue_message = control_queue_->delete_head(); gr_message_sptr queue_message = control_queue_->delete_head();
if (queue_message != 0) if (queue_message != 0)
{ {
control_messages_ = control_message_factory_->GetControlMessages( control_messages_ = control_message_factory_->GetControlMessages(
queue_message); queue_message);
} }
else else
{ {
control_messages_ = 0; control_messages_ = 0;
} }
} }
// Apply the corresponding control actions // Apply the corresponding control actions
@ -161,21 +161,21 @@ void ControlThread::process_control_messages()
{ {
for (unsigned int i = 0; i < control_messages_->size(); i++) for (unsigned int i = 0; i < control_messages_->size(); i++)
{
if (stop_) break;
if (control_messages_->at(i)->who == 200)
{ {
apply_action(control_messages_->at(i)->what); if (stop_) break;
} if (control_messages_->at(i)->who == 200)
else {
{ apply_action(control_messages_->at(i)->what);
flowgraph_->apply_action(control_messages_->at(i)->who, }
control_messages_->at(i)->what); else
} {
flowgraph_->apply_action(control_messages_->at(i)->who,
control_messages_->at(i)->what);
}
delete control_messages_->at(i); delete control_messages_->at(i);
processed_control_messages_++; processed_control_messages_++;
} }
control_messages_->clear(); control_messages_->clear();
delete control_messages_; delete control_messages_;
@ -188,13 +188,13 @@ void ControlThread::apply_action(unsigned int what)
switch (what) switch (what)
{ {
case 0: case 0:
DLOG(INFO) << "Received action STOP"; DLOG(INFO) << "Received action STOP";
stop_ = true; stop_ = true;
applied_actions_++; applied_actions_++;
break; break;
default: default:
DLOG(INFO) << "Unrecognized action."; DLOG(INFO) << "Unrecognized action.";
} }
} }

View File

@ -66,14 +66,14 @@ public:
//! \brief Virtual destructor. Derived classes must implement the destructor //! \brief Virtual destructor. Derived classes must implement the destructor
virtual ~ControlThread(); virtual ~ControlThread();
/*! \brief Runs the control thread /*! \brief Runs the control thread
* *
* This is the main loop that reads and process the control messages * This is the main loop that reads and process the control messages:
* 1- Connect the GNSS receiver flowgraph * - Connect the GNSS receiver flowgraph;
* 2- Start the GNSS receiver flowgraph * - Start the GNSS receiver flowgraph;
* while (flowgraph_->running() && !stop)_{ * while (flowgraph_->running() && !stop)_{
* 3- Read control messages and process them } * - Read control messages and process them; }
*/ */
void run(); void run();
/*! /*!
@ -101,9 +101,8 @@ public:
*/ */
GNSSFlowgraph* flowgraph() GNSSFlowgraph* flowgraph()
{ {
return flowgraph_; return flowgraph_;
} }
private: private:

View File

@ -1,6 +1,7 @@
/*! /*!
* \file file_configuration.cc * \file file_configuration.cc
* \brief This class is an implementation of the interface ConfigurationInterface. * \brief Implementation of the interface ConfigurationInterface that reads the
* configuration from a file.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* This implementation has a text file as the source for the values of the parameters. * This implementation has a text file as the source for the values of the parameters.
@ -35,12 +36,9 @@
#include "file_configuration.h" #include "file_configuration.h"
#include <string> #include <string>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
#include "INIReader.h" #include "INIReader.h"
#include "string_converter.h" #include "string_converter.h"
#include "in_memory_configuration.h" #include "in_memory_configuration.h"

View File

@ -1,6 +1,6 @@
/*! /*!
* \file file_configuration.h * \file file_configuration.h
* \brief This class is an implementation of the interface ConfigurationInterface. * \brief A ConfigurationInterface that reads the configuration from a file.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* This implementation has a text file as the source for the values of the parameters. * This implementation has a text file as the source for the values of the parameters.

View File

@ -34,15 +34,12 @@
*/ */
#include "gnss_block_factory.h" #include "gnss_block_factory.h"
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gnss_block_interface.h" #include "gnss_block_interface.h"
#include "pass_through.h" #include "pass_through.h"
@ -169,10 +166,10 @@ GNSSBlockInterface* GNSSBlockFactory::GetChannel(
"SignalConditioner", "Pass_Through", 1, 1, queue), "SignalConditioner", "Pass_Through", 1, 1, queue),
(AcquisitionInterface*)GetBlock(configuration, "Acquisition", (AcquisitionInterface*)GetBlock(configuration, "Acquisition",
acq, 1, 1, queue), (TrackingInterface*)GetBlock( acq, 1, 1, queue), (TrackingInterface*)GetBlock(
configuration, "Tracking", trk, 1, 1, queue), configuration, "Tracking", trk, 1, 1, queue),
(TelemetryDecoderInterface*)GetBlock(configuration, (TelemetryDecoderInterface*)GetBlock(configuration,
"TelemetryDecoder", tlm, 1, 1, queue), "Channel", "TelemetryDecoder", tlm, 1, 1, queue), "Channel",
"Channel", queue); "Channel", queue);
} }
std::vector<GNSSBlockInterface*>* GNSSBlockFactory::GetChannels( std::vector<GNSSBlockInterface*>* GNSSBlockFactory::GetChannels(
@ -190,141 +187,143 @@ std::vector<GNSSBlockInterface*>* GNSSBlockFactory::GetChannels(
std::string telemetry_decoder = configuration->property( std::string telemetry_decoder = configuration->property(
"TelemetryDecoder.implementation", default_implementation); "TelemetryDecoder.implementation", default_implementation);
for (unsigned int i = 0; i < channel_count; i++) for (unsigned int i = 0; i < channel_count; i++)
{ {
std::string acquisition_implementation_name = "Acquisition" std::string acquisition_implementation_name = "Acquisition"
+ boost::lexical_cast<std::string>(i) + ".implementation"; + boost::lexical_cast<std::string>(i) + ".implementation";
std::string acquisition_implementation = configuration->property( std::string acquisition_implementation = configuration->property(
acquisition_implementation_name, default_implementation); acquisition_implementation_name, default_implementation);
channels->push_back(GetChannel(configuration, channels->push_back(GetChannel(configuration,
acquisition_implementation, tracking, telemetry_decoder, i, acquisition_implementation, tracking, telemetry_decoder, i,
queue)); queue));
//std::cout << "getchannel_" << i << ", acq_implementation_name: " //std::cout << "getchannel_" << i << ", acq_implementation_name: "
//<< acquisition_implementation_name << ", implementation: " //<< acquisition_implementation_name << ", implementation: "
//<< acquisition_implementation << std::endl; //<< acquisition_implementation << std::endl;
} }
DLOG(INFO) << "Getting " << channel_count << " channels"; DLOG(INFO) << "Getting " << channel_count << " channels";
return channels; return channels;
} }
/*
* Returns the block with the required configuration and implementation
*
* PLEASE ADD YOUR NEW BLOCK HERE!!
*/
GNSSBlockInterface* GNSSBlockFactory::GetBlock( GNSSBlockInterface* GNSSBlockFactory::GetBlock(
ConfigurationInterface *configuration, std::string role, ConfigurationInterface *configuration, std::string role,
std::string implementation, unsigned int in_streams, std::string implementation, unsigned int in_streams,
unsigned int out_streams, gr_msg_queue_sptr queue) unsigned int out_streams, gr_msg_queue_sptr queue)
{ {
/*!
* \brief Returns the block with the required configuration and implementation
*
* PLEASE ADD YOUR NEW BLOCK HERE!!
*/
GNSSBlockInterface* block = NULL; //Change to nullptr when available in compilers (C++11) GNSSBlockInterface* block = NULL; //Change to nullptr when available in compilers (C++11)
// SIGNAL SOURCES // SIGNAL SOURCES -------------------------------------------------------------
if (implementation.compare("File_Signal_Source") == 0) if (implementation.compare("File_Signal_Source") == 0)
{ {
block = new FileSignalSource(configuration, role, in_streams, block = new FileSignalSource(configuration, role, in_streams,
out_streams, queue); out_streams, queue);
} }
// else if (implementation.compare("USRP1_Signal_Source") == 0) // else if (implementation.compare("USRP1_Signal_Source") == 0)
// { // {
// block = new Usrp1SignalSource(configuration, role, in_streams, // block = new Usrp1SignalSource(configuration, role, in_streams,
// out_streams, queue); // out_streams, queue);
// } // }
//! \todo Create a UHD block //! \todo Create a UHD block
// SIGNAL CONDITIONERS // SIGNAL CONDITIONERS ---------------------------------------------------------
else if (implementation.compare("Pass_Through") == 0) else if (implementation.compare("Pass_Through") == 0)
{ {
block = new PassThrough(configuration, role, in_streams, out_streams); block = new PassThrough(configuration, role, in_streams, out_streams);
} }
else if (implementation.compare("Direct_Resampler") == 0) else if (implementation.compare("Direct_Resampler") == 0)
{ {
block = new DirectResamplerConditioner(configuration, role, block = new DirectResamplerConditioner(configuration, role,
in_streams, out_streams); in_streams, out_streams);
} }
// ACQUISITION BLOCKS // ACQUISITION BLOCKS ---------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_GPS_SDR_Acquisition") == 0) else if (implementation.compare("GPS_L1_CA_GPS_SDR_Acquisition") == 0)
{ {
block = new GpsL1CaGpsSdrAcquisition(configuration, role, in_streams, block = new GpsL1CaGpsSdrAcquisition(configuration, role, in_streams,
out_streams, queue); out_streams, queue);
} }
else if (implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0) else if (implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0)
{ {
block = new GpsL1CaPcpsAcquisition(configuration, role, in_streams, block = new GpsL1CaPcpsAcquisition(configuration, role, in_streams,
out_streams, queue); out_streams, queue);
} }
else if (implementation.compare("GPS_L1_CA_TONG_PCPS_Acquisition") == 0) else if (implementation.compare("GPS_L1_CA_TONG_PCPS_Acquisition") == 0)
{ {
block = new GpsL1CaTongPcpsAcquisition(configuration, role, block = new GpsL1CaTongPcpsAcquisition(configuration, role,
in_streams, out_streams, queue); in_streams, out_streams, queue);
} }
// TRACKING BLOCKS // TRACKING BLOCKS -------------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking") == 0) else if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking") == 0)
{ {
block = new GpsL1CaDllPllTracking(configuration, role, in_streams, block = new GpsL1CaDllPllTracking(configuration, role, in_streams,
out_streams, queue); out_streams, queue);
} }
else if (implementation.compare("GPS_L1_CA_DLL_FLL_PLL_Tracking") == 0) else if (implementation.compare("GPS_L1_CA_DLL_FLL_PLL_Tracking") == 0)
{ {
block = new GpsL1CaDllFllPllTracking(configuration, role, in_streams, block = new GpsL1CaDllFllPllTracking(configuration, role, in_streams,
out_streams, queue); out_streams, queue);
} }
// TELEMETRY DECODERS // TELEMETRY DECODERS ----------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_Telemetry_Decoder") == 0) else if (implementation.compare("GPS_L1_CA_Telemetry_Decoder") == 0)
{ {
block = new GpsL1CaTelemetryDecoder(configuration, role, in_streams, block = new GpsL1CaTelemetryDecoder(configuration, role, in_streams,
out_streams, queue); out_streams, queue);
} }
// OBSERVABLES // OBSERVABLES -----------------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_Observables") == 0) else if (implementation.compare("GPS_L1_CA_Observables") == 0)
{ {
block = new GpsL1CaObservables(configuration, role, in_streams, block = new GpsL1CaObservables(configuration, role, in_streams,
out_streams, queue); out_streams, queue);
} }
// PVT // PVT -------------------------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_PVT") == 0) else if (implementation.compare("GPS_L1_CA_PVT") == 0)
{ {
block = new GpsL1CaPvt(configuration, role, in_streams, block = new GpsL1CaPvt(configuration, role, in_streams,
out_streams, queue); out_streams, queue);
} }
// OUTPUT FILTERS // OUTPUT FILTERS --------------------------------------------------------------
else if (implementation.compare("Null_Sink_Output_Filter") == 0) else if (implementation.compare("Null_Sink_Output_Filter") == 0)
{ {
block = new NullSinkOutputFilter(configuration, role, in_streams, block = new NullSinkOutputFilter(configuration, role, in_streams,
out_streams); out_streams);
} }
else if (implementation.compare("File_Output_Filter") == 0) else if (implementation.compare("File_Output_Filter") == 0)
{ {
block = new FileOutputFilter(configuration, role, in_streams, block = new FileOutputFilter(configuration, role, in_streams,
out_streams); out_streams);
} }
else else
{ {
// Log fatal. This causes execution to stop. // Log fatal. This causes execution to stop.
LOG_AT_LEVEL(ERROR) << implementation LOG_AT_LEVEL(ERROR) << implementation
<< ": Undefined implementation for block"; << ": Undefined implementation for block";
} }
return block; return block;
} }

View File

@ -1,6 +1,6 @@
/*! /*!
* \file gnss_block_factory.h * \file gnss_block_factory.h
* \brief This class implements a factory that returns instances of GNSS blocks. * \brief Interface of a factory that returns instances of GNSS blocks.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2011. luis(at)epsilon-formacion.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com
* Javier Arribas, 2011. jarribas(at)cttc.es * Javier Arribas, 2011. jarribas(at)cttc.es
@ -38,7 +38,6 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <gnuradio/gr_msg_queue.h> #include <gnuradio/gr_msg_queue.h>
class ConfigurationInterface; class ConfigurationInterface;
@ -67,6 +66,10 @@ public:
gr_msg_queue_sptr queue); gr_msg_queue_sptr queue);
std::vector<GNSSBlockInterface*>* GetChannels( std::vector<GNSSBlockInterface*>* GetChannels(
ConfigurationInterface *configuration, gr_msg_queue_sptr queue); ConfigurationInterface *configuration, gr_msg_queue_sptr queue);
/*
* \brief Returns the block with the required configuration and implementation
*/
GNSSBlockInterface* GetBlock(ConfigurationInterface* configuration, GNSSBlockInterface* GetBlock(ConfigurationInterface* configuration,
std::string role, std::string implementation, std::string role, std::string implementation,
unsigned int in_streams, unsigned int out_streams, unsigned int in_streams, unsigned int out_streams,

View File

@ -1,6 +1,6 @@
/*! /*!
* \file gnss_flowgraph.cc * \file gnss_flowgraph.cc
* \brief Brief description of the file here * \brief Implementation of a GNSS receiver flowgraph
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2011. luis(at)epsilon-formacion.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com
* *
@ -64,9 +64,9 @@ GNSSFlowgraph::~GNSSFlowgraph()
delete block_factory_; delete block_factory_;
for (unsigned int i = 0; i < blocks_->size(); i++) for (unsigned int i = 0; i < blocks_->size(); i++)
{ {
delete blocks_->at(i); delete blocks_->at(i);
} }
blocks_->clear(); blocks_->clear();
delete blocks_; delete blocks_;
@ -75,20 +75,20 @@ GNSSFlowgraph::~GNSSFlowgraph()
void GNSSFlowgraph::start() void GNSSFlowgraph::start()
{ {
if (running_) if (running_)
{ {
LOG_AT_LEVEL(WARNING) << "Already running"; LOG_AT_LEVEL(WARNING) << "Already running";
return; return;
} }
try try
{ {
top_block_->start(); top_block_->start();
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG_AT_LEVEL(ERROR) << "Unable to start flowgraph"; LOG_AT_LEVEL(ERROR) << "Unable to start flowgraph";
LOG_AT_LEVEL(ERROR) << e.what(); LOG_AT_LEVEL(ERROR) << e.what();
return; return;
} }
running_ = true; running_ = true;
@ -97,9 +97,9 @@ void GNSSFlowgraph::start()
void GNSSFlowgraph::stop() void GNSSFlowgraph::stop()
{ {
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)
{ {
channel(i)->stop(); channel(i)->stop();
} }
DLOG(INFO) << "Threads finished. Return to main program."; DLOG(INFO) << "Threads finished. Return to main program.";
top_block_->stop(); top_block_->stop();
running_ = false; running_ = false;
@ -107,184 +107,184 @@ void GNSSFlowgraph::stop()
void GNSSFlowgraph::connect() void GNSSFlowgraph::connect()
{ {
/* Connects the blocks in the flowgraph /* Connects the blocks in the flowgraph
* *
* Signal Source > Signal conditioner > Channels >> Observables >> PVT > Output filter * Signal Source > Signal conditioner > Channels >> Observables >> PVT > Output filter
*/ */
DLOG(INFO) << "Connecting flowgraph"; DLOG(INFO) << "Connecting flowgraph";
if (connected_) if (connected_)
{ {
LOG_AT_LEVEL(WARNING) << "flowgraph already connected"; LOG_AT_LEVEL(WARNING) << "flowgraph already connected";
return; return;
} }
// Connect GNSS block internally // Connect GNSS block internally
try try
{ {
signal_source()->connect(top_block_); signal_source()->connect(top_block_);
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG_AT_LEVEL(ERROR) << "Can't connect signal source block internally"; LOG_AT_LEVEL(ERROR) << "Can't connect signal source block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
try
{
signal_conditioner()->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal conditioner block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
for (unsigned int i = 0; i < channels_count_; i++)
{
try
{
channel(i)->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect channel " << i
<< " internally";
LOG_AT_LEVEL(ERROR) << e.what(); LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all(); top_block_->disconnect_all();
return; return;
}
try
{
signal_conditioner()->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal conditioner block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
for (unsigned int i = 0; i < channels_count_; i++)
{
try
{
channel(i)->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect channel " << i
<< " internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
} }
try
{
observables()->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect observables block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
} }
try try
{ {
observables()->connect(top_block_); pvt()->connect(top_block_);
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG_AT_LEVEL(ERROR) << "Can't connect observables block internally"; LOG_AT_LEVEL(ERROR) << "Can't connect PVT block internally";
LOG_AT_LEVEL(ERROR) << e.what(); LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all(); top_block_->disconnect_all();
return; return;
} }
try try
{ {
pvt()->connect(top_block_); output_filter()->connect(top_block_);
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG_AT_LEVEL(ERROR) << "Can't connect PVT block internally"; LOG_AT_LEVEL(ERROR) << "Can't connect output filter block internally";
LOG_AT_LEVEL(ERROR) << e.what(); LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all(); top_block_->disconnect_all();
return; return;
}
try
{
output_filter()->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect output filter block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
} }
DLOG(INFO) << "blocks connected internally"; DLOG(INFO) << "blocks connected internally";
try try
{ {
top_block_->connect(signal_source()->get_right_block(), 0, top_block_->connect(signal_source()->get_right_block(), 0,
signal_conditioner()->get_left_block(), 0); signal_conditioner()->get_left_block(), 0);
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG_AT_LEVEL(ERROR) LOG_AT_LEVEL(ERROR)
<< "Can't connect signal source to signal conditioner"; << "Can't connect signal source to signal conditioner";
LOG_AT_LEVEL(ERROR) << e.what(); LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all(); top_block_->disconnect_all();
return; return;
} }
DLOG(INFO) << "Signal source connected to signal conditioner"; DLOG(INFO) << "Signal source connected to signal conditioner";
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)
{
try
{ {
top_block_->connect(signal_conditioner()->get_right_block(), 0, try
channel(i)->get_left_block(), 0); {
} top_block_->connect(signal_conditioner()->get_right_block(), 0,
catch (std::exception& e) channel(i)->get_left_block(), 0);
{ }
LOG_AT_LEVEL(ERROR) catch (std::exception& e)
<< "Can't connect signal conditioner to channel " << i; {
LOG_AT_LEVEL(ERROR) << e.what(); LOG_AT_LEVEL(ERROR)
top_block_->disconnect_all(); << "Can't connect signal conditioner to channel " << i;
return; LOG_AT_LEVEL(ERROR) << e.what();
} top_block_->disconnect_all();
return;
}
DLOG(INFO) << "signal conditioner connected to channel " << i; DLOG(INFO) << "signal conditioner connected to channel " << i;
try try
{ {
top_block_->connect(channel(i)->get_right_block(), 0, top_block_->connect(channel(i)->get_right_block(), 0,
observables()->get_left_block(), i); observables()->get_left_block(), i);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect channel " << i
<< " to observables";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
channel(i)->set_satellite(available_GPS_satellites_IDs_->front());
std::cout << "Channel " << i << " satellite "
<< available_GPS_satellites_IDs_->front() << std::endl;
available_GPS_satellites_IDs_->pop_front();
channel(i)->start();
//channel(i)->start_acquisition();
DLOG(INFO) << "Channel " << i
<< " connected to observables and ready for acquisition";
} }
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect channel " << i
<< " to observables";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
channel(i)->set_satellite(available_GPS_satellites_IDs_->front());
std::cout << "Channel " << i << " satellite "
<< available_GPS_satellites_IDs_->front() << std::endl;
available_GPS_satellites_IDs_->pop_front();
channel(i)->start();
//channel(i)->start_acquisition();
DLOG(INFO) << "Channel " << i
<< " connected to observables and ready for acquisition";
}
/* /*
* Connect the observables output of each channel to the PVT block * Connect the observables output of each channel to the PVT block
*/ */
try try
{ {
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)
{ {
top_block_->connect(observables()->get_right_block(), i, top_block_->connect(observables()->get_right_block(), i,
pvt()->get_left_block(), i); pvt()->get_left_block(), i);
} }
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG_AT_LEVEL(ERROR) << "Can't connect observables to PVT"; LOG_AT_LEVEL(ERROR) << "Can't connect observables to PVT";
LOG_AT_LEVEL(ERROR) << e.what(); LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all(); top_block_->disconnect_all();
return; return;
} }
try try
{ {
top_block_->connect(pvt()->get_right_block(), 0, top_block_->connect(pvt()->get_right_block(), 0,
output_filter()->get_left_block(), 0); output_filter()->get_left_block(), 0);
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG_AT_LEVEL(ERROR) << "Can't connect PVT to output filter"; LOG_AT_LEVEL(ERROR) << "Can't connect PVT to output filter";
LOG_AT_LEVEL(ERROR) << e.what(); LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all(); top_block_->disconnect_all();
return; return;
} }
DLOG(INFO) << "PVT connected to output filter"; DLOG(INFO) << "PVT connected to output filter";
@ -298,42 +298,42 @@ void GNSSFlowgraph::connect()
void GNSSFlowgraph::wait() void GNSSFlowgraph::wait()
{ {
if (!running_) if (!running_)
{ {
LOG_AT_LEVEL(WARNING) << "Can't apply wait. Flowgraph is not running"; LOG_AT_LEVEL(WARNING) << "Can't apply wait. Flowgraph is not running";
return; return;
} }
top_block_->wait(); top_block_->wait();
DLOG(INFO) << "Flowgraph finished calculations"; DLOG(INFO) << "Flowgraph finished calculations";
running_ = false; running_ = false;
} }
/*
* Applies an action to the flowgraph
*
* \param[in] who Who generated the action
* \param[in] what What is the action 0: acquisition failed
*/
void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
{ {
/*!
* \brief Applies an action to the flowgraph
*
* \param[in] who Who generated the action
* \param[in] what What is the action 0: acquisition failed
*/
DLOG(INFO) << "received " << what << " from " << who; DLOG(INFO) << "received " << what << " from " << who;
switch (what) switch (what)
{ {
case 0: case 0:
LOG_AT_LEVEL(INFO) << "Channel " << who LOG_AT_LEVEL(INFO) << "Channel " << who
<< " ACQ FAILED satellite " << channel(who)->satellite(); << " ACQ FAILED satellite " << channel(who)->satellite();
available_GPS_satellites_IDs_->push_back( available_GPS_satellites_IDs_->push_back(
channel(who)->satellite()); channel(who)->satellite());
channel(who)->set_satellite( channel(who)->set_satellite(
available_GPS_satellites_IDs_->front()); available_GPS_satellites_IDs_->front());
available_GPS_satellites_IDs_->pop_front(); available_GPS_satellites_IDs_->pop_front();
channel(who)->start_acquisition(); channel(who)->start_acquisition();
break; break;
// TODO: Tracking messages // TODO: Tracking messages
default: default:
break; break;
} }
DLOG(INFO) << "available channels " DLOG(INFO) << "available channels "
@ -343,17 +343,17 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
void GNSSFlowgraph::set_configuration(ConfigurationInterface* configuration) void GNSSFlowgraph::set_configuration(ConfigurationInterface* configuration)
{ {
if (running_) if (running_)
{ {
LOG_AT_LEVEL(WARNING) LOG_AT_LEVEL(WARNING)
<< "Unable to update configuration while flowgraph running"; << "Unable to update configuration while flowgraph running";
return; return;
} }
if (connected_) if (connected_)
{ {
LOG_AT_LEVEL(WARNING) LOG_AT_LEVEL(WARNING)
<< "Unable to update configuration while flowgraph connected"; << "Unable to update configuration while flowgraph connected";
} }
configuration_ = configuration; configuration_ = configuration;
} }
@ -390,9 +390,9 @@ GNSSBlockInterface* GNSSFlowgraph::output_filter()
void GNSSFlowgraph::init() void GNSSFlowgraph::init()
{ {
/*! /*
* \brief Instantiates the receiver blocks * Instantiates the receiver blocks
*/ */
blocks_->push_back( blocks_->push_back(
block_factory_->GetSignalSource(configuration_, queue_)); block_factory_->GetSignalSource(configuration_, queue_));
blocks_->push_back(block_factory_->GetSignalConditioner(configuration_, blocks_->push_back(block_factory_->GetSignalConditioner(configuration_,
@ -408,9 +408,9 @@ void GNSSFlowgraph::init()
channels_count_ = channels->size(); channels_count_ = channels->size();
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)
{ {
blocks_->push_back(channels->at(i)); blocks_->push_back(channels->at(i));
} }
top_block_ = gr_make_top_block("GNSSFlowgraph"); top_block_ = gr_make_top_block("GNSSFlowgraph");
@ -429,45 +429,45 @@ void GNSSFlowgraph::init()
void GNSSFlowgraph::set_satellites_list() void GNSSFlowgraph::set_satellites_list()
{ {
/* /*
* Sets a sequential list of satellites (1...33) * Sets a sequential list of satellites (1...33)
*/ */
/*! /*!
* \TODO Describe GNSS satellites more nicely, with RINEX notation * \TODO Describe GNSS satellites more nicely, with RINEX notation
* See http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf (page 5) * See http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf (page 5)
*/ */
for (unsigned int id = 1; id < 33; id++) for (unsigned int id = 1; id < 33; id++)
{ {
available_GPS_satellites_IDs_->push_back(id); available_GPS_satellites_IDs_->push_back(id);
} }
std::list<unsigned int>::iterator it = std::list<unsigned int>::iterator it =
available_GPS_satellites_IDs_->begin(); available_GPS_satellites_IDs_->begin();
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)
{
unsigned int sat = configuration_->property("Acquisition"
+ boost::lexical_cast<std::string>(i) + ".satellite", 0);
if ((sat == 0) || (sat==*it)) // 0 = not PRN in configuration file
{ {
it++; unsigned int sat = configuration_->property("Acquisition"
+ boost::lexical_cast<std::string>(i) + ".satellite", 0);
if ((sat == 0) || (sat==*it)) // 0 = not PRN in configuration file
{
it++;
}
else
{
available_GPS_satellites_IDs_->remove(sat);
available_GPS_satellites_IDs_->insert(it, sat);
}
} }
else
{
available_GPS_satellites_IDs_->remove(sat);
available_GPS_satellites_IDs_->insert(it, sat);
}
}
// std::cout << "Satellite queue: "; // std::cout << "Satellite queue: ";
// for (std::list<unsigned int>::iterator it = // for (std::list<unsigned int>::iterator it =
// available_GPS_satellites_IDs_->begin(); it // available_GPS_satellites_IDs_->begin(); it
// != available_GPS_satellites_IDs_->end(); it++) // != available_GPS_satellites_IDs_->end(); it++)
// { // {
// std::cout << *it << ", "; // std::cout << *it << ", ";
// } // }
// std::cout << std::endl; // std::cout << std::endl;
} }

View File

@ -1,6 +1,6 @@
/*! /*!
* \file gnss_flowgraph.h * \file gnss_flowgraph.h
* \brief This class represents a GNSS flowgraph. * \brief Interface of a GNSS receiver flowgraph.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2011. luis(at)epsilon-formacion.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com
* *
@ -55,15 +55,15 @@ class GNSSFlowgraph
{ {
public: public:
/*! /*!
* \brief Constructor that initializes the receiver flowgraph * \brief Constructor that initializes the receiver flowgraph
*/ */
GNSSFlowgraph(ConfigurationInterface* configuration, GNSSFlowgraph(ConfigurationInterface* configuration,
gr_msg_queue_sptr queue); gr_msg_queue_sptr queue);
/*! /*!
* \brief Virtual destructor * \brief Virtual destructor
*/ */
virtual ~GNSSFlowgraph(); virtual ~GNSSFlowgraph();
//! \brief Start the flowgraph //! \brief Start the flowgraph
@ -72,15 +72,21 @@ public:
//! \brief Stop the flowgraph //! \brief Stop the flowgraph
void stop(); void stop();
/*! /*!
* \brief Connects the defined blocks in the flowgraph * \brief Connects the defined blocks in the flowgraph
* *
* Signal Source > Signal conditioner > Channels >> Observables >> PVT > Output filter * Signal Source > Signal conditioner > Channels >> Observables >> PVT > Output filter
*/ */
void connect(); void connect();
void wait(); void wait();
/*!
* \brief Applies an action to the flowgraph
*
* \param[in] who Who generated the action
* \param[in] what What is the action 0: acquisition failed
*/
void apply_action(unsigned int who, unsigned int what); void apply_action(unsigned int who, unsigned int what);
void set_configuration(ConfigurationInterface* configuration); void set_configuration(ConfigurationInterface* configuration);

View File

@ -1,10 +1,9 @@
/*! /*!
* \file * \file in_memory_configuration.cc
* \brief Brief description of the file here * \brief This implementation accepts configuration parameters upon instantiation and
* it is intended to be used in unit testing.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* Detailed description of the file here if needed.
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -32,9 +31,7 @@
#include "in_memory_configuration.h" #include "in_memory_configuration.h"
#include <utility> #include <utility>
#include "string_converter.h" #include "string_converter.h"
InMemoryConfiguration::InMemoryConfiguration() InMemoryConfiguration::InMemoryConfiguration()

View File

@ -1,6 +1,6 @@
/*! /*!
* \file in_memory_configuration.h * \file in_memory_configuration.h
* \brief This class is an implementation of the interface ConfigurationInterface. * \brief A ConfigurationInterface for testing purposes.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* This implementation accepts configuration parameters upon instantiation and * This implementation accepts configuration parameters upon instantiation and

View File

@ -3,8 +3,8 @@
* \brief Main file of the GNSS-SDR program. * \brief Main file of the GNSS-SDR program.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* *
* It creates a ControlThread object, makes it run, and releases memory * It sets up the logging system, creates a ControlThread object,
* back when the main thread has ended. * makes it run, and releases memory back when the main thread has ended.
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
@ -51,8 +51,8 @@ DECLARE_string(log_dir);
* \todo make this queue generic for all the GNSS systems (javi) * \todo make this queue generic for all the GNSS systems (javi)
*/ */
/*! /*
* \brief Concurrent queue that communicates the Telemetry Decoder * Concurrent queue that communicates the Telemetry Decoder
* to the Observables modules * to the Observables modules
*/ */
concurrent_queue<gps_navigation_message> global_gps_nav_msg_queue; concurrent_queue<gps_navigation_message> global_gps_nav_msg_queue;
@ -61,12 +61,12 @@ int main(int argc, char** argv)
{ {
const std::string intro_help( const std::string intro_help(
std::string("\nGNSS-SDR is an Open Source GNSS Software Defined Receiver\n") std::string("\nGNSS-SDR is an Open Source GNSS Software Defined Receiver\n")
+ +
"Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)\n" "Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)\n"
+ +
"This program comes with ABSOLUTELY NO WARRANTY;\n" "This program comes with ABSOLUTELY NO WARRANTY;\n"
+ +
"See COPYING file to see a copy of the General Public License\n \n"); "See COPYING file to see a copy of the General Public License\n \n");
google::SetUsageMessage(intro_help); google::SetUsageMessage(intro_help);
@ -77,20 +77,20 @@ int main(int argc, char** argv)
google::InitGoogleLogging(argv[0]); google::InitGoogleLogging(argv[0]);
if (FLAGS_log_dir.empty()) if (FLAGS_log_dir.empty())
{ {
std::cout << "Logging will be done at " << boost::filesystem::temp_directory_path() << std::endl std::cout << "Logging will be done at " << boost::filesystem::temp_directory_path() << std::endl
<< "Use gnss-sdr --log_dir=/path/to/log to change that."<< std::endl; << "Use gnss-sdr --log_dir=/path/to/log to change that."<< std::endl;
} }
else else
{ {
const boost::filesystem::path p (FLAGS_log_dir); const boost::filesystem::path p (FLAGS_log_dir);
if (!boost::filesystem::exists(p)) if (!boost::filesystem::exists(p))
{ {
std::cout << "The path " << FLAGS_log_dir << " does not exist, attepting to create it" << std::endl; std::cout << "The path " << FLAGS_log_dir << " does not exist, attempting to create it" << std::endl;
boost::filesystem::create_directory(p); boost::filesystem::create_directory(p);
} }
std::cout << "Logging with be done at " << FLAGS_log_dir << std::endl; std::cout << "Logging with be done at " << FLAGS_log_dir << std::endl;
} }