[hamradio-commits] [gnss-sdr] 146/303: Improve variable naming, some code cleaning

Carles Fernandez carles_fernandez-guest at moszumanska.debian.org
Mon Feb 13 22:35:56 UTC 2017


This is an automated email from the git hooks/post-receive script.

carles_fernandez-guest pushed a commit to branch master
in repository gnss-sdr.

commit 6ed62341707e1a409f022c3cd58ada4506cc3c53
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date:   Thu Nov 3 16:58:54 2016 +0100

    Improve variable naming, some code cleaning
---
 .../PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc       | 29 +++++++----------
 .../PVT/gnuradio_blocks/galileo_e1_pvt_cc.h        |  3 +-
 .../PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc        | 38 +++++++++-------------
 .../PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h         |  6 ++--
 4 files changed, 31 insertions(+), 45 deletions(-)

diff --git a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc
index 32f5433..35e1478 100644
--- a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc
+++ b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc
@@ -174,7 +174,7 @@ galileo_e1_pvt_cc::galileo_e1_pvt_cc(unsigned int nchannels, bool dump, std::str
     d_last_sample_nav_output = 0;
     d_rx_time = 0.0;
 
-    b_rinex_header_writen = false;
+    b_rinex_header_written = false;
     b_rinex_header_updated = false;
 
     rp = std::make_shared<Rinex_Printer>();
@@ -218,13 +218,6 @@ galileo_e1_pvt_cc::~galileo_e1_pvt_cc()
 }
 
 
-
-bool galileo_e1_pvt_cc::pseudoranges_pairCompare_min(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
-{
-    return (a.second.Pseudorange_m) < (b.second.Pseudorange_m);
-}
-
-
 void galileo_e1_pvt_cc::print_receiver_status(Gnss_Synchro** channels_synchronization_data)
 {
     // Print the current receiver status using std::cout every second
@@ -259,7 +252,7 @@ int galileo_e1_pvt_cc::general_work (int noutput_items __attribute__((unused)),
 {
     d_sample_counter++;
 
-    std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
+    std::map<int,Gnss_Synchro> gnss_observables_map;
 
     Gnss_Synchro **in = (Gnss_Synchro **)  &input_items[0]; //Get the input pointer
 
@@ -270,7 +263,7 @@ int galileo_e1_pvt_cc::general_work (int noutput_items __attribute__((unused)),
         {
             if (in[i][0].Flag_valid_pseudorange == true)
                 {
-                    gnss_pseudoranges_map.insert(std::pair<int,Gnss_Synchro>(in[i][0].PRN, in[i][0])); // store valid pseudoranges in a map
+                    gnss_observables_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)
                     if(d_ls_pvt->galileo_ephemeris_map.size() > 0)
                         {
@@ -284,13 +277,13 @@ int galileo_e1_pvt_cc::general_work (int noutput_items __attribute__((unused)),
         }
 
     // ############ 2 COMPUTE THE PVT ################################
-    if (gnss_pseudoranges_map.size() > 0 and d_ls_pvt->galileo_ephemeris_map.size() > 0)
+    if (gnss_observables_map.size() > 0 and d_ls_pvt->galileo_ephemeris_map.size() > 0)
         {
             // compute on the fly PVT solution
             if ((d_sample_counter % d_output_rate_ms) == 0)
                 {
                     bool pvt_result;
-                    pvt_result = d_ls_pvt->get_PVT(gnss_pseudoranges_map, d_rx_time, d_flag_averaging);
+                    pvt_result = d_ls_pvt->get_PVT(gnss_observables_map, d_rx_time, d_flag_averaging);
 
                     if (pvt_result == true)
                         {
@@ -309,7 +302,7 @@ int galileo_e1_pvt_cc::general_work (int noutput_items __attribute__((unused)),
                             d_geojson_printer->print_position(d_ls_pvt, d_flag_averaging);
                             d_nmea_printer->Print_Nmea_Line(d_ls_pvt, d_flag_averaging);
 
-                            if (!b_rinex_header_writen)
+                            if (!b_rinex_header_written)
                                 {
                                     std::map<int,Galileo_Ephemeris>::iterator galileo_ephemeris_iter;
                                     galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.begin();
@@ -317,10 +310,10 @@ int galileo_e1_pvt_cc::general_work (int noutput_items __attribute__((unused)),
                                         {
                                             rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time);
                                             rp->rinex_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac);
-                                            b_rinex_header_writen = true; // do not write header anymore
+                                            b_rinex_header_written = true; // do not write header anymore
                                         }
                                 }
-                            if(b_rinex_header_writen) // Put here another condition to separate annotations (e.g 30 s)
+                            if(b_rinex_header_written) // Put here another condition to separate annotations (e.g 30 s)
                                 {
                                     // Limit the RINEX navigation output rate to 1/6 seg
                                     // Notice that d_sample_counter period is 4ms (for Galileo correlators)
@@ -333,7 +326,7 @@ int galileo_e1_pvt_cc::general_work (int noutput_items __attribute__((unused)),
                                     galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.begin();
                                     if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end())
                                         {
-                                            rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_pseudoranges_map);
+                                            rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map);
                                         }
                                     if (!b_rinex_header_updated && (d_ls_pvt->galileo_utc_model.A0_6 != 0))
                                         {
@@ -358,7 +351,7 @@ int galileo_e1_pvt_cc::general_work (int noutput_items __attribute__((unused)),
                                             gal_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.begin();
                                             if (gal_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end())
                                                 {
-                                                    d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_ephemeris_iter->second, d_rx_time, gnss_pseudoranges_map, 0, 0, 0, 0, 0);
+                                                    d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
                                                 }
                                         }
                                 }
@@ -373,7 +366,7 @@ int galileo_e1_pvt_cc::general_work (int noutput_items __attribute__((unused)),
 
                                     if (gal_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end())
                                         {
-                                            d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_ephemeris_iter->second, d_rx_time, gnss_pseudoranges_map, 0, 0, 0, 0, 0);
+                                            d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
                                         }
                                     b_rtcm_writing_started = true;
                                 }
diff --git a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.h
index 6384179..6a16dd5 100644
--- a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.h
+++ b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.h
@@ -108,7 +108,7 @@ private:
     void msg_handler_telemetry(pmt::pmt_t msg);
 
     bool d_dump;
-    bool b_rinex_header_writen;
+    bool b_rinex_header_written;
     bool b_rinex_header_updated;
     bool b_rtcm_writing_started;
 
@@ -135,7 +135,6 @@ private:
 
     double d_rx_time;
     std::shared_ptr<galileo_e1_ls_pvt> d_ls_pvt;
-    bool pseudoranges_pairCompare_min(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b);
 
     bool first_fix;
     key_t sysv_msg_key;
diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc
index d73c6de..83804b9 100644
--- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc
+++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc
@@ -131,21 +131,21 @@ void gps_l1_ca_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg)
                     Sbas_Raw_Msg sbas_raw_msg = *sbas_raw_msg_ptr;
                     // read SBAS raw messages directly from queue and write them into rinex file
                     // create the header of not yet done
-                    if(!b_rinex_sbs_header_writen)
+                    if(!b_rinex_sbs_header_written)
                         {
                             rp->rinex_sbs_header(rp->sbsFile);
-                            b_rinex_sbs_header_writen = true;
+                            b_rinex_sbs_header_written = true;
                         }
 
                     // Define the RX time of the SBAS message by using the GPS time.
                     // It has only an effect if there has not been yet a SBAS MT12 available
                     // when the message was received.
                     if(sbas_raw_msg.get_rx_time_obj().is_related() == false
-                            && gnss_pseudoranges_map.size() > 0
+                            && gnss_observables_map.size() > 0
                             && d_ls_pvt->gps_ephemeris_map.size() > 0)
                         {
                             // doesn't matter which channel/satellite we choose
-                            Gnss_Synchro gs = gnss_pseudoranges_map.begin()->second;
+                            Gnss_Synchro gs = gnss_observables_map.begin()->second;
                             Gps_Ephemeris eph = d_ls_pvt->gps_ephemeris_map.begin()->second;
 
                             double relative_rx_time = gs.Tracking_timestamp_secs;
@@ -277,9 +277,9 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels,
 
     d_last_status_print_seg = 0;
 
-    b_rinex_header_writen = false;
+    b_rinex_header_written = false;
     b_rinex_header_updated = false;
-    b_rinex_sbs_header_writen = false;
+    b_rinex_sbs_header_written = false;
     rp = std::make_shared<Rinex_Printer>();
 
     // ############# ENABLE DATA FILE LOG #################
@@ -318,12 +318,6 @@ gps_l1_ca_pvt_cc::~gps_l1_ca_pvt_cc()
 }
 
 
-bool pseudoranges_pairCompare_min(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
-{
-    return (a.second.Pseudorange_m) < (b.second.Pseudorange_m);
-}
-
-
 void gps_l1_ca_pvt_cc::print_receiver_status(Gnss_Synchro** channels_synchronization_data)
 {
     // Print the current receiver status using std::cout every second
@@ -341,7 +335,7 @@ void gps_l1_ca_pvt_cc::print_receiver_status(Gnss_Synchro** channels_synchroniza
 int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
         gr_vector_const_void_star &input_items, gr_vector_void_star &output_items __attribute__((unused)))
 {
-    gnss_pseudoranges_map.clear();
+    gnss_observables_map.clear();
     d_sample_counter++;
     Gnss_Synchro **in = (Gnss_Synchro **)  &input_items[0]; //Get the input pointer
 
@@ -352,7 +346,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), g
         {
             if (in[i][0].Flag_valid_pseudorange == true)
                 {
-                    gnss_pseudoranges_map.insert(std::pair<int,Gnss_Synchro>(in[i][0].PRN, in[i][0])); // store valid pseudoranges in a map
+                    gnss_observables_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)
                     if(d_ls_pvt->gps_ephemeris_map.size() > 0)
                         {
@@ -366,14 +360,14 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), g
         }
 
     // ############ 2 COMPUTE THE PVT ################################
-    if (gnss_pseudoranges_map.size() > 0 and d_ls_pvt->gps_ephemeris_map.size() > 0)
+    if (gnss_observables_map.size() > 0 and d_ls_pvt->gps_ephemeris_map.size() > 0)
         {
             // compute on the fly PVT solution
             //mod 8/4/2012 Set the PVT computation rate in this block
             if ((d_sample_counter % d_output_rate_ms) == 0)
                 {
                     bool pvt_result;
-                    pvt_result = d_ls_pvt->get_PVT(gnss_pseudoranges_map, d_rx_time, d_flag_averaging);
+                    pvt_result = d_ls_pvt->get_PVT(gnss_observables_map, d_rx_time, d_flag_averaging);
                     if (pvt_result == true)
                         {
                             if( first_fix == true)
@@ -391,7 +385,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), g
                             d_geojson_printer->print_position(d_ls_pvt, d_flag_averaging);
                             d_nmea_printer->Print_Nmea_Line(d_ls_pvt, d_flag_averaging);
 
-                            if (!b_rinex_header_writen)
+                            if (!b_rinex_header_written)
                                 {
                                     std::map<int,Gps_Ephemeris>::iterator gps_ephemeris_iter;
                                     gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin();
@@ -399,10 +393,10 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), g
                                         {
                                             rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, d_rx_time);
                                             rp->rinex_nav_header(rp->navFile, d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model);
-                                            b_rinex_header_writen = true; // do not write header anymore
+                                            b_rinex_header_written = true; // do not write header anymore
                                         }
                                 }
-                            if(b_rinex_header_writen) // Put here another condition to separate annotations (e.g 30 s)
+                            if(b_rinex_header_written) // Put here another condition to separate annotations (e.g 30 s)
                                 {
                                     // Limit the RINEX navigation output rate to 1/6 seg
                                     // Notice that d_sample_counter period is 1ms (for GPS correlators)
@@ -415,7 +409,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), g
                                     gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin();
                                     if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end())
                                         {
-                                            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_observables_map);
                                         }
                                     if (!b_rinex_header_updated && (d_ls_pvt->gps_utc_model.d_A0 != 0))
                                         {
@@ -439,7 +433,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), g
                                             gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin();
                                             if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end())
                                                 {
-                                                    d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, d_rx_time, gnss_pseudoranges_map, 0, 0, 0, 0, 0);
+                                                    d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
                                                 }
                                         }
                                 }
@@ -455,7 +449,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), g
 
                                     if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end())
                                         {
-                                            d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, d_rx_time, gnss_pseudoranges_map, 0, 0, 0, 0, 0);
+                                            d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
                                         }
                                     b_rtcm_writing_started = true;
                                 }
diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h
index f0b3b02..f2234b1 100644
--- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h
+++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h
@@ -108,8 +108,8 @@ private:
     void msg_handler_telemetry(pmt::pmt_t msg);
 
     bool d_dump;
-    bool b_rinex_header_writen;
-    bool b_rinex_sbs_header_writen;
+    bool b_rinex_header_written;
+    bool b_rinex_sbs_header_written;
     bool b_rinex_header_updated;
     bool b_rtcm_writing_started;
     unsigned short d_rtcm_tcp_port;
@@ -138,7 +138,7 @@ private:
     double d_rx_time;
     std::shared_ptr<gps_l1_ca_ls_pvt> d_ls_pvt;
 
-    std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
+    std::map<int,Gnss_Synchro> gnss_observables_map;
 
     bool first_fix;
     key_t sysv_msg_key;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git



More information about the pkg-hamradio-commits mailing list