From d88cd25f030c85c313f242dd49504ceecafc8b86 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Feb 2020 19:51:33 +0100 Subject: [PATCH] Add new carrier_smoothing_factor flag Fix some public/private dependency issues Add enable_carrier_smoothing flag to position_test --- src/algorithms/libs/gnss_sdr_flags.cc | 1 + src/algorithms/libs/gnss_sdr_flags.h | 4 ++++ src/algorithms/observables/adapters/CMakeLists.txt | 1 + .../observables/adapters/hybrid_observables.cc | 12 +++++++++--- src/algorithms/observables/libs/CMakeLists.txt | 5 +++++ src/algorithms/observables/libs/obs_conf.cc | 3 ++- src/algorithms/tracking/adapters/CMakeLists.txt | 2 +- .../tracking/gnuradio_blocks/CMakeLists.txt | 3 ++- src/algorithms/tracking/libs/CMakeLists.txt | 1 + src/tests/CMakeLists.txt | 8 ++++---- src/tests/system-tests/libs/position_test_flags.h | 2 ++ src/tests/system-tests/position_test.cc | 3 +++ 12 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/algorithms/libs/gnss_sdr_flags.cc b/src/algorithms/libs/gnss_sdr_flags.cc index 4983f8776..ad8e0746a 100644 --- a/src/algorithms/libs/gnss_sdr_flags.cc +++ b/src/algorithms/libs/gnss_sdr_flags.cc @@ -71,6 +71,7 @@ DEFINE_double(dll_bw_hz, 0.0, "If defined, bandwidth of the DLL low pass filter, DEFINE_double(pll_bw_hz, 0.0, "If defined, bandwidth of the PLL low pass filter, in Hz (overrides the configuration file)."); +DEFINE_double(carrier_smoothing_factor, DEFAULT_CARRIER_SMOOTHING_FACTOR, "Sets carrier smoothing factor M"); #if GFLAGS_GREATER_2_0 diff --git a/src/algorithms/libs/gnss_sdr_flags.h b/src/algorithms/libs/gnss_sdr_flags.h index 3f4669414..4e3b76ddd 100644 --- a/src/algorithms/libs/gnss_sdr_flags.h +++ b/src/algorithms/libs/gnss_sdr_flags.h @@ -46,6 +46,10 @@ DECLARE_double(carrier_lock_th); //!< Carrier lock threshold (in rad). DECLARE_double(dll_bw_hz); //!< Bandwidth of the DLL low pass filter, in Hz (overrides the configuration file). DECLARE_double(pll_bw_hz); //!< Bandwidth of the PLL low pass filter, in Hz (overrides the configuration file). +// Declare flags for observables block +DECLARE_double(carrier_smoothing_factor); //!< Sets carrier smoothing factor M (overrides the configuration file). +const double DEFAULT_CARRIER_SMOOTHING_FACTOR = 200.0; + // Declare flags for PVT DECLARE_string(RINEX_version); //!< If defined, specifies the RINEX version (2.11 or 3.02). Overrides the configuration file. diff --git a/src/algorithms/observables/adapters/CMakeLists.txt b/src/algorithms/observables/adapters/CMakeLists.txt index 749fe7f80..b91c413fe 100644 --- a/src/algorithms/observables/adapters/CMakeLists.txt +++ b/src/algorithms/observables/adapters/CMakeLists.txt @@ -28,6 +28,7 @@ target_link_libraries(obs_adapters obs_gr_blocks algorithms_libs PRIVATE + gnss_sdr_flags observables_libs Gflags::gflags Glog::glog diff --git a/src/algorithms/observables/adapters/hybrid_observables.cc b/src/algorithms/observables/adapters/hybrid_observables.cc index 85a265a46..4ba708aa5 100644 --- a/src/algorithms/observables/adapters/hybrid_observables.cc +++ b/src/algorithms/observables/adapters/hybrid_observables.cc @@ -20,11 +20,13 @@ #include "hybrid_observables.h" #include "configuration_interface.h" +#include "gnss_sdr_flags.h" #include "obs_conf.h" #include +#include // for std::fabs +#include // for epsilon() #include // for operator<< - HybridObservables::HybridObservables(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { @@ -41,9 +43,13 @@ HybridObservables::HybridObservables(ConfigurationInterface* configuration, conf.dump_filename = dump_filename_; conf.nchannels_in = in_streams_; conf.nchannels_out = out_streams_; + conf.enable_carrier_smoothing = configuration->property(role + ".enable_carrier_smoothing", conf.enable_carrier_smoothing); + + if (std::fabs(FLAGS_carrier_smoothing_factor - DEFAULT_CARRIER_SMOOTHING_FACTOR) <= std::numeric_limits::epsilon()) // compare doubles + { + conf.smoothing_factor = configuration->property(role + ".smoothing_factor", conf.smoothing_factor); + } - conf.enable_carrier_smoothing = configuration->property(role + ".enable_carrier_smoothing", false); - conf.smoothing_factor = configuration->property(role + ".smoothing_factor", 200.0); if (conf.enable_carrier_smoothing == true) { LOG(INFO) << "Observables carrier smoothing enabled with smoothing factor " << conf.smoothing_factor; diff --git a/src/algorithms/observables/libs/CMakeLists.txt b/src/algorithms/observables/libs/CMakeLists.txt index 8966cbd0c..4f3b8ab50 100644 --- a/src/algorithms/observables/libs/CMakeLists.txt +++ b/src/algorithms/observables/libs/CMakeLists.txt @@ -18,6 +18,11 @@ add_library(observables_libs ${OBSERVABLES_LIB_HEADERS} ) +target_link_libraries(observables_libs + PRIVATE + gnss_sdr_flags +) + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(observables_libs diff --git a/src/algorithms/observables/libs/obs_conf.cc b/src/algorithms/observables/libs/obs_conf.cc index be42811df..c2a8ad0f6 100644 --- a/src/algorithms/observables/libs/obs_conf.cc +++ b/src/algorithms/observables/libs/obs_conf.cc @@ -19,11 +19,12 @@ */ #include "obs_conf.h" +#include "gnss_sdr_flags.h" Obs_Conf::Obs_Conf() { enable_carrier_smoothing = false; - smoothing_factor = 200; + smoothing_factor = FLAGS_carrier_smoothing_factor; nchannels_in = 0; nchannels_out = 0; dump = false; diff --git a/src/algorithms/tracking/adapters/CMakeLists.txt b/src/algorithms/tracking/adapters/CMakeLists.txt index 9912e385f..2f74163a7 100644 --- a/src/algorithms/tracking/adapters/CMakeLists.txt +++ b/src/algorithms/tracking/adapters/CMakeLists.txt @@ -86,9 +86,9 @@ target_link_libraries(tracking_adapters PUBLIC tracking_gr_blocks algorithms_libs - gnss_sdr_flags Gnuradio::runtime PRIVATE + gnss_sdr_flags Volkgnsssdr::volkgnsssdr ) diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index c5163669a..30902355b 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -82,9 +82,10 @@ target_link_libraries(tracking_gr_blocks Gnuradio::blocks Matio::matio Volkgnsssdr::volkgnsssdr - gnss_sdr_flags algorithms_libs tracking_libs + PRIVATE + gnss_sdr_flags ) if(ENABLE_CUDA AND NOT CMAKE_VERSION VERSION_GREATER 3.11) diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index cfb4b97e6..17ea7d9f6 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -84,6 +84,7 @@ target_link_libraries(tracking_libs algorithms_libs ${OPT_TRACKING_LIBRARIES} PRIVATE + gnss_sdr_flags Gflags::gflags Glog::glog ) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index c31904616..8c71cfaff 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -649,13 +649,13 @@ if(ENABLE_SYSTEM_TESTING) if(ENABLE_SYSTEM_TESTING_EXTRA) #### POSITION_TEST - set(OPT_LIBS_ Boost::thread - Threads::Threads Gflags::gflags Glog::glog + set(OPT_LIBS_ + algorithms_libs core_receiver core_system_parameters gnss_sdr_flags + system_testing_lib signal_processing_testing_lib + Boost::thread Threads::Threads Gflags::gflags Glog::glog GTest::GTest GTest::Main Gnuradio::runtime Gnuradio::blocks Gnuradio::filter Gnuradio::analog Matio::matio Volkgnsssdr::volkgnsssdr - algorithms_libs core_receiver core_system_parameters - system_testing_lib signal_processing_testing_lib ) add_system_test(position_test) if(NOT GNSSSIMULATOR_FOUND OR ENABLE_GNSS_SIM_INSTALL) diff --git a/src/tests/system-tests/libs/position_test_flags.h b/src/tests/system-tests/libs/position_test_flags.h index 646719c26..3a847f346 100644 --- a/src/tests/system-tests/libs/position_test_flags.h +++ b/src/tests/system-tests/libs/position_test_flags.h @@ -37,4 +37,6 @@ DEFINE_double(accuracy_CEP, 2.0, "Static scenario 2D (East, North) accuracy Circ DEFINE_double(precision_SEP, 10.0, "Static scenario 3D (East, North, Up) precision Spherical Error Position (SEP) threshold [meters]"); DEFINE_double(dynamic_3D_position_RMSE, 10.0, "Dynamic scenario 3D (ECEF) accuracy RMSE threshold [meters]"); DEFINE_double(dynamic_3D_velocity_RMSE, 5.0, "Dynamic scenario 3D (ECEF) velocity accuracy RMSE threshold [meters/second]"); +DEFINE_bool(enable_carrier_smoothing, false, "Activates carrier smoothing of pseudoranges"); + #endif diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 9ad8a1409..27b149823 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -28,6 +28,7 @@ #include "control_thread.h" #include "file_configuration.h" #include "geofunctions.h" +#include "gnss_sdr_flags.h" #include "gnuplot_i.h" #include "in_memory_configuration.h" #include "position_test_flags.h" @@ -302,6 +303,8 @@ int PositionSystemTest::configure_receiver() // Set Observables config->set_property("Observables.implementation", "Hybrid_Observables"); + config->set_property("Observables.enable_carrier_smoothing", FLAGS_enable_carrier_smoothing ? "true" : "false"); + config->set_property("Observables.smoothing_factor", std::to_string(FLAGS_carrier_smoothing_factor)); config->set_property("Observables.dump", "false"); config->set_property("Observables.dump_filename", "./observables.dat");