From e8fa2a0932ca7d8cee1362c9057986be30563ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Cebri=C3=A1n=20Juan?= Date: Mon, 18 Feb 2019 17:51:02 +0100 Subject: [PATCH 1/5] Rename the decimation factor parameter of the Monitor block configuration from output_rate_ms to decimation_factor --- src/core/monitor/gnss_synchro_monitor.cc | 14 +++++++------- src/core/monitor/gnss_synchro_monitor.h | 8 ++++---- src/core/receiver/gnss_flowgraph.cc | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc index f8997d6a3..49b609ce6 100644 --- a/src/core/monitor/gnss_synchro_monitor.cc +++ b/src/core/monitor/gnss_synchro_monitor.cc @@ -43,25 +43,25 @@ using google::LogMessage; gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels, - int output_rate_ms, + int decimation_factor, int udp_port, const std::vector& udp_addresses) { return gnss_synchro_monitor_sptr(new gnss_synchro_monitor(n_channels, - output_rate_ms, + decimation_factor, udp_port, udp_addresses)); } gnss_synchro_monitor::gnss_synchro_monitor(unsigned int n_channels, - int output_rate_ms, + int decimation_factor, int udp_port, const std::vector& udp_addresses) : gr::sync_block("gnss_synchro_monitor", - gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), - gr::io_signature::make(0, 0, 0)) + gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), + gr::io_signature::make(0, 0, 0)) { - d_output_rate_ms = output_rate_ms; + d_decimation_factor = decimation_factor; d_nchannels = n_channels; udp_sink_ptr = std::unique_ptr(new Gnss_Synchro_Udp_Sink(udp_addresses, udp_port)); @@ -80,7 +80,7 @@ int gnss_synchro_monitor::work(int noutput_items, gr_vector_const_void_star& inp for (int epoch = 0; epoch < noutput_items; epoch++) { count++; - if (count >= d_output_rate_ms) + if (count >= d_decimation_factor) { for (unsigned int i = 0; i < d_nchannels; i++) { diff --git a/src/core/monitor/gnss_synchro_monitor.h b/src/core/monitor/gnss_synchro_monitor.h index a0a8e470a..696e6a4e8 100644 --- a/src/core/monitor/gnss_synchro_monitor.h +++ b/src/core/monitor/gnss_synchro_monitor.h @@ -46,7 +46,7 @@ class gnss_synchro_monitor; using gnss_synchro_monitor_sptr = boost::shared_ptr; gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels, - int output_rate_ms, + int decimation_factor, int udp_port, const std::vector& udp_addresses); @@ -57,13 +57,13 @@ class gnss_synchro_monitor : public gr::sync_block { private: friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int nchannels, - int output_rate_ms, + int decimation_factor, int udp_port, const std::vector& udp_addresses); unsigned int d_nchannels; - int d_output_rate_ms; + int d_decimation_factor; std::unique_ptr udp_sink_ptr; @@ -72,7 +72,7 @@ private: public: gnss_synchro_monitor(unsigned int nchannels, - int output_rate_ms, + int decimation_factor, int udp_port, const std::vector& udp_addresses); diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 126dffbd1..d88508c7b 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -1538,7 +1538,7 @@ void GNSSFlowgraph::init() if (enable_monitor_) { GnssSynchroMonitor_ = gr::basic_block_sptr(new gnss_synchro_monitor(channels_count_, - configuration_->property("Monitor.output_rate_ms", 1), + configuration_->property("Monitor.decimation_factor", 1), configuration_->property("Monitor.udp_port", 1234), udp_addr_vec)); } From 82b7a244ebe56d3971b6b5d445aafb717e9dbdbe Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 18 Feb 2019 21:44:19 +0100 Subject: [PATCH 2/5] Small fixes --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 2 +- .../PVT/gnuradio_blocks/rtklib_pvt_cc.cc | 46 ++++++++++--------- .../PVT/gnuradio_blocks/rtklib_pvt_cc.h | 28 +++++------ src/core/receiver/control_thread.cc | 6 ++- 4 files changed, 44 insertions(+), 38 deletions(-) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index 33e6e5acc..fd6e667af 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -802,5 +802,5 @@ gr::basic_block_sptr RtklibPvt::get_left_block() gr::basic_block_sptr RtklibPvt::get_right_block() { - return pvt_; // this is a sink, nothing downstream + return nullptr; // this is a sink, nothing downstream } diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc index e618e7b5d..ed531f0f2 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc @@ -562,8 +562,6 @@ rtklib_pvt_cc::rtklib_pvt_cc(uint32_t nchannels, xml_base_path = xml_base_path + boost::filesystem::path::preferred_separator; } - d_pvt_solver = std::make_shared(static_cast(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat, rtk); - d_pvt_solver->set_averaging_depth(1); d_rx_time = 0.0; @@ -580,7 +578,10 @@ rtklib_pvt_cc::rtklib_pvt_cc(uint32_t nchannels, udp_sink_ptr = std::unique_ptr(new Monitor_Pvt_Udp_Sink(udp_addr_vec, conf_.udp_port)); } - + else + { + udp_sink_ptr = nullptr; + } // Create Sys V message queue first_fix = true; @@ -591,6 +592,9 @@ rtklib_pvt_cc::rtklib_pvt_cc(uint32_t nchannels, std::cout << "GNSS-SDR can not create message queues!" << std::endl; throw std::exception(); } + + d_pvt_solver = std::make_shared(static_cast(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat, rtk); + d_pvt_solver->set_averaging_depth(1); start = std::chrono::system_clock::now(); } @@ -1210,14 +1214,28 @@ bool rtklib_pvt_cc::load_gnss_synchro_map_xml(const std::string& file_name) } +std::vector rtklib_pvt_cc::split_string(const std::string& s, char delim) +{ + std::vector v; + std::stringstream ss(s); + std::string item; + + while (std::getline(ss, item, delim)) + { + *(std::back_inserter(v)++) = item; + } + + return v; +} + + bool rtklib_pvt_cc::get_latest_PVT(double* longitude_deg, double* latitude_deg, double* height_m, double* ground_speed_kmh, double* course_over_ground_deg, - time_t* UTC_time) + time_t* UTC_time) const { - gr::thread::scoped_lock lock(d_setlock); if (d_pvt_solver->is_valid_position()) { *latitude_deg = d_pvt_solver->get_latitude(); @@ -1225,7 +1243,7 @@ bool rtklib_pvt_cc::get_latest_PVT(double* longitude_deg, *height_m = d_pvt_solver->get_height(); *ground_speed_kmh = d_pvt_solver->get_speed_over_ground() * 3600.0 / 1000.0; *course_over_ground_deg = d_pvt_solver->get_course_over_ground(); - *UTC_time = to_time_t(d_pvt_solver->get_position_UTC_time()); + *UTC_time = convert_to_time_t(d_pvt_solver->get_position_UTC_time()); return true; } @@ -1237,8 +1255,6 @@ bool rtklib_pvt_cc::get_latest_PVT(double* longitude_deg, int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items __attribute__((unused))) { - gr::thread::scoped_lock l(d_setlock); - for (int32_t epoch = 0; epoch < noutput_items; epoch++) { bool flag_display_pvt = false; @@ -3284,17 +3300,3 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item return noutput_items; } - -std::vector rtklib_pvt_cc::split_string(const std::string& s, char delim) -{ - std::vector v; - std::stringstream ss(s); - std::string item; - - while (std::getline(ss, item, delim)) - { - *(std::back_inserter(v)++) = item; - } - - return v; -} diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h index f2174039e..72b038683 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h @@ -85,15 +85,15 @@ private: bool b_rtcm_writing_started; bool b_rtcm_enabled; - int32_t d_rtcm_MT1045_rate_ms; //!< Galileo Broadcast Ephemeris - int32_t d_rtcm_MT1019_rate_ms; //!< GPS Broadcast Ephemeris (orbits) - int32_t d_rtcm_MT1020_rate_ms; //!< GLONASS Broadcast Ephemeris (orbits) - int32_t d_rtcm_MT1077_rate_ms; //!< The type 7 Multiple Signal Message format for the USA’s GPS system, popular - int32_t d_rtcm_MT1087_rate_ms; //!< GLONASS MSM7. The type 7 Multiple Signal Message format for the Russian GLONASS system - int32_t d_rtcm_MT1097_rate_ms; //!< Galileo MSM7. The type 7 Multiple Signal Message format for Europe’s Galileo system + int32_t d_rtcm_MT1045_rate_ms; // Galileo Broadcast Ephemeris + int32_t d_rtcm_MT1019_rate_ms; // GPS Broadcast Ephemeris (orbits) + int32_t d_rtcm_MT1020_rate_ms; // GLONASS Broadcast Ephemeris (orbits) + int32_t d_rtcm_MT1077_rate_ms; // The type 7 Multiple Signal Message format for the USA’s GPS system, popular + int32_t d_rtcm_MT1087_rate_ms; // GLONASS MSM7. The type 7 Multiple Signal Message format for the Russian GLONASS system + int32_t d_rtcm_MT1097_rate_ms; // Galileo MSM7. The type 7 Multiple Signal Message format for Europe’s Galileo system int32_t d_rtcm_MSM_rate_ms; - int32_t d_last_status_print_seg; //for status printer + int32_t d_last_status_print_seg; // for status printer uint32_t d_nchannels; std::string d_dump_filename; @@ -132,14 +132,14 @@ private: bool send_sys_v_ttff_msg(ttff_msgbuf ttff); std::chrono::time_point start, end; - bool save_gnss_synchro_map_xml(const std::string& file_name); //debug helper function + bool save_gnss_synchro_map_xml(const std::string& file_name); // debug helper function - bool load_gnss_synchro_map_xml(const std::string& file_name); //debug helper function + bool load_gnss_synchro_map_xml(const std::string& file_name); // debug helper function bool d_xml_storage; std::string xml_base_path; - inline std::time_t to_time_t(boost::posix_time::ptime pt) + inline std::time_t convert_to_time_t(const boost::posix_time::ptime pt) const { return (pt - boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1))).total_seconds(); } @@ -153,8 +153,10 @@ public: const Pvt_Conf& conf_, const rtk_t& rtk); + ~rtklib_pvt_cc(); //!< Default destructor + /*! - * \brief Get latest set of ephemeris from PVT block + * \brief Get latest set of GPS ephemeris from PVT block * */ std::map get_gps_ephemeris_map() const; @@ -183,9 +185,7 @@ public: double* height_m, double* ground_speed_kmh, double* course_over_ground_deg, - time_t* UTC_time); - - ~rtklib_pvt_cc(); //!< Default destructor + time_t* UTC_time) const; int work(int noutput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items); //!< PVT Signal Processing diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 0b9115d94..5ebb96ad0 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -293,7 +293,11 @@ int ControlThread::run() } catch (const boost::thread_interrupted &interrupt) { - DLOG(INFO) << "Thread interrupted"; + DLOG(WARNING) << "Thread interrupted"; + } + catch (const boost::system::system_error &e) + { + LOG(WARNING) << "System error"; } if (restart_) From 1decfcc4882b30dfcb5e4fcc0231f0ed1618afed Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 18 Feb 2019 21:45:12 +0100 Subject: [PATCH 3/5] Remove unused checks --- CMakeLists.txt | 15 --------------- src/tests/CMakeLists.txt | 8 +------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a24614ea5..7476d5f2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -469,15 +469,6 @@ endif() -################################################################################ -# Check for availability of SSE -################################################################################ -if(NOT ENABLE_GENERIC_ARCH) - include(TestForSSE) -endif() - - - ################################################################################ # Find the POSIX thread (pthread) libraries ################################################################################ @@ -1866,12 +1857,6 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -Wall -Wextra") #Add warning flags: For "-Wall" see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html endif() -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - if(OS_IS_MACOSX) - set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -stdlib=libc++") - endif() -endif() - # Processor-architecture related flags # See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html if(NOT ARCH_COMPILER_FLAGS) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 197a3b162..f3da0060f 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -58,6 +58,7 @@ if(NOT ${GTEST_DIR_LOCAL}) if(OS_IS_MACOSX) if(CMAKE_GENERATOR STREQUAL Xcode) set(DEBUG_PREFIX "Debug/") + set(DEBUG_POSTFIX "d") endif() endif() @@ -167,12 +168,6 @@ if(OPENSSL_FOUND) add_definitions(-DUSE_OPENSSL_FALLBACK=1) endif() -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - if(OS_IS_MACOSX) - set(CLANG_FLAGS "-stdlib=libc++ -lc++") - endif() -endif() - if(OPENCL_FOUND) add_definitions(-DOPENCL_BLOCKS_TEST=1) endif() @@ -350,7 +345,6 @@ if(ENABLE_UNIT_TESTING) target_link_libraries(run_tests PUBLIC - ${CLANG_FLAGS} Boost::chrono Boost::filesystem Boost::system From 4784a58af044a189ea4ea87fbda3af8e8de82c43 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 18 Feb 2019 22:20:32 +0100 Subject: [PATCH 4/5] Remove unused definitions --- src/algorithms/PVT/libs/pvt_solution.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/algorithms/PVT/libs/pvt_solution.h b/src/algorithms/PVT/libs/pvt_solution.h index 116cd771e..7afd074d2 100644 --- a/src/algorithms/PVT/libs/pvt_solution.h +++ b/src/algorithms/PVT/libs/pvt_solution.h @@ -37,8 +37,6 @@ #include #include -const unsigned int PVT_MAX_CHANNELS = 90; -const unsigned int PVT_MAX_PRN = 127; // 126 is SBAS /*! * \brief Base class for a PVT solution From b5e52776629d8913670dbebb807bdc3f1cf93d2a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 18 Feb 2019 22:29:50 +0100 Subject: [PATCH 5/5] Fix random crashes when program ended in macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The program randomly crashed when destroying the pvt block (EXC_BAD_ACCESS). This didn’t happen on Linux. Beidou PVT fixes not available in macOS until finding the root cause. --- src/algorithms/libs/rtklib/rtklib.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/algorithms/libs/rtklib/rtklib.h b/src/algorithms/libs/rtklib/rtklib.h index 2cf0f1a63..e6eb11faa 100644 --- a/src/algorithms/libs/rtklib/rtklib.h +++ b/src/algorithms/libs/rtklib/rtklib.h @@ -221,7 +221,9 @@ const int NSATQZS = 0; const int NSYSQZS = 0; #endif +#ifndef __APPLE__ #define ENABDS +#endif #ifdef ENABDS const int MINPRNBDS = 1; //!< min satellite sat number of BeiDou const int MAXPRNBDS = 37; //!< max satellite sat number of BeiDou