From 49beb1241a390ba083a209ed259f8fddff88a45d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 4 Sep 2018 20:08:59 +0200 Subject: [PATCH 01/13] Fix header and testing in non-interactive environments --- .../tracking/adapters/gps_l1_ca_kf_tracking.h | 4 ++-- .../tracking/gps_l1_ca_kf_tracking_test.cc | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h index a687b8a9e..e17831ffb 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.h @@ -1,6 +1,6 @@ /*! - * \file GPS_L1_CA_KF_Tracking.h - * \brief Interface of an adapter of a DLL + Kalman carrier + * \file gps_l1_ca_kf_tracking.h + * \brief Interface of an adapter of a DLL + Kalman carrier * tracking loop block for GPS L1 C/A signals * \author Javier Arribas, 2018. jarribas(at)cttc.es * \author Jordi Vila-Valls 2018. jvila(at)cttc.es diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_kf_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_kf_tracking_test.cc index 599e408c6..775c3540b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_kf_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_kf_tracking_test.cc @@ -550,7 +550,14 @@ TEST_F(GpsL1CAKfTrackingTest, ValidationOfResults) g1.plot_xy(timevec, late, "Late", decimate); g1.savetops("Correlators_outputs"); g1.savetopdf("Correlators_outputs", 18); - g1.showonscreen(); // window output + if (FLAGS_show_plots) + { + g1.showonscreen(); // window output + } + else + { + g1.disablescreen(); + } Gnuplot g2("points"); g2.set_title("Constellation diagram (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -561,7 +568,14 @@ TEST_F(GpsL1CAKfTrackingTest, ValidationOfResults) g2.plot_xy(promptI, promptQ); g2.savetops("Constellation"); g2.savetopdf("Constellation", 18); - g2.showonscreen(); // window output + if (FLAGS_show_plots) + { + g2.showonscreen(); // window output + } + else + { + g2.disablescreen(); + } } catch (const GnuplotException& ge) { From 8cd4ac060bff6822dfe35fc15ba4c9ccef1c8708 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 4 Sep 2018 20:11:33 +0200 Subject: [PATCH 02/13] Test reordering --- src/tests/test_main.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 64920b9a1..b2c8c3342 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -138,11 +138,16 @@ DECLARE_string(log_dir); #include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc" #endif +#include "unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc" +#include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc" +#include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc" + #include "unit-tests/signal-processing-blocks/pvt/rtcm_test.cc" #include "unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc" #include "unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc" #include "unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc" + #if EXTRA_TESTS #include "unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc" #include "unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc" @@ -158,9 +163,6 @@ DECLARE_string(log_dir); #include "unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc" #endif -#include "unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc" -#include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc" -#include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc" // For GPS NAVIGATION (L1) concurrent_queue global_gps_acq_assist_queue; From a956fdee7dcac852459bb30c3e50cc8a2e047ca7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 5 Sep 2018 21:02:48 +0200 Subject: [PATCH 03/13] Minor 3D error plot improvements --- src/tests/system-tests/position_test.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index b95a2b42d..d41f9ca24 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -781,8 +781,10 @@ void StaticPositionSystemTest::check_results() //conversion between arma::vec and std:vector std::vector error_vec(error_module_R_eb_e.colptr(0), error_module_R_eb_e.colptr(0) + error_module_R_eb_e.n_rows); g3.cmd("set key box opaque"); - g3.plot_xy(time_vector_from_start_s, error_vec, - "Position_3d_error"); + g3.plot_xy(time_vector_from_start_s, error_vec, "Position 3D error"); + double mean3d = std::accumulate(error_vec.begin(), error_vec.end(), 0.0) / error_vec.size(); + std::vector error_mean(mean3d, error_vec.size()); + g3.plot_xy(time_vector_from_start_s, error_mean, "Mean"); g3.set_legend(); g3.savetops("Position_3d_error"); From 7e9a094caacfb9509e89c2ac146ef10941398595 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 5 Sep 2018 21:24:36 +0200 Subject: [PATCH 04/13] Fix arma_vec usage --- src/tests/system-tests/position_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index d41f9ca24..e4f09e444 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -783,7 +783,7 @@ void StaticPositionSystemTest::check_results() g3.cmd("set key box opaque"); g3.plot_xy(time_vector_from_start_s, error_vec, "Position 3D error"); double mean3d = std::accumulate(error_vec.begin(), error_vec.end(), 0.0) / error_vec.size(); - std::vector error_mean(mean3d, error_vec.size()); + std::vector error_mean(mean3d, time_vector_from_start_s.n_elem); g3.plot_xy(time_vector_from_start_s, error_mean, "Mean"); g3.set_legend(); g3.savetops("Position_3d_error"); From a95cd87f797ddffbe4504618ee15daa5e4fca97f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 5 Sep 2018 21:41:15 +0200 Subject: [PATCH 05/13] Fix position test --- src/tests/system-tests/position_test.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index e4f09e444..44ae584c4 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -783,7 +783,7 @@ void StaticPositionSystemTest::check_results() g3.cmd("set key box opaque"); g3.plot_xy(time_vector_from_start_s, error_vec, "Position 3D error"); double mean3d = std::accumulate(error_vec.begin(), error_vec.end(), 0.0) / error_vec.size(); - std::vector error_mean(mean3d, time_vector_from_start_s.n_elem); + std::vector error_mean(mean3d, error_module_R_eb_e.colptr(0) + error_module_R_eb_e.n_rows); g3.plot_xy(time_vector_from_start_s, error_mean, "Mean"); g3.set_legend(); g3.savetops("Position_3d_error"); @@ -804,8 +804,7 @@ void StaticPositionSystemTest::check_results() //conversion between arma::vec and std:vector std::vector error_vec2(error_module_V_eb_e.colptr(0), error_module_V_eb_e.colptr(0) + error_module_V_eb_e.n_rows); g4.cmd("set key box opaque"); - g4.plot_xy(time_vector_from_start_s, error_vec2, - "Velocity_3d_error"); + g4.plot_xy(time_vector_from_start_s, error_vec2, "Velocity 3D error"); g4.set_legend(); g4.savetops("Velocity_3d_error"); } From ec7bd4dae54a7ea0a2ef8ba3942c825f17263602 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 5 Sep 2018 21:50:46 +0200 Subject: [PATCH 06/13] Fix position test --- src/tests/system-tests/position_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 44ae584c4..e6ae9b882 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -783,7 +783,7 @@ void StaticPositionSystemTest::check_results() g3.cmd("set key box opaque"); g3.plot_xy(time_vector_from_start_s, error_vec, "Position 3D error"); double mean3d = std::accumulate(error_vec.begin(), error_vec.end(), 0.0) / error_vec.size(); - std::vector error_mean(mean3d, error_module_R_eb_e.colptr(0) + error_module_R_eb_e.n_rows); + std::vector error_mean(mean3d, error_module_R_eb_e.n_rows); g3.plot_xy(time_vector_from_start_s, error_mean, "Mean"); g3.set_legend(); g3.savetops("Position_3d_error"); From 116b327d36dfe140d0ec42058e535c511d34035e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 6 Sep 2018 07:38:41 +0200 Subject: [PATCH 07/13] Fix position test --- src/tests/system-tests/position_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index e6ae9b882..e8e00be17 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -783,7 +783,7 @@ void StaticPositionSystemTest::check_results() g3.cmd("set key box opaque"); g3.plot_xy(time_vector_from_start_s, error_vec, "Position 3D error"); double mean3d = std::accumulate(error_vec.begin(), error_vec.end(), 0.0) / error_vec.size(); - std::vector error_mean(mean3d, error_module_R_eb_e.n_rows); + std::vector error_mean(error_module_R_eb_e.n_rows, mean3d); g3.plot_xy(time_vector_from_start_s, error_mean, "Mean"); g3.set_legend(); g3.savetops("Position_3d_error"); From a8b1fdc37c4f7ac7300ea542f991f4501afd987b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 6 Sep 2018 08:17:35 +0200 Subject: [PATCH 08/13] Fix position test --- src/tests/system-tests/position_test.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index e8e00be17..6a2b1ca1d 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -759,7 +759,7 @@ void StaticPositionSystemTest::check_results() std::vector Z(error_R_eb_e.colptr(2), error_R_eb_e.colptr(2) + error_R_eb_e.n_rows); g1.cmd("set key box opaque"); - g1.plot_xyz(X, Y, Z, "ECEF_3d_error"); + g1.plot_xyz(X, Y, Z, "ECEF 3D error"); g1.set_legend(); g1.savetops("ECEF_3d_error"); @@ -784,6 +784,7 @@ void StaticPositionSystemTest::check_results() g3.plot_xy(time_vector_from_start_s, error_vec, "Position 3D error"); double mean3d = std::accumulate(error_vec.begin(), error_vec.end(), 0.0) / error_vec.size(); std::vector error_mean(error_module_R_eb_e.n_rows, mean3d); + g3.set_style("lines"); g3.plot_xy(time_vector_from_start_s, error_mean, "Mean"); g3.set_legend(); g3.savetops("Position_3d_error"); @@ -805,6 +806,10 @@ void StaticPositionSystemTest::check_results() std::vector error_vec2(error_module_V_eb_e.colptr(0), error_module_V_eb_e.colptr(0) + error_module_V_eb_e.n_rows); g4.cmd("set key box opaque"); g4.plot_xy(time_vector_from_start_s, error_vec2, "Velocity 3D error"); + double mean3dv = std::accumulate(error_vec2.begin(), error_vec2.end(), 0.0) / error_vec2.size(); + std::vector error_mean_v(error_module_V_eb_e.n_rows, mean3dv); + g4.set_style("lines"); + g4.plot_xy(time_vector_from_start_s, error_mean_v, "Mean"); g4.set_legend(); g4.savetops("Velocity_3d_error"); } From ab1c87bdc4b9aa87f6e71a7b338740116de6dbfe Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 6 Sep 2018 11:16:56 +0200 Subject: [PATCH 09/13] Add configuration name in output figures --- src/tests/system-tests/position_test.cc | 55 ++++++++++++++++++++----- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 6a2b1ca1d..1bf4bc71d 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -761,9 +761,14 @@ void StaticPositionSystemTest::check_results() g1.cmd("set key box opaque"); g1.plot_xyz(X, Y, Z, "ECEF 3D error"); g1.set_legend(); - g1.savetops("ECEF_3d_error"); - - + if (FLAGS_config_file_ptest.empty()) + { + g1.savetops("ECEF_3d_error"); + } + else + { + g1.savetops("ECEF_3d_error_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); + } arma::vec time_vector_from_start_s = receiver_time_s - receiver_time_s(0); Gnuplot g3("linespoints"); if (FLAGS_show_plots) @@ -787,7 +792,14 @@ void StaticPositionSystemTest::check_results() g3.set_style("lines"); g3.plot_xy(time_vector_from_start_s, error_mean, "Mean"); g3.set_legend(); - g3.savetops("Position_3d_error"); + if (FLAGS_config_file_ptest.empty()) + { + g3.savetops("Position_3d_error"); + } + else + { + g3.savetops("Position_3d_error_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); + } Gnuplot g4("linespoints"); if (FLAGS_show_plots) @@ -811,7 +823,14 @@ void StaticPositionSystemTest::check_results() g4.set_style("lines"); g4.plot_xy(time_vector_from_start_s, error_mean_v, "Mean"); g4.set_legend(); - g4.savetops("Velocity_3d_error"); + if (FLAGS_config_file_ptest.empty()) + { + g4.savetops("Velocity_3d_error"); + } + else + { + g4.savetops("Velocity_3d_error_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); + } } } @@ -881,9 +900,16 @@ void StaticPositionSystemTest::print_results(const std::vector& east, g1.cmd("set grid front"); g1.cmd("replot"); - - g1.savetops("Position_test_2D"); - g1.savetopdf("Position_test_2D", 18); + if (FLAGS_config_file_ptest.empty()) + { + g1.savetops("Position_test_2D"); + g1.savetopdf("Position_test_2D", 18); + } + else + { + g1.savetops("Position_test_2D_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); + g1.savetopdf("Position_test_2D_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5), 18); + } Gnuplot g2("points"); if (FLAGS_show_plots) @@ -909,9 +935,16 @@ void StaticPositionSystemTest::print_results(const std::vector& east, std::to_string(ninty_sas) + "\n fx(v,u) = r*cos(v)*cos(u)\n fy(v,u) = r*cos(v)*sin(u)\n fz(v) = r*sin(v) \n splot fx(v,u),fy(v,u),fz(v) title \"90\%-SAS\" lt rgb \"gray\"\n"); g2.plot_xyz(east, north, up, "3D Position Fixes"); - - g2.savetops("Position_test_3D"); - g2.savetopdf("Position_test_3D"); + if (FLAGS_config_file_ptest.empty()) + { + g2.savetops("Position_test_3D"); + g2.savetopdf("Position_test_3D"); + } + else + { + g2.savetops("Position_test_3D_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); + g2.savetopdf("Position_test_3D_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); + } } catch (const GnuplotException& ge) { From 3adba38c34c8dde04ba6d959af18efc102e6a87d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 6 Sep 2018 11:48:40 +0200 Subject: [PATCH 10/13] Fix name of output files --- src/tests/system-tests/position_test.cc | 29 ++++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 1bf4bc71d..0f1f4ed80 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -67,6 +67,7 @@ public: int configure_receiver(); int run_receiver(); void check_results(); + std::string config_filename_no_extension; private: std::string generator_binary; @@ -608,7 +609,10 @@ void StaticPositionSystemTest::check_results() std::stringstream stm; std::ofstream position_test_file; - + if (!FLAGS_config_file_ptest.empty()) + { + stm << "Configuration file: " << FLAGS_config_file_ptest << std::endl; + } if (FLAGS_config_file_ptest.empty()) { stm << "---- ACCURACY ----" << std::endl; @@ -726,6 +730,10 @@ void StaticPositionSystemTest::check_results() //report std::cout << "----- Position and Velocity 3D ECEF error statistics -----" << std::endl; + if (!FLAGS_config_file_ptest.empty()) + { + std::cout << "Configuration file: " << FLAGS_config_file_ptest << std::endl; + } std::streamsize ss = std::cout.precision(); std::cout << std::setprecision(10) << "---- 3D ECEF Position RMSE = " << rmse_R_eb_e << ", mean = " << error_mean_R_eb_e @@ -767,7 +775,7 @@ void StaticPositionSystemTest::check_results() } else { - g1.savetops("ECEF_3d_error_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); + g1.savetops("ECEF_3d_error_" + config_filename_no_extension); } arma::vec time_vector_from_start_s = receiver_time_s - receiver_time_s(0); Gnuplot g3("linespoints"); @@ -798,7 +806,7 @@ void StaticPositionSystemTest::check_results() } else { - g3.savetops("Position_3d_error_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); + g3.savetops("Position_3d_error_" + config_filename_no_extension); } Gnuplot g4("linespoints"); @@ -829,7 +837,7 @@ void StaticPositionSystemTest::check_results() } else { - g4.savetops("Velocity_3d_error_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); + g4.savetops("Velocity_3d_error_" + config_filename_no_extension); } } } @@ -907,8 +915,8 @@ void StaticPositionSystemTest::print_results(const std::vector& east, } else { - g1.savetops("Position_test_2D_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); - g1.savetopdf("Position_test_2D_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5), 18); + g1.savetops("Position_test_2D_" + config_filename_no_extension); + g1.savetopdf("Position_test_2D_" + config_filename_no_extension, 18); } Gnuplot g2("points"); @@ -942,8 +950,8 @@ void StaticPositionSystemTest::print_results(const std::vector& east, } else { - g2.savetops("Position_test_3D_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); - g2.savetopdf("Position_test_3D_" + FLAGS_config_file_ptest.erase(FLAGS_config_file_ptest.length() - 5)); + g2.savetops("Position_test_3D_" + config_filename_no_extension); + g2.savetopdf("Position_test_3D_" + config_filename_no_extension); } } catch (const GnuplotException& ge) @@ -966,6 +974,11 @@ TEST_F(StaticPositionSystemTest, Position_system_test) generate_signal(); } } + else + { + config_filename_no_extension = FLAGS_config_file_ptest.substr(FLAGS_config_file_ptest.find_last_of("/\\") + 1); + config_filename_no_extension = config_filename_no_extension.erase(config_filename_no_extension.length() - 5); + } // Configure receiver configure_receiver(); From db50c2a27533986f509143dc115f27cdb289da1b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 6 Sep 2018 12:05:31 +0200 Subject: [PATCH 11/13] Cosmetics --- src/tests/system-tests/position_test.cc | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 0f1f4ed80..6d099075b 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -59,7 +59,7 @@ concurrent_queue global_gps_acq_assist_queue; concurrent_map global_gps_acq_assist_map; -class StaticPositionSystemTest : public ::testing::Test +class PositionSystemTest : public ::testing::Test { public: int configure_generator(); @@ -101,7 +101,7 @@ private: }; -void StaticPositionSystemTest::geodetic2Ecef(const double latitude, const double longitude, const double altitude, +void PositionSystemTest::geodetic2Ecef(const double latitude, const double longitude, const double altitude, double* x, double* y, double* z) { const double a = 6378137.0; // WGS84 @@ -126,7 +126,7 @@ void StaticPositionSystemTest::geodetic2Ecef(const double latitude, const double } -void StaticPositionSystemTest::geodetic2Enu(double latitude, double longitude, double altitude, +void PositionSystemTest::geodetic2Enu(double latitude, double longitude, double altitude, double* east, double* north, double* up) { double x, y, z; @@ -169,7 +169,7 @@ void StaticPositionSystemTest::geodetic2Enu(double latitude, double longitude, d } -double StaticPositionSystemTest::compute_stdev_precision(const std::vector& vec) +double PositionSystemTest::compute_stdev_precision(const std::vector& vec) { double sum__ = std::accumulate(vec.begin(), vec.end(), 0.0); double mean__ = sum__ / vec.size(); @@ -182,7 +182,7 @@ double StaticPositionSystemTest::compute_stdev_precision(const std::vector& vec, const double ref) +double PositionSystemTest::compute_stdev_accuracy(const std::vector& vec, const double ref) { const double mean__ = ref; double accum__ = 0.0; @@ -194,7 +194,7 @@ double StaticPositionSystemTest::compute_stdev_accuracy(const std::vector control_thread; if (FLAGS_config_file_ptest.empty()) @@ -449,15 +449,15 @@ int StaticPositionSystemTest::run_receiver() { std::string aux = std::string(buffer); EXPECT_EQ(aux.empty(), false); - StaticPositionSystemTest::generated_kml_file = aux.erase(aux.length() - 1, 1); + PositionSystemTest::generated_kml_file = aux.erase(aux.length() - 1, 1); } pclose(fp); - EXPECT_EQ(StaticPositionSystemTest::generated_kml_file.empty(), false); + EXPECT_EQ(PositionSystemTest::generated_kml_file.empty(), false); return 0; } -void StaticPositionSystemTest::check_results() +void PositionSystemTest::check_results() { std::vector pos_e; std::vector pos_n; @@ -488,7 +488,7 @@ void StaticPositionSystemTest::check_results() if (!FLAGS_use_pvt_solver_dump) { //fall back to read receiver KML output (position only) - std::fstream myfile(StaticPositionSystemTest::generated_kml_file, std::ios_base::in); + std::fstream myfile(PositionSystemTest::generated_kml_file, std::ios_base::in); ASSERT_TRUE(myfile.is_open()) << "No valid kml file could be opened"; std::string line; // Skip header @@ -638,7 +638,7 @@ void StaticPositionSystemTest::check_results() stm << "SEP = " << 0.51 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision) << " [m]" << std::endl; std::cout << stm.rdbuf(); - std::string output_filename = "position_test_output_" + StaticPositionSystemTest::generated_kml_file.erase(StaticPositionSystemTest::generated_kml_file.length() - 3, 3) + "txt"; + std::string output_filename = "position_test_output_" + PositionSystemTest::generated_kml_file.erase(PositionSystemTest::generated_kml_file.length() - 3, 3) + "txt"; position_test_file.open(output_filename.c_str()); if (position_test_file.is_open()) { @@ -732,7 +732,7 @@ void StaticPositionSystemTest::check_results() std::cout << "----- Position and Velocity 3D ECEF error statistics -----" << std::endl; if (!FLAGS_config_file_ptest.empty()) { - std::cout << "Configuration file: " << FLAGS_config_file_ptest << std::endl; + std::cout << "----- Configuration file: " << FLAGS_config_file_ptest << std::endl; } std::streamsize ss = std::cout.precision(); std::cout << std::setprecision(10) << "---- 3D ECEF Position RMSE = " @@ -843,7 +843,7 @@ void StaticPositionSystemTest::check_results() } -void StaticPositionSystemTest::print_results(const std::vector& east, +void PositionSystemTest::print_results(const std::vector& east, const std::vector& north, const std::vector& up) { @@ -961,7 +961,7 @@ void StaticPositionSystemTest::print_results(const std::vector& east, } } -TEST_F(StaticPositionSystemTest, Position_system_test) +TEST_F(PositionSystemTest, Position_system_test) { if (FLAGS_config_file_ptest.empty()) { From 5ad98885a517fb1986678407475b6f1cdb08fc4d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 6 Sep 2018 12:26:03 +0200 Subject: [PATCH 12/13] Cosmetics --- src/tests/system-tests/position_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 6d099075b..7d66adfc3 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -732,7 +732,7 @@ void PositionSystemTest::check_results() std::cout << "----- Position and Velocity 3D ECEF error statistics -----" << std::endl; if (!FLAGS_config_file_ptest.empty()) { - std::cout << "----- Configuration file: " << FLAGS_config_file_ptest << std::endl; + std::cout << "---- Configuration file: " << FLAGS_config_file_ptest << std::endl; } std::streamsize ss = std::cout.precision(); std::cout << std::setprecision(10) << "---- 3D ECEF Position RMSE = " From cc3ead3ea25bb8d017528b543689090a9a483aa6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 17 Sep 2018 11:30:42 +0200 Subject: [PATCH 13/13] Reserve memory only one if acquisition init is called multiple times --- .../gnuradio_blocks/pcps_acquisition.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index b1b6d699a..034cbbd10 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -271,8 +271,8 @@ void pcps_acquisition::init() d_num_doppler_bins = static_cast(std::ceil(static_cast(static_cast(acq_parameters.doppler_max) - static_cast(-acq_parameters.doppler_max)) / static_cast(d_doppler_step))); // Create the carrier Doppler wipeoff signals - d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins]; - if (acq_parameters.make_2_steps) + if (d_grid_doppler_wipeoffs == nullptr) d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins]; + if (acq_parameters.make_2_steps && (d_grid_doppler_wipeoffs_step_two == nullptr)) { d_grid_doppler_wipeoffs_step_two = new gr_complex*[d_num_doppler_bins_step2]; for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++) @@ -281,11 +281,18 @@ void pcps_acquisition::init() } } - d_magnitude_grid = new float*[d_num_doppler_bins]; + if (d_magnitude_grid == nullptr) + { + d_magnitude_grid = new float*[d_num_doppler_bins]; + for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) + { + d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + d_magnitude_grid[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); + } + } + for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) { - d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); - d_magnitude_grid[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); for (uint32_t k = 0; k < d_fft_size; k++) { d_magnitude_grid[doppler_index][k] = 0.0;