diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 9ba86b425..5049154a4 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -126,9 +126,12 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, { // Send feedback message to observables block with the receiver clock offset this->message_port_register_out(pmt::mp("pvt_to_observables")); + // Send PVT status to gnss_flowgraph + this->message_port_register_out(pmt::mp("status")); d_output_rate_ms = conf_.output_rate_ms; d_display_rate_ms = conf_.display_rate_ms; + d_report_rate_ms = 1000; //report every second PVT to gnss_synchro d_dump = conf_.dump; d_dump_mat = conf_.dump_mat and d_dump; d_dump_filename = conf_.dump_filename; @@ -3729,10 +3732,19 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item } // PVT MONITOR - if (d_pvt_solver->is_valid_position() and flag_monitor_pvt_enabled) + if (d_pvt_solver->is_valid_position()) { - Monitor_Pvt monitor_pvt = d_pvt_solver->get_monitor_pvt(); - udp_sink_ptr->write_monitor_pvt(monitor_pvt); + std::shared_ptr monitor_pvt = std::make_shared(d_pvt_solver->get_monitor_pvt()); + + //publish new position to the gnss_flowgraph channel status monitor + if (current_RX_time_ms % d_report_rate_ms == 0) + { + this->message_port_pub(pmt::mp("status"), pmt::make_any(monitor_pvt)); + } + if (flag_monitor_pvt_enabled) + { + udp_sink_ptr->write_monitor_pvt(monitor_pvt); + } } } } diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h index 595cd2624..b046735d8 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h @@ -169,6 +169,7 @@ private: int32_t d_output_rate_ms; int32_t d_display_rate_ms; + int32_t d_report_rate_ms; std::shared_ptr rp; std::shared_ptr d_kml_dump; diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc index 2796f13da..ed23fbb5d 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc @@ -51,14 +51,14 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector& addre } -bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt& monitor_pvt) +bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(std::shared_ptr monitor_pvt) { std::string outbound_data; if (use_protobuf == false) { std::ostringstream archive_stream; boost::archive::binary_oarchive oa{archive_stream}; - oa << monitor_pvt; + oa << *monitor_pvt.get(); outbound_data = archive_stream.str(); } else diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h index f1f9146f4..588e70257 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h @@ -45,8 +45,8 @@ using b_io_context = boost::asio::io_service; class Monitor_Pvt_Udp_Sink { public: - Monitor_Pvt_Udp_Sink(const std::vector& addresses, const uint16_t &port, bool protobuf_enabled); - bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt); + Monitor_Pvt_Udp_Sink(const std::vector& addresses, const uint16_t& port, bool protobuf_enabled); + bool write_monitor_pvt(std::shared_ptr monitor_pvt); private: b_io_context io_context; diff --git a/src/algorithms/PVT/libs/serdes_monitor_pvt.h b/src/algorithms/PVT/libs/serdes_monitor_pvt.h index 1b5ca11ca..1477442df 100644 --- a/src/algorithms/PVT/libs/serdes_monitor_pvt.h +++ b/src/algorithms/PVT/libs/serdes_monitor_pvt.h @@ -34,7 +34,7 @@ #include "monitor_pvt.h" #include "monitor_pvt.pb.h" // file created by Protocol Buffers at compile time - +#include /*! * \brief This class implements serialization and deserialization of @@ -80,40 +80,40 @@ public: return *this; } - inline std::string createProtobuffer(const Monitor_Pvt& monitor) //!< Serialization into a string + inline std::string createProtobuffer(std::shared_ptr monitor) //!< Serialization into a string { monitor_.Clear(); std::string data; - monitor_.set_tow_at_current_symbol_ms(monitor.TOW_at_current_symbol_ms); - monitor_.set_week(monitor.week); - monitor_.set_rx_time(monitor.RX_time); - monitor_.set_user_clk_offset(monitor.user_clk_offset); - monitor_.set_pos_x(monitor.pos_x); - monitor_.set_pos_y(monitor.pos_y); - monitor_.set_pos_z(monitor.pos_z); - monitor_.set_vel_x(monitor.vel_x); - monitor_.set_vel_y(monitor.vel_y); - monitor_.set_vel_z(monitor.vel_z); - monitor_.set_cov_xx(monitor.cov_xx); - monitor_.set_cov_yy(monitor.cov_yy); - monitor_.set_cov_zz(monitor.cov_zz); - monitor_.set_cov_xy(monitor.cov_xy); - monitor_.set_cov_yz(monitor.cov_yz); - monitor_.set_cov_zx(monitor.cov_zx); - monitor_.set_latitude(monitor.latitude); - monitor_.set_longitude(monitor.longitude); - monitor_.set_height(monitor.height); - monitor_.set_valid_sats(monitor.valid_sats); - monitor_.set_solution_status(monitor.solution_status); - monitor_.set_solution_type(monitor.solution_type); - monitor_.set_ar_ratio_factor(monitor.AR_ratio_factor); - monitor_.set_ar_ratio_threshold(monitor.AR_ratio_threshold); - monitor_.set_gdop(monitor.gdop); - monitor_.set_pdop(monitor.pdop); - monitor_.set_hdop(monitor.hdop); - monitor_.set_vdop(monitor.vdop); + monitor_.set_tow_at_current_symbol_ms(monitor->TOW_at_current_symbol_ms); + monitor_.set_week(monitor->week); + monitor_.set_rx_time(monitor->RX_time); + monitor_.set_user_clk_offset(monitor->user_clk_offset); + monitor_.set_pos_x(monitor->pos_x); + monitor_.set_pos_y(monitor->pos_y); + monitor_.set_pos_z(monitor->pos_z); + monitor_.set_vel_x(monitor->vel_x); + monitor_.set_vel_y(monitor->vel_y); + monitor_.set_vel_z(monitor->vel_z); + monitor_.set_cov_xx(monitor->cov_xx); + monitor_.set_cov_yy(monitor->cov_yy); + monitor_.set_cov_zz(monitor->cov_zz); + monitor_.set_cov_xy(monitor->cov_xy); + monitor_.set_cov_yz(monitor->cov_yz); + monitor_.set_cov_zx(monitor->cov_zx); + monitor_.set_latitude(monitor->latitude); + monitor_.set_longitude(monitor->longitude); + monitor_.set_height(monitor->height); + monitor_.set_valid_sats(monitor->valid_sats); + monitor_.set_solution_status(monitor->solution_status); + monitor_.set_solution_type(monitor->solution_type); + monitor_.set_ar_ratio_factor(monitor->AR_ratio_factor); + monitor_.set_ar_ratio_threshold(monitor->AR_ratio_threshold); + monitor_.set_gdop(monitor->gdop); + monitor_.set_pdop(monitor->pdop); + monitor_.set_hdop(monitor->hdop); + monitor_.set_vdop(monitor->vdop); monitor_.SerializeToString(&data); return data; diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc index 91e4760f8..5ce1cc9dc 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc @@ -104,6 +104,9 @@ hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in, this->message_port_register_in(pmt::mp("pvt_to_observables")); this->set_msg_handler(pmt::mp("pvt_to_observables"), boost::bind(&hybrid_observables_gs::msg_handler_pvt_to_observables, this, _1)); + // Send Channel status to gnss_flowgraph + this->message_port_register_out(pmt::mp("status")); + d_dump = dump; d_dump_mat = dump_mat and d_dump; d_dump_filename = std::move(dump_filename); @@ -160,7 +163,7 @@ hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in, T_rx_remnant_to_20ms = 0; T_rx_step_ms = 20; //read from config at the adapter GNSS-SDR.observable_interval_ms!! T_rx_TOW_set = false; - + T_status_report_timer_ms = 0; // rework d_Rx_clock_buffer.set_capacity(10); // 10*20 ms = 200 ms of data in buffer d_Rx_clock_buffer.clear(); // Clear all the elements in the buffer @@ -601,6 +604,20 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused) { out[n][0] = epoch_data.at(n); } + + //report channel status every second + T_status_report_timer_ms += T_rx_step_ms; + if (T_status_report_timer_ms >= 1000) + { + for (uint32_t n = 0; n < d_nchannels_out; n++) + { + std::shared_ptr gnss_synchro_sptr = std::make_shared(epoch_data.at(n)); + //publish valid gnss_synchro to the gnss_flowgraph channel status monitor + this->message_port_pub(pmt::mp("status"), pmt::make_any(gnss_synchro_sptr)); + } + T_status_report_timer_ms = 0; + } + if (d_dump) { // MULTIPLEXED FILE RECORDING - Record results to file diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.h b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.h index f21510254..0c6150b54 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.h +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.h @@ -89,6 +89,7 @@ private: uint32_t T_rx_TOW_ms; uint32_t T_rx_remnant_to_20ms; uint32_t T_rx_step_ms; + uint32_t T_status_report_timer_ms; uint32_t d_nchannels_in; uint32_t d_nchannels_out; double T_rx_offset_ms; diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index a61dd6e2b..12485d937 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -24,6 +24,7 @@ set(CORE_LIBS_SOURCES string_converter.cc gnss_sdr_supl_client.cc gnss_sdr_sample_counter.cc + channel_status_msg_receiver.cc ) set(CORE_LIBS_HEADERS @@ -32,6 +33,7 @@ set(CORE_LIBS_HEADERS string_converter.h gnss_sdr_supl_client.h gnss_sdr_sample_counter.h + channel_status_msg_receiver.h ) if(ENABLE_FPGA) @@ -60,6 +62,7 @@ target_link_libraries(core_libs Gnuradio::runtime core_libs_supl core_system_parameters + pvt_libs PRIVATE Boost::serialization Gflags::gflags diff --git a/src/core/libs/channel_status_msg_receiver.cc b/src/core/libs/channel_status_msg_receiver.cc new file mode 100644 index 000000000..965a99a46 --- /dev/null +++ b/src/core/libs/channel_status_msg_receiver.cc @@ -0,0 +1,116 @@ +/*! + * \file channel_status_msg_receiver.cc + * \brief GNU Radio block that receives asynchronous channel messages from acquisition and tracking blocks + * \author Javier Arribas, 2016. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + + +#include "channel_status_msg_receiver.h" +#include +#include +#include +#include +#include +#include +#include + + +channel_status_msg_receiver_sptr channel_status_msg_receiver_make() +{ + return channel_status_msg_receiver_sptr(new channel_status_msg_receiver()); +} + + +channel_status_msg_receiver::channel_status_msg_receiver() : gr::block("channel_status_msg_receiver", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) +{ + this->message_port_register_in(pmt::mp("status")); + this->set_msg_handler(pmt::mp("status"), boost::bind(&channel_status_msg_receiver::msg_handler_events, this, _1)); + d_pvt_status.RX_time = -1; // to indicate that the PVT is not available +} + + +channel_status_msg_receiver::~channel_status_msg_receiver() = default; + + +void channel_status_msg_receiver::msg_handler_events(pmt::pmt_t msg) +{ + gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_events function called by the scheduler + try + { + // ************* Gnss_Synchro received ***************** + if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) + { + std::shared_ptr gnss_synchro_obj; + gnss_synchro_obj = boost::any_cast>(pmt::any_ref(msg)); + if (gnss_synchro_obj->Flag_valid_pseudorange == true) + { + d_channel_status_map[gnss_synchro_obj->Channel_ID] = gnss_synchro_obj; + } + else + { + d_channel_status_map.erase(gnss_synchro_obj->Channel_ID); + } + + // std::cout << "-------- \n\n"; + // for (std::map>::iterator it = d_channel_status_map.begin(); it != d_channel_status_map.end(); ++it) + // { + // std::cout << " Channel: " << it->first << " => Doppler: " << it->second->Carrier_Doppler_hz << "[Hz] \n"; + // } + // std::cout << "-------- \n\n"; + } + else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) + { + // ************* Monitor_Pvt received ***************** + std::shared_ptr monitor_pvt_obj; + monitor_pvt_obj = boost::any_cast>(pmt::any_ref(msg)); + d_pvt_status = *monitor_pvt_obj.get(); + // + // std::cout << "-------- \n\n"; + // std::cout << "PVT TOW: " << d_pvt_status->TOW_at_current_symbol_ms << std::endl; + // std::cout << "-------- \n\n"; + } + else + { + LOG(WARNING) << "channel_status_msg_receiver unknown object type!"; + } + } + catch (boost::bad_any_cast& e) + { + LOG(WARNING) << "channel_status_msg_receiver Bad any cast!"; + } +} + +std::map> channel_status_msg_receiver::get_current_status_map() +{ + gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_events function called by the scheduler + return d_channel_status_map; +} +Monitor_Pvt channel_status_msg_receiver::get_current_status_pvt() +{ + gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_events function called by the scheduler + return d_pvt_status; +} diff --git a/src/core/libs/channel_status_msg_receiver.h b/src/core/libs/channel_status_msg_receiver.h new file mode 100644 index 000000000..283fc6f0e --- /dev/null +++ b/src/core/libs/channel_status_msg_receiver.h @@ -0,0 +1,71 @@ +/*! + * \file channel_msg_receiver_cc.h + * \brief GNU Radio block that receives asynchronous channel messages from acquisition and tracking blocks + * \author Javier Arribas, 2016. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_CHANNEL_STATUS_MSG_RECEIVER_CC_H +#define GNSS_SDR_CHANNEL_STATUS_MSG_RECEIVER_CC_H + +#include "gnss_synchro.h" +#include "monitor_pvt.h" +#include +#include +#include + +class channel_status_msg_receiver; + +using channel_status_msg_receiver_sptr = boost::shared_ptr; + +channel_status_msg_receiver_sptr channel_status_msg_receiver_make(); + +/*! + * \brief GNU Radio block that receives asynchronous channel messages from tlm blocks + */ +class channel_status_msg_receiver : public gr::block +{ +public: + ~channel_status_msg_receiver(); //!< Default destructor + /*! + * \brief return the current status map of all channels with valid telemetry + */ + std::map> get_current_status_map(); + /*! + * \brief return the current receiver PVT + */ + Monitor_Pvt get_current_status_pvt(); + +private: + friend channel_status_msg_receiver_sptr channel_status_msg_receiver_make(); + channel_status_msg_receiver(); + std::map> d_channel_status_map; + + Monitor_Pvt d_pvt_status; + void msg_handler_events(pmt::pmt_t msg); +}; + +#endif diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 4d11c4193..5efa45f2b 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -598,7 +598,11 @@ void GNSSFlowgraph::connect() } if (sat == 0) { - channels_.at(i)->set_signal(search_next_signal(gnss_signal, false)); + bool assistance_available; + float estimated_doppler; + double RX_time; + bool is_primary_freq; + channels_.at(i)->set_signal(search_next_signal(gnss_signal, false, is_primary_freq, assistance_available, estimated_doppler, RX_time)); } else { @@ -680,7 +684,11 @@ void GNSSFlowgraph::connect() top_block_->connect(observables_->get_right_block(), i, pvt_->get_left_block(), i); top_block_->msg_connect(channels_.at(i)->get_right_block(), pmt::mp("telemetry"), pvt_->get_left_block(), pmt::mp("telemetry")); } + + top_block_->msg_connect(observables_->get_right_block(), pmt::mp("status"), channels_status_, pmt::mp("status")); + top_block_->msg_connect(pvt_->get_left_block(), pmt::mp("pvt_to_observables"), observables_->get_right_block(), pmt::mp("pvt_to_observables")); + top_block_->msg_connect(pvt_->get_left_block(), pmt::mp("status"), channels_status_, pmt::mp("status")); } catch (const std::exception& e) { @@ -1065,7 +1073,7 @@ bool GNSSFlowgraph::send_telemetry_msg(const pmt::pmt_t& msg) * \param[in] what What is the action: * --- actions from channels --- * -> 0 acquisition failed - * -> 1 acquisition successful + * -> 1 acquisition succesfull * -> 2 tracking lost * --- actions from TC receiver control --- * -> 10 TC request standby mode @@ -1078,6 +1086,8 @@ bool GNSSFlowgraph::send_telemetry_msg(const pmt::pmt_t& msg) */ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) { + //todo: the acquisition events are initiated from the acquisition success or failure queued msg. If the acquisition is disabled for non-assisted secondary freq channels, the engine stops.. + std::lock_guard lock(signal_list_mutex); DLOG(INFO) << "Received " << what << " from " << who << ". Number of applied actions = " << applied_actions_; unsigned int sat = 0; @@ -1167,20 +1177,34 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) } if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[ch_index] == 0)) { - channels_state_[ch_index] = 1; + bool is_primary_freq = true; + bool assistance_available = false; if (sat_ == 0) { - channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true)); + float estimated_doppler; + double RX_time; + Gnss_Signal gnss_signal; + gnss_signal = search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), false, is_primary_freq, assistance_available, estimated_doppler, RX_time); + channels_[ch_index]->set_signal(gnss_signal); } - acq_channels_count_++; - DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); + //todo: add configuration parameter to enable the mandatory acquisition assistance in secondary freq + if (is_primary_freq == true or assistance_available == true) + { + channels_state_[ch_index] = 1; + acq_channels_count_++; + DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); #ifndef ENABLE_FPGA - channels_[ch_index]->start_acquisition(); + channels_[ch_index]->start_acquisition(); #else - // create a task for the FPGA such that it doesn't stop the flow - std::thread tmp_thread(&ChannelInterface::start_acquisition, channels_[ch_index]); - tmp_thread.detach(); + // create a task for the FPGA such that it doesn't stop the flow + std::thread tmp_thread(&ChannelInterface::start_acquisition, channels_[ch_index]); + tmp_thread.detach(); #endif + } + else + { + DLOG(INFO) << "Channel " << ch_index << " secondary frequency acquisition assistance not available in " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); + } } DLOG(INFO) << "Channel " << ch_index << " in state " << channels_state_[ch_index]; } @@ -1248,20 +1272,34 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) } if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0)) { - channels_state_[i] = 1; + bool is_primary_freq = true; + bool assistance_available = false; if (sat_ == 0) { - channels_[i]->set_signal(search_next_signal(channels_[i]->get_signal().get_signal_str(), true, true)); + float estimated_doppler; + double RX_time; + Gnss_Signal gnss_signal; + gnss_signal = search_next_signal(channels_[i]->get_signal().get_signal_str(), true, is_primary_freq, assistance_available, estimated_doppler, RX_time); } - acq_channels_count_++; - DLOG(INFO) << "Channel " << i << " Starting acquisition " << channels_[i]->get_signal().get_satellite() << ", Signal " << channels_[i]->get_signal().get_signal_str(); + + //todo: add configuration parameter to enable the mandatory acquisition assistance in secondary freq + if (is_primary_freq == true or assistance_available == true) + { + channels_state_[i] = 1; + acq_channels_count_++; + DLOG(INFO) << "Channel " << i << " Starting acquisition " << channels_[i]->get_signal().get_satellite() << ", Signal " << channels_[i]->get_signal().get_signal_str(); #ifndef ENABLE_FPGA - channels_[i]->start_acquisition(); + channels_[i]->start_acquisition(); #else - // create a task for the FPGA such that it doesn't stop the flow - std::thread tmp_thread(&ChannelInterface::start_acquisition, channels_[i]); - tmp_thread.detach(); + // create a task for the FPGA such that it doesn't stop the flow + std::thread tmp_thread(&ChannelInterface::start_acquisition, channels_[i]); + tmp_thread.detach(); #endif + } + else + { + DLOG(INFO) << "Channel " << i << " secondary frequency acquisition assistance not available in " << channels_[i]->get_signal().get_satellite() << ", Signal " << channels_[i]->get_signal().get_signal_str(); + } } DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i]; } @@ -1420,7 +1458,11 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) channels_state_[ch_index] = 1; if (sat_ == 0) { - channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true)); + bool is_primary_freq; + bool assistance_available; + float estimated_doppler; + double RX_time; + channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true, is_primary_freq, assistance_available, estimated_doppler, RX_time)); } acq_channels_count_++; DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); @@ -1454,7 +1496,11 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) channels_state_[ch_index] = 1; if (sat_ == 0) { - channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true)); + bool is_primary_freq; + bool assistance_available; + float estimated_doppler; + double RX_time; + channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true, is_primary_freq, assistance_available, estimated_doppler, RX_time)); } acq_channels_count_++; DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); @@ -1489,7 +1535,11 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) channels_state_[ch_index] = 1; if (sat_ == 0) { - channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true)); + bool is_primary_freq; + bool assistance_available; + float estimated_doppler; + double RX_time; + channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true, is_primary_freq, assistance_available, estimated_doppler, RX_time)); } acq_channels_count_++; DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); @@ -1610,6 +1660,8 @@ void GNSSFlowgraph::init() */ std::unique_ptr block_factory_(new GNSSBlockFactory()); + channels_status_ = channel_status_msg_receiver_make(); + // 1. read the number of RF front-ends available (one file_source per RF front-end) sources_count_ = configuration_->property("Receiver.sources_count", 1); @@ -2010,110 +2062,116 @@ void GNSSFlowgraph::set_channels_state() } -Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal, bool pop, bool tracked) +Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal, + const bool pop, + bool& is_primary_frequency, + bool& assistance_available, + float& estimated_doppler, + double& RX_time) { + is_primary_frequency = false; Gnss_Signal result; - bool untracked_satellite = true; switch (mapStringValues_[searched_signal]) { case evGPS_1C: + //todo: assist the satellite selection with almanac and current PVT here (rehuse priorize_satellite function used in control_thread) result = available_GPS_1C_signals_.front(); available_GPS_1C_signals_.pop_front(); if (!pop) { available_GPS_1C_signals_.push_back(result); } - if (tracked) - { - if ((configuration_->property("Channels_2S.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0)) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "1C")) - { - untracked_satellite = false; - } - } - if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); - available_GPS_2S_signals_.remove(gs); - available_GPS_2S_signals_.push_front(gs); - } - if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); - available_GPS_L5_signals_.remove(gs); - available_GPS_L5_signals_.push_front(gs); - } - } - } + is_primary_frequency = true; //indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..) break; case evGPS_2S: - result = available_GPS_2S_signals_.front(); - available_GPS_2S_signals_.pop_front(); - if (!pop) + if (configuration_->property("Channels_1C.count", 0) > 0) { - available_GPS_2S_signals_.push_back(result); - } - if (tracked) - { - if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0)) + //1. Get the current channel status map + std::map> current_channels_status = channels_status_->get_current_status_map(); + //2. search the currently tracked GPS L1 satellites and assist the GPS L2 acquisition if the satellite is not tracked on L2 + for (std::map>::iterator it = current_channels_status.begin(); it != current_channels_status.end(); ++it) { - for (unsigned int ch = 0; ch < channels_count_; ch++) + if (std::string(it->second->Signal) == "1C") { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2S")) + std::list::iterator it2; + it2 = std::find_if(std::begin(available_GPS_2S_signals_), std::end(available_GPS_2S_signals_), + [&](Gnss_Signal const& sig) { return sig.get_satellite().get_PRN() == it->second->PRN; }); + + if (it2 != available_GPS_2S_signals_.end()) { - untracked_satellite = false; + std::cout << " Channel: " << it->first << " => Doppler: " << it->second->Carrier_Doppler_hz << "[Hz] \n"; + //3. return the GPS L2 satellite and remove it from list + result = *it2; + if (pop) + { + available_GPS_2S_signals_.erase(it2); + } + break; } } - if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); - available_GPS_1C_signals_.remove(gs); - available_GPS_1C_signals_.push_front(gs); - } - if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); - available_GPS_L5_signals_.remove(gs); - available_GPS_L5_signals_.push_front(gs); - } + } + //fallback: pick the front satellite because there is no tracked satellites in L1 to assist L2 + result = available_GPS_2S_signals_.front(); + available_GPS_2S_signals_.pop_front(); + if (!pop) + { + available_GPS_2S_signals_.push_back(result); + } + } + else + { + result = available_GPS_2S_signals_.front(); + available_GPS_2S_signals_.pop_front(); + if (!pop) + { + available_GPS_2S_signals_.push_back(result); } } break; case evGPS_L5: - result = available_GPS_L5_signals_.front(); - available_GPS_L5_signals_.pop_front(); - if (!pop) + if (configuration_->property("Channels_1C.count", 0) > 0) { - available_GPS_L5_signals_.push_back(result); - } - if (tracked) - { - if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_2S.count", 0) > 0)) + //1. Get the current channel status map + std::map> current_channels_status = channels_status_->get_current_status_map(); + //2. search the currently tracked GPS L1 satellites and assist the GPS L5 acquisition if the satellite is not tracked on L5 + for (std::map>::iterator it = current_channels_status.begin(); it != current_channels_status.end(); ++it) { - for (unsigned int ch = 0; ch < channels_count_; ch++) + if (std::string(it->second->Signal) == "1C") { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "L5")) + std::list::iterator it2; + it2 = std::find_if(std::begin(available_GPS_L5_signals_), std::end(available_GPS_L5_signals_), + [&](Gnss_Signal const& sig) { return sig.get_satellite().get_PRN() == it->second->PRN; }); + + if (it2 != available_GPS_L5_signals_.end()) { - untracked_satellite = false; + std::cout << " Channel: " << it->first << " => Doppler: " << it->second->Carrier_Doppler_hz << "[Hz] \n"; + //3. return the GPS L5 satellite and remove it from list + result = *it2; + if (pop) + { + available_GPS_L5_signals_.erase(it2); + } + break; } } - if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); - available_GPS_1C_signals_.remove(gs); - available_GPS_1C_signals_.push_front(gs); - } - if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); - available_GPS_2S_signals_.remove(gs); - available_GPS_2S_signals_.push_front(gs); - } + } + //fallback: pick the front satellite because there is no tracked satellites in L1 to assist L5 + result = available_GPS_L5_signals_.front(); + available_GPS_L5_signals_.pop_front(); + if (!pop) + { + available_GPS_L5_signals_.push_back(result); + } + } + else + { + result = available_GPS_L5_signals_.front(); + available_GPS_L5_signals_.pop_front(); + if (!pop) + { + available_GPS_L5_signals_.push_back(result); } } break; @@ -2125,25 +2183,7 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal { available_GAL_1B_signals_.push_back(result); } - if (tracked) - { - if (configuration_->property("Channels_5X.count", 0) > 0) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "1B")) - { - untracked_satellite = false; - } - } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "5X"); - available_GAL_5X_signals_.remove(gs); - available_GAL_5X_signals_.push_front(gs); - } - } - } + is_primary_frequency = true; //indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..) break; case evGAL_5X: @@ -2153,25 +2193,6 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal { available_GAL_5X_signals_.push_back(result); } - if (tracked) - { - if (configuration_->property("Channels_1B.count", 0) > 0) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "5X")) - { - untracked_satellite = false; - } - } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1B"); - available_GAL_1B_signals_.remove(gs); - available_GAL_1B_signals_.push_front(gs); - } - } - } break; case evGLO_1G: @@ -2181,25 +2202,7 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal { available_GLO_1G_signals_.push_back(result); } - if (tracked) - { - if (configuration_->property("Channels_2G.count", 0) > 0) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "1G")) - { - untracked_satellite = false; - } - } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2G"); - available_GLO_2G_signals_.remove(gs); - available_GLO_2G_signals_.push_front(gs); - } - } - } + is_primary_frequency = true; //indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..) break; case evGLO_2G: @@ -2209,25 +2212,6 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal { available_GLO_2G_signals_.push_back(result); } - if (tracked) - { - if (configuration_->property("Channels_1G.count", 0) > 0) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2G")) - { - untracked_satellite = false; - } - } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1G"); - available_GLO_1G_signals_.remove(gs); - available_GLO_1G_signals_.push_front(gs); - } - } - } break; case evBDS_B1: @@ -2237,25 +2221,7 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal { available_BDS_B1_signals_.push_back(result); } - if (tracked) - { - if (configuration_->property("Channels_B3.count", 0) > 0) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2G")) - { - untracked_satellite = false; - } - } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "B3"); - available_BDS_B3_signals_.remove(gs); - available_BDS_B3_signals_.push_front(gs); - } - } - } + is_primary_frequency = true; //indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..) break; case evBDS_B3: @@ -2265,25 +2231,6 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal { available_BDS_B3_signals_.push_back(result); } - if (tracked) - { - if (configuration_->property("Channels_B1.count", 0) > 0) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2G")) - { - untracked_satellite = false; - } - } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "B1"); - available_BDS_B1_signals_.remove(gs); - available_BDS_B1_signals_.push_front(gs); - } - } - } break; default: @@ -2296,4 +2243,290 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal break; } return result; + + + //old + // bool untracked_satellite = true; + // switch (mapStringValues_[searched_signal]) + // { + // case evGPS_1C: + // result = available_GPS_1C_signals_.front(); + // available_GPS_1C_signals_.pop_front(); + // if (!pop) + // { + // available_GPS_1C_signals_.push_back(result); + // } + // if (tracked) + // { + // if ((configuration_->property("Channels_2S.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0)) + // { + // for (unsigned int ch = 0; ch < channels_count_; ch++) + // { + // if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "1C")) + // { + // untracked_satellite = false; + // } + // } + // if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); + // available_GPS_2S_signals_.remove(gs); + // available_GPS_2S_signals_.push_front(gs); + // } + // if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); + // available_GPS_L5_signals_.remove(gs); + // available_GPS_L5_signals_.push_front(gs); + // } + // } + // } + // break; + // + // case evGPS_2S: + // result = available_GPS_2S_signals_.front(); + // available_GPS_2S_signals_.pop_front(); + // if (!pop) + // { + // available_GPS_2S_signals_.push_back(result); + // } + // if (tracked) + // { + // if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0)) + // { + // for (unsigned int ch = 0; ch < channels_count_; ch++) + // { + // if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2S")) + // { + // untracked_satellite = false; + // } + // } + // if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); + // available_GPS_1C_signals_.remove(gs); + // available_GPS_1C_signals_.push_front(gs); + // } + // if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); + // available_GPS_L5_signals_.remove(gs); + // available_GPS_L5_signals_.push_front(gs); + // } + // } + // } + // break; + // + // case evGPS_L5: + // result = available_GPS_L5_signals_.front(); + // available_GPS_L5_signals_.pop_front(); + // if (!pop) + // { + // available_GPS_L5_signals_.push_back(result); + // } + // if (tracked) + // { + // if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_2S.count", 0) > 0)) + // { + // for (unsigned int ch = 0; ch < channels_count_; ch++) + // { + // if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "L5")) + // { + // untracked_satellite = false; + // } + // } + // if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); + // available_GPS_1C_signals_.remove(gs); + // available_GPS_1C_signals_.push_front(gs); + // } + // if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); + // available_GPS_2S_signals_.remove(gs); + // available_GPS_2S_signals_.push_front(gs); + // } + // } + // } + // break; + // + // case evGAL_1B: + // result = available_GAL_1B_signals_.front(); + // available_GAL_1B_signals_.pop_front(); + // if (!pop) + // { + // available_GAL_1B_signals_.push_back(result); + // } + // if (tracked) + // { + // if (configuration_->property("Channels_5X.count", 0) > 0) + // { + // for (unsigned int ch = 0; ch < channels_count_; ch++) + // { + // if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "1B")) + // { + // untracked_satellite = false; + // } + // } + // if (untracked_satellite) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "5X"); + // available_GAL_5X_signals_.remove(gs); + // available_GAL_5X_signals_.push_front(gs); + // } + // } + // } + // break; + // + // case evGAL_5X: + // result = available_GAL_5X_signals_.front(); + // available_GAL_5X_signals_.pop_front(); + // if (!pop) + // { + // available_GAL_5X_signals_.push_back(result); + // } + // if (tracked) + // { + // if (configuration_->property("Channels_1B.count", 0) > 0) + // { + // for (unsigned int ch = 0; ch < channels_count_; ch++) + // { + // if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "5X")) + // { + // untracked_satellite = false; + // } + // } + // if (untracked_satellite) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1B"); + // available_GAL_1B_signals_.remove(gs); + // available_GAL_1B_signals_.push_front(gs); + // } + // } + // } + // break; + // + // case evGLO_1G: + // result = available_GLO_1G_signals_.front(); + // available_GLO_1G_signals_.pop_front(); + // if (!pop) + // { + // available_GLO_1G_signals_.push_back(result); + // } + // if (tracked) + // { + // if (configuration_->property("Channels_2G.count", 0) > 0) + // { + // for (unsigned int ch = 0; ch < channels_count_; ch++) + // { + // if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "1G")) + // { + // untracked_satellite = false; + // } + // } + // if (untracked_satellite) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2G"); + // available_GLO_2G_signals_.remove(gs); + // available_GLO_2G_signals_.push_front(gs); + // } + // } + // } + // break; + // + // case evGLO_2G: + // result = available_GLO_2G_signals_.front(); + // available_GLO_2G_signals_.pop_front(); + // if (!pop) + // { + // available_GLO_2G_signals_.push_back(result); + // } + // if (tracked) + // { + // if (configuration_->property("Channels_1G.count", 0) > 0) + // { + // for (unsigned int ch = 0; ch < channels_count_; ch++) + // { + // if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2G")) + // { + // untracked_satellite = false; + // } + // } + // if (untracked_satellite) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1G"); + // available_GLO_1G_signals_.remove(gs); + // available_GLO_1G_signals_.push_front(gs); + // } + // } + // } + // break; + // + // case evBDS_B1: + // result = available_BDS_B1_signals_.front(); + // available_BDS_B1_signals_.pop_front(); + // if (!pop) + // { + // available_BDS_B1_signals_.push_back(result); + // } + // if (tracked) + // { + // if (configuration_->property("Channels_B3.count", 0) > 0) + // { + // for (unsigned int ch = 0; ch < channels_count_; ch++) + // { + // if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2G")) + // { + // untracked_satellite = false; + // } + // } + // if (untracked_satellite) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "B3"); + // available_BDS_B3_signals_.remove(gs); + // available_BDS_B3_signals_.push_front(gs); + // } + // } + // } + // break; + // + // case evBDS_B3: + // result = available_BDS_B3_signals_.front(); + // available_BDS_B3_signals_.pop_front(); + // if (!pop) + // { + // available_BDS_B3_signals_.push_back(result); + // } + // if (tracked) + // { + // if (configuration_->property("Channels_B1.count", 0) > 0) + // { + // for (unsigned int ch = 0; ch < channels_count_; ch++) + // { + // if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2G")) + // { + // untracked_satellite = false; + // } + // } + // if (untracked_satellite) + // { + // Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "B1"); + // available_BDS_B1_signals_.remove(gs); + // available_BDS_B1_signals_.push_front(gs); + // } + // } + // } + // break; + // + // default: + // LOG(ERROR) << "This should not happen :-("; + // result = available_GPS_1C_signals_.front(); + // if (pop) + // { + // available_GPS_1C_signals_.pop_front(); + // } + // break; + // } + // return result; } diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 7552c46a7..ea2ecc2ad 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -37,6 +37,7 @@ #ifndef GNSS_SDR_GNSS_FLOWGRAPH_H_ #define GNSS_SDR_GNSS_FLOWGRAPH_H_ +#include "channel_status_msg_receiver.h" #include "gnss_sdr_sample_counter.h" #include "gnss_signal.h" #include "pvt_interface.h" @@ -149,7 +150,12 @@ private: void set_signals_list(); void set_channels_state(); // Initializes the channels state (start acquisition or keep standby) // using the configuration parameters (number of channels and max channels in acquisition) - Gnss_Signal search_next_signal(const std::string& searched_signal, bool pop, bool tracked = false); + Gnss_Signal search_next_signal(const std::string& searched_signal, + const bool pop, + bool& is_primary_frequency, + bool& assistance_available, + float& estimated_doppler, + double& RX_time); bool connected_; bool running_; int sources_count_; @@ -203,6 +209,7 @@ private: std::map mapStringValues_; std::vector channels_state_; + channel_status_msg_receiver_sptr channels_status_; //class that receives and stores the current status of the receiver channels std::mutex signal_list_mutex; bool enable_monitor_; diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc b/src/tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc index eb586f147..647e7f245 100644 --- a/src/tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc @@ -29,12 +29,13 @@ */ #include "serdes_monitor_pvt.h" +#include TEST(Serdes_Monitor_Pvt_Test, Simpletest) { - Monitor_Pvt monitor = Monitor_Pvt(); + std::shared_ptr monitor = std::make_shared(Monitor_Pvt()); double true_latitude = 23.4; - monitor.latitude = true_latitude; + monitor->latitude = true_latitude; Serdes_Monitor_Pvt serdes = Serdes_Monitor_Pvt(); std::string serialized_data = serdes.createProtobuffer(monitor);