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 ee4bb40c7..d7fa8e706 100644 --- a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc @@ -48,6 +48,7 @@ using google::LogMessage; extern concurrent_map global_galileo_ephemeris_map; extern concurrent_map global_galileo_iono_map; extern concurrent_map global_galileo_utc_model_map; +extern concurrent_map global_galileo_almanac_map; galileo_e1_pvt_cc_sptr galileo_e1_make_pvt_cc(unsigned int nchannels, boost::shared_ptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname) @@ -163,6 +164,11 @@ int galileo_e1_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_it global_galileo_iono_map.read(0, d_ls_pvt->galileo_iono); } + if (global_galileo_almanac_map.size() > 0) + { + // Almanac data is shared for all the Galileo satellites. Read always at ID=0 + global_galileo_almanac_map.read(0, d_ls_pvt->galileo_almanac); + } // ############ 2 COMPUTE THE PVT ################################ if (gnss_pseudoranges_map.size() > 0 and d_ls_pvt->galileo_ephemeris_map.size() > 0) { diff --git a/src/algorithms/PVT/libs/galileo_e1_ls_pvt.h b/src/algorithms/PVT/libs/galileo_e1_ls_pvt.h index 277e3b3cb..a185c4ab1 100644 --- a/src/algorithms/PVT/libs/galileo_e1_ls_pvt.h +++ b/src/algorithms/PVT/libs/galileo_e1_ls_pvt.h @@ -77,6 +77,7 @@ public: std::map galileo_ephemeris_map; //!< Map storing new Galileo_Ephemeris Galileo_Utc_Model galileo_utc_model; Galileo_Iono galileo_iono; + Galileo_Almanac galileo_almanac; double d_galileo_current_time; boost::posix_time::ptime d_position_UTC_time; diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 88674d052..29c3814b5 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -162,6 +162,7 @@ void ControlThread::run() galileo_ephemeris_data_collector_thread_ = boost::thread(&ControlThread::galileo_ephemeris_data_collector, this); galileo_iono_data_collector_thread_ = boost::thread(&ControlThread::galileo_iono_data_collector, this); + galileo_almanac_data_collector_thread_ = boost::thread(&ControlThread::galileo_almanac_data_collector, this); galileo_utc_model_data_collector_thread_ = boost::thread(&ControlThread::galileo_utc_model_data_collector, this); // Main loop to read and process the control messages while (flowgraph_->running() && !stop_) @@ -729,6 +730,20 @@ void ControlThread::gps_iono_data_collector() } +void ControlThread::galileo_almanac_data_collector() +{ + // ############ 1.bis READ ALMANAC QUEUE #################### + Galileo_Almanac galileo_almanac; + while(stop_ == false) + { + global_galileo_almanac_queue.wait_and_pop(galileo_almanac); + + LOG(INFO) << "New galileo_almanac record has arrived "; + // there is no timestamp for the galileo_almanac data, new entries must always be added + global_galileo_almanac_map.write(0, galileo_almanac); + } +} + void ControlThread::galileo_iono_data_collector() { Galileo_Iono galileo_iono; diff --git a/src/core/receiver/control_thread.h b/src/core/receiver/control_thread.h index df8c25ac2..c83032c8f 100644 --- a/src/core/receiver/control_thread.h +++ b/src/core/receiver/control_thread.h @@ -178,6 +178,11 @@ private: */ void galileo_iono_data_collector(); + /* + * Blocking function that reads the galileo_almanac queue and updates the shared map, accessible from the PVT block + */ + void galileo_almanac_data_collector(); + void apply_action(unsigned int what); std::shared_ptr flowgraph_; std::shared_ptr configuration_; @@ -200,6 +205,7 @@ private: boost::thread galileo_ephemeris_data_collector_thread_; boost::thread galileo_utc_model_data_collector_thread_; boost::thread galileo_iono_data_collector_thread_; + boost::thread galileo_almanac_data_collector_thread_; void keyboard_listener(); // default filename for assistance data