2011-10-01 18:45:20 +00:00
|
|
|
/*!
|
|
|
|
* \file gnss_flowgraph.cc
|
2018-04-20 11:20:10 +00:00
|
|
|
* \brief Implementation of a GNSS receiver flow graph
|
2011-10-01 18:45:20 +00:00
|
|
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
2012-03-02 17:17:51 +00:00
|
|
|
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
2014-04-13 00:51:00 +00:00
|
|
|
* Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es
|
2018-07-03 11:25:43 +00:00
|
|
|
* Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
|
2011-10-01 18:45:20 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2018-04-20 10:50:32 +00:00
|
|
|
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
2011-10-01 18:45:20 +00:00
|
|
|
*
|
|
|
|
* 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
|
2015-01-08 18:49:59 +00:00
|
|
|
* (at your option) any later version.
|
2011-10-01 18:45:20 +00:00
|
|
|
*
|
|
|
|
* 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
|
2018-05-13 20:49:11 +00:00
|
|
|
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
2011-10-01 18:45:20 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gnss_flowgraph.h"
|
2018-04-06 15:03:20 +00:00
|
|
|
#include "gnss_synchro.h"
|
2011-10-01 18:45:20 +00:00
|
|
|
#include "configuration_interface.h"
|
|
|
|
#include "gnss_block_interface.h"
|
|
|
|
#include "channel_interface.h"
|
|
|
|
#include "gnss_block_factory.h"
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <boost/lexical_cast.hpp>
|
|
|
|
#include <boost/tokenizer.hpp>
|
|
|
|
#include <glog/logging.h>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <exception>
|
|
|
|
#include <iostream>
|
|
|
|
#include <set>
|
2011-10-01 18:45:20 +00:00
|
|
|
|
2017-05-02 10:01:18 +00:00
|
|
|
|
2014-02-18 19:40:44 +00:00
|
|
|
#define GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS 8
|
|
|
|
|
2011-10-01 18:45:20 +00:00
|
|
|
using google::LogMessage;
|
|
|
|
|
2017-12-21 12:05:21 +00:00
|
|
|
GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration, gr::msg_queue::sptr queue)
|
2012-04-14 18:04:27 +00:00
|
|
|
{
|
|
|
|
connected_ = false;
|
|
|
|
running_ = false;
|
|
|
|
configuration_ = configuration;
|
|
|
|
queue_ = queue;
|
|
|
|
init();
|
2011-10-01 18:45:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-22 17:49:13 +00:00
|
|
|
GNSSFlowgraph::~GNSSFlowgraph()
|
|
|
|
{
|
|
|
|
if (connected_)
|
|
|
|
{
|
|
|
|
GNSSFlowgraph::disconnect();
|
|
|
|
}
|
|
|
|
}
|
2018-04-20 10:50:32 +00:00
|
|
|
|
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
void GNSSFlowgraph::start()
|
|
|
|
{
|
|
|
|
if (running_)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Already running";
|
2012-04-14 18:04:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2012-04-14 18:04:27 +00:00
|
|
|
top_block_->start();
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Unable to start flowgraph";
|
|
|
|
LOG(ERROR) << e.what();
|
2012-04-14 18:04:27 +00:00
|
|
|
return;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2012-04-14 18:04:27 +00:00
|
|
|
|
|
|
|
running_ = true;
|
2011-10-01 18:45:20 +00:00
|
|
|
}
|
|
|
|
|
2015-02-27 17:21:25 +00:00
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
void GNSSFlowgraph::stop()
|
|
|
|
{
|
|
|
|
top_block_->stop();
|
|
|
|
running_ = false;
|
2011-10-01 18:45:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
void GNSSFlowgraph::connect()
|
|
|
|
{
|
2018-04-20 11:20:10 +00:00
|
|
|
// Connects the blocks in the flow graph
|
2018-04-20 10:50:32 +00:00
|
|
|
// Signal Source > Signal conditioner >> Channels >> Observables >> PVT
|
|
|
|
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(INFO) << "Connecting flowgraph";
|
2012-04-14 18:04:27 +00:00
|
|
|
if (connected_)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "flowgraph already connected";
|
2012-04-14 18:04:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-02-27 17:21:25 +00:00
|
|
|
for (int i = 0; i < sources_count_; i++)
|
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
if (configuration_->property(sig_source_.at(i)->role() + ".enable_FPGA", false) == false)
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
sig_source_.at(i)->connect(top_block_);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Can't connect signal source block " << i << " internally";
|
|
|
|
LOG(ERROR) << e.what();
|
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
|
|
|
}
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2015-02-27 17:21:25 +00:00
|
|
|
}
|
2012-04-14 18:04:27 +00:00
|
|
|
|
|
|
|
// Signal Source > Signal conditioner >
|
2015-03-01 21:23:17 +00:00
|
|
|
for (unsigned int i = 0; i < sig_conditioner_.size(); i++)
|
2015-02-27 17:21:25 +00:00
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
if (configuration_->property(sig_conditioner_.at(i)->role() + ".enable_FPGA", false) == false)
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
sig_conditioner_.at(i)->connect(top_block_);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Can't connect signal conditioner block " << i << " internally";
|
|
|
|
LOG(ERROR) << e.what();
|
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
|
|
|
}
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2015-02-27 17:21:25 +00:00
|
|
|
}
|
2012-04-14 18:04:27 +00:00
|
|
|
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
2017-05-05 14:37:29 +00:00
|
|
|
{
|
2012-04-14 18:04:27 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2014-04-12 17:45:45 +00:00
|
|
|
channels_.at(i)->connect(top_block_);
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Can't connect channel " << i << " internally";
|
|
|
|
LOG(ERROR) << e.what();
|
2012-04-14 18:04:27 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2017-05-05 14:37:29 +00:00
|
|
|
}
|
2012-04-14 18:04:27 +00:00
|
|
|
|
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2014-04-12 17:45:45 +00:00
|
|
|
observables_->connect(top_block_);
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Can't connect observables block internally";
|
|
|
|
LOG(ERROR) << e.what();
|
2012-04-14 18:04:27 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2012-04-14 18:04:27 +00:00
|
|
|
|
|
|
|
// Signal Source > Signal conditioner >> Channels >> Observables > PVT
|
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2014-04-12 17:45:45 +00:00
|
|
|
pvt_->connect(top_block_);
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Can't connect PVT block internally";
|
|
|
|
LOG(ERROR) << e.what();
|
2012-04-14 18:04:27 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2012-04-14 18:04:27 +00:00
|
|
|
|
|
|
|
DLOG(INFO) << "blocks connected internally";
|
2015-02-12 17:56:05 +00:00
|
|
|
// Signal Source (i) > Signal conditioner (i) >
|
2015-03-01 21:23:17 +00:00
|
|
|
int RF_Channels = 0;
|
|
|
|
int signal_conditioner_ID = 0;
|
|
|
|
|
2015-02-27 17:21:25 +00:00
|
|
|
for (int i = 0; i < sources_count_; i++)
|
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
//FPGA Accelerators do not need signal sources or conditioners
|
|
|
|
//as the samples are feed directly to the FPGA fabric, so, if enabled, do not connect any source
|
|
|
|
if (configuration_->property(sig_source_.at(i)->role() + ".enable_FPGA", false) == false)
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
try
|
2015-02-27 17:21:25 +00:00
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
//TODO: Remove this array implementation and create generic multistream connector
|
|
|
|
//(if a signal source has more than 1 stream, then connect it to the multistream signal conditioner)
|
|
|
|
if (sig_source_.at(i)->implementation().compare("Raw_Array_Signal_Source") == 0)
|
2015-02-27 17:21:25 +00:00
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
//Multichannel Array
|
|
|
|
std::cout << "ARRAY MODE" << std::endl;
|
|
|
|
for (int j = 0; j < GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS; j++)
|
|
|
|
{
|
|
|
|
std::cout << "connecting ch " << j << std::endl;
|
|
|
|
top_block_->connect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(i)->get_left_block(), j);
|
|
|
|
}
|
2015-02-27 17:21:25 +00:00
|
|
|
}
|
2018-04-13 13:27:14 +00:00
|
|
|
else
|
2015-03-01 21:23:17 +00:00
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
//TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
|
|
|
|
//Include GetRFChannels in the interface to avoid read config parameters here
|
|
|
|
//read the number of RF channels for each front-end
|
|
|
|
RF_Channels = configuration_->property(sig_source_.at(i)->role() + ".RF_channels", 1);
|
2015-04-24 17:11:45 +00:00
|
|
|
|
2018-04-13 13:27:14 +00:00
|
|
|
for (int j = 0; j < RF_Channels; j++)
|
2015-03-04 19:54:15 +00:00
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
//Connect the multichannel signal source to multiple signal conditioners
|
|
|
|
// GNURADIO max_streams=-1 means infinite ports!
|
|
|
|
LOG(INFO) << "sig_source_.at(i)->get_right_block()->output_signature()->max_streams()=" << sig_source_.at(i)->get_right_block()->output_signature()->max_streams();
|
|
|
|
LOG(INFO) << "sig_conditioner_.at(signal_conditioner_ID)->get_left_block()->input_signature()=" << sig_conditioner_.at(signal_conditioner_ID)->get_left_block()->input_signature()->max_streams();
|
|
|
|
|
|
|
|
if (sig_source_.at(i)->get_right_block()->output_signature()->max_streams() > 1)
|
2015-03-04 19:54:15 +00:00
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
LOG(INFO) << "connecting sig_source_ " << i << " stream " << j << " to conditioner " << j;
|
|
|
|
top_block_->connect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
2015-03-04 19:54:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
if (j == 0)
|
|
|
|
{
|
|
|
|
// RF_channel 0 backward compatibility with single channel sources
|
|
|
|
LOG(INFO) << "connecting sig_source_ " << i << " stream " << 0 << " to conditioner " << j;
|
|
|
|
top_block_->connect(sig_source_.at(i)->get_right_block(), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Multiple channel sources using multiple output blocks of single channel (requires RF_channel selector in call)
|
|
|
|
LOG(INFO) << "connecting sig_source_ " << i << " stream " << j << " to conditioner " << j;
|
|
|
|
top_block_->connect(sig_source_.at(i)->get_right_block(j), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
|
|
|
}
|
2015-03-04 19:54:15 +00:00
|
|
|
}
|
2018-04-13 13:27:14 +00:00
|
|
|
signal_conditioner_ID++;
|
2015-03-04 19:54:15 +00:00
|
|
|
}
|
2015-03-01 21:23:17 +00:00
|
|
|
}
|
|
|
|
}
|
2018-04-13 13:27:14 +00:00
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << "Can't connect signal source " << i << " to signal conditioner " << i;
|
|
|
|
LOG(ERROR) << e.what();
|
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DLOG(INFO) << "Signal source connected to signal conditioner";
|
|
|
|
bool FPGA_enabled = configuration_->property(sig_source_.at(0)->role() + ".enable_FPGA", false);
|
|
|
|
|
|
|
|
#if ENABLE_FPGA
|
|
|
|
if (FPGA_enabled == false)
|
|
|
|
{
|
|
|
|
//connect the signal source to sample counter
|
|
|
|
//connect the sample counter to Observables
|
|
|
|
try
|
|
|
|
{
|
|
|
|
double fs = static_cast<double>(configuration_->property("GNSS-SDR.internal_fs_sps", 0));
|
|
|
|
if (fs == 0.0)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << "Set GNSS-SDR.internal_fs_sps in configuration file";
|
|
|
|
std::cout << "Set GNSS-SDR.internal_fs_sps in configuration file" << std::endl;
|
|
|
|
throw(std::invalid_argument("Set GNSS-SDR.internal_fs_sps in configuration"));
|
|
|
|
}
|
2018-08-07 18:04:44 +00:00
|
|
|
int observable_interval_ms = static_cast<double>(configuration_->property("GNSS-SDR.observable_interval_ms", 20));
|
|
|
|
ch_out_sample_counter = gnss_sdr_make_sample_counter(fs, observable_interval_ms, sig_conditioner_.at(0)->get_right_block()->output_signature()->sizeof_stream_item(0));
|
2018-04-13 13:27:14 +00:00
|
|
|
top_block_->connect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0);
|
|
|
|
top_block_->connect(ch_out_sample_counter, 0, observables_->get_left_block(), channels_count_); //extra port for the sample counter pulse
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2018-04-13 13:27:14 +00:00
|
|
|
LOG(WARNING) << "Can't connect sample counter";
|
2015-02-27 17:21:25 +00:00
|
|
|
LOG(ERROR) << e.what();
|
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2015-02-27 17:21:25 +00:00
|
|
|
}
|
2018-04-13 13:27:14 +00:00
|
|
|
else
|
2012-04-14 18:04:27 +00:00
|
|
|
{
|
2018-08-10 09:53:40 +00:00
|
|
|
//create a hardware-defined gnss_synchro pulse for the observables block
|
2015-02-27 17:21:25 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2018-08-10 09:53:40 +00:00
|
|
|
double fs = static_cast<double>(configuration_->property("GNSS-SDR.internal_fs_sps", 0));
|
|
|
|
if (fs == 0.0)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << "Set GNSS-SDR.internal_fs_sps in configuration file";
|
|
|
|
std::cout << "Set GNSS-SDR.internal_fs_sps in configuration file" << std::endl;
|
|
|
|
throw(std::invalid_argument("Set GNSS-SDR.internal_fs_sps in configuration"));
|
|
|
|
}
|
2018-08-07 18:04:44 +00:00
|
|
|
int observable_interval_ms = static_cast<double>(configuration_->property("GNSS-SDR.observable_interval_ms", 20));
|
2018-08-10 09:53:40 +00:00
|
|
|
ch_out_fpga_sample_counter = gnss_sdr_make_fpga_sample_counter(fs, observable_interval_ms);
|
|
|
|
top_block_->connect(ch_out_fpga_sample_counter, 0, observables_->get_left_block(), channels_count_); //extra port for the sample counter pulse
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2018-08-10 09:53:40 +00:00
|
|
|
LOG(WARNING) << "Can't connect FPGA sample counter";
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(ERROR) << e.what();
|
2012-04-14 18:04:27 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2018-04-13 13:27:14 +00:00
|
|
|
}
|
|
|
|
#else
|
2018-04-20 10:50:32 +00:00
|
|
|
// connect the signal source to sample counter
|
|
|
|
// connect the sample counter to Observables
|
2018-04-13 13:27:14 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
double fs = static_cast<double>(configuration_->property("GNSS-SDR.internal_fs_sps", 0));
|
|
|
|
if (fs == 0.0)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << "Set GNSS-SDR.internal_fs_sps in configuration file";
|
|
|
|
std::cout << "Set GNSS-SDR.internal_fs_sps in configuration file" << std::endl;
|
|
|
|
throw(std::invalid_argument("Set GNSS-SDR.internal_fs_sps in configuration"));
|
|
|
|
}
|
2018-08-07 18:04:44 +00:00
|
|
|
|
|
|
|
int observable_interval_ms = static_cast<double>(configuration_->property("GNSS-SDR.observable_interval_ms", 20));
|
|
|
|
ch_out_sample_counter = gnss_sdr_make_sample_counter(fs, observable_interval_ms, sig_conditioner_.at(0)->get_right_block()->output_signature()->sizeof_stream_item(0));
|
2018-04-13 13:27:14 +00:00
|
|
|
top_block_->connect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0);
|
|
|
|
top_block_->connect(ch_out_sample_counter, 0, observables_->get_left_block(), channels_count_); //extra port for the sample counter pulse
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << "Can't connect sample counter";
|
|
|
|
LOG(ERROR) << e.what();
|
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// Signal conditioner (selected_signal_source) >> channels (i) (dependent of their associated SignalSource_ID)
|
2018-05-05 10:50:00 +00:00
|
|
|
int selected_signal_conditioner_ID = 0;
|
2018-04-13 13:27:14 +00:00
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
|
|
|
if (FPGA_enabled == false)
|
|
|
|
{
|
2018-05-01 21:32:52 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
selected_signal_conditioner_ID = configuration_->property("Channel" + std::to_string(i) + ".RF_channel_ID", 0);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << e.what();
|
|
|
|
}
|
2018-04-13 13:27:14 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0,
|
|
|
|
channels_.at(i)->get_left_block(), 0);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << "Can't connect signal conditioner " << selected_signal_conditioner_ID << " to channel " << i;
|
|
|
|
LOG(ERROR) << e.what();
|
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DLOG(INFO) << "signal conditioner " << selected_signal_conditioner_ID << " connected to channel " << i;
|
|
|
|
}
|
2012-04-14 18:04:27 +00:00
|
|
|
// Signal Source > Signal conditioner >> Channels >> Observables
|
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2014-04-12 17:45:45 +00:00
|
|
|
top_block_->connect(channels_.at(i)->get_right_block(), 0,
|
2018-03-03 01:03:39 +00:00
|
|
|
observables_->get_left_block(), i);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Can't connect channel " << i << " to observables";
|
|
|
|
LOG(ERROR) << e.what();
|
2012-04-14 18:04:27 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2018-04-20 10:50:32 +00:00
|
|
|
}
|
2014-04-12 20:02:18 +00:00
|
|
|
|
2018-04-20 10:50:32 +00:00
|
|
|
// Put channels fixed to a given satellite at the beginning of the vector, then the rest
|
|
|
|
std::vector<unsigned int> vector_of_channels;
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
2018-05-01 21:32:52 +00:00
|
|
|
unsigned int sat = 0;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sat = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << e.what();
|
|
|
|
}
|
2018-04-20 10:50:32 +00:00
|
|
|
if (sat == 0)
|
|
|
|
{
|
|
|
|
vector_of_channels.push_back(i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
auto it = vector_of_channels.begin();
|
|
|
|
it = vector_of_channels.insert(it, i);
|
|
|
|
}
|
|
|
|
}
|
2014-04-12 20:02:18 +00:00
|
|
|
|
2018-04-20 10:50:32 +00:00
|
|
|
// Assign satellites to channels in the initialization
|
|
|
|
for (unsigned int& i : vector_of_channels)
|
|
|
|
{
|
|
|
|
std::string gnss_signal = channels_.at(i)->get_signal().get_signal_str(); // use channel's implicit signal
|
2018-05-01 21:32:52 +00:00
|
|
|
unsigned int sat = 0;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sat = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << e.what();
|
|
|
|
}
|
2018-07-12 18:01:18 +00:00
|
|
|
if (sat == 0)
|
|
|
|
{
|
|
|
|
channels_.at(i)->set_signal(search_next_signal(gnss_signal, false));
|
|
|
|
}
|
|
|
|
else
|
2012-04-14 18:04:27 +00:00
|
|
|
{
|
2018-04-20 10:50:32 +00:00
|
|
|
std::string gnss_system;
|
2018-06-14 21:10:43 +00:00
|
|
|
Gnss_Signal signal_value;
|
|
|
|
switch (mapStringValues_[gnss_signal])
|
|
|
|
{
|
|
|
|
case evGPS_1C:
|
|
|
|
gnss_system = "GPS";
|
|
|
|
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
|
|
|
available_GPS_1C_signals_.remove(signal_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGPS_2S:
|
|
|
|
gnss_system = "GPS";
|
|
|
|
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
|
|
|
available_GPS_2S_signals_.remove(signal_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGPS_L5:
|
|
|
|
gnss_system = "GPS";
|
|
|
|
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
|
|
|
available_GPS_L5_signals_.remove(signal_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGAL_1B:
|
|
|
|
gnss_system = "Galileo";
|
|
|
|
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
|
|
|
available_GAL_1B_signals_.remove(signal_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGAL_5X:
|
|
|
|
gnss_system = "Galileo";
|
|
|
|
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
|
|
|
available_GAL_5X_signals_.remove(signal_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGLO_1G:
|
|
|
|
gnss_system = "Glonass";
|
|
|
|
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
|
|
|
available_GLO_1G_signals_.remove(signal_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGLO_2G:
|
|
|
|
gnss_system = "Glonass";
|
|
|
|
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
|
|
|
available_GLO_2G_signals_.remove(signal_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
LOG(ERROR) << "This should not happen :-(";
|
|
|
|
gnss_system = "GPS";
|
|
|
|
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
|
|
|
available_GPS_1C_signals_.remove(signal_value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-04-20 10:50:32 +00:00
|
|
|
channels_.at(i)->set_signal(signal_value);
|
2012-04-14 18:04:27 +00:00
|
|
|
}
|
2017-05-05 14:37:29 +00:00
|
|
|
}
|
2015-02-27 17:21:25 +00:00
|
|
|
|
2018-04-20 10:50:32 +00:00
|
|
|
// Connect the observables output of each channel to the PVT block
|
2012-04-14 18:04:27 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2012-04-14 18:04:27 +00:00
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
2014-04-12 17:45:45 +00:00
|
|
|
top_block_->connect(observables_->get_right_block(), i, pvt_->get_left_block(), i);
|
2016-05-02 21:46:30 +00:00
|
|
|
top_block_->msg_connect(channels_.at(i)->get_right_block(), pmt::mp("telemetry"), pvt_->get_left_block(), pmt::mp("telemetry"));
|
2012-04-14 18:04:27 +00:00
|
|
|
}
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Can't connect observables to PVT";
|
|
|
|
LOG(ERROR) << e.what();
|
2012-04-14 18:04:27 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2012-04-14 18:04:27 +00:00
|
|
|
|
2018-07-03 11:25:43 +00:00
|
|
|
// GNSS SYNCHRO MONITOR
|
|
|
|
if (enable_monitor_)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
|
|
|
top_block_->connect(observables_->get_right_block(), i, GnssSynchroMonitor_, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << "Can't connect observables to Monitor block";
|
|
|
|
LOG(ERROR) << e.what();
|
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-20 10:50:32 +00:00
|
|
|
// Activate acquisition in enabled channels
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Channel " << i << " assigned to " << channels_.at(i)->get_signal();
|
|
|
|
if (channels_state_[i] == 1)
|
|
|
|
{
|
2018-04-30 17:23:35 +00:00
|
|
|
if (FPGA_enabled == false)
|
|
|
|
{
|
|
|
|
channels_.at(i)->start_acquisition();
|
|
|
|
}
|
2018-04-20 10:50:32 +00:00
|
|
|
LOG(INFO) << "Channel " << i << " connected to observables and ready for acquisition";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Channel " << i << " connected to observables in standby mode";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
connected_ = true;
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(INFO) << "Flowgraph connected";
|
2012-04-14 18:04:27 +00:00
|
|
|
top_block_->dump();
|
2011-10-01 18:45:20 +00:00
|
|
|
}
|
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
|
2018-04-22 17:49:13 +00:00
|
|
|
void GNSSFlowgraph::disconnect()
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Disconnecting flowgraph";
|
|
|
|
|
|
|
|
if (!connected_)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "flowgraph was not connected";
|
|
|
|
return;
|
|
|
|
}
|
2018-05-01 21:32:52 +00:00
|
|
|
connected_ = false;
|
2018-04-22 17:49:13 +00:00
|
|
|
// Signal Source (i) > Signal conditioner (i) >
|
|
|
|
int RF_Channels = 0;
|
|
|
|
int signal_conditioner_ID = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < sources_count_; i++)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// TODO: Remove this array implementation and create generic multistream connector
|
|
|
|
// (if a signal source has more than 1 stream, then connect it to the multistream signal conditioner)
|
|
|
|
if (sig_source_.at(i)->implementation().compare("Raw_Array_Signal_Source") == 0)
|
|
|
|
{
|
|
|
|
//Multichannel Array
|
|
|
|
for (int j = 0; j < GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS; j++)
|
|
|
|
{
|
|
|
|
top_block_->disconnect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(i)->get_left_block(), j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
|
|
|
|
// Include GetRFChannels in the interface to avoid read config parameters here
|
|
|
|
// read the number of RF channels for each front-end
|
|
|
|
RF_Channels = configuration_->property(sig_source_.at(i)->role() + ".RF_channels", 1);
|
|
|
|
|
|
|
|
for (int j = 0; j < RF_Channels; j++)
|
|
|
|
{
|
|
|
|
if (sig_source_.at(i)->get_right_block()->output_signature()->max_streams() > 1)
|
|
|
|
{
|
|
|
|
top_block_->disconnect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (j == 0)
|
|
|
|
{
|
|
|
|
// RF_channel 0 backward compatibility with single channel sources
|
|
|
|
top_block_->disconnect(sig_source_.at(i)->get_right_block(), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Multiple channel sources using multiple output blocks of single channel (requires RF_channel selector in call)
|
|
|
|
top_block_->disconnect(sig_source_.at(i)->get_right_block(j), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
signal_conditioner_ID++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Can't disconnect signal source " << i << " to signal conditioner " << i << ": " << e.what();
|
2018-05-01 21:32:52 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-04-22 17:49:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-01 21:32:52 +00:00
|
|
|
#if ENABLE_FPGA
|
2018-05-05 10:50:00 +00:00
|
|
|
bool FPGA_enabled = configuration_->property(sig_source_.at(0)->role() + ".enable_FPGA", false);
|
2018-05-01 21:32:52 +00:00
|
|
|
if (FPGA_enabled == false)
|
|
|
|
{
|
|
|
|
// disconnect the signal source to sample counter
|
|
|
|
// disconnect the sample counter to Observables
|
|
|
|
try
|
|
|
|
{
|
|
|
|
top_block_->disconnect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0);
|
|
|
|
top_block_->disconnect(ch_out_sample_counter, 0, observables_->get_left_block(), channels_count_); // extra port for the sample counter pulse
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << "Can't disconnect sample counter";
|
|
|
|
LOG(ERROR) << e.what();
|
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2018-08-10 09:53:40 +00:00
|
|
|
top_block_->disconnect(ch_out_fpga_sample_counter, 0, observables_->get_left_block(), channels_count_);
|
2018-05-01 21:32:52 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2018-08-10 09:53:40 +00:00
|
|
|
LOG(WARNING) << "Can't connect FPGA sample counter";
|
2018-05-01 21:32:52 +00:00
|
|
|
LOG(ERROR) << e.what();
|
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
// disconnect the signal source to sample counter
|
|
|
|
// disconnect the sample counter to Observables
|
2018-04-22 17:49:13 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
top_block_->disconnect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0);
|
2018-05-01 21:32:52 +00:00
|
|
|
top_block_->disconnect(ch_out_sample_counter, 0, observables_->get_left_block(), channels_count_); // extra port for the sample counter pulse
|
2018-04-22 17:49:13 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
2018-05-01 21:32:52 +00:00
|
|
|
LOG(WARNING) << "Can't connect sample counter";
|
|
|
|
LOG(ERROR) << e.what();
|
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-04-22 17:49:13 +00:00
|
|
|
}
|
2018-05-01 21:32:52 +00:00
|
|
|
#endif
|
2018-04-22 17:49:13 +00:00
|
|
|
// Signal conditioner (selected_signal_source) >> channels (i) (dependent of their associated SignalSource_ID)
|
|
|
|
int selected_signal_conditioner_ID;
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
2018-05-01 21:32:52 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
selected_signal_conditioner_ID = configuration_->property("Channel" + std::to_string(i) + ".RF_channel_ID", 0);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << e.what();
|
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
|
|
|
}
|
2018-04-22 17:49:13 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
top_block_->disconnect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0,
|
|
|
|
channels_.at(i)->get_left_block(), 0);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Can't disconnect signal conditioner " << selected_signal_conditioner_ID << " to channel " << i << ": " << e.what();
|
2018-05-01 21:32:52 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-04-22 17:49:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Signal Source > Signal conditioner >> Channels >> Observables
|
|
|
|
try
|
|
|
|
{
|
|
|
|
top_block_->disconnect(channels_.at(i)->get_right_block(), 0,
|
|
|
|
observables_->get_left_block(), i);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Can't disconnect channel " << i << " to observables: " << e.what();
|
2018-05-01 21:32:52 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-04-22 17:49:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
|
|
|
top_block_->disconnect(observables_->get_right_block(), i, pvt_->get_left_block(), i);
|
|
|
|
top_block_->msg_disconnect(channels_.at(i)->get_right_block(), pmt::mp("telemetry"), pvt_->get_left_block(), pmt::mp("telemetry"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Can't disconnect observables to PVT: " << e.what();
|
2018-05-01 21:32:52 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-04-22 17:49:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < sources_count_; i++)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sig_source_.at(i)->disconnect(top_block_);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Can't disconnect signal source block " << i << " internally: " << e.what();
|
2018-05-01 21:32:52 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-04-22 17:49:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Signal Source > Signal conditioner >
|
|
|
|
for (unsigned int i = 0; i < sig_conditioner_.size(); i++)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sig_conditioner_.at(i)->disconnect(top_block_);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Can't disconnect signal conditioner block " << i << " internally: " << e.what();
|
2018-05-01 21:32:52 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-04-22 17:49:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
channels_.at(i)->disconnect(top_block_);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Can't disconnect channel " << i << " internally: " << e.what();
|
2018-05-01 21:32:52 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-04-22 17:49:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
observables_->disconnect(top_block_);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Can't disconnect observables block internally: " << e.what();
|
2018-05-01 21:32:52 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-04-22 17:49:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Signal Source > Signal conditioner >> Channels >> Observables > PVT
|
|
|
|
try
|
|
|
|
{
|
|
|
|
pvt_->disconnect(top_block_);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(INFO) << "Can't disconnect PVT block internally: " << e.what();
|
2018-05-01 21:32:52 +00:00
|
|
|
top_block_->disconnect_all();
|
|
|
|
return;
|
2018-04-22 17:49:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DLOG(INFO) << "blocks disconnected internally";
|
|
|
|
LOG(INFO) << "Flowgraph disconnected";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
void GNSSFlowgraph::wait()
|
|
|
|
{
|
|
|
|
if (!running_)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Can't apply wait. Flowgraph is not running";
|
2012-04-14 18:04:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
top_block_->wait();
|
|
|
|
DLOG(INFO) << "Flowgraph finished calculations";
|
|
|
|
running_ = false;
|
2011-10-01 18:45:20 +00:00
|
|
|
}
|
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
|
2016-04-13 14:19:15 +00:00
|
|
|
bool GNSSFlowgraph::send_telemetry_msg(pmt::pmt_t msg)
|
|
|
|
{
|
|
|
|
//push ephemeris to PVT telemetry msg in port using a channel out port
|
|
|
|
// it uses the first channel as a message produces (it is already connected to PVT)
|
|
|
|
channels_.at(0)->get_right_block()->message_port_pub(pmt::mp("telemetry"), msg);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-05-10 20:16:18 +00:00
|
|
|
|
2011-12-28 21:36:45 +00:00
|
|
|
/*
|
2018-04-20 11:20:10 +00:00
|
|
|
* Applies an action to the flow graph
|
2011-12-28 21:36:45 +00:00
|
|
|
*
|
|
|
|
* \param[in] who Who generated the action
|
|
|
|
* \param[in] what What is the action 0: acquisition failed
|
|
|
|
*/
|
2012-04-14 18:04:27 +00:00
|
|
|
void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
|
|
|
|
{
|
2017-12-20 15:12:08 +00:00
|
|
|
DLOG(INFO) << "Received " << what << " from " << who << ". Number of applied actions = " << applied_actions_;
|
2018-05-01 21:32:52 +00:00
|
|
|
unsigned int sat = 0;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sat = configuration_->property("Channel" + std::to_string(who) + ".satellite", 0);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << e.what();
|
|
|
|
}
|
2018-06-15 12:35:53 +00:00
|
|
|
std::lock_guard<std::mutex> lock(signal_list_mutex);
|
2012-04-14 18:04:27 +00:00
|
|
|
switch (what)
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
|
|
|
case 0:
|
2018-04-22 17:49:13 +00:00
|
|
|
DLOG(INFO) << "Channel " << who << " ACQ FAILED satellite " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str();
|
2018-04-20 10:50:32 +00:00
|
|
|
if (sat == 0)
|
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()])
|
|
|
|
{
|
|
|
|
case evGPS_1C:
|
|
|
|
available_GPS_1C_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGPS_2S:
|
|
|
|
available_GPS_2S_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGPS_L5:
|
|
|
|
available_GPS_L5_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGAL_1B:
|
|
|
|
available_GAL_1B_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGAL_5X:
|
|
|
|
available_GAL_5X_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGLO_1G:
|
|
|
|
available_GLO_1G_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGLO_2G:
|
|
|
|
available_GLO_2G_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
LOG(ERROR) << "This should not happen :-(";
|
|
|
|
break;
|
|
|
|
}
|
2018-04-20 10:50:32 +00:00
|
|
|
}
|
2018-06-13 19:01:40 +00:00
|
|
|
channels_state_[who] = 0;
|
|
|
|
acq_channels_count_--;
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
unsigned int ch_index = (who + i + 1) % channels_count_;
|
2018-06-13 19:01:40 +00:00
|
|
|
unsigned int sat_ = 0;
|
|
|
|
try
|
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
sat_ = configuration_->property("Channel" + std::to_string(ch_index) + ".satellite", 0);
|
2018-06-13 19:01:40 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << e.what();
|
|
|
|
}
|
2018-06-14 21:10:43 +00:00
|
|
|
if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[ch_index] == 0))
|
2018-06-13 19:01:40 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
channels_state_[ch_index] = 1;
|
2018-06-13 19:01:40 +00:00
|
|
|
if (sat_ == 0)
|
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true));
|
2018-06-13 19:01:40 +00:00
|
|
|
}
|
|
|
|
acq_channels_count_++;
|
2018-06-14 21:10:43 +00:00
|
|
|
DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str();
|
|
|
|
channels_[ch_index]->start_acquisition();
|
2018-06-13 19:01:40 +00:00
|
|
|
}
|
2018-06-14 21:10:43 +00:00
|
|
|
DLOG(INFO) << "Channel " << ch_index << " in state " << channels_state_[ch_index];
|
2018-06-13 19:01:40 +00:00
|
|
|
}
|
2018-03-03 01:03:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2018-04-22 17:49:13 +00:00
|
|
|
LOG(INFO) << "Channel " << who << " ACQ SUCCESS satellite " << channels_[who]->get_signal().get_satellite();
|
2018-07-12 18:01:18 +00:00
|
|
|
|
|
|
|
// If the satellite is in the list of available ones, remove it.
|
|
|
|
switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()])
|
|
|
|
{
|
|
|
|
case evGPS_1C:
|
|
|
|
available_GPS_1C_signals_.remove(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGPS_2S:
|
|
|
|
available_GPS_2S_signals_.remove(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGPS_L5:
|
|
|
|
available_GPS_L5_signals_.remove(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGAL_1B:
|
|
|
|
available_GAL_1B_signals_.remove(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGAL_5X:
|
|
|
|
available_GAL_5X_signals_.remove(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGLO_1G:
|
|
|
|
available_GLO_1G_signals_.remove(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGLO_2G:
|
|
|
|
available_GLO_2G_signals_.remove(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
LOG(ERROR) << "This should not happen :-(";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
channels_state_[who] = 2;
|
|
|
|
acq_channels_count_--;
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
2018-06-06 10:26:45 +00:00
|
|
|
unsigned int sat_ = 0;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sat_ = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0);
|
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
LOG(WARNING) << e.what();
|
|
|
|
}
|
2018-06-14 21:10:43 +00:00
|
|
|
if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0))
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
|
|
|
channels_state_[i] = 1;
|
2018-06-06 10:26:45 +00:00
|
|
|
if (sat_ == 0)
|
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
channels_[i]->set_signal(search_next_signal(channels_[i]->get_signal().get_signal_str(), true, true));
|
2018-06-06 10:26:45 +00:00
|
|
|
}
|
2018-03-03 01:03:39 +00:00
|
|
|
acq_channels_count_++;
|
2018-04-22 17:49:13 +00:00
|
|
|
DLOG(INFO) << "Channel " << i << " Starting acquisition " << channels_[i]->get_signal().get_satellite() << ", Signal " << channels_[i]->get_signal().get_signal_str();
|
|
|
|
channels_[i]->start_acquisition();
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2018-04-22 17:49:13 +00:00
|
|
|
LOG(INFO) << "Channel " << who << " TRK FAILED satellite " << channels_[who]->get_signal().get_satellite();
|
2018-03-03 01:03:39 +00:00
|
|
|
DLOG(INFO) << "Number of channels in acquisition = " << acq_channels_count_;
|
|
|
|
|
|
|
|
if (acq_channels_count_ < max_acq_channels_)
|
|
|
|
{
|
|
|
|
channels_state_[who] = 1;
|
|
|
|
acq_channels_count_++;
|
2018-04-22 17:49:13 +00:00
|
|
|
LOG(INFO) << "Channel " << who << " Starting acquisition " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str();
|
|
|
|
channels_[who]->start_acquisition();
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
channels_state_[who] = 0;
|
|
|
|
LOG(INFO) << "Channel " << who << " Idle state";
|
2018-04-20 10:50:32 +00:00
|
|
|
if (sat == 0)
|
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()])
|
|
|
|
{
|
|
|
|
case evGPS_1C:
|
|
|
|
available_GPS_1C_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGPS_2S:
|
|
|
|
available_GPS_2S_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGPS_L5:
|
|
|
|
available_GPS_L5_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGAL_1B:
|
|
|
|
available_GAL_1B_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGAL_5X:
|
|
|
|
available_GAL_5X_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGLO_1G:
|
|
|
|
available_GLO_1G_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGLO_2G:
|
|
|
|
available_GLO_2G_signals_.push_back(channels_[who]->get_signal());
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
LOG(ERROR) << "This should not happen :-(";
|
|
|
|
break;
|
|
|
|
}
|
2018-04-20 10:50:32 +00:00
|
|
|
}
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2017-12-18 14:40:14 +00:00
|
|
|
applied_actions_++;
|
2011-10-01 18:45:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-03 21:59:14 +00:00
|
|
|
void GNSSFlowgraph::set_configuration(std::shared_ptr<ConfigurationInterface> configuration)
|
2012-04-14 18:04:27 +00:00
|
|
|
{
|
|
|
|
if (running_)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Unable to update configuration while flowgraph running";
|
2012-04-14 18:04:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (connected_)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Unable to update configuration while flowgraph connected";
|
2012-04-14 18:04:27 +00:00
|
|
|
}
|
|
|
|
configuration_ = configuration;
|
2011-10-01 18:45:20 +00:00
|
|
|
}
|
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
|
2018-04-06 15:03:20 +00:00
|
|
|
void GNSSFlowgraph::start_acquisition_helper()
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
2018-04-13 13:27:14 +00:00
|
|
|
{
|
|
|
|
if (channels_state_[i] == 1)
|
|
|
|
{
|
|
|
|
channels_.at(i)->start_acquisition();
|
|
|
|
}
|
|
|
|
}
|
2018-04-06 15:03:20 +00:00
|
|
|
}
|
|
|
|
|
2018-04-30 17:23:35 +00:00
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
void GNSSFlowgraph::init()
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Instantiates the receiver blocks
|
|
|
|
*/
|
2016-04-15 14:33:41 +00:00
|
|
|
std::unique_ptr<GNSSBlockFactory> block_factory_(new GNSSBlockFactory());
|
2012-04-14 18:04:27 +00:00
|
|
|
|
2015-02-12 17:56:05 +00:00
|
|
|
// 1. read the number of RF front-ends available (one file_source per RF front-end)
|
|
|
|
sources_count_ = configuration_->property("Receiver.sources_count", 1);
|
2012-01-16 18:27:31 +00:00
|
|
|
|
2015-03-01 21:23:17 +00:00
|
|
|
int RF_Channels = 0;
|
|
|
|
int signal_conditioner_ID = 0;
|
2015-03-01 19:25:50 +00:00
|
|
|
|
2015-02-27 17:21:25 +00:00
|
|
|
if (sources_count_ > 1)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < sources_count_; i++)
|
|
|
|
{
|
2015-03-01 21:23:17 +00:00
|
|
|
std::cout << "Creating source " << i << std::endl;
|
2015-02-27 17:21:25 +00:00
|
|
|
sig_source_.push_back(block_factory_->GetSignalSource(configuration_, queue_, i));
|
2018-04-20 11:20:10 +00:00
|
|
|
// TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
|
|
|
|
// Include GetRFChannels in the interface to avoid read config parameters here
|
|
|
|
// read the number of RF channels for each front-end
|
2015-03-01 21:23:17 +00:00
|
|
|
RF_Channels = configuration_->property(sig_source_.at(i)->role() + ".RF_channels", 1);
|
|
|
|
std::cout << "RF Channels " << RF_Channels << std::endl;
|
|
|
|
for (int j = 0; j < RF_Channels; j++)
|
|
|
|
{
|
2016-05-09 23:32:26 +00:00
|
|
|
sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_, signal_conditioner_ID));
|
2015-03-01 21:23:17 +00:00
|
|
|
signal_conditioner_ID++;
|
|
|
|
}
|
2015-02-27 17:21:25 +00:00
|
|
|
}
|
|
|
|
}
|
2017-05-05 14:37:29 +00:00
|
|
|
else
|
|
|
|
{
|
2018-04-20 11:20:10 +00:00
|
|
|
// backwards compatibility for old config files
|
2015-02-27 17:21:25 +00:00
|
|
|
sig_source_.push_back(block_factory_->GetSignalSource(configuration_, queue_, -1));
|
2018-04-20 11:20:10 +00:00
|
|
|
// TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
|
|
|
|
// Include GetRFChannels in the interface to avoid read config parameters here
|
|
|
|
// read the number of RF channels for each front-end
|
2015-03-01 21:23:17 +00:00
|
|
|
RF_Channels = configuration_->property(sig_source_.at(0)->role() + ".RF_channels", 0);
|
|
|
|
if (RF_Channels != 0)
|
|
|
|
{
|
|
|
|
for (int j = 0; j < RF_Channels; j++)
|
|
|
|
{
|
2016-05-09 23:32:26 +00:00
|
|
|
sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_, signal_conditioner_ID));
|
2015-03-01 21:23:17 +00:00
|
|
|
signal_conditioner_ID++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-20 11:20:10 +00:00
|
|
|
// old config file, single signal source and single channel, not specified
|
2016-05-09 23:32:26 +00:00
|
|
|
sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_, -1));
|
2015-03-01 21:23:17 +00:00
|
|
|
}
|
2017-05-05 14:37:29 +00:00
|
|
|
}
|
2015-02-12 17:56:05 +00:00
|
|
|
|
2016-05-09 23:32:26 +00:00
|
|
|
observables_ = block_factory_->GetObservables(configuration_);
|
2017-05-08 19:17:54 +00:00
|
|
|
// Mark old implementations as deprecated
|
|
|
|
std::string default_str("Default");
|
|
|
|
std::string obs_implementation = configuration_->property("Observables.implementation", default_str);
|
|
|
|
if ((obs_implementation.compare("GPS_L1_CA_Observables") == 0) || (obs_implementation.compare("GPS_L2C_Observables") == 0) ||
|
2018-03-03 01:03:39 +00:00
|
|
|
(obs_implementation.compare("Galileo_E1B_Observables") == 0) || (obs_implementation.compare("Galileo_E5A_Observables") == 0))
|
2017-05-05 14:37:29 +00:00
|
|
|
{
|
2017-05-10 20:16:18 +00:00
|
|
|
std::cout << "WARNING: Implementation '" << obs_implementation << "' of the Observables block has been replaced by 'Hybrid_Observables'." << std::endl;
|
|
|
|
std::cout << "Please update your configuration file." << std::endl;
|
2017-05-05 14:37:29 +00:00
|
|
|
}
|
2015-02-12 17:56:05 +00:00
|
|
|
|
2016-05-09 23:32:26 +00:00
|
|
|
pvt_ = block_factory_->GetPVT(configuration_);
|
2017-05-08 19:17:54 +00:00
|
|
|
// Mark old implementations as deprecated
|
|
|
|
std::string pvt_implementation = configuration_->property("PVT.implementation", default_str);
|
2017-05-10 14:42:22 +00:00
|
|
|
if ((pvt_implementation.compare("GPS_L1_CA_PVT") == 0) || (pvt_implementation.compare("Galileo_E1_PVT") == 0) || (pvt_implementation.compare("Hybrid_PVT") == 0))
|
2017-05-08 19:17:54 +00:00
|
|
|
{
|
2017-05-10 20:16:18 +00:00
|
|
|
std::cout << "WARNING: Implementation '" << pvt_implementation << "' of the PVT block has been replaced by 'RTKLIB_PVT'." << std::endl;
|
|
|
|
std::cout << "Please update your configuration file." << std::endl;
|
2017-05-08 19:17:54 +00:00
|
|
|
}
|
2011-10-01 18:45:20 +00:00
|
|
|
|
2018-05-01 21:32:52 +00:00
|
|
|
std::shared_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = block_factory_->GetChannels(configuration_, queue_);
|
2012-01-16 18:27:31 +00:00
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
channels_count_ = channels->size();
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
2015-02-27 17:21:25 +00:00
|
|
|
std::shared_ptr<GNSSBlockInterface> chan_ = std::move(channels->at(i));
|
2015-02-12 17:56:05 +00:00
|
|
|
channels_.push_back(std::dynamic_pointer_cast<ChannelInterface>(chan_));
|
2012-04-14 18:04:27 +00:00
|
|
|
}
|
2011-10-01 18:45:20 +00:00
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
top_block_ = gr::make_top_block("GNSSFlowgraph");
|
2011-10-01 18:45:20 +00:00
|
|
|
|
2018-06-14 21:10:43 +00:00
|
|
|
mapStringValues_["1C"] = evGPS_1C;
|
|
|
|
mapStringValues_["2S"] = evGPS_2S;
|
|
|
|
mapStringValues_["L5"] = evGPS_L5;
|
|
|
|
mapStringValues_["1B"] = evGAL_1B;
|
|
|
|
mapStringValues_["5X"] = evGAL_5X;
|
|
|
|
mapStringValues_["1G"] = evGLO_1G;
|
|
|
|
mapStringValues_["2G"] = evGLO_2G;
|
|
|
|
|
|
|
|
// fill the signals queue with the satellites ID's to be searched by the acquisition
|
2012-04-14 18:04:27 +00:00
|
|
|
set_signals_list();
|
|
|
|
set_channels_state();
|
|
|
|
applied_actions_ = 0;
|
|
|
|
DLOG(INFO) << "Blocks instantiated. " << channels_count_ << " channels.";
|
2018-07-03 11:25:43 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Instantiate the receiver monitor block, if required
|
|
|
|
*/
|
|
|
|
enable_monitor_ = configuration_->property("Monitor.enable_monitor", false);
|
|
|
|
|
|
|
|
std::vector<std::string> udp_addr_vec;
|
|
|
|
|
|
|
|
std::string address_string = configuration_->property("Monitor.client_addresses", std::string("127.0.0.1"));
|
|
|
|
//todo: split the string in substrings using the separator and fill the address vector.
|
|
|
|
udp_addr_vec.push_back(address_string);
|
|
|
|
|
|
|
|
if (enable_monitor_)
|
|
|
|
{
|
|
|
|
GnssSynchroMonitor_ = gr::basic_block_sptr(new gnss_synchro_monitor(channels_count_,
|
|
|
|
configuration_->property("Monitor.output_rate_ms", 1),
|
|
|
|
configuration_->property("Monitor.udp_port", 1234),
|
|
|
|
udp_addr_vec));
|
|
|
|
}
|
2011-10-01 18:45:20 +00:00
|
|
|
}
|
|
|
|
|
2015-02-27 17:21:25 +00:00
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
void GNSSFlowgraph::set_signals_list()
|
|
|
|
{
|
2018-04-20 10:50:32 +00:00
|
|
|
// Set a sequential list of GNSS satellites
|
2017-08-17 09:03:02 +00:00
|
|
|
std::set<unsigned int>::const_iterator available_gnss_prn_iter;
|
2013-07-20 07:58:59 +00:00
|
|
|
|
2018-04-20 10:50:32 +00:00
|
|
|
// Create the lists of GNSS satellites
|
2018-03-03 01:03:39 +00:00
|
|
|
std::set<unsigned int> available_gps_prn = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
|
|
|
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
|
|
|
|
29, 30, 31, 32};
|
2015-05-07 14:30:01 +00:00
|
|
|
|
2018-08-21 14:41:07 +00:00
|
|
|
std::set<unsigned int> available_sbas_prn = {123, 131, 135, 136, 138};
|
2015-05-08 23:48:16 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
std::set<unsigned int> available_galileo_prn = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
|
|
|
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
|
|
|
|
29, 30, 31, 32, 33, 34, 35, 36};
|
2015-05-08 23:48:16 +00:00
|
|
|
|
2017-09-09 19:44:35 +00:00
|
|
|
// Removing satellites sharing same frequency number(1 and 5, 2 and 6, 3 and 7, 4 and 6, 11 and 15, 12 and 16, 14 and 18, 17 and 21
|
2018-03-03 01:03:39 +00:00
|
|
|
std::set<unsigned int> available_glonass_prn = {1, 2, 3, 4, 9, 10, 11, 12, 18, 19, 20, 21, 24};
|
2017-03-29 15:15:57 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
std::string sv_list = configuration_->property("Galileo.prns", std::string(""));
|
2015-10-24 08:39:10 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (sv_list.length() > 0)
|
2017-05-05 14:37:29 +00:00
|
|
|
{
|
2016-05-01 23:28:37 +00:00
|
|
|
// Reset the available prns:
|
2018-03-03 01:03:39 +00:00
|
|
|
std::set<unsigned int> tmp_set;
|
|
|
|
boost::tokenizer<> tok(sv_list);
|
|
|
|
std::transform(tok.begin(), tok.end(), std::inserter(tmp_set, tmp_set.begin()),
|
|
|
|
boost::lexical_cast<unsigned int, std::string>);
|
2016-05-01 23:28:37 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (tmp_set.size() > 0)
|
2016-05-01 23:28:37 +00:00
|
|
|
{
|
|
|
|
available_galileo_prn = tmp_set;
|
|
|
|
}
|
2015-10-24 08:39:10 +00:00
|
|
|
}
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
sv_list = configuration_->property("GPS.prns", std::string(""));
|
2015-05-08 23:48:16 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (sv_list.length() > 0)
|
2017-05-05 14:37:29 +00:00
|
|
|
{
|
2016-05-01 23:28:37 +00:00
|
|
|
// Reset the available prns:
|
2018-03-03 01:03:39 +00:00
|
|
|
std::set<unsigned int> tmp_set;
|
|
|
|
boost::tokenizer<> tok(sv_list);
|
|
|
|
std::transform(tok.begin(), tok.end(), std::inserter(tmp_set, tmp_set.begin()),
|
|
|
|
boost::lexical_cast<unsigned int, std::string>);
|
2016-05-01 23:28:37 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (tmp_set.size() > 0)
|
2016-05-01 23:28:37 +00:00
|
|
|
{
|
|
|
|
available_gps_prn = tmp_set;
|
|
|
|
}
|
2015-10-24 08:39:10 +00:00
|
|
|
}
|
2016-05-01 23:28:37 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
sv_list = configuration_->property("SBAS.prns", std::string(""));
|
2015-05-08 23:48:16 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (sv_list.length() > 0)
|
2017-05-05 14:37:29 +00:00
|
|
|
{
|
2016-05-01 23:28:37 +00:00
|
|
|
// Reset the available prns:
|
2018-03-03 01:03:39 +00:00
|
|
|
std::set<unsigned int> tmp_set;
|
|
|
|
boost::tokenizer<> tok(sv_list);
|
|
|
|
std::transform(tok.begin(), tok.end(), std::inserter(tmp_set, tmp_set.begin()),
|
|
|
|
boost::lexical_cast<unsigned int, std::string>);
|
2016-05-01 23:28:37 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (tmp_set.size() > 0)
|
2016-05-01 23:28:37 +00:00
|
|
|
{
|
|
|
|
available_sbas_prn = tmp_set;
|
|
|
|
}
|
2015-10-24 08:39:10 +00:00
|
|
|
}
|
2015-05-08 23:48:16 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
sv_list = configuration_->property("Glonass.prns", std::string(""));
|
2017-03-29 15:15:57 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (sv_list.length() > 0)
|
2017-03-29 15:15:57 +00:00
|
|
|
{
|
|
|
|
// Reset the available prns:
|
2018-03-03 01:03:39 +00:00
|
|
|
std::set<unsigned int> tmp_set;
|
|
|
|
boost::tokenizer<> tok(sv_list);
|
|
|
|
std::transform(tok.begin(), tok.end(), std::inserter(tmp_set, tmp_set.begin()),
|
|
|
|
boost::lexical_cast<unsigned int, std::string>);
|
2017-03-29 15:15:57 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (tmp_set.size() > 0)
|
2017-03-29 15:15:57 +00:00
|
|
|
{
|
|
|
|
available_glonass_prn = tmp_set;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (configuration_->property("Channels_1C.count", 0) > 0)
|
2014-04-13 16:58:52 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
// Loop to create GPS L1 C/A signals
|
2017-08-17 09:03:02 +00:00
|
|
|
for (available_gnss_prn_iter = available_gps_prn.cbegin();
|
2018-03-03 01:03:39 +00:00
|
|
|
available_gnss_prn_iter != available_gps_prn.cend();
|
|
|
|
available_gnss_prn_iter++)
|
2014-04-13 16:58:52 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GPS_1C_signals_.push_back(Gnss_Signal(
|
2018-03-03 01:03:39 +00:00
|
|
|
Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter),
|
|
|
|
std::string("1C")));
|
2014-04-13 16:58:52 +00:00
|
|
|
}
|
|
|
|
}
|
2013-07-20 07:58:59 +00:00
|
|
|
|
2016-04-21 16:54:08 +00:00
|
|
|
if (configuration_->property("Channels_2S.count", 0) > 0)
|
2015-04-24 17:11:45 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
// Loop to create GPS L2C M signals
|
2017-08-17 09:03:02 +00:00
|
|
|
for (available_gnss_prn_iter = available_gps_prn.cbegin();
|
2018-03-03 01:03:39 +00:00
|
|
|
available_gnss_prn_iter != available_gps_prn.cend();
|
|
|
|
available_gnss_prn_iter++)
|
2015-04-24 17:11:45 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GPS_2S_signals_.push_back(Gnss_Signal(
|
2018-03-03 01:03:39 +00:00
|
|
|
Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter),
|
|
|
|
std::string("2S")));
|
2015-04-24 17:11:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-30 16:42:19 +00:00
|
|
|
if (configuration_->property("Channels_L5.count", 0) > 0)
|
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
// Loop to create GPS L5 signals
|
2017-11-30 16:42:19 +00:00
|
|
|
for (available_gnss_prn_iter = available_gps_prn.cbegin();
|
2018-03-03 01:03:39 +00:00
|
|
|
available_gnss_prn_iter != available_gps_prn.cend();
|
|
|
|
available_gnss_prn_iter++)
|
2017-11-30 16:42:19 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GPS_L5_signals_.push_back(Gnss_Signal(
|
2018-03-03 01:03:39 +00:00
|
|
|
Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter),
|
|
|
|
std::string("L5")));
|
2017-11-30 16:42:19 +00:00
|
|
|
}
|
|
|
|
}
|
2018-04-20 10:50:32 +00:00
|
|
|
|
2016-04-21 16:54:08 +00:00
|
|
|
if (configuration_->property("Channels_SBAS.count", 0) > 0)
|
2014-04-13 16:58:52 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
// Loop to create SBAS L1 C/A signals
|
2017-08-17 09:03:02 +00:00
|
|
|
for (available_gnss_prn_iter = available_sbas_prn.cbegin();
|
2018-03-03 01:03:39 +00:00
|
|
|
available_gnss_prn_iter != available_sbas_prn.cend();
|
|
|
|
available_gnss_prn_iter++)
|
2014-04-13 16:58:52 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
available_SBAS_1C_signals_.push_back(Gnss_Signal(
|
2018-03-03 01:03:39 +00:00
|
|
|
Gnss_Satellite(std::string("SBAS"), *available_gnss_prn_iter),
|
|
|
|
std::string("1C")));
|
2014-04-13 16:58:52 +00:00
|
|
|
}
|
|
|
|
}
|
2013-07-20 07:58:59 +00:00
|
|
|
|
2016-04-21 16:54:08 +00:00
|
|
|
if (configuration_->property("Channels_1B.count", 0) > 0)
|
2012-09-03 11:58:28 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
// Loop to create the list of Galileo E1B signals
|
2017-08-17 09:03:02 +00:00
|
|
|
for (available_gnss_prn_iter = available_galileo_prn.cbegin();
|
2018-03-03 01:03:39 +00:00
|
|
|
available_gnss_prn_iter != available_galileo_prn.cend();
|
|
|
|
available_gnss_prn_iter++)
|
2015-05-07 14:30:01 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GAL_1B_signals_.push_back(Gnss_Signal(
|
2018-03-03 01:03:39 +00:00
|
|
|
Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter),
|
|
|
|
std::string("1B")));
|
2015-05-07 14:30:01 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-13 16:58:52 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (configuration_->property("Channels_5X.count", 0) > 0)
|
2015-05-07 14:30:01 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
// Loop to create the list of Galileo E5a signals
|
2017-08-17 09:03:02 +00:00
|
|
|
for (available_gnss_prn_iter = available_galileo_prn.cbegin();
|
2018-03-03 01:03:39 +00:00
|
|
|
available_gnss_prn_iter != available_galileo_prn.cend();
|
|
|
|
available_gnss_prn_iter++)
|
2014-04-13 16:58:52 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GAL_5X_signals_.push_back(Gnss_Signal(
|
2018-03-03 01:03:39 +00:00
|
|
|
Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter),
|
|
|
|
std::string("5X")));
|
2014-04-13 16:58:52 +00:00
|
|
|
}
|
2012-04-14 18:04:27 +00:00
|
|
|
}
|
2017-03-29 15:15:57 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (configuration_->property("Channels_1G.count", 0) > 0)
|
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
// Loop to create the list of GLONASS L1 C/A signals
|
2018-03-03 01:03:39 +00:00
|
|
|
for (available_gnss_prn_iter = available_glonass_prn.begin();
|
|
|
|
available_gnss_prn_iter != available_glonass_prn.end();
|
|
|
|
available_gnss_prn_iter++)
|
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GLO_1G_signals_.push_back(Gnss_Signal(
|
2018-03-03 01:03:39 +00:00
|
|
|
Gnss_Satellite(std::string("Glonass"), *available_gnss_prn_iter),
|
|
|
|
std::string("1G")));
|
|
|
|
}
|
|
|
|
}
|
2018-03-24 18:42:04 +00:00
|
|
|
|
|
|
|
if (configuration_->property("Channels_2G.count", 0) > 0)
|
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
// Loop to create the list of GLONASS L2 C/A signals
|
2018-03-24 18:42:04 +00:00
|
|
|
for (available_gnss_prn_iter = available_glonass_prn.begin();
|
|
|
|
available_gnss_prn_iter != available_glonass_prn.end();
|
|
|
|
available_gnss_prn_iter++)
|
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GLO_2G_signals_.push_back(Gnss_Signal(
|
2018-03-24 18:42:04 +00:00
|
|
|
Gnss_Satellite(std::string("Glonass"), *available_gnss_prn_iter),
|
|
|
|
std::string("2G")));
|
|
|
|
}
|
|
|
|
}
|
2012-03-02 17:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-14 18:04:27 +00:00
|
|
|
void GNSSFlowgraph::set_channels_state()
|
|
|
|
{
|
2018-04-20 10:50:32 +00:00
|
|
|
max_acq_channels_ = configuration_->property("Channels.in_acquisition", channels_count_);
|
2012-04-14 18:04:27 +00:00
|
|
|
if (max_acq_channels_ > channels_count_)
|
|
|
|
{
|
|
|
|
max_acq_channels_ = channels_count_;
|
2016-05-01 23:28:37 +00:00
|
|
|
LOG(WARNING) << "Channels_in_acquisition is bigger than number of channels. Variable acq_channels_count_ is set to " << channels_count_;
|
2012-04-14 18:04:27 +00:00
|
|
|
}
|
|
|
|
channels_state_.reserve(channels_count_);
|
|
|
|
for (unsigned int i = 0; i < channels_count_; i++)
|
|
|
|
{
|
2018-03-03 01:03:39 +00:00
|
|
|
if (i < max_acq_channels_)
|
|
|
|
{
|
|
|
|
channels_state_.push_back(1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
channels_state_.push_back(0);
|
|
|
|
}
|
2015-05-04 20:16:26 +00:00
|
|
|
DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i];
|
2012-04-14 18:04:27 +00:00
|
|
|
}
|
2018-06-17 19:52:18 +00:00
|
|
|
std::lock_guard<std::mutex> lock(signal_list_mutex);
|
2012-04-14 18:04:27 +00:00
|
|
|
acq_channels_count_ = max_acq_channels_;
|
|
|
|
DLOG(INFO) << acq_channels_count_ << " channels in acquisition state";
|
2011-10-01 18:45:20 +00:00
|
|
|
}
|
2018-01-05 10:50:52 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
|
2018-06-14 21:10:43 +00:00
|
|
|
Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool pop, bool tracked)
|
2018-01-05 10:50:52 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
Gnss_Signal result;
|
|
|
|
bool untracked_satellite = true;
|
|
|
|
switch (mapStringValues_[searched_signal])
|
2018-01-05 10:50:52 +00:00
|
|
|
{
|
2018-06-14 21:10:43 +00:00
|
|
|
case evGPS_1C:
|
|
|
|
result = available_GPS_1C_signals_.front();
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GPS_1C_signals_.pop_front();
|
|
|
|
if (!pop)
|
2018-06-14 21:10:43 +00:00
|
|
|
{
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GPS_1C_signals_.push_back(result);
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
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++)
|
|
|
|
{
|
2018-06-15 12:35:53 +00:00
|
|
|
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1C") != 0)) untracked_satellite = false;
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0)
|
|
|
|
{
|
|
|
|
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S");
|
2018-06-15 12:35:53 +00:00
|
|
|
available_GPS_2S_signals_.remove(gs);
|
2018-06-14 21:10:43 +00:00
|
|
|
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");
|
2018-06-15 12:35:53 +00:00
|
|
|
available_GPS_L5_signals_.remove(gs);
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GPS_L5_signals_.push_front(gs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGPS_2S:
|
|
|
|
result = available_GPS_2S_signals_.front();
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GPS_2S_signals_.pop_front();
|
|
|
|
if (!pop)
|
2018-06-14 21:10:43 +00:00
|
|
|
{
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GPS_2S_signals_.push_back(result);
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
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++)
|
|
|
|
{
|
2018-06-15 12:35:53 +00:00
|
|
|
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("2S") != 0)) untracked_satellite = false;
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0)
|
|
|
|
{
|
|
|
|
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C");
|
2018-06-15 12:35:53 +00:00
|
|
|
available_GPS_1C_signals_.remove(gs);
|
2018-06-14 21:10:43 +00:00
|
|
|
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");
|
2018-06-15 12:35:53 +00:00
|
|
|
available_GPS_L5_signals_.remove(gs);
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GPS_L5_signals_.push_front(gs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGPS_L5:
|
|
|
|
result = available_GPS_L5_signals_.front();
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GPS_L5_signals_.pop_front();
|
|
|
|
if (!pop)
|
2018-06-14 21:10:43 +00:00
|
|
|
{
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GPS_L5_signals_.push_back(result);
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
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++)
|
|
|
|
{
|
2018-06-15 12:35:53 +00:00
|
|
|
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("L5") != 0)) untracked_satellite = false;
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0)
|
|
|
|
{
|
|
|
|
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C");
|
2018-06-15 12:35:53 +00:00
|
|
|
available_GPS_1C_signals_.remove(gs);
|
2018-06-14 21:10:43 +00:00
|
|
|
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");
|
2018-06-15 12:35:53 +00:00
|
|
|
available_GPS_2S_signals_.remove(gs);
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GPS_2S_signals_.push_front(gs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGAL_1B:
|
|
|
|
result = available_GAL_1B_signals_.front();
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GAL_1B_signals_.pop_front();
|
|
|
|
if (!pop)
|
2018-06-14 21:10:43 +00:00
|
|
|
{
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GAL_1B_signals_.push_back(result);
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
if (tracked)
|
|
|
|
{
|
|
|
|
if (configuration_->property("Channels_5X.count", 0) > 0)
|
|
|
|
{
|
|
|
|
for (unsigned int ch = 0; ch < channels_count_; ch++)
|
|
|
|
{
|
2018-06-15 12:35:53 +00:00
|
|
|
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1B") != 0)) untracked_satellite = false;
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
if (untracked_satellite)
|
|
|
|
{
|
|
|
|
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "5X");
|
2018-06-15 12:35:53 +00:00
|
|
|
available_GAL_5X_signals_.remove(gs);
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GAL_5X_signals_.push_front(gs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGAL_5X:
|
|
|
|
result = available_GAL_5X_signals_.front();
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GAL_5X_signals_.pop_front();
|
|
|
|
if (!pop)
|
2018-06-14 21:10:43 +00:00
|
|
|
{
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GAL_5X_signals_.push_back(result);
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
if (tracked)
|
|
|
|
{
|
|
|
|
if (configuration_->property("Channels_1B.count", 0) > 0)
|
|
|
|
{
|
|
|
|
for (unsigned int ch = 0; ch < channels_count_; ch++)
|
|
|
|
{
|
2018-06-15 12:35:53 +00:00
|
|
|
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("5X") != 0)) untracked_satellite = false;
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
if (untracked_satellite)
|
|
|
|
{
|
|
|
|
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1B");
|
2018-06-15 12:35:53 +00:00
|
|
|
available_GAL_1B_signals_.remove(gs);
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GAL_1B_signals_.push_front(gs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGLO_1G:
|
|
|
|
result = available_GLO_1G_signals_.front();
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GLO_1G_signals_.pop_front();
|
|
|
|
if (!pop)
|
2018-06-14 21:10:43 +00:00
|
|
|
{
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GLO_1G_signals_.push_back(result);
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
if (tracked)
|
|
|
|
{
|
|
|
|
if (configuration_->property("Channels_2G.count", 0) > 0)
|
|
|
|
{
|
|
|
|
for (unsigned int ch = 0; ch < channels_count_; ch++)
|
|
|
|
{
|
2018-06-15 12:35:53 +00:00
|
|
|
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1G") != 0)) untracked_satellite = false;
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
if (untracked_satellite)
|
|
|
|
{
|
|
|
|
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2G");
|
2018-06-15 12:35:53 +00:00
|
|
|
available_GLO_2G_signals_.remove(gs);
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GLO_2G_signals_.push_front(gs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evGLO_2G:
|
|
|
|
result = available_GLO_2G_signals_.front();
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GLO_2G_signals_.pop_front();
|
|
|
|
if (!pop)
|
2018-06-14 21:10:43 +00:00
|
|
|
{
|
2018-07-08 11:30:49 +00:00
|
|
|
available_GLO_2G_signals_.push_back(result);
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
if (tracked)
|
|
|
|
{
|
|
|
|
if (configuration_->property("Channels_1G.count", 0) > 0)
|
|
|
|
{
|
|
|
|
for (unsigned int ch = 0; ch < channels_count_; ch++)
|
|
|
|
{
|
2018-06-15 12:35:53 +00:00
|
|
|
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("2G") != 0)) untracked_satellite = false;
|
2018-06-14 21:10:43 +00:00
|
|
|
}
|
|
|
|
if (untracked_satellite)
|
|
|
|
{
|
|
|
|
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1G");
|
2018-06-15 12:35:53 +00:00
|
|
|
available_GLO_1G_signals_.remove(gs);
|
2018-06-14 21:10:43 +00:00
|
|
|
available_GLO_1G_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;
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2018-01-05 10:50:52 +00:00
|
|
|
return result;
|
|
|
|
}
|