1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 04:00:34 +00:00

Changing some raw pointers by smart pointers. Commenting out some custom

code
This commit is contained in:
Carles Fernandez 2014-09-04 19:35:55 +02:00
parent bcd90ca9cf
commit a57c5ccf8a
5 changed files with 218 additions and 226 deletions

View File

@ -77,17 +77,18 @@ hybrid_pvt_cc::hybrid_pvt_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_q
std::string kml_dump_filename; std::string kml_dump_filename;
kml_dump_filename = d_dump_filename; kml_dump_filename = d_dump_filename;
kml_dump_filename.append(".kml"); kml_dump_filename.append(".kml");
d_kml_dump.set_headers(kml_dump_filename); d_kml_dump = std::make_shared<Kml_Printer>();
d_kml_dump->set_headers(kml_dump_filename);
//initialize nmea_printer //initialize nmea_printer
d_nmea_printer = new Nmea_Printer(nmea_dump_filename, flag_nmea_tty_port, nmea_dump_devname); d_nmea_printer = std::make_shared<Nmea_Printer>(nmea_dump_filename, flag_nmea_tty_port, nmea_dump_devname);
d_dump_filename.append("_raw.dat"); d_dump_filename.append("_raw.dat");
dump_ls_pvt_filename.append("_ls_pvt.dat"); dump_ls_pvt_filename.append("_ls_pvt.dat");
d_averaging_depth = averaging_depth; d_averaging_depth = averaging_depth;
d_flag_averaging = flag_averaging; d_flag_averaging = flag_averaging;
d_ls_pvt = new hybrid_ls_pvt(nchannels, dump_ls_pvt_filename, d_dump); d_ls_pvt = std::make_shared<hybrid_ls_pvt>((int)nchannels, dump_ls_pvt_filename, d_dump);
d_ls_pvt->set_averaging_depth(d_averaging_depth); d_ls_pvt->set_averaging_depth(d_averaging_depth);
d_sample_counter = 0; d_sample_counter = 0;
@ -96,7 +97,7 @@ hybrid_pvt_cc::hybrid_pvt_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_q
d_rx_time = 0.0; d_rx_time = 0.0;
d_TOW_at_curr_symbol_constellation = 0.0; d_TOW_at_curr_symbol_constellation = 0.0;
b_rinex_header_writen = false; b_rinex_header_writen = false;
rp = new Rinex_Printer(); rp = std::make_shared<Rinex_Printer>();
// ############# ENABLE DATA FILE LOG ################# // ############# ENABLE DATA FILE LOG #################
if (d_dump == true) if (d_dump == true)
@ -120,12 +121,7 @@ hybrid_pvt_cc::hybrid_pvt_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_q
hybrid_pvt_cc::~hybrid_pvt_cc() hybrid_pvt_cc::~hybrid_pvt_cc()
{ {}
d_kml_dump.close_file();
delete d_ls_pvt;
delete rp;
delete d_nmea_printer;
}
@ -151,7 +147,7 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
{ {
gnss_pseudoranges_map.insert(std::pair<int,Gnss_Synchro>(in[i][0].PRN, in[i][0])); // store valid pseudoranges in a map gnss_pseudoranges_map.insert(std::pair<int,Gnss_Synchro>(in[i][0].PRN, in[i][0])); // store valid pseudoranges in a map
//d_rx_time = in[i][0].d_TOW_at_current_symbol; // all the channels have the same RX timestamp (common RX time pseudoranges) //d_rx_time = in[i][0].d_TOW_at_current_symbol; // all the channels have the same RX timestamp (common RX time pseudoranges)
d_TOW_at_curr_symbol_constellation=in[i][0].d_TOW_at_current_symbol; // d_TOW_at_current_symbol not corrected by delta t (just for debug) d_TOW_at_curr_symbol_constellation = in[i][0].d_TOW_at_current_symbol; // d_TOW_at_current_symbol not corrected by delta t (just for debug)
d_rx_time = in[i][0].d_TOW_hybrid_at_current_symbol; // hybrid rx time, all the channels have the same RX timestamp (common RX time pseudoranges) d_rx_time = in[i][0].d_TOW_hybrid_at_current_symbol; // hybrid rx time, all the channels have the same RX timestamp (common RX time pseudoranges)
//std::cout<<"CH PVT = "<< i << ", d_TOW = " << d_TOW_at_curr_symbol_constellation<<", rx_time_hybrid_PVT = " << d_rx_time << " same RX timestamp (common RX time pseudoranges)"<< std::endl; //std::cout<<"CH PVT = "<< i << ", d_TOW = " << d_TOW_at_curr_symbol_constellation<<", rx_time_hybrid_PVT = " << d_rx_time << " same RX timestamp (common RX time pseudoranges)"<< std::endl;
@ -215,7 +211,7 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
valid_solution_counter ++; valid_solution_counter ++;
d_kml_dump.print_position_hybrid(d_ls_pvt, d_flag_averaging); d_kml_dump->print_position_hybrid(d_ls_pvt, d_flag_averaging);
/* *********************************** COMPUTE STATISTICS OVER THE FIRST 1000 SOLUTOINS **********************************/ /* *********************************** COMPUTE STATISTICS OVER THE FIRST 1000 SOLUTOINS **********************************/
if (valid_solution_counter<=1000) if (valid_solution_counter<=1000)
@ -243,29 +239,29 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
//if(valid_solution_16_sat_counter ==1000) //if(valid_solution_16_sat_counter ==1000)
if (valid_solution_counter==1000) /* if (valid_solution_counter==1000)
{ {
//compute ECEF average and standard deviation over the first 1000 solutions //compute ECEF average and standard deviation over the first 1000 solutions
GDOP_sum=std::accumulate( GDOP_vect.begin(), GDOP_vect.end(), 0.0); GDOP_sum = std::accumulate( GDOP_vect.begin(), GDOP_vect.end(), 0.0);
GDOP_mean = GDOP_sum / GDOP_vect.size(); GDOP_mean = GDOP_sum / GDOP_vect.size();
longitude_vect_sum = std::accumulate( longitude_vect.begin(), longitude_vect.end(), 0.0); longitude_vect_sum = std::accumulate( longitude_vect.begin(), longitude_vect.end(), 0.0);
longitude_mean = longitude_vect_sum / longitude_vect.size(); longitude_mean = longitude_vect_sum / longitude_vect.size();
//IFEN true solutions //IFEN true solutions
double ref_longitude= 11.80800563; double ref_longitude = 11.80800563;
double ref_latitude= 48.17149767; double ref_latitude = 48.17149767;
double ref_X=4171691.011; double ref_X = 4171691.011;
double ref_Y=872120.003; double ref_Y = 872120.003;
double ref_Z=4730005.761; double ref_Z = 4730005.761;
// //REAL CAPTURE reference solutions (obtained with 4 Galileo) // REAL CAPTURE reference solutions (obtained with 4 Galileo)
// double ref_longitude= 1.987686994; // double ref_longitude= 1.987686994;
// double ref_latitude= 41.274786935; // double ref_latitude= 41.274786935;
// double ref_X=4797680.560; // double ref_X=4797680.560;
// double ref_Y= 166506.414; // double ref_Y= 166506.414;
// double ref_Z=4185453.947; // double ref_Z=4185453.947;
//compute mean value for precision //compute mean value for precision
latitude_vect_sum = std::accumulate( latitude_vect.begin(), latitude_vect.end(), 0.0); latitude_vect_sum = std::accumulate( latitude_vect.begin(), latitude_vect.end(), 0.0);
@ -305,12 +301,12 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
file_statitics << std::setprecision(9); file_statitics << std::setprecision(9);
file_solutions << std::setw(13)<< "time" << std::setw(26)<<"X [m]" << std::setw(20)<< "Y [m]"<< std::setw(20)<< "Z [m]" << // X Y Z solutions file_solutions << std::setw(13) << "time" << std::setw(26) <<"X [m]" << std::setw(20)<< "Y [m]"<< std::setw(20)<< "Z [m]" << // X Y Z solutions
std::setw(20)<<"Long [deg]" << std::setw(15)<< "Lat [deg]"<< std::setw(15)<< "h [m]"<< // long, lat, h solutions std::setw(20) << "Long [deg]" << std::setw(15) << "Lat [deg]" << std::setw(15) << "h [m]" << // long, lat, h solutions
std::setw(18)<<"E(Acc) [m]" << std::setw(18)<< "N(Acc) [m]"<<std::setw(18)<<"Up(Acc) [m]"<< //ENU residual for accuracy columns 7:8:9 std::setw(18) << "E(Acc) [m]" << std::setw(18) << "N(Acc) [m]" << std::setw(18) <<"Up(Acc) [m]" << //ENU residual for accuracy columns 7:8:9
std::setw(18)<<"E(Pre) [m]" << std::setw(18)<< "N(Pre) [m]"<<std::setw(18)<<"Up(Pre) [m]"<< //ENU residual for precision columns 10:11:12 std::setw(18) << "E(Pre) [m]" << std::setw(18) << "N(Pre) [m]" << std::setw(18) <<"Up(Pre) [m]" << //ENU residual for precision columns 10:11:12
std::setw(18)<<"Tot Sat" << std::setw(18)<< "Gal"<<std::setw(18)<<"GPS"<< //number of satellites std::setw(18) << "Tot Sat" << std::setw(18) << "Gal"<< std::setw(18) << "GPS" << //number of satellites
std::setw(18)<<"GDOP" <<std::endl; //GDOP std::setw(18) << "GDOP" << std::endl; //GDOP
@ -463,7 +459,7 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
file_solutions.close(); file_solutions.close();
file_statitics.close(); file_statitics.close();
}/* END *********************************** COMPUTE STATISTICS OVER THE FIRST 1000 SOLUTOINS **********************************/ } / * END *********************************** COMPUTE STATISTICS OVER THE FIRST 1000 SOLUTOINS ********************************** /
@ -498,7 +494,7 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
// { // {
// rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, d_rx_time, gnss_pseudoranges_map); // rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, d_rx_time, gnss_pseudoranges_map);
// } // }
// } // } */
} }
} }
@ -517,11 +513,6 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
<< " using "<<d_ls_pvt->d_valid_observations<<" observations is HDOP = " << d_ls_pvt->d_HDOP << " VDOP = " << " using "<<d_ls_pvt->d_valid_observations<<" observations is HDOP = " << d_ls_pvt->d_HDOP << " VDOP = "
<< d_ls_pvt->d_VDOP <<" TDOP = " << d_ls_pvt->d_TDOP << d_ls_pvt->d_VDOP <<" TDOP = " << d_ls_pvt->d_TDOP
<< " GDOP = " << d_ls_pvt->d_GDOP; << " GDOP = " << d_ls_pvt->d_GDOP;
} }
// MULTIPLEXED FILE RECORDING - Record results to file // MULTIPLEXED FILE RECORDING - Record results to file

View File

@ -100,7 +100,7 @@ private:
boost::shared_ptr<gr::msg_queue> d_queue; boost::shared_ptr<gr::msg_queue> d_queue;
bool d_dump; bool d_dump;
bool b_rinex_header_writen; bool b_rinex_header_writen;
Rinex_Printer *rp; std::shared_ptr<Rinex_Printer> rp;
unsigned int d_nchannels; unsigned int d_nchannels;
std::string d_dump_filename; std::string d_dump_filename;
std::ofstream d_dump_file; std::ofstream d_dump_file;
@ -112,8 +112,8 @@ private:
long unsigned int valid_solution_counter; long unsigned int valid_solution_counter;
long unsigned int valid_solution_16_sat_counter; long unsigned int valid_solution_16_sat_counter;
long unsigned int d_last_sample_nav_output; long unsigned int d_last_sample_nav_output;
Kml_Printer d_kml_dump; std::shared_ptr<Kml_Printer> d_kml_dump;
Nmea_Printer *d_nmea_printer; std::shared_ptr<Nmea_Printer> d_nmea_printer;
double d_rx_time; double d_rx_time;
double d_TOW_at_curr_symbol_constellation; double d_TOW_at_curr_symbol_constellation;
/* *********variable used for final statistics****/ /* *********variable used for final statistics****/
@ -209,8 +209,7 @@ private:
double SEP; //3D-50% double SEP; //3D-50%
/* END variable used for final statistics */ /* END variable used for final statistics */
std::shared_ptr<hybrid_ls_pvt> d_ls_pvt;
hybrid_ls_pvt *d_ls_pvt;
bool pseudoranges_pairCompare_min(std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b); bool pseudoranges_pairCompare_min(std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b);
public: public:

View File

@ -40,6 +40,7 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <memory>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <armadillo> #include <armadillo>

View File

@ -146,7 +146,7 @@ bool Kml_Printer::print_position_galileo(const std::shared_ptr<galileo_e1_ls_pvt
} }
} }
bool Kml_Printer::print_position_hybrid(hybrid_ls_pvt* position,bool print_average_values) bool Kml_Printer::print_position_hybrid(const std::shared_ptr<hybrid_ls_pvt>& position, bool print_average_values)
{ {
double latitude; double latitude;
double longitude; double longitude;

View File

@ -35,6 +35,7 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <memory>
#include <string> #include <string>
#include "gps_l1_ca_ls_pvt.h" #include "gps_l1_ca_ls_pvt.h"
#include "galileo_e1_ls_pvt.h" #include "galileo_e1_ls_pvt.h"
@ -53,7 +54,7 @@ public:
bool set_headers(std::string filename); bool set_headers(std::string filename);
bool print_position(const std::shared_ptr<gps_l1_ca_ls_pvt>& position, bool print_average_values); bool print_position(const std::shared_ptr<gps_l1_ca_ls_pvt>& position, bool print_average_values);
bool print_position_galileo(const std::shared_ptr<galileo_e1_ls_pvt>& position, bool print_average_values); bool print_position_galileo(const std::shared_ptr<galileo_e1_ls_pvt>& position, bool print_average_values);
bool print_position_hybrid(hybrid_ls_pvt* position, bool print_average_values); bool print_position_hybrid(const std::shared_ptr<hybrid_ls_pvt>& position, bool print_average_values);
bool close_file(); bool close_file();
Kml_Printer(); Kml_Printer();
~Kml_Printer(); ~Kml_Printer();