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
* \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
*
*
@ -56,8 +57,8 @@ GpsL1CaPvt::GpsL1CaPvt(ConfigurationInterface* configuration,
DLOG(INFO) << "role " << role;
int averaging_depth;
averaging_depth=configuration->property(role + ".averaging_depth", 10);
int averaging_depth;
averaging_depth=configuration->property(role + ".averaging_depth", 10);
bool flag_averaging;
flag_averaging=configuration->property(role + ".flag_averaging", false);
@ -65,7 +66,7 @@ GpsL1CaPvt::GpsL1CaPvt(ConfigurationInterface* configuration,
dump_ = configuration->property(role + ".dump", false);
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() << ")";
// set the navigation msg queue;

View File

@ -1,6 +1,8 @@
/*!
* \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
*
*
@ -48,7 +50,7 @@ class GpsL1CaPvt : public PvtInterface
public:
GpsL1CaPvt(ConfigurationInterface* configuration,
GpsL1CaPvt(ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams,
unsigned int out_streams,

View File

@ -1,6 +1,6 @@
/*!
* \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
* -------------------------------------------------------------------------
*
@ -48,36 +48,36 @@ using google::LogMessage;
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) {
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) :
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_block ("gps_l1_ca_pvt_cc", gr_make_io_signature (nchannels, nchannels, sizeof(gnss_pseudorange)),
gr_make_io_signature(1, 1, sizeof(gr_complex))) {
// initialize internal vars
d_queue = queue;
d_dump = dump;
d_nchannels = nchannels;
d_dump_filename=dump_filename;
std::string kml_dump_filename;
kml_dump_filename=d_dump_filename;
kml_dump_filename.append(".kml");
d_kml_dump.set_headers(kml_dump_filename);
d_dump_filename.append(".dat");
// initialize internal vars
d_queue = queue;
d_dump = dump;
d_nchannels = nchannels;
d_dump_filename=dump_filename;
std::string kml_dump_filename;
kml_dump_filename=d_dump_filename;
kml_dump_filename.append(".kml");
d_kml_dump.set_headers(kml_dump_filename);
d_dump_filename.append(".dat");
d_averaging_depth=averaging_depth;
d_flag_averaging=flag_averaging;
/*!
* \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_ls_pvt=new gps_l1_ca_ls_pvt(nchannels,d_dump_filename,d_dump);
d_ls_pvt->set_averaging_depth(d_averaging_depth);
d_ephemeris_clock_s=0.0;
d_averaging_depth=averaging_depth;
d_flag_averaging=flag_averaging;
/*!
* \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_ls_pvt=new gps_l1_ca_ls_pvt(nchannels,d_dump_filename,d_dump);
d_ls_pvt->set_averaging_depth(d_averaging_depth);
d_ephemeris_clock_s=0.0;
d_sample_counter=0;
d_sample_counter=0;
}
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)
{
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,
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>::iterator gnss_pseudoranges_iter;
std::map<int,gnss_pseudorange> gnss_pseudoranges_map;
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++)
{
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
}
}
for (unsigned int i=0;i<d_nchannels;i++)
{
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
}
}
//debug print
std::cout << std::setprecision(16);
for(gnss_pseudoranges_iter = gnss_pseudoranges_map.begin();
gnss_pseudoranges_iter != gnss_pseudoranges_map.end();
gnss_pseudoranges_iter++)
{
std::cout<<"Pseudoranges(SV ID,pseudorange [m]) =("<<gnss_pseudoranges_iter->first<<","<<gnss_pseudoranges_iter->second.pseudorange_m<<")"<<std::endl;
}
//debug print
std::cout << std::setprecision(16);
for(gnss_pseudoranges_iter = gnss_pseudoranges_map.begin();
gnss_pseudoranges_iter != gnss_pseudoranges_map.end();
gnss_pseudoranges_iter++)
{
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)
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;
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;
d_last_nav_msg=nav_msg;
d_ls_pvt->d_ephemeris[nav_msg.d_channel_ID]=nav_msg;
// **** update pseudoranges clock ****
if (nav_msg.d_satellite_PRN==gnss_pseudoranges_iter->second.SV_ID)
{
d_ephemeris_clock_s=d_last_nav_msg.d_TOW;
d_ephemeris_timestamp_ms=d_last_nav_msg.d_subframe1_timestamp_ms;
}
// **** write ephemeris to RINES NAV file
//d_rinex_printer.LogRinex2Nav(nav_msg);
}
gps_navigation_message nav_msg;
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;
d_last_nav_msg=nav_msg;
d_ls_pvt->d_ephemeris[nav_msg.d_channel_ID]=nav_msg;
// **** update pseudoranges clock ****
if (nav_msg.d_satellite_PRN==gnss_pseudoranges_iter->second.SV_ID)
{
d_ephemeris_clock_s=d_last_nav_msg.d_TOW;
d_ephemeris_timestamp_ms=d_last_nav_msg.d_subframe1_timestamp_ms;
}
// **** write ephemeris to RINES NAV file
//d_rinex_printer.LogRinex2Nav(nav_msg);
}
// ############ 2. COMPUTE THE PVT ################################
// write the pseudoranges to RINEX OBS file
// 1- need a valid clock
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);
// 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";
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_flag_averaging)==true)
{
d_kml_dump.print_position(d_ls_pvt,d_flag_averaging);
}
}
// ############ 2. COMPUTE THE PVT ################################
// write the pseudoranges to RINEX OBS file
// 1- need a valid clock
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);
// 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";
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_flag_averaging)==true)
{
d_kml_dump.print_position(d_ls_pvt,d_flag_averaging);
}
}
consume_each(1); //one by one
return 0;
consume_each(1); //one by one
return 0;
}

View File

@ -1,6 +1,6 @@
/*!
* \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
* -------------------------------------------------------------------------
*

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
/*!
* \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
*
*

View File

@ -1,6 +1,8 @@
/*!
* \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
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
*
@ -32,19 +34,17 @@
#include "gps_l1_ca_gps_sdr_acquisition.h"
#include "GPS_L1_CA.h"
#include "configuration_interface.h"
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_stream_to_vector.h>
#include <gnuradio/gr_vector_to_stream.h>
#include <gnuradio/gr_complex_to_interleaved_short.h>
#include <gnuradio/gr_interleaved_short_to_complex.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
using google::LogMessage;
//! Constructor
// Constructor
GpsL1CaGpsSdrAcquisition::GpsL1CaGpsSdrAcquisition(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams,
@ -108,11 +108,11 @@ GpsL1CaGpsSdrAcquisition::GpsL1CaGpsSdrAcquisition(
}
//! Destructor
// Destructor
GpsL1CaGpsSdrAcquisition::~GpsL1CaGpsSdrAcquisition()
{}
//! Set satellite
// Set satellite
void GpsL1CaGpsSdrAcquisition::set_satellite(unsigned int 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)
{
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)
{
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)
{
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(
concurrent_queue<int> *channel_internal_queue)
{

View File

@ -1,6 +1,8 @@
/*!
* \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
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
*

View File

@ -1,11 +1,9 @@
/*!
* \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
* 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)
@ -40,7 +38,6 @@
#include <gnuradio/gr_vector_to_stream.h>
#include <gnuradio/gr_complex_to_interleaved_short.h>
#include <gnuradio/gr_interleaved_short_to_complex.h>
#include <glog/log_severity.h>
#include <glog/logging.h>

View File

@ -1,6 +1,6 @@
/*!
* \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
* 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);
/*!
* \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
{
@ -130,22 +130,27 @@ public:
}
void set_satellite(unsigned int satellite);
void set_active(bool active)
{
d_active = active;
}
void set_channel(unsigned int channel)
{
d_channel = channel;
}
void set_threshold(float threshold)
{
d_threshold = threshold;
}
void set_doppler_max(unsigned int doppler_max)
{
d_doppler_max = doppler_max;
}
void set_doppler_step(unsigned int 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,
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
std::string dump_filename) :
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_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))
{
// SAMPLE COUNTER
@ -130,9 +130,9 @@ gps_l1_ca_tong_pcps_acquisition_cc::~gps_l1_ca_tong_pcps_acquisition_cc()
delete d_ifft;
if (d_dump)
{
d_dump_file.close();
}
{
d_dump_file.close();
}
}
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
//! \TODO Optimize it ! Try conj() or Armadillo
for (unsigned int i = 0; i < d_samples; i++)
{
d_fft_codes[i] = std::complex<float>(
d_fft_if->get_outbuf()[i].real(),
-d_fft_if->get_outbuf()[i].imag());
}
{
d_fft_codes[i] = std::complex<float>(
d_fft_if->get_outbuf()[i].real(),
-d_fft_if->get_outbuf()[i].imag());
}
}
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)
{
// sample counter
d_sample_counter += d_samples * noutput_items;
consume_each(noutput_items);
}
{
// sample counter
d_sample_counter += d_samples * noutput_items;
consume_each(noutput_items);
}
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_noise_power = sqrt(d_noise_power / (float)d_samples);
d_sample_counter += 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_fft_if->get_inbuf()[i] = in[i] * d_if_sin[i];
}
// initialize acquisition algorithm
//3- Perform the FFT-based circular convolution (parallel time search)
d_fft_if->execute();
bool positive_acquisition = false;
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
//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];
}
//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;
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
x86_float_max((float*)d_ifft->get_outbuf(), &d_indext, &magt,
d_samples); // find max of |abs(·)|^2 -> index and magt
magt = sqrt(magt) / (float)d_samples;
d_test_statistics = magt / d_noise_power;
// aux vars
std::stringstream filename;
//unsigned int consume_items = 1;
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;
// complex file write
// std::streamsize n = 2 * sizeof(float) * (d_samples);
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
{
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)
// 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_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;
d_noise_power += std::abs(in[i]);
}
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_doppler_step;
d_fft_if->get_inbuf()[i] = in[i] * d_if_sin[i];
}
}
else d_dwells++;
}
// 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();
// }
//3- Perform the FFT-based circular convolution (parallel time search)
d_fft_if->execute();
//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)
{
if (positive_acquisition)
{
acquisition_message = 1;
}
d_ifft->execute();
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,
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
{
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;
}
@ -344,10 +344,10 @@ float gps_l1_ca_tong_pcps_acquisition_cc::calculate_envelope(
//std::cout << "tmp_cpx " << tmp_cpx << std::endl;
for (unsigned int i = 0; i < d_samples; i++)
{
tmp_cpx = tmp_cpx + _input_signal[i] * _local_code[i]
* _local_if_sin[i];
}
{
tmp_cpx = tmp_cpx + _input_signal[i] * _local_code[i]
* _local_if_sin[i];
}
//std::cout << "tmp_cpx " << tmp_cpx << std::endl;
mag = abs(tmp_cpx);

View File

@ -44,10 +44,12 @@
#include "concurrent_queue.h"
class 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_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,
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
* 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)
@ -32,34 +30,30 @@
*/
#include "channel.h"
#include "acquisition_interface.h"
#include "tracking_interface.h"
#include "telemetry_decoder_interface.h"
#include "configuration_interface.h"
#include "gnss_flowgraph.h"
#include <iostream>
#include <sstream>
#include <boost/lexical_cast.hpp>
#include <boost/thread/thread.hpp>
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_message.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
using google::LogMessage;
//! Constructor
// Constructor
Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
GNSSBlockInterface *pass_through, AcquisitionInterface *acq,
TrackingInterface *trk, TelemetryDecoderInterface *nav,
std::string role, std::string implementation, gr_msg_queue_sptr queue) :
pass_through_(pass_through), acq_(acq), trk_(trk), nav_(nav),
role_(role), implementation_(implementation), channel_(channel),
queue_(queue)
pass_through_(pass_through), acq_(acq), trk_(trk), nav_(nav),
role_(role), implementation_(implementation), channel_(channel),
queue_(queue)
{
stop_ = false;
@ -95,7 +89,7 @@ Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
}
//! Destructor
// Destructor
Channel::~Channel()
{
@ -109,10 +103,10 @@ void Channel::connect(gr_top_block_sptr top_block)
{
if (connected_)
{
LOG_AT_LEVEL(WARNING) << "channel already connected internally";
return;
}
{
LOG_AT_LEVEL(WARNING) << "channel already connected internally";
return;
}
pass_through_->connect(top_block);
acq_->connect(top_block);
@ -140,10 +134,10 @@ void Channel::disconnect(gr_top_block_sptr top_block)
{
if (!connected_)
{
LOG_AT_LEVEL(WARNING) << "Channel already disconnected internally";
return;
}
{
LOG_AT_LEVEL(WARNING) << "Channel already disconnected internally";
return;
}
top_block->disconnect(acq_->get_right_block(), 0, trk_->get_left_block(),
0);
@ -190,15 +184,15 @@ void Channel::run()
{
start_acquisition();
while (!stop_)
{
channel_internal_queue_.wait_and_pop(message_);
process_channel_messages();
}
{
channel_internal_queue_.wait_and_pop(message_);
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
*/
void Channel::stop()
@ -224,46 +218,46 @@ void Channel::process_channel_messages()
{
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_
<< " ACQ SUCCESS satellite " << satellite_;
channel_fsm_.Event_gps_valid_acquisition();
LOG_AT_LEVEL(INFO) << "Channel " << channel_
<< " ACQ SUCCESS satellite " << satellite_;
channel_fsm_.Event_gps_valid_acquisition();
break;
break;
case 2:
case 2:
LOG_AT_LEVEL(INFO) << "Channel " << channel_
<< " ACQ FAILED satellite " << satellite_;
if (repeat_ == true)
LOG_AT_LEVEL(INFO) << "Channel " << channel_
<< " ACQ FAILED satellite " << satellite_;
if (repeat_ == true)
{
channel_fsm_.Event_gps_failed_acquisition_repeat();
}
else
else
{
channel_fsm_.Event_gps_failed_acquisition_no_repeat();
}
break;
break;
case 3:
LOG_AT_LEVEL(INFO) << "Channel " << channel_
<< " TRACKING FAILED satellite " << satellite_
<< ", reacquisition.";
channel_fsm_.Event_gps_failed_tracking();
case 3:
LOG_AT_LEVEL(INFO) << "Channel " << channel_
<< " TRACKING FAILED satellite " << satellite_
<< ", reacquisition.";
channel_fsm_.Event_gps_failed_tracking();
break;
break;
default:
default:
LOG_AT_LEVEL(WARNING) << "Default case, invalid message.";
break;
LOG_AT_LEVEL(WARNING) << "Default case, invalid message.";
break;
}
}

View File

@ -1,6 +1,6 @@
/*!
* \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
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
*
@ -88,6 +88,11 @@ public:
void start_acquisition();
void set_satellite(unsigned int satellite);
void start();
/*!
* \brief Set stop_ to true and blocks the calling thread until
* the thread of the constructor has completed
*/
void stop();
private:

View File

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

View File

@ -1,10 +1,9 @@
/*!
* \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
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -31,15 +30,11 @@
*/
#include "direct_resampler_conditioner.h"
// #include <gnuradio/usrp_source_c.h>
#include <gnuradio/gr_file_sink.h>
#include "direct_resampler_conditioner_cc.h"
#include "direct_resampler_conditioner_ss.h"
#include "configuration_interface.h"
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -48,7 +43,7 @@ using google::LogMessage;
DirectResamplerConditioner::DirectResamplerConditioner(
ConfigurationInterface* configuration, std::string role,
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";
@ -65,64 +60,62 @@ DirectResamplerConditioner::DirectResamplerConditioner(
default_dump_file);
if (item_type_.compare("gr_complex") == 0)
{
item_size_ = sizeof(gr_complex);
resampler_ = direct_resampler_make_conditioner_cc(sample_freq_in_,
sample_freq_out_);
}
{
item_size_ = sizeof(gr_complex);
resampler_ = direct_resampler_make_conditioner_cc(sample_freq_in_,
sample_freq_out_);
}
else if (item_type_.compare("short") == 0)
{
item_size_ = sizeof(short);
resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_,
sample_freq_out_);
}
{
item_size_ = sizeof(short);
resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_,
sample_freq_out_);
}
else
{
LOG_AT_LEVEL(WARNING) << item_type_
<< " unrecognized item type. Using short";
item_size_ = sizeof(short);
}
{
LOG_AT_LEVEL(WARNING) << item_type_
<< " unrecognized item type. Using short";
item_size_ = sizeof(short);
}
if (dump_)
{
DLOG(INFO) << "Dumping output into file " << dump_filename_;
file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
}
{
DLOG(INFO) << "Dumping output into file " << dump_filename_;
file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
}
DLOG(INFO) << "sample_freq_in " << sample_freq_in_;
DLOG(INFO) << "sample_freq_out" << sample_freq_out_;
DLOG(INFO) << "Item size " << item_size_;
DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")";
if (dump_)
{
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
}
}
DirectResamplerConditioner::~DirectResamplerConditioner()
{
{
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
}
}
DirectResamplerConditioner::~DirectResamplerConditioner() {}
void DirectResamplerConditioner::connect(gr_top_block_sptr top_block)
{
if (dump_)
{
top_block->connect(resampler_, 0, file_sink_, 0);
DLOG(INFO) << "connected resampler to file sink";
}
{
top_block->connect(resampler_, 0, file_sink_, 0);
DLOG(INFO) << "connected resampler to file sink";
}
else
{
DLOG(INFO) << "nothing to connect internally";
}
{
DLOG(INFO) << "nothing to connect internally";
}
}
void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block)
{
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()

View File

@ -1,10 +1,9 @@
/*!
* \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
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -42,9 +41,10 @@ class DirectResamplerConditioner: public GNSSBlockInterface
{
public:
DirectResamplerConditioner(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream,
unsigned int out_stream);
DirectResamplerConditioner(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream,
unsigned int out_stream);
virtual ~DirectResamplerConditioner();
std::string role()
@ -70,7 +70,6 @@ private:
std::string role_;
unsigned int in_stream_;
unsigned int out_stream_;
std::string item_type_;
size_t item_size_;
long samples_;
@ -78,7 +77,6 @@ private:
std::string dump_filename_;
double sample_freq_in_;
double sample_freq_out_;
gr_block_sptr resampler_;
gr_block_sptr file_sink_;
};

View File

@ -1,11 +1,9 @@
/*!
* \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.
* \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)
@ -34,8 +32,8 @@
#ifndef GNSS_SDR_VALVE_H_
#define GNSS_SDR_VALVE_H_
#ifndef GNSS_SDR_GNSS_SDR_VALVE_H_
#define GNSS_SDR_GNSS_SDR_VALVE_H_
#include <cstring>
#include <gr_sync_block.h>
@ -66,4 +64,4 @@ public:
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
* \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
*
* Detailed description of the file here if needed.
@ -33,14 +34,10 @@
#include "pass_through.h"
#include <iostream>
#include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include "configuration_interface.h"
using google::LogMessage;

View File

@ -1,6 +1,6 @@
/*!
* \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.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
*
@ -33,13 +33,12 @@
#ifndef PASS_THROUGH_H_
#define PASS_THROUGH_H_
#ifndef GNSS_SDR_PASS_THROUGH_H_
#define GNSS_SDR_PASS_THROUGH_H_
#include <gr_hier_block2.h>
#include <gr_kludge_copy.h>
#include <gr_file_sink.h>
#include "gnss_block_interface.h"
class ConfigurationInterface;
@ -94,4 +93,4 @@ private:
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
* \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
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -31,17 +30,12 @@
*/
#include "gps_l1_ca_observables.h"
#include "configuration_interface.h"
#include "gps_l1_ca_observables_cc.h"
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_stream_to_vector.h>
#include <gnuradio/gr_vector_to_stream.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -60,8 +54,8 @@ GpsL1CaObservables::GpsL1CaObservables(ConfigurationInterface* configuration,
queue_(queue)
{
int output_rate_ms;
output_rate_ms=configuration->property(role + ".output_rate_ms", 500);
int output_rate_ms;
output_rate_ms=configuration->property(role + ".output_rate_ms", 500);
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);
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_->set_fs_in(fs_in_);
observables_ = gps_l1_ca_make_observables_cc(in_streams_, queue_, dump_,dump_filename_,output_rate_ms,flag_averaging);
observables_->set_fs_in(fs_in_);
DLOG(INFO) << "pseudorange(" << observables_->unique_id() << ")";
// set the navigation msg queue;

View File

@ -1,10 +1,9 @@
/*!
* \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
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* 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
* \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
* -------------------------------------------------------------------------
*
@ -32,17 +32,12 @@
#include <vector>
#include <map>
#include <algorithm>
# include <bitset>
#include <bitset>
#include <cmath>
#include "math.h"
#include "gps_l1_ca_observables_cc.h"
#include "control_message_factory.h"
#include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>

View File

@ -1,6 +1,6 @@
/*!
* \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
* -------------------------------------------------------------------------
*

View File

@ -1,10 +1,9 @@
/*!
* \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
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -30,15 +29,10 @@
* -------------------------------------------------------------------------
*/
#include "file_output_filter.h"
#include <glog/log_severity.h>
#include <glog/logging.h>
#include <gr_io_signature.h>
#include "configuration_interface.h"
using google::LogMessage;

View File

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

View File

@ -1,10 +1,9 @@
/*!
* \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
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -33,12 +32,9 @@
#include "null_sink_output_filter.h"
#include <glog/log_severity.h>
#include <glog/logging.h>
#include <gr_io_signature.h>
#include "configuration_interface.h"
using google::LogMessage;

View File

@ -1,6 +1,7 @@
/*!
* \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
*
* This class represents an implementation of an output filter that

View File

@ -1,11 +1,10 @@
/*!
* \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
* 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)
@ -32,10 +31,8 @@
*/
#include "file_signal_source.h"
#include "gnss_sdr_valve.h"
#include "configuration_interface.h"
#include <string>
#include <iostream>
#include <fstream>
@ -43,7 +40,6 @@
#include <gflags/gflags.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include <gnuradio/gr_io_signature.h>
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.
* 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
*/
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
* \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
*
* This class represents a file signal source. Internally it uses a GNU Radio's gr_file_source
* a a connector to the data.
* This class represents a file signal source. Internally it uses a GNU Radio's
* gr_file_source as a connector to the data.
*
* -------------------------------------------------------------------------
*

View File

@ -1,10 +1,9 @@
/*!
* \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
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -31,7 +30,6 @@
*/
#include "gps_l1_ca_telemetry_decoder.h"
#include "configuration_interface.h"
#include "gps_l1_ca_telemetry_decoder_cc.h"

View File

@ -1,6 +1,7 @@
/*!
* \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
*
* -------------------------------------------------------------------------

View File

@ -1,6 +1,7 @@
/*!
* \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
*
* -------------------------------------------------------------------------

View File

@ -1,6 +1,7 @@
/*!
* \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
* -------------------------------------------------------------------------
*

View File

@ -1,11 +1,13 @@
/*!
* \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
*
* This file implements the code Delay Locked Loop (DLL) + carrier Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL) stage
* according to the algorithms described in [1]
* [1] E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* This file implements the code Delay Locked Loop (DLL) + carrier Phase
* Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL)
* according to the algorithms described in:
* E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* Applications, Second Edition, Artech House Publishers, 2005.
*
* -------------------------------------------------------------------------
@ -40,18 +42,21 @@
#include <boost/math/special_functions/round.hpp>
#endif
#include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
using google::LogMessage;
GpsL1CaDllFllPllTracking::GpsL1CaDllFllPllTracking(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams,
ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams, unsigned int
out_streams,
gr_msg_queue_sptr queue) :
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(
queue)
role_(role),
in_streams_(in_streams),
out_streams_(out_streams),
queue_(queue)
{
DLOG(INFO) << "role " << role;

View File

@ -1,11 +1,13 @@
/*!
* \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
*
* This file implements the code Delay Locked Loop (DLL) + carrier Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL) stage
* according to the algorithms described in [1]
* [1] E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* This is the interface of a code Delay Locked Loop (DLL) + carrier
* Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL)
* according to the algorithms described in:
* E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* Applications, Second Edition, Artech House Publishers, 2005.
*
* -------------------------------------------------------------------------

View File

@ -1,12 +1,14 @@
/*!
* \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
* Javier Arribas, 2011. jarribas(at)cttc.es
*
* Code DLL + carrier PLL according to the algorithms described in [1]
* [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
* Code DLL + carrier PLL according to the algorithms 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
*
* -------------------------------------------------------------------------
*
@ -40,7 +42,6 @@
#include <boost/math/special_functions/round.hpp>
#endif
#include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@ -50,8 +51,8 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams,
gr_msg_queue_sptr queue) :
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(
queue)
role_(role), in_streams_(in_streams), out_streams_(out_streams),
queue_(queue)
{
DLOG(INFO) << "role " << role;
@ -82,22 +83,22 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
std::string default_dump_filename = "./track_ch";
dump_filename = configuration->property(role + ".dump_filename",
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));
#else
#else
vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
#endif
#endif
//################# MAKE TRACKING GNURadio object ###################
if (item_type.compare("gr_complex") == 0)
{
item_size_ = sizeof(gr_complex);
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);
}
{
item_size_ = sizeof(gr_complex);
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);
}
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() << ")";
}
@ -111,7 +112,7 @@ void GpsL1CaDllPllTracking::start_tracking()
tracking_->start_tracking();
}
/*!
/*
* Set satellite ID
*/
void GpsL1CaDllPllTracking::set_satellite(unsigned int satellite)
@ -121,7 +122,7 @@ void GpsL1CaDllPllTracking::set_satellite(unsigned int satellite)
DLOG(INFO) << "satellite set to " << satellite_;
}
/*!
/*
* Set tracking channel unique ID
*/
void GpsL1CaDllPllTracking::set_channel(unsigned int channel)
@ -130,7 +131,7 @@ void GpsL1CaDllPllTracking::set_channel(unsigned int channel)
tracking_->set_channel(channel);
}
/*!
/*
* Set tracking channel internal queue
*/
void GpsL1CaDllPllTracking::set_channel_queue(
@ -141,21 +142,24 @@ void GpsL1CaDllPllTracking::set_channel_queue(
tracking_->set_channel_queue(channel_internal_queue_);
}
/*!
/*
* Set acquisition code phase in samples
*/
void GpsL1CaDllPllTracking::set_prn_code_phase(signed int phase_samples)
{
return tracking_->set_acq_code_phase((float)phase_samples);
}
/*!
/*
* Set acquisition Doppler frequency in Hz.
*/
void GpsL1CaDllPllTracking::set_doppler_freq_shift(float 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
*/
void GpsL1CaDllPllTracking::set_acq_sample_stamp(
@ -163,6 +167,7 @@ void GpsL1CaDllPllTracking::set_acq_sample_stamp(
{
return tracking_->set_acq_sample_stamp(sample_stamp);
}
void GpsL1CaDllPllTracking::connect(gr_top_block_sptr top_block)
{
//nothing to connect, now the tracking uses gr_sync_decimator

View File

@ -1,12 +1,14 @@
/*!
* \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
* Javier Arribas, 2011. jarribas(at)cttc.es
*
* Code DLL + carrier PLL according to the algorithms described in [1]
* [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
* Code DLL + carrier PLL according to the algorithms 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, Birkha user, 2007
*
* -------------------------------------------------------------------------
*
@ -76,14 +78,37 @@ public:
gr_basic_block_sptr get_left_block();
gr_basic_block_sptr get_right_block();
/*!
* \brief Set satellite ID
*/
void set_satellite(unsigned int satellite);
/*!
* \brief Set tracking channel unique ID
*/
void set_channel(unsigned int channel);
/*!
* \brief Set acquisition code phase in 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);
/*!
* \brief Set tracking channel internal queue
*/
void set_channel_queue(concurrent_queue<int> *channel_internal_queue);
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);
private:

View File

@ -1,11 +1,12 @@
/*!
* \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
*
* This file implements the code Delay Locked Loop (DLL) + carrier Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL) stage
* according to the algorithms described in [1]
* [1] E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* This file implements the code Delay Locked Loop (DLL) + carrier
* Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL)
* according to the algorithms described in:
* E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* Applications, Second Edition, Artech House Publishers, 2005.
*
* -------------------------------------------------------------------------
@ -39,16 +40,13 @@
#include "tracking_discriminators.h"
#include "CN_estimators.h"
#include "tracking_FLL_PLL_filter.h"
#include "control_message_factory.h"
#include <boost/lexical_cast.hpp>
#include <iostream>
#include <sstream>
#include <cmath>
#include "math.h"
#include <gnuradio/gr_io_signature.h>
#include <glog/log_severity.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(){
/*!
/*
* correct the code phase according to the delay between acq and trk
*/
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;
}
/*! 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
*/
@ -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);
if (d_enable_tracking==true){
/*!
/*
* Receiver signal alignment
*/
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];
}
/*!
/*
* DLL, FLL, and PLL discriminators
*/
// Compute DLL error

View File

@ -1,12 +1,12 @@
/*!
* \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
*
* This file implements the code Delay Locked Loop (DLL) +
* carrier Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL) stage
* according to the algorithms described in [1]
* [1] E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* This is the interface of a code Delay Locked Loop (DLL) +
* carrier Phase Locked Loop (PLL) helped with a carrier Frequency Locked
* Loop (FLL) according to the algorithms described in:
* E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and
* Applications, Second Edition, Artech House Publishers, 2005.
*
* -------------------------------------------------------------------------

View File

@ -1,12 +1,13 @@
/*!
* \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
* 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,
* 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(){
/*!
/*
* correct the code phase according to the delay between acq and trk
*/
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;
}
/*! 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
*/
@ -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);
if (d_enable_tracking==true){
/*!
/*
* Receiver signal alignment
*/
if (d_pull_in==true)

View File

@ -1,12 +1,13 @@
/*!
* \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
* Javier Arribas, 2011. jarribas(at)cttc.es
*
* Code DLL + carrier PLL according to the algorithms described in [1]
* [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
* Code DLL + carrier PLL according to the algorithms 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
*
* -------------------------------------------------------------------------
*

View File

@ -1,25 +1,18 @@
/*!
* \file CN_estimators.cc
* \brief Library with a set of Carrier to Noise estimators and lock detectors.
* SNV_CN0 is a Carrier-to-Noise (CN0) estimator based on the Signal-to-Noise Variance (SNV) estimator [1].
*
* \brief Implementation of a library with a set of Carrier to Noise
* 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
* of twice the carrier phase error [2].
*
*
* [1] 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.
*
*
*
* [2] 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.
*
*
* \author Javier Arribas, 2011. jarribas(at)cttc.es
*
*
@ -52,7 +45,7 @@
#include <gnuradio/gr_complex.h>
#include <math.h>
/*!
/*
* 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},
@ -66,36 +59,37 @@
* 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.
*
*/
float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in)
{
// estimate CN0 using buffered values
// MATLAB CODE
//Psig=((1/N)*sum(abs(imag(x((n-N+1):n)))))^2;
//Ptot=(1/N)*sum(abs(x((n-N+1):n)).^2);
//SNR_SNV(count)=Psig/(Ptot-Psig);
//CN0_SNV_dB=10*log10(SNR_SNV)+10*log10(BW)-10*log10(PRN_length);
float SNR, SNR_dB_Hz;
float tmp_abs_I,tmp_abs_Q;
float Psig,Ptot;
//float M2,M4;
Psig=0;
Ptot=0;
for (int i=0;i<length;i++)
{
tmp_abs_I=std::abs(Prompt_buffer[i].imag());
tmp_abs_Q=std::abs(Prompt_buffer[i].real());
Psig+=tmp_abs_I;
Ptot+=Prompt_buffer[i].imag()*Prompt_buffer[i].imag()+Prompt_buffer[i].real()*Prompt_buffer[i].real();
}
Psig=Psig/(float)length;
Psig=Psig*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);
return SNR_dB_Hz;
// estimate CN0 using buffered values
// MATLAB CODE
//Psig=((1/N)*sum(abs(imag(x((n-N+1):n)))))^2;
//Ptot=(1/N)*sum(abs(x((n-N+1):n)).^2);
//SNR_SNV(count)=Psig/(Ptot-Psig);
//CN0_SNV_dB=10*log10(SNR_SNV)+10*log10(BW)-10*log10(PRN_length);
float SNR, SNR_dB_Hz;
float tmp_abs_I,tmp_abs_Q;
float Psig,Ptot;
//float M2,M4;
Psig=0;
Ptot=0;
for (int i=0;i<length;i++)
{
tmp_abs_I=std::abs(Prompt_buffer[i].imag());
tmp_abs_Q=std::abs(Prompt_buffer[i].real());
Psig+=tmp_abs_I;
Ptot+=Prompt_buffer[i].imag()*Prompt_buffer[i].imag()+Prompt_buffer[i].real()*Prompt_buffer[i].real();
}
Psig=Psig/(float)length;
Psig=Psig*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);
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
* \f{equation}
* 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$Pc(i)\f$ is the prompt correlator output for the sample index i.
*/
float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
{
/*!
* \todo Code lock detector
*/
// estimate using buffered values
// MATLAB CODE
// lock detector operation
//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);
//LOCK(count)=NBD/NBP;
float tmp_abs_I,tmp_abs_Q;
float tmp_sum_abs_I,tmp_sum_abs_Q;
float tmp_sum_sqr_I,tmp_sum_sqr_Q;
tmp_sum_abs_I=0;
tmp_sum_abs_Q=0;
tmp_sum_sqr_I=0;
tmp_sum_sqr_Q=0;
float NBD,NBP;
for (int i=0;i<length;i++)
{
tmp_abs_I=std::abs(Prompt_buffer[i].imag());
tmp_abs_Q=std::abs(Prompt_buffer[i].real());
tmp_sum_abs_I+=tmp_abs_I;
tmp_sum_abs_Q+=tmp_abs_Q;
tmp_sum_sqr_I+=(Prompt_buffer[i].imag()*Prompt_buffer[i].imag());
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;
NBP=tmp_sum_sqr_I-tmp_sum_sqr_Q;
return NBD/NBP;
/*!
* \todo Code lock detector
*/
// estimate using buffered values
// MATLAB CODE
// lock detector operation
//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);
//LOCK(count)=NBD/NBP;
float tmp_abs_I,tmp_abs_Q;
float tmp_sum_abs_I,tmp_sum_abs_Q;
float tmp_sum_sqr_I,tmp_sum_sqr_Q;
tmp_sum_abs_I=0;
tmp_sum_abs_Q=0;
tmp_sum_sqr_I=0;
tmp_sum_sqr_Q=0;
float NBD,NBP;
for (int i=0;i<length;i++)
{
tmp_abs_I=std::abs(Prompt_buffer[i].imag());
tmp_abs_Q=std::abs(Prompt_buffer[i].real());
tmp_sum_abs_I+=tmp_abs_I;
tmp_sum_abs_Q+=tmp_abs_Q;
tmp_sum_sqr_I+=(Prompt_buffer[i].imag()*Prompt_buffer[i].imag());
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;
NBP=tmp_sum_sqr_I-tmp_sum_sqr_Q;
return NBD/NBP;
}

View File

@ -1,10 +1,9 @@
/*!
* \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
*
* Library with a set of Carrier to Noise estimators and lock detectors
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -35,8 +34,43 @@
#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);
/*! \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);
#endif

View File

@ -1,11 +1,12 @@
/*!
* \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
*
* Class that implements 2 order PLL filter for code tracking loop. The algorithm is described in [1]
*
* [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,
* Class that implements 2 order PLL filter for code tracking loop.
* 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.
*
* -------------------------------------------------------------------------
@ -38,19 +39,19 @@
void tracking_2nd_DLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k){
// Solve natural frequency
float Wn;
Wn = lbw*8*zeta / (4*zeta*zeta + 1);
// solve for t1 & t2
*tau1 = k / (Wn * Wn);
*tau2 = (2.0 * zeta) / Wn;
// Solve natural frequency
float Wn;
Wn = lbw*8*zeta / (4*zeta*zeta + 1);
// solve for t1 & t2
*tau1 = k / (Wn * Wn);
*tau2 = (2.0 * zeta) / Wn;
}
void tracking_2nd_DLL_filter::set_DLL_BW(float dll_bw_hz)
{
//Calculate filter coefficient values
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 filter coefficient values
d_dllnoisebandwidth=dll_bw_hz;
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)
{
@ -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 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);
d_old_code_nco = code_nco;
d_old_code_error = DLL_discriminator; //[chips]
return 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);
d_old_code_nco = code_nco;
d_old_code_error = DLL_discriminator; //[chips]
return code_nco;
}
tracking_2nd_DLL_filter::tracking_2nd_DLL_filter ()
{
d_pdi_code = 0.001;// Summation interval for code
d_dlldampingratio=0.7;
d_pdi_code = 0.001;// Summation interval for code
d_dlldampingratio=0.7;
}
tracking_2nd_DLL_filter::~tracking_2nd_DLL_filter ()

View File

@ -1,10 +1,12 @@
/*!
* \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
*
* Class that implements 2 order PLL filter for code tracking loop. 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,
* Class that implements a 2nd order PLL filter for code tracking loop.
* 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.
*
* -------------------------------------------------------------------------

View File

@ -1,11 +1,12 @@
/*!
* \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
*
* Class that implements 2 order PLL filter for tracking carrier loop. The algorithm is described in [1]
*
* [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,
* Class that implements 2 order PLL filter for tracking carrier loop. 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.
*
* -------------------------------------------------------------------------

View File

@ -1,10 +1,12 @@
/*!
* \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
*
* Class that implements 2 order PLL filter for tracking carrier loop. 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,
* Class that implements 2 order PLL filter for tracking carrier loop.
* 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.
*
* -------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
/*!
* \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
*
* 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)
{
/*!
/*
* Filter design (Kaplan 2nd ed., Pag. 181 Fig. 181)
*/
d_order=order;
d_order=order;
if (d_order==3)
{
/*!
* 3rd order PLL with 2nd order FLL assist
*/
d_pll_b3 = 2.400;
d_pll_a3 = 1.100;
d_pll_a2 = 1.414;
d_pll_w0p = pll_bw_hz/0.7845;
d_pll_w0p2 = d_pll_w0p*d_pll_w0p;
d_pll_w0p3 = d_pll_w0p2*d_pll_w0p;
{
/*
* 3rd order PLL with 2nd order FLL assist
*/
d_pll_b3 = 2.400;
d_pll_a3 = 1.100;
d_pll_a2 = 1.414;
d_pll_w0p = pll_bw_hz/0.7845;
d_pll_w0p2 = d_pll_w0p*d_pll_w0p;
d_pll_w0p3 = d_pll_w0p2*d_pll_w0p;
d_pll_w0f = fll_bw_hz/0.53;
d_pll_w0f2 = d_pll_w0f*d_pll_w0f;
}else
{
/*!
* 2rd order PLL with 1st order FLL assist
*/
d_pll_a2 = 1.414;
d_pll_w0p = pll_bw_hz/0.53;
d_pll_w0p2 = d_pll_w0p*d_pll_w0p;
d_pll_w0f = fll_bw_hz/0.25;
}
d_pll_w0f = fll_bw_hz/0.53;
d_pll_w0f2 = d_pll_w0f*d_pll_w0f;
}else
{
/*
* 2nd order PLL with 1st order FLL assist
*/
d_pll_a2 = 1.414;
d_pll_w0p = pll_bw_hz/0.53;
d_pll_w0p2 = d_pll_w0p*d_pll_w0p;
d_pll_w0f = fll_bw_hz/0.25;
}
}
void tracking_FLL_PLL_filter::initialize(float d_acq_carrier_doppler_hz)
{
if (d_order==3)
{
d_pll_x = 2.0*d_acq_carrier_doppler_hz;
d_pll_w = 0;
}else{
d_pll_w = d_acq_carrier_doppler_hz;
d_pll_x = 0;
}
if (d_order==3)
{
d_pll_x = 2.0*d_acq_carrier_doppler_hz;
d_pll_w = 0;
}else{
d_pll_w = d_acq_carrier_doppler_hz;
d_pll_x = 0;
}
}
float tracking_FLL_PLL_filter::get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s)
{
float carrier_error_hz;
if (d_order==3)
{
/*!
* 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_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;
}else
{
/*!
* 2rd order PLL with 1st order FLL assist
*/
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 ;
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;
/*std::cout<<" d_pll_w = "<<carrier_error_hz<<
float carrier_error_hz;
if (d_order==3)
{
/*
* 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_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;
}else
{
/*
* 2nd order PLL with 1st order FLL assist
*/
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 ;
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;
/*std::cout<<" d_pll_w = "<<carrier_error_hz<<
", pll_w_new = "<<pll_w_new
<<", PLL_discriminator=" <<PLL_discriminator
<<" FLL_discriminator ="<<FLL_discriminator
<<" 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
* \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
*
* Class that implements hybrid FLL and PLL filter for tracking carrier loop
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)

View File

@ -1,6 +1,7 @@
/*!
* \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
*
*
@ -33,7 +34,7 @@
#include <math.h>
// All the outputs are in RADIANS
/*!
/*
* FLL four quadrant arctan discriminator:
* \f{equation}
* \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 cross,dot;
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();
return atan2(cross,dot)/(t2-t1);
float cross,dot;
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();
return atan2(cross,dot)/(t2-t1);
}
/*!
/*
* PLL four quadrant arctan discriminator:
* \f{equation}
* \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)
{
return atan2(prompt_s1.real(),prompt_s1.imag());
return atan2(prompt_s1.real(),prompt_s1.imag());
}
/*!
/*
* 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)
{
if (prompt_s1.imag()!=0.0)
{
return atan(prompt_s1.real()/prompt_s1.imag());
}else{
return 0;
}
if (prompt_s1.imag()!=0.0)
{
return atan(prompt_s1.real()/prompt_s1.imag());
}else{
return 0;
}
}
/*!
/*
* DLL Noncoherent Early minus Late envelope normalized discriminator:
* \f{equation}
* 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 P_early, P_late;
P_early=std::abs(early_s1);
P_late=std::abs(late_s1);
return (P_early-P_late)/((P_early+P_late));
float P_early, P_late;
P_early=std::abs(early_s1);
P_late=std::abs(late_s1);
return (P_early-P_late)/((P_early+P_late));
}

View File

@ -1,9 +1,11 @@
/*!
* \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
*
* 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>
/*! 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);
/*! \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);
/*! \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);
/*! \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);

View File

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

View File

@ -6,10 +6,6 @@
* The interface defines an accessor method that gets a parameter name as input
* and returns the value of this parameter, a string, as output.
* 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;
virtual float property(std::string property_name, float 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;
};

View File

@ -59,7 +59,6 @@ public:
virtual std::string role() = 0;
virtual std::string implementation() = 0;
virtual size_t item_size() = 0;
virtual void connect(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;

View File

@ -1,9 +1,9 @@
/*!
* \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
*
* 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
* instantiated directly if all inherited pure virtual methods have been
* implemented by that class or a parent class.

View File

@ -1,9 +1,9 @@
/*!
* \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
*
* 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
* instantiated directly if all inherited pure virtual methods have been
* implemented by that class or a parent class.
@ -40,9 +40,9 @@
#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,
* this class cannot be instantiated directly, and a subclass can only be
* instantiated directly if all inherited pure virtual methods have been

View File

@ -1,9 +1,9 @@
/*!
* \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
*
* 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
* instantiated directly if all inherited pure virtual methods have been
* implemented by that class or a parent class.

View File

@ -1,6 +1,6 @@
/*!
* \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
*
* Abstract class for tracking interfaces. Since all its methods are virtual,

View File

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

View File

@ -1,7 +1,7 @@
/*!
* \file string_converter.h
* \brief This class interprets the contents of a string and converts it into
* different types.
* \brief Interface of a class that interprets the contents of a string
* and converts it into different types.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
*
* -------------------------------------------------------------------------
@ -30,23 +30,23 @@
*/
#ifndef STRING_CONVERTER_H_
#define STRING_CONVERTER_H_
#ifndef GNSS_SDR_STRING_CONVERTER_H_
#define GNSS_SDR_STRING_CONVERTER_H_
#include <string>
class StringConverter {
public:
StringConverter();
virtual ~StringConverter();
StringConverter();
virtual ~StringConverter();
bool convert(std::string value, bool default_value);
long convert(std::string value, long default_value);
int convert(std::string value, int default_value);
unsigned int convert(std::string value, unsigned int default_value);
float convert(std::string value, float default_value);
double convert(std::string value, double default_value);
bool convert(std::string value, bool default_value);
long convert(std::string value, long default_value);
int convert(std::string value, int default_value);
unsigned int convert(std::string value, unsigned int default_value);
float convert(std::string value, float 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
* \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
*
* -------------------------------------------------------------------------
@ -65,9 +65,9 @@ public:
{
boost::mutex::scoped_lock lock(the_mutex);
if(the_queue.empty())
{
return false;
}
{
return false;
}
popped_value=the_queue.front();
the_queue.pop();
@ -78,9 +78,9 @@ public:
{
boost::mutex::scoped_lock lock(the_mutex);
while(the_queue.empty())
{
the_condition_variable.wait(lock);
}
{
the_condition_variable.wait(lock);
}
popped_value=the_queue.front();
the_queue.pop();

View File

@ -1,6 +1,6 @@
/*!
* \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
*
* -------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
/*!
* \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
*
* This implementation has a text file as the source for the values of the parameters.
@ -35,12 +36,9 @@
#include "file_configuration.h"
#include <string>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include "INIReader.h"
#include "string_converter.h"
#include "in_memory_configuration.h"

View File

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

View File

@ -1,6 +1,6 @@
/*!
* \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
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
* Javier Arribas, 2011. jarribas(at)cttc.es
@ -38,7 +38,6 @@
#include <vector>
#include <string>
#include <gnuradio/gr_msg_queue.h>
class ConfigurationInterface;
@ -67,6 +66,10 @@ public:
gr_msg_queue_sptr queue);
std::vector<GNSSBlockInterface*>* GetChannels(
ConfigurationInterface *configuration, gr_msg_queue_sptr queue);
/*
* \brief Returns the block with the required configuration and implementation
*/
GNSSBlockInterface* GetBlock(ConfigurationInterface* configuration,
std::string role, std::string implementation,
unsigned int in_streams, unsigned int out_streams,

View File

@ -1,6 +1,6 @@
/*!
* \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
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
*
@ -64,9 +64,9 @@ GNSSFlowgraph::~GNSSFlowgraph()
delete block_factory_;
for (unsigned int i = 0; i < blocks_->size(); i++)
{
delete blocks_->at(i);
}
{
delete blocks_->at(i);
}
blocks_->clear();
delete blocks_;
@ -75,20 +75,20 @@ GNSSFlowgraph::~GNSSFlowgraph()
void GNSSFlowgraph::start()
{
if (running_)
{
LOG_AT_LEVEL(WARNING) << "Already running";
return;
}
{
LOG_AT_LEVEL(WARNING) << "Already running";
return;
}
try
{
top_block_->start();
top_block_->start();
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Unable to start flowgraph";
LOG_AT_LEVEL(ERROR) << e.what();
return;
LOG_AT_LEVEL(ERROR) << "Unable to start flowgraph";
LOG_AT_LEVEL(ERROR) << e.what();
return;
}
running_ = true;
@ -97,9 +97,9 @@ void GNSSFlowgraph::start()
void GNSSFlowgraph::stop()
{
for (unsigned int i = 0; i < channels_count_; i++)
{
channel(i)->stop();
}
{
channel(i)->stop();
}
DLOG(INFO) << "Threads finished. Return to main program.";
top_block_->stop();
running_ = false;
@ -107,184 +107,184 @@ void GNSSFlowgraph::stop()
void GNSSFlowgraph::connect()
{
/* Connects the blocks in the flowgraph
*
* Signal Source > Signal conditioner > Channels >> Observables >> PVT > Output filter
*/
DLOG(INFO) << "Connecting flowgraph";
/* Connects the blocks in the flowgraph
*
* Signal Source > Signal conditioner > Channels >> Observables >> PVT > Output filter
*/
DLOG(INFO) << "Connecting flowgraph";
if (connected_)
{
LOG_AT_LEVEL(WARNING) << "flowgraph already connected";
return;
}
{
LOG_AT_LEVEL(WARNING) << "flowgraph already connected";
return;
}
// Connect GNSS block internally
try
{
signal_source()->connect(top_block_);
signal_source()->connect(top_block_);
}
catch (std::exception& e)
{
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) << "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();
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
{
observables()->connect(top_block_);
pvt()->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;
LOG_AT_LEVEL(ERROR) << "Can't connect PVT block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
try
{
pvt()->connect(top_block_);
output_filter()->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect PVT block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
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;
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";
try
{
top_block_->connect(signal_source()->get_right_block(), 0,
signal_conditioner()->get_left_block(), 0);
top_block_->connect(signal_source()->get_right_block(), 0,
signal_conditioner()->get_left_block(), 0);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal source to signal conditioner";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal source to signal conditioner";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
DLOG(INFO) << "Signal source connected to signal conditioner";
for (unsigned int i = 0; i < channels_count_; i++)
{
try
{
top_block_->connect(signal_conditioner()->get_right_block(), 0,
channel(i)->get_left_block(), 0);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal conditioner to channel " << i;
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
try
{
top_block_->connect(signal_conditioner()->get_right_block(), 0,
channel(i)->get_left_block(), 0);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal conditioner to channel " << i;
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
{
top_block_->connect(channel(i)->get_right_block(), 0,
observables()->get_left_block(), i);
try
{
top_block_->connect(channel(i)->get_right_block(), 0,
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
*/
try
{
for (unsigned int i = 0; i < channels_count_; i++)
{
top_block_->connect(observables()->get_right_block(), i,
pvt()->get_left_block(), i);
}
for (unsigned int i = 0; i < channels_count_; i++)
{
top_block_->connect(observables()->get_right_block(), i,
pvt()->get_left_block(), i);
}
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect observables to PVT";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
LOG_AT_LEVEL(ERROR) << "Can't connect observables to PVT";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
try
{
top_block_->connect(pvt()->get_right_block(), 0,
output_filter()->get_left_block(), 0);
top_block_->connect(pvt()->get_right_block(), 0,
output_filter()->get_left_block(), 0);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect PVT to output filter";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
LOG_AT_LEVEL(ERROR) << "Can't connect PVT to output filter";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
DLOG(INFO) << "PVT connected to output filter";
@ -298,42 +298,42 @@ void GNSSFlowgraph::connect()
void GNSSFlowgraph::wait()
{
if (!running_)
{
LOG_AT_LEVEL(WARNING) << "Can't apply wait. Flowgraph is not running";
return;
}
{
LOG_AT_LEVEL(WARNING) << "Can't apply wait. Flowgraph is not running";
return;
}
top_block_->wait();
DLOG(INFO) << "Flowgraph finished calculations";
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)
{
/*!
* \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;
switch (what)
{
case 0:
case 0:
LOG_AT_LEVEL(INFO) << "Channel " << who
<< " ACQ FAILED satellite " << channel(who)->satellite();
available_GPS_satellites_IDs_->push_back(
channel(who)->satellite());
channel(who)->set_satellite(
available_GPS_satellites_IDs_->front());
available_GPS_satellites_IDs_->pop_front();
channel(who)->start_acquisition();
break;
// TODO: Tracking messages
LOG_AT_LEVEL(INFO) << "Channel " << who
<< " ACQ FAILED satellite " << channel(who)->satellite();
available_GPS_satellites_IDs_->push_back(
channel(who)->satellite());
channel(who)->set_satellite(
available_GPS_satellites_IDs_->front());
available_GPS_satellites_IDs_->pop_front();
channel(who)->start_acquisition();
break;
// TODO: Tracking messages
default:
break;
default:
break;
}
DLOG(INFO) << "available channels "
@ -343,17 +343,17 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
void GNSSFlowgraph::set_configuration(ConfigurationInterface* configuration)
{
if (running_)
{
LOG_AT_LEVEL(WARNING)
<< "Unable to update configuration while flowgraph running";
return;
}
{
LOG_AT_LEVEL(WARNING)
<< "Unable to update configuration while flowgraph running";
return;
}
if (connected_)
{
LOG_AT_LEVEL(WARNING)
<< "Unable to update configuration while flowgraph connected";
}
{
LOG_AT_LEVEL(WARNING)
<< "Unable to update configuration while flowgraph connected";
}
configuration_ = configuration;
}
@ -390,9 +390,9 @@ GNSSBlockInterface* GNSSFlowgraph::output_filter()
void GNSSFlowgraph::init()
{
/*!
* \brief Instantiates the receiver blocks
*/
/*
* Instantiates the receiver blocks
*/
blocks_->push_back(
block_factory_->GetSignalSource(configuration_, queue_));
blocks_->push_back(block_factory_->GetSignalConditioner(configuration_,
@ -408,9 +408,9 @@ void GNSSFlowgraph::init()
channels_count_ = channels->size();
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");
@ -429,45 +429,45 @@ void GNSSFlowgraph::init()
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
* See http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf (page 5)
*/
for (unsigned int id = 1; id < 33; id++)
{
available_GPS_satellites_IDs_->push_back(id);
}
/*!
* \TODO Describe GNSS satellites more nicely, with RINEX notation
* See http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf (page 5)
*/
for (unsigned int id = 1; id < 33; id++)
{
available_GPS_satellites_IDs_->push_back(id);
}
std::list<unsigned int>::iterator it =
available_GPS_satellites_IDs_->begin();
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: ";
// for (std::list<unsigned int>::iterator it =
// available_GPS_satellites_IDs_->begin(); it
// != available_GPS_satellites_IDs_->end(); it++)
// {
// std::cout << *it << ", ";
// }
// std::cout << std::endl;
// std::cout << "Satellite queue: ";
// for (std::list<unsigned int>::iterator it =
// available_GPS_satellites_IDs_->begin(); it
// != available_GPS_satellites_IDs_->end(); it++)
// {
// std::cout << *it << ", ";
// }
// std::cout << std::endl;
}

View File

@ -1,6 +1,6 @@
/*!
* \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
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
*
@ -55,15 +55,15 @@ class GNSSFlowgraph
{
public:
/*!
* \brief Constructor that initializes the receiver flowgraph
/*!
* \brief Constructor that initializes the receiver flowgraph
*/
GNSSFlowgraph(ConfigurationInterface* configuration,
gr_msg_queue_sptr queue);
/*!
* \brief Virtual destructor
*/
/*!
* \brief Virtual destructor
*/
virtual ~GNSSFlowgraph();
//! \brief Start the flowgraph
@ -72,15 +72,21 @@ public:
//! \brief Stop the flowgraph
void stop();
/*!
* \brief Connects the defined blocks in the flowgraph
*
* Signal Source > Signal conditioner > Channels >> Observables >> PVT > Output filter
*/
/*!
* \brief Connects the defined blocks in the flowgraph
*
* Signal Source > Signal conditioner > Channels >> Observables >> PVT > Output filter
*/
void connect();
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 set_configuration(ConfigurationInterface* configuration);

View File

@ -1,10 +1,9 @@
/*!
* \file
* \brief Brief description of the file here
* \file in_memory_configuration.cc
* \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
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
@ -32,9 +31,7 @@
#include "in_memory_configuration.h"
#include <utility>
#include "string_converter.h"
InMemoryConfiguration::InMemoryConfiguration()

View File

@ -1,6 +1,6 @@
/*!
* \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
*
* This implementation accepts configuration parameters upon instantiation and

View File

@ -3,8 +3,8 @@
* \brief Main file of the GNSS-SDR program.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
*
* It creates a ControlThread object, makes it run, and releases memory
* back when the main thread has ended.
* It sets up the logging system, creates a ControlThread object,
* 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)
*/
/*!
* \brief Concurrent queue that communicates the Telemetry Decoder
/*
* Concurrent queue that communicates the Telemetry Decoder
* to the Observables modules
*/
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(
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"
+
"This program comes with ABSOLUTELY NO WARRANTY;\n"
+
"See COPYING file to see a copy of the General Public License\n \n");
+
"Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)\n"
+
"This program comes with ABSOLUTELY NO WARRANTY;\n"
+
"See COPYING file to see a copy of the General Public License\n \n");
google::SetUsageMessage(intro_help);
@ -77,20 +77,20 @@ int main(int argc, char** argv)
google::InitGoogleLogging(argv[0]);
if (FLAGS_log_dir.empty())
{
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;
}
{
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;
}
else
{
const boost::filesystem::path p (FLAGS_log_dir);
if (!boost::filesystem::exists(p))
{
std::cout << "The path " << FLAGS_log_dir << " does not exist, attepting to create it" << std::endl;
boost::filesystem::create_directory(p);
}
std::cout << "Logging with be done at " << FLAGS_log_dir << std::endl;
}
{
const boost::filesystem::path p (FLAGS_log_dir);
if (!boost::filesystem::exists(p))
{
std::cout << "The path " << FLAGS_log_dir << " does not exist, attempting to create it" << std::endl;
boost::filesystem::create_directory(p);
}
std::cout << "Logging with be done at " << FLAGS_log_dir << std::endl;
}