1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

New asynchronous channel and PVT status reporting from observables and PVT to flowgraph. Partial implementation of assistance from L1 to L2 and L5

This commit is contained in:
Javier Arribas 2019-07-11 18:39:28 +02:00
parent c98bc16552
commit 71d93dc4b9
13 changed files with 711 additions and 249 deletions

View File

@ -126,9 +126,12 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
{ {
// Send feedback message to observables block with the receiver clock offset // Send feedback message to observables block with the receiver clock offset
this->message_port_register_out(pmt::mp("pvt_to_observables")); 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_output_rate_ms = conf_.output_rate_ms;
d_display_rate_ms = conf_.display_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 = conf_.dump;
d_dump_mat = conf_.dump_mat and d_dump; d_dump_mat = conf_.dump_mat and d_dump;
d_dump_filename = conf_.dump_filename; d_dump_filename = conf_.dump_filename;
@ -3729,13 +3732,22 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
} }
// PVT MONITOR // PVT MONITOR
if (d_pvt_solver->is_valid_position() and flag_monitor_pvt_enabled) if (d_pvt_solver->is_valid_position())
{
std::shared_ptr<Monitor_Pvt> monitor_pvt = std::make_shared<Monitor_Pvt>(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)
{ {
Monitor_Pvt monitor_pvt = d_pvt_solver->get_monitor_pvt();
udp_sink_ptr->write_monitor_pvt(monitor_pvt); udp_sink_ptr->write_monitor_pvt(monitor_pvt);
} }
} }
} }
}
return noutput_items; return noutput_items;
} }

View File

@ -169,6 +169,7 @@ private:
int32_t d_output_rate_ms; int32_t d_output_rate_ms;
int32_t d_display_rate_ms; int32_t d_display_rate_ms;
int32_t d_report_rate_ms;
std::shared_ptr<Rinex_Printer> rp; std::shared_ptr<Rinex_Printer> rp;
std::shared_ptr<Kml_Printer> d_kml_dump; std::shared_ptr<Kml_Printer> d_kml_dump;

View File

@ -51,14 +51,14 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& 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> monitor_pvt)
{ {
std::string outbound_data; std::string outbound_data;
if (use_protobuf == false) if (use_protobuf == false)
{ {
std::ostringstream archive_stream; std::ostringstream archive_stream;
boost::archive::binary_oarchive oa{archive_stream}; boost::archive::binary_oarchive oa{archive_stream};
oa << monitor_pvt; oa << *monitor_pvt.get();
outbound_data = archive_stream.str(); outbound_data = archive_stream.str();
} }
else else

View File

@ -46,7 +46,7 @@ class Monitor_Pvt_Udp_Sink
{ {
public: public:
Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled); Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled);
bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt); bool write_monitor_pvt(std::shared_ptr<Monitor_Pvt> monitor_pvt);
private: private:
b_io_context io_context; b_io_context io_context;

View File

@ -34,7 +34,7 @@
#include "monitor_pvt.h" #include "monitor_pvt.h"
#include "monitor_pvt.pb.h" // file created by Protocol Buffers at compile time #include "monitor_pvt.pb.h" // file created by Protocol Buffers at compile time
#include <memory>
/*! /*!
* \brief This class implements serialization and deserialization of * \brief This class implements serialization and deserialization of
@ -80,40 +80,40 @@ public:
return *this; return *this;
} }
inline std::string createProtobuffer(const Monitor_Pvt& monitor) //!< Serialization into a string inline std::string createProtobuffer(std::shared_ptr<Monitor_Pvt> monitor) //!< Serialization into a string
{ {
monitor_.Clear(); monitor_.Clear();
std::string data; std::string data;
monitor_.set_tow_at_current_symbol_ms(monitor.TOW_at_current_symbol_ms); monitor_.set_tow_at_current_symbol_ms(monitor->TOW_at_current_symbol_ms);
monitor_.set_week(monitor.week); monitor_.set_week(monitor->week);
monitor_.set_rx_time(monitor.RX_time); monitor_.set_rx_time(monitor->RX_time);
monitor_.set_user_clk_offset(monitor.user_clk_offset); monitor_.set_user_clk_offset(monitor->user_clk_offset);
monitor_.set_pos_x(monitor.pos_x); monitor_.set_pos_x(monitor->pos_x);
monitor_.set_pos_y(monitor.pos_y); monitor_.set_pos_y(monitor->pos_y);
monitor_.set_pos_z(monitor.pos_z); monitor_.set_pos_z(monitor->pos_z);
monitor_.set_vel_x(monitor.vel_x); monitor_.set_vel_x(monitor->vel_x);
monitor_.set_vel_y(monitor.vel_y); monitor_.set_vel_y(monitor->vel_y);
monitor_.set_vel_z(monitor.vel_z); monitor_.set_vel_z(monitor->vel_z);
monitor_.set_cov_xx(monitor.cov_xx); monitor_.set_cov_xx(monitor->cov_xx);
monitor_.set_cov_yy(monitor.cov_yy); monitor_.set_cov_yy(monitor->cov_yy);
monitor_.set_cov_zz(monitor.cov_zz); monitor_.set_cov_zz(monitor->cov_zz);
monitor_.set_cov_xy(monitor.cov_xy); monitor_.set_cov_xy(monitor->cov_xy);
monitor_.set_cov_yz(monitor.cov_yz); monitor_.set_cov_yz(monitor->cov_yz);
monitor_.set_cov_zx(monitor.cov_zx); monitor_.set_cov_zx(monitor->cov_zx);
monitor_.set_latitude(monitor.latitude); monitor_.set_latitude(monitor->latitude);
monitor_.set_longitude(monitor.longitude); monitor_.set_longitude(monitor->longitude);
monitor_.set_height(monitor.height); monitor_.set_height(monitor->height);
monitor_.set_valid_sats(monitor.valid_sats); monitor_.set_valid_sats(monitor->valid_sats);
monitor_.set_solution_status(monitor.solution_status); monitor_.set_solution_status(monitor->solution_status);
monitor_.set_solution_type(monitor.solution_type); monitor_.set_solution_type(monitor->solution_type);
monitor_.set_ar_ratio_factor(monitor.AR_ratio_factor); monitor_.set_ar_ratio_factor(monitor->AR_ratio_factor);
monitor_.set_ar_ratio_threshold(monitor.AR_ratio_threshold); monitor_.set_ar_ratio_threshold(monitor->AR_ratio_threshold);
monitor_.set_gdop(monitor.gdop); monitor_.set_gdop(monitor->gdop);
monitor_.set_pdop(monitor.pdop); monitor_.set_pdop(monitor->pdop);
monitor_.set_hdop(monitor.hdop); monitor_.set_hdop(monitor->hdop);
monitor_.set_vdop(monitor.vdop); monitor_.set_vdop(monitor->vdop);
monitor_.SerializeToString(&data); monitor_.SerializeToString(&data);
return data; return data;

View File

@ -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->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)); 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 = dump;
d_dump_mat = dump_mat and d_dump; d_dump_mat = dump_mat and d_dump;
d_dump_filename = std::move(dump_filename); 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_remnant_to_20ms = 0;
T_rx_step_ms = 20; //read from config at the adapter GNSS-SDR.observable_interval_ms!! T_rx_step_ms = 20; //read from config at the adapter GNSS-SDR.observable_interval_ms!!
T_rx_TOW_set = false; T_rx_TOW_set = false;
T_status_report_timer_ms = 0;
// rework // rework
d_Rx_clock_buffer.set_capacity(10); // 10*20 ms = 200 ms of data in buffer 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 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); 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> gnss_synchro_sptr = std::make_shared<Gnss_Synchro>(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) if (d_dump)
{ {
// MULTIPLEXED FILE RECORDING - Record results to file // MULTIPLEXED FILE RECORDING - Record results to file

View File

@ -89,6 +89,7 @@ private:
uint32_t T_rx_TOW_ms; uint32_t T_rx_TOW_ms;
uint32_t T_rx_remnant_to_20ms; uint32_t T_rx_remnant_to_20ms;
uint32_t T_rx_step_ms; uint32_t T_rx_step_ms;
uint32_t T_status_report_timer_ms;
uint32_t d_nchannels_in; uint32_t d_nchannels_in;
uint32_t d_nchannels_out; uint32_t d_nchannels_out;
double T_rx_offset_ms; double T_rx_offset_ms;

View File

@ -24,6 +24,7 @@ set(CORE_LIBS_SOURCES
string_converter.cc string_converter.cc
gnss_sdr_supl_client.cc gnss_sdr_supl_client.cc
gnss_sdr_sample_counter.cc gnss_sdr_sample_counter.cc
channel_status_msg_receiver.cc
) )
set(CORE_LIBS_HEADERS set(CORE_LIBS_HEADERS
@ -32,6 +33,7 @@ set(CORE_LIBS_HEADERS
string_converter.h string_converter.h
gnss_sdr_supl_client.h gnss_sdr_supl_client.h
gnss_sdr_sample_counter.h gnss_sdr_sample_counter.h
channel_status_msg_receiver.h
) )
if(ENABLE_FPGA) if(ENABLE_FPGA)
@ -60,6 +62,7 @@ target_link_libraries(core_libs
Gnuradio::runtime Gnuradio::runtime
core_libs_supl core_libs_supl
core_system_parameters core_system_parameters
pvt_libs
PRIVATE PRIVATE
Boost::serialization Boost::serialization
Gflags::gflags Gflags::gflags

View File

@ -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 <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "channel_status_msg_receiver.h"
#include <boost/any.hpp>
#include <boost/bind.hpp>
#include <glog/logging.h>
#include <gnuradio/gr_complex.h>
#include <gnuradio/io_signature.h>
#include <cstdint>
#include <utility>
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<Gnss_Synchro>))
{
std::shared_ptr<Gnss_Synchro> gnss_synchro_obj;
gnss_synchro_obj = boost::any_cast<std::shared_ptr<Gnss_Synchro>>(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<int, std::shared_ptr<Gnss_Synchro>>::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>))
{
// ************* Monitor_Pvt received *****************
std::shared_ptr<Monitor_Pvt> monitor_pvt_obj;
monitor_pvt_obj = boost::any_cast<std::shared_ptr<Monitor_Pvt>>(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<int, std::shared_ptr<Gnss_Synchro>> 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;
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#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 <gnuradio/block.h>
#include <pmt/pmt.h>
#include <memory>
class channel_status_msg_receiver;
using channel_status_msg_receiver_sptr = boost::shared_ptr<channel_status_msg_receiver>;
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<int, std::shared_ptr<Gnss_Synchro>> 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<int, std::shared_ptr<Gnss_Synchro>> d_channel_status_map;
Monitor_Pvt d_pvt_status;
void msg_handler_events(pmt::pmt_t msg);
};
#endif

View File

@ -598,7 +598,11 @@ void GNSSFlowgraph::connect()
} }
if (sat == 0) 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 else
{ {
@ -680,7 +684,11 @@ void GNSSFlowgraph::connect()
top_block_->connect(observables_->get_right_block(), i, pvt_->get_left_block(), i); 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(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("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) 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: * \param[in] what What is the action:
* --- actions from channels --- * --- actions from channels ---
* -> 0 acquisition failed * -> 0 acquisition failed
* -> 1 acquisition successful * -> 1 acquisition succesfull
* -> 2 tracking lost * -> 2 tracking lost
* --- actions from TC receiver control --- * --- actions from TC receiver control ---
* -> 10 TC request standby mode * -> 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) 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<std::mutex> lock(signal_list_mutex); std::lock_guard<std::mutex> lock(signal_list_mutex);
DLOG(INFO) << "Received " << what << " from " << who << ". Number of applied actions = " << applied_actions_; DLOG(INFO) << "Received " << what << " from " << who << ". Number of applied actions = " << applied_actions_;
unsigned int sat = 0; unsigned int sat = 0;
@ -1167,11 +1177,20 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
} }
if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[ch_index] == 0)) 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) 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);
} }
//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_++; 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(); 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 #ifndef ENABLE_FPGA
@ -1182,6 +1201,11 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
tmp_thread.detach(); tmp_thread.detach();
#endif #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]; DLOG(INFO) << "Channel " << ch_index << " in state " << channels_state_[ch_index];
} }
break; break;
@ -1248,11 +1272,20 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
} }
if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0)) 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) 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);
} }
//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_++; acq_channels_count_++;
DLOG(INFO) << "Channel " << i << " Starting acquisition " << channels_[i]->get_signal().get_satellite() << ", Signal " << channels_[i]->get_signal().get_signal_str(); DLOG(INFO) << "Channel " << i << " Starting acquisition " << channels_[i]->get_signal().get_satellite() << ", Signal " << channels_[i]->get_signal().get_signal_str();
#ifndef ENABLE_FPGA #ifndef ENABLE_FPGA
@ -1263,6 +1296,11 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
tmp_thread.detach(); tmp_thread.detach();
#endif #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]; DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i];
} }
break; break;
@ -1420,7 +1458,11 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
channels_state_[ch_index] = 1; channels_state_[ch_index] = 1;
if (sat_ == 0) 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_++; 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(); 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; channels_state_[ch_index] = 1;
if (sat_ == 0) 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_++; 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(); 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; channels_state_[ch_index] = 1;
if (sat_ == 0) 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_++; 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(); 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<GNSSBlockFactory> block_factory_(new GNSSBlockFactory()); std::unique_ptr<GNSSBlockFactory> 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) // 1. read the number of RF front-ends available (one file_source per RF front-end)
sources_count_ = configuration_->property("Receiver.sources_count", 1); 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; Gnss_Signal result;
bool untracked_satellite = true;
switch (mapStringValues_[searched_signal]) switch (mapStringValues_[searched_signal])
{ {
case evGPS_1C: 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(); result = available_GPS_1C_signals_.front();
available_GPS_1C_signals_.pop_front(); available_GPS_1C_signals_.pop_front();
if (!pop) if (!pop)
{ {
available_GPS_1C_signals_.push_back(result); available_GPS_1C_signals_.push_back(result);
} }
if (tracked) is_primary_frequency = true; //indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..)
{
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; break;
case evGPS_2S: case evGPS_2S:
if (configuration_->property("Channels_1C.count", 0) > 0)
{
//1. Get the current channel status map
std::map<int, std::shared_ptr<Gnss_Synchro>> 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<int, std::shared_ptr<Gnss_Synchro>>::iterator it = current_channels_status.begin(); it != current_channels_status.end(); ++it)
{
if (std::string(it->second->Signal) == "1C")
{
std::list<Gnss_Signal>::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())
{
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;
}
}
}
//fallback: pick the front satellite because there is no tracked satellites in L1 to assist L2
result = available_GPS_2S_signals_.front(); result = available_GPS_2S_signals_.front();
available_GPS_2S_signals_.pop_front(); available_GPS_2S_signals_.pop_front();
if (!pop) if (!pop)
{ {
available_GPS_2S_signals_.push_back(result); 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;
} }
} else
if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0)
{ {
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); result = available_GPS_2S_signals_.front();
available_GPS_1C_signals_.remove(gs); available_GPS_2S_signals_.pop_front();
available_GPS_1C_signals_.push_front(gs); if (!pop)
}
if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0)
{ {
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); available_GPS_2S_signals_.push_back(result);
available_GPS_L5_signals_.remove(gs);
available_GPS_L5_signals_.push_front(gs);
}
} }
} }
break; break;
case evGPS_L5: case evGPS_L5:
if (configuration_->property("Channels_1C.count", 0) > 0)
{
//1. Get the current channel status map
std::map<int, std::shared_ptr<Gnss_Synchro>> 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<int, std::shared_ptr<Gnss_Synchro>>::iterator it = current_channels_status.begin(); it != current_channels_status.end(); ++it)
{
if (std::string(it->second->Signal) == "1C")
{
std::list<Gnss_Signal>::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())
{
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;
}
}
}
//fallback: pick the front satellite because there is no tracked satellites in L1 to assist L5
result = available_GPS_L5_signals_.front(); result = available_GPS_L5_signals_.front();
available_GPS_L5_signals_.pop_front(); available_GPS_L5_signals_.pop_front();
if (!pop) if (!pop)
{ {
available_GPS_L5_signals_.push_back(result); 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;
} }
} else
if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0)
{ {
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); result = available_GPS_L5_signals_.front();
available_GPS_1C_signals_.remove(gs); available_GPS_L5_signals_.pop_front();
available_GPS_1C_signals_.push_front(gs); if (!pop)
}
if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0)
{ {
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); available_GPS_L5_signals_.push_back(result);
available_GPS_2S_signals_.remove(gs);
available_GPS_2S_signals_.push_front(gs);
}
} }
} }
break; break;
@ -2125,25 +2183,7 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal
{ {
available_GAL_1B_signals_.push_back(result); available_GAL_1B_signals_.push_back(result);
} }
if (tracked) is_primary_frequency = true; //indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..)
{
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; break;
case evGAL_5X: 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); 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; break;
case evGLO_1G: 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); available_GLO_1G_signals_.push_back(result);
} }
if (tracked) is_primary_frequency = true; //indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..)
{
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; break;
case evGLO_2G: 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); 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; break;
case evBDS_B1: 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); available_BDS_B1_signals_.push_back(result);
} }
if (tracked) is_primary_frequency = true; //indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..)
{
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; break;
case evBDS_B3: 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); 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; break;
default: default:
@ -2296,4 +2243,290 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal
break; break;
} }
return result; 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;
} }

View File

@ -37,6 +37,7 @@
#ifndef GNSS_SDR_GNSS_FLOWGRAPH_H_ #ifndef GNSS_SDR_GNSS_FLOWGRAPH_H_
#define 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_sdr_sample_counter.h"
#include "gnss_signal.h" #include "gnss_signal.h"
#include "pvt_interface.h" #include "pvt_interface.h"
@ -149,7 +150,12 @@ private:
void set_signals_list(); void set_signals_list();
void set_channels_state(); // Initializes the channels state (start acquisition or keep standby) 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) // 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 connected_;
bool running_; bool running_;
int sources_count_; int sources_count_;
@ -203,6 +209,7 @@ private:
std::map<std::string, StringValue> mapStringValues_; std::map<std::string, StringValue> mapStringValues_;
std::vector<unsigned int> channels_state_; std::vector<unsigned int> 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; std::mutex signal_list_mutex;
bool enable_monitor_; bool enable_monitor_;

View File

@ -29,12 +29,13 @@
*/ */
#include "serdes_monitor_pvt.h" #include "serdes_monitor_pvt.h"
#include <memory>
TEST(Serdes_Monitor_Pvt_Test, Simpletest) TEST(Serdes_Monitor_Pvt_Test, Simpletest)
{ {
Monitor_Pvt monitor = Monitor_Pvt(); std::shared_ptr<Monitor_Pvt> monitor = std::make_shared<Monitor_Pvt>(Monitor_Pvt());
double true_latitude = 23.4; double true_latitude = 23.4;
monitor.latitude = true_latitude; monitor->latitude = true_latitude;
Serdes_Monitor_Pvt serdes = Serdes_Monitor_Pvt(); Serdes_Monitor_Pvt serdes = Serdes_Monitor_Pvt();
std::string serialized_data = serdes.createProtobuffer(monitor); std::string serialized_data = serdes.createProtobuffer(monitor);