1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-18 11:09:56 +00:00

Allowing multisignal configurations

This commit is contained in:
Carles Fernandez 2015-05-09 01:48:16 +02:00
parent 1536ab7be0
commit 9e534ab814
2 changed files with 140 additions and 52 deletions

View File

@ -432,6 +432,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
std::string telemetry_decoder_implementation;
std::string acquisition_implementation;
unsigned int total_channels = configuration->property("Channels_GPS.count", 0) +
configuration->property("Channels_1C.count", 0) +
configuration->property("Channels_2S.count", 0) +
configuration->property("Channels_Galileo.count", 0) +
configuration->property("Channels_1B.count", 0) +
configuration->property("Channels_5X.count", 0);
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels(new std::vector<std::unique_ptr<GNSSBlockInterface>>());
unsigned int channel_absolute_id = 0;
@ -463,13 +471,29 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
acquisition_implementation = configuration->property("Acquisition_1C.implementation", default_implementation);
}
for (unsigned int i = 0; i < channel_count; i++)
bool apply_;
std::string s;
for (unsigned int i = 0; i < total_channels; i++)
{
apply_ = false;
if( total_channels == channel_count )
{
apply_ = true;
}
// Search for specific implementation of that particular channel in config file
//(i.e. Acquisition_GPS0.implementation=xxxx) DEPRECATED
s = configuration->property("Channel" + boost::lexical_cast<std::string>(i) + ".signal", std::string("W"));
if( s.compare("1C") == 0 )
{
apply_ = true;
}
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_GPS" + boost::lexical_cast<std::string>(i) + ".implementation",
default_implementation);
//(i.e. Acquisition_1C0.implementation=xxxx)
if(acquisition_implementation_specific.compare(default_implementation) == 0)
{
@ -481,6 +505,7 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(acquisition_implementation_specific.compare(default_implementation) != 0)
{
acquisition_implementation = acquisition_implementation_specific;
apply_ = true;
}
//(i.e. Tracking_GPS0.implementation=xxxx) DEPRECATED
@ -498,6 +523,7 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(tracking_implementation_specific.compare(default_implementation) != 0)
{
tracking_implementation = tracking_implementation_specific;
apply_ = true;
}
//(i.e. TelemetryDecoder_GPS0.implementation=xxxx) DEPRECATED
@ -514,20 +540,22 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(telemetry_decoder_implementation_specific.compare(default_implementation) != 0)
{
telemetry_decoder_implementation = telemetry_decoder_implementation_specific;
apply_ = true;
}
if(configuration->property("Channels_GPS.count", 0) > 0)
// Push back the channel to the vector of channels, if apply.
if((configuration->property("Channels_GPS.count", 0) > 0) and apply_)
{
channels->push_back(std::move(GetChannel_GPS(configuration,
acquisition_implementation, tracking_implementation, telemetry_decoder_implementation, channel_absolute_id, queue)));
acquisition_implementation, tracking_implementation, telemetry_decoder_implementation, i, queue)));
channel_absolute_id++;
}
if(configuration->property("Channels_1C.count", 0) > 0)
if((configuration->property("Channels_1C.count", 0) > 0) and apply_)
{
channels->push_back(std::move(GetChannel_1C(configuration,
acquisition_implementation, tracking_implementation, telemetry_decoder_implementation, channel_absolute_id, queue)));
acquisition_implementation, tracking_implementation, telemetry_decoder_implementation, i, queue)));
channel_absolute_id++;
}
channel_absolute_id++;
}
//**************** GPS L2C (M) CHANNELS **********************
@ -539,10 +567,21 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
telemetry_decoder_implementation = configuration->property("TelemetryDecoder_2S.implementation", default_implementation);
acquisition_implementation = configuration->property("Acquisition_2S.implementation", default_implementation);
for (unsigned int i = 0; i < channel_count; i++)
for (unsigned int i = 0; i < total_channels; i++)
{
apply_ = false;
if( total_channels == channel_count )
{
apply_ = true;
}
// Search for specific implementation of that particular channel in config file
//(i.e. Acquisition_2S0.implementation=xxxx)
s = configuration->property("Channel" + boost::lexical_cast<std::string>(i) + ".signal", std::string("W"));
if( s.compare("2S") == 0 )
{
apply_ = true;
}
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_2S" + boost::lexical_cast<std::string>(i) + ".implementation",
default_implementation);
@ -550,6 +589,7 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(acquisition_implementation_specific.compare(default_implementation) != 0)
{
acquisition_implementation = acquisition_implementation_specific;
apply_ = true;
}
//(i.e. Tracking_2S0.implementation=xxxx)
@ -560,9 +600,9 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(tracking_implementation_specific.compare(default_implementation) != 0)
{
tracking_implementation = tracking_implementation_specific;
apply_ = true;
}
//(i.e. TelemetryDecoder_1C0.implementation=xxxx)
std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_2S" + boost::lexical_cast<std::string>(i) + ".implementation",
@ -571,11 +611,17 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(telemetry_decoder_implementation_specific.compare(default_implementation) != 0)
{
telemetry_decoder_implementation = telemetry_decoder_implementation_specific;
apply_ = true;
}
channels->push_back(std::move(GetChannel_GPS(configuration,
acquisition_implementation, tracking_implementation, telemetry_decoder_implementation, channel_absolute_id, queue)));
channel_absolute_id++;
// Push back the channel to the vector of channels, if apply.
if((channel_count > 0) and apply_)
{
channels->push_back(std::move(GetChannel_GPS(configuration,
acquisition_implementation, tracking_implementation, telemetry_decoder_implementation, i, queue)));
channel_absolute_id++;
}
}
@ -606,13 +652,28 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
acquisition_implementation = configuration->property("Acquisition_1B.count", 0);
}
for (unsigned int i = 0; i < channel_count; i++)
for (unsigned int i = 0; i < total_channels; i++)
{
apply_ = false;
if( total_channels == channel_count )
{
apply_ = true;
}
// Search for specific implementation of that particular channel in config file
//(i.e. Acquisition_Galileo0.implementation=xxxx) DEPRECATED
s = configuration->property("Channel" + boost::lexical_cast<std::string>(i) + ".signal", std::string("W"));
if( s.compare("IB") == 0 )
{
apply_ = true;
}
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_Galileo" + boost::lexical_cast<std::string>(i) + ".implementation",
default_implementation);
std::string s = configuration->property("Channel" + boost::lexical_cast<std::string>(i) + ".signal", std::string("W"));
if( s.compare("1B") == 0 )
{
apply_ = true;
}
//(i.e. Acquisition_1B0.implementation=xxxx)
if(acquisition_implementation_specific.compare(default_implementation) == 0)
{
@ -624,6 +685,7 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(acquisition_implementation_specific.compare(default_implementation) != 0)
{
acquisition_implementation = acquisition_implementation_specific;
apply_ = true;
}
//(i.e. Tracking_Galileo0.implementation=xxxx) DEPRECATED
@ -641,6 +703,7 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(tracking_implementation_specific.compare(default_implementation) != 0)
{
tracking_implementation = tracking_implementation_specific;
apply_ = true;
}
//(i.e. TelemetryDecoder_Galileo0.implementation=xxxx) DEPRECATED
@ -658,11 +721,23 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(telemetry_decoder_implementation_specific.compare(default_implementation) != 0)
{
telemetry_decoder_implementation = telemetry_decoder_implementation_specific;
apply_ = true;
}
channels->push_back(std::move(GetChannel_Galileo(configuration,
acquisition_implementation, tracking_implementation, telemetry_decoder_implementation, channel_absolute_id, queue)));
channel_absolute_id++;
// Push back the channel to the vector of channels, if apply.
if((configuration->property("Channels_Galileo.count", 0) > 0) and apply_)
{
channels->push_back(std::move(GetChannel_Galileo(configuration,
acquisition_implementation, tracking_implementation, telemetry_decoder_implementation, i, queue)));
channel_absolute_id++;
}
if((configuration->property("Channels_1B.count", 0) > 0) and apply_)
{
channels->push_back(std::move(GetChannel_1B(configuration,
acquisition_implementation, tracking_implementation, telemetry_decoder_implementation, i, queue)));
channel_absolute_id++;
}
}
@ -675,10 +750,20 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
telemetry_decoder_implementation = configuration->property("TelemetryDecoder_5X.implementation", default_implementation);
acquisition_implementation = configuration->property("Acquisition_5X.implementation", default_implementation);
for (unsigned int i = 0; i < channel_count; i++)
for (unsigned int i = 0; i < total_channels; i++)
{
apply_ = false;
if( total_channels == channel_count )
{
apply_ = true;
}
// Search for specific implementation of that particular channel in config file
//(i.e. Acquisition_5X0.implementation=xxxx)
s = configuration->property("Channel" + boost::lexical_cast<std::string>(i) + ".signal", std::string("W"));
if( s.compare("5X") == 0 )
{
apply_ = true;
}
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_5X" + boost::lexical_cast<std::string>(i) + ".implementation",
default_implementation);
@ -686,6 +771,7 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(acquisition_implementation_specific.compare(default_implementation) != 0)
{
acquisition_implementation = acquisition_implementation_specific;
apply_ = true;
}
//(i.e. Tracking_5X0.implementation=xxxx)
@ -696,9 +782,9 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(tracking_implementation_specific.compare(default_implementation) != 0)
{
tracking_implementation = tracking_implementation_specific;
apply_ = true;
}
//(i.e. TelemetryDecoder_5X0.implementation=xxxx)
std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_5X" + boost::lexical_cast<std::string>(i) + ".implementation",
@ -707,11 +793,17 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
if(telemetry_decoder_implementation_specific.compare(default_implementation) != 0)
{
telemetry_decoder_implementation = telemetry_decoder_implementation_specific;
apply_ = true;
}
channels->push_back(std::move(GetChannel_5X(configuration,
acquisition_implementation, tracking_implementation, telemetry_decoder_implementation, channel_absolute_id, queue)));
channel_absolute_id++;
// Push back the channel to the vector of channels, if apply.
if((channel_count > 0) and apply_)
{
channels->push_back(std::move(GetChannel_5X(configuration,
acquisition_implementation, tracking_implementation, telemetry_decoder_implementation, i, queue)));
channel_absolute_id++;
}
}
return channels;
@ -1226,7 +1318,7 @@ std::unique_ptr<AcquisitionInterface> GNSSBlockFactory::GetAcqBlock(
else
{
// Log fatal. This causes execution to stop.
LOG(ERROR) << role<<"."<<implementation << ": Undefined implementation for block";
LOG(ERROR) << role << "." << implementation << ": Undefined implementation for block";
}
return std::move(block);
}

View File

@ -90,7 +90,7 @@ void GNSSFlowgraph::stop()
for (unsigned int i = 0; i < channels_count_; i++)
{
channels_.at(i)->stop();
LOG(INFO) << "Channel " << i << " in state " << channels_state_[i] << std::endl;
LOG(INFO) << "Channel " << i << " in state " << channels_state_[i];
}
LOG(INFO) << "Threads finished. Return to main program.";
top_block_->stop();
@ -405,9 +405,6 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
channels_.at(who)->set_signal(available_GNSS_signals_.front());
available_GNSS_signals_.pop_front();
channels_.at(who)->start_acquisition();
break;
@ -575,6 +572,13 @@ void GNSSFlowgraph::set_signals_list()
std::string default_system = configuration_->property("Channel.system", std::string("")); // DEPRECATED
std::string default_signal = configuration_->property("Channel.signal", std::string(""));
unsigned int total_channels = configuration_->property("Channels_GPS.count", 0) +
configuration_->property("Channels_1C.count", 0) +
configuration_->property("Channels_2S.count", 0) +
configuration_->property("Channels_Galileo.count", 0) +
configuration_->property("Channels_1B.count", 0) +
configuration_->property("Channels_5X.count", 0);
/*
* Loop to create the list of GNSS Signals
* To add signals from other systems, add another loop 'for'
@ -584,6 +588,14 @@ void GNSSFlowgraph::set_signals_list()
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32 };
std::set<unsigned int> available_sbas_prn = {120, 124, 126};
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, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36};
if ((configuration_->property("Channels_1C.count", 0) > 0) or (default_system.find(std::string("GPS")) != std::string::npos) or (default_signal.compare("1C") == 0) or (configuration_->property("Channels_GPS.count", 0) > 0) )
{
/*
@ -618,7 +630,7 @@ void GNSSFlowgraph::set_signals_list()
/*
* Loop to create SBAS L1 C/A signals
*/
std::set<unsigned int> available_sbas_prn = {120, 124, 126};
for (available_gnss_prn_iter = available_sbas_prn.begin();
available_gnss_prn_iter != available_sbas_prn.end();
@ -629,9 +641,7 @@ void GNSSFlowgraph::set_signals_list()
}
}
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, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36};
if ((configuration_->property("Channels_1B.count", 0) > 0) or (default_system.find(std::string("Galileo")) != std::string::npos) or (default_signal.compare("1B") == 0) or (configuration_->property("Channels_Galileo.count", 0) > 0))
{
@ -642,14 +652,12 @@ void GNSSFlowgraph::set_signals_list()
available_gnss_prn_iter != available_galileo_prn.end();
available_gnss_prn_iter++)
{
// available_GNSS_signals_.push_back(Gnss_Signal(Gnss_Satellite(std::string("Galileo"),
// *available_gnss_prn_iter), std::string("1B")));
available_GNSS_signals_.push_back(Gnss_Signal(Gnss_Satellite(std::string("Galileo"),
*available_gnss_prn_iter), std::string("1B")));
}
}
if ((configuration_->property("Channels_5X.count", 0) > 0) )
if ((configuration_->property("Channels_5X.count", 0) > 0) )
{
/*
* Loop to create the list of Galileo E1 B signals
@ -658,8 +666,6 @@ if ((configuration_->property("Channels_5X.count", 0) > 0) )
available_gnss_prn_iter != available_galileo_prn.end();
available_gnss_prn_iter++)
{
// available_GNSS_signals_.push_back(Gnss_Signal(Gnss_Satellite(std::string("Galileo"),
// *available_gnss_prn_iter), std::string("1B")));
available_GNSS_signals_.push_back(Gnss_Signal(Gnss_Satellite(std::string("Galileo"),
*available_gnss_prn_iter), std::string("5X")));
}
@ -668,27 +674,20 @@ if ((configuration_->property("Channels_5X.count", 0) > 0) )
/*
* Ordering the list of signals from configuration file
*/
std::list<Gnss_Signal>::iterator gnss_it = available_GNSS_signals_.begin();
// Preassignation if not defined at ChannelX.signal=1C ...? In what order?
for (unsigned int i = 0; i < channels_count_; i++)
for (unsigned int i = 0; i < total_channels; i++)
{
std::string gnss_system = (configuration_->property("Channel"
+ boost::lexical_cast<std::string>(i) + ".system",
default_system));
// LOG(INFO) << "Channel " << i << " system " << gnss_system;
std::string gnss_system = (configuration_->property("Channel" + boost::lexical_cast<std::string>(i) + ".system", default_system));
std::string gnss_signal = (configuration_->property("Channel"
+ boost::lexical_cast<std::string>(i) + ".signal",
default_signal));
std::string gnss_signal = (configuration_->property("Channel" + boost::lexical_cast<std::string>(i) + ".signal", default_signal));
LOG(INFO) << "Channel " << i << " signal " << gnss_signal;
unsigned int sat = configuration_->property("Channel"
+ boost::lexical_cast<std::string>(i) + ".satellite", 0);
unsigned int sat = configuration_->property("Channel" + boost::lexical_cast<std::string>(i) + ".satellite", 0);
if ((sat == 0) || (sat == gnss_it->get_satellite().get_PRN())) // 0 = not PRN in configuration file
if (((sat == 0) || (sat == gnss_it->get_satellite().get_PRN())) and ( gnss_it->get_signal().compare(gnss_signal) == 0 ) ) // 0 = not PRN in configuration file and ( gnss_it->get_signal().compare(gnss_signal) == 0 )
{
gnss_it++;
}
@ -696,15 +695,12 @@ if ((configuration_->property("Channels_5X.count", 0) > 0) )
{
if((gnss_signal.compare("1C") == 0) or (gnss_signal.compare("2S") == 0) ) gnss_system = "GPS";
if((gnss_signal.compare("1B") == 0) or (gnss_signal.compare("5X") == 0) ) gnss_system = "Galileo";
Gnss_Signal signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
DLOG(INFO) << "Channel " << i << " " << signal_value;
Gnss_Signal signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, gnss_it->get_satellite().get_PRN()), gnss_signal);
available_GNSS_signals_.remove(signal_value);
available_GNSS_signals_.insert(gnss_it, signal_value);
}
}
// **** FOR DEBUGGING THE LIST OF GNSS SIGNALS ****
// std::cout << "default_system=" << default_system << std::endl;