1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-27 01:14:51 +00:00

merging next Merge branch 'next' of https://git.code.sf.net/p/gnss-sdr/cttc into next

This commit is contained in:
Carles Fernandez 2015-02-27 19:21:49 +01:00
commit e4bd312731
7 changed files with 290 additions and 284 deletions

View File

@ -85,9 +85,6 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role,
fir_filter_fff_2_ = gr::filter::fir_filter_fff::make(1, taps_);
DLOG(INFO) << "I input_filter(" << fir_filter_fff_1_->unique_id() << ")";
DLOG(INFO) << "Q input_filter(" << fir_filter_fff_2_->unique_id() << ")";
//float_to_short_1_ = gr::blocks::float_to_short::make();
//float_to_short_2_ = gr::blocks::float_to_short::make();
//short_x2_to_cshort_ = make_short_x2_to_cshort();
float_to_complex_ = gr::blocks::float_to_complex::make();
if (dump_)
{

View File

@ -47,8 +47,18 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro
out_streams_(out_streams)
{
std::string default_item_type = "gr_complex";
item_type_ = configuration->property(role + ".item_type", default_item_type);
std::string input_type = configuration->property(role + ".input_item_type", default_item_type);
std::string output_type = configuration->property(role + ".output_item_type", default_item_type);
if(input_type.compare(output_type) != 0)
{
LOG(WARNING) << "input_item_type and output_item_type are different in a Pass_Through implementation! Taking "
<< input_type
<< ", but item_size will supersede it.";
}
item_type_ = configuration->property(role + ".item_type", input_type);
vector_size_ = configuration->property(role + ".vector_size", 1);
if(item_type_.compare("float") == 0)
{
item_size_ = sizeof(float);
@ -61,6 +71,10 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro
{
item_size_ = sizeof(int16_t);
}
else if(item_type_.compare("ishort") == 0)
{
item_size_ = sizeof(int16_t);
}
else if(item_type_.compare("cshort") == 0)
{
item_size_ = sizeof(lv_16sc_t);
@ -69,6 +83,10 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro
{
item_size_ = sizeof(int8_t);
}
else if(item_type_.compare("ibyte") == 0)
{
item_size_ = sizeof(int8_t);
}
else if(item_type_.compare("cbyte") == 0)
{
item_size_ = sizeof(lv_8sc_t);

View File

@ -53,7 +53,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
// UHD COMMON PARAMETERS
uhd::device_addr_t dev_addr;
device_address_= configuration->property(role + ".device_address", empty);
device_address_ = configuration->property(role + ".device_address", empty);
// When left empty, the device discovery routines will search all
// available transports on the system (ethernet, usb...).
// To narrow down the discovery process to a particular device,
@ -63,12 +63,12 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
dev_addr["addr"] = device_address_;
}
subdevice_=configuration->property(role + ".subdevice", empty);
RF_channels_=configuration->property(role + ".RF_channels", 1);
subdevice_ = configuration->property(role + ".subdevice", empty);
RF_channels_ = configuration->property(role + ".RF_channels", 1);
sample_rate_ = configuration->property(role + ".sampling_frequency", (double)4.0e6);
item_type_ = configuration->property(role + ".item_type", default_item_type);
if (RF_channels_==1)
if (RF_channels_ == 1)
{
// Single RF channel UHD operation (backward compatible config file format)
samples_.push_back(configuration->property(role + ".samples", 0));
@ -80,9 +80,11 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
IF_bandwidth_hz_.push_back(configuration->property(role + ".IF_bandwidth_hz", sample_rate_/2));
}else{
}
else
{
// multiple RF channels selected
for (int i=0;i<RF_channels_;i++)
for (int i = 0; i < RF_channels_; i++)
{
// Single RF channel UHD operation (backward compatible config file format)
samples_.push_back(configuration->property(role + ".samples" + boost::lexical_cast<std::string>(i), 0));
@ -108,27 +110,27 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
if (item_type_.compare("cbyte") == 0)
{
item_size_ = sizeof(lv_8sc_t);
uhd_stream_args_=uhd::stream_args_t("sc8");
uhd_stream_args_ = uhd::stream_args_t("sc8");
}
else if (item_type_.compare("cshort") == 0)
{
item_size_ = sizeof(lv_16sc_t);
uhd_stream_args_=uhd::stream_args_t("sc16");
uhd_stream_args_ = uhd::stream_args_t("sc16");
}
else if (item_type_.compare("gr_complex") == 0)
{
item_size_ = sizeof(gr_complex);
uhd_stream_args_=uhd::stream_args_t("fc32");
uhd_stream_args_ = uhd::stream_args_t("fc32");
}
else
{
LOG(WARNING) << item_type_ << " unrecognized item type. Using cshort.";
item_size_ = sizeof(lv_16sc_t);
uhd_stream_args_=uhd::stream_args_t("sc16");
uhd_stream_args_ = uhd::stream_args_t("sc16");
}
// select the number of channels and the subdevice specifications
for (int i=0;i<RF_channels_;i++)
for (int i = 0; i< RF_channels_; i++)
{
uhd_stream_args_.channels.push_back(i);
}
@ -161,7 +163,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
std::vector<std::string> sensor_names;
for (int i=0;i<RF_channels_;i++)
for (int i = 0; i < RF_channels_; i++)
{
// 3. Tune the usrp device to the desired center frequency
uhd_source_->set_center_freq(freq_.at(i),i);
@ -206,7 +208,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
}
for (int i=0;i<RF_channels_;i++)
for (int i = 0; i < RF_channels_; i++)
{
if (samples_.at(i) != 0)
{
@ -222,7 +224,6 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
DLOG(INFO) << "file_sink(" << file_sink_.at(i)->unique_id() << ")";
}
}
}
@ -230,12 +231,11 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
UhdSignalSource::~UhdSignalSource()
{}
void UhdSignalSource::connect(gr::top_block_sptr top_block)
{
for (int i=0;i<RF_channels_;i++)
for (int i = 0; i < RF_channels_; i++)
{
if (samples_.at(i) != 0)
{
top_block->connect(uhd_source_, i, valve_.at(i), 0);
@ -261,7 +261,7 @@ void UhdSignalSource::connect(gr::top_block_sptr top_block)
void UhdSignalSource::disconnect(gr::top_block_sptr top_block)
{
for (int i=0;i<RF_channels_;i++)
for (int i = 0; i < RF_channels_; i++)
{
if (samples_.at(i) != 0)
{
@ -297,6 +297,7 @@ gr::basic_block_sptr UhdSignalSource::get_right_block()
return get_right_block(0);
}
gr::basic_block_sptr UhdSignalSource::get_right_block(int RF_channel)
{
if (samples_.at(RF_channel) != 0)

View File

@ -128,10 +128,10 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetSignalSource(
std::shared_ptr<ConfigurationInterface> configuration, boost::shared_ptr<gr::msg_queue> queue, int ID)
{
std::string default_implementation = "File_Signal_Source";
std::string role="SignalSource";//backwards compatibility for old conf files
if (ID!=-1)
std::string role = "SignalSource"; //backwards compatibility for old conf files
if (ID != -1)
{
role="SignalSource"+ boost::lexical_cast<std::string>(ID);
role = "SignalSource" + boost::lexical_cast<std::string>(ID);
}
std::string implementation = configuration->property(role + ".implementation", default_implementation);
LOG(INFO) << "Getting SignalSource with implementation " << implementation;
@ -145,21 +145,21 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetSignalConditioner(
{
std::string default_implementation = "Pass_Through";
//backwards compatibility for old conf files
std::string role_conditioner="SignalConditioner" ;
std::string role_datatypeadapter="DataTypeAdapter";
std::string role_inputfilter="InputFilter";
std::string role_resampler="Resampler";
std::string role_conditioner = "SignalConditioner" ;
std::string role_datatypeadapter = "DataTypeAdapter";
std::string role_inputfilter = "InputFilter";
std::string role_resampler = "Resampler";
if (ID!=-1)
if (ID != -1)
{
role_conditioner="SignalConditioner" + boost::lexical_cast<std::string>(ID);
role_datatypeadapter="DataTypeAdapter" + boost::lexical_cast<std::string>(ID);
role_inputfilter="InputFilter" + boost::lexical_cast<std::string>(ID);
role_resampler="Resampler" + boost::lexical_cast<std::string>(ID);
role_conditioner = "SignalConditioner" + boost::lexical_cast<std::string>(ID);
role_datatypeadapter = "DataTypeAdapter" + boost::lexical_cast<std::string>(ID);
role_inputfilter = "InputFilter" + boost::lexical_cast<std::string>(ID);
role_resampler = "Resampler" + boost::lexical_cast<std::string>(ID);
}
std::string signal_conditioner = configuration->property(
role_conditioner+".implementation", default_implementation);
role_conditioner + ".implementation", default_implementation);
std::string data_type_adapter;
std::string input_filter;

View File

@ -57,10 +57,10 @@ public:
GNSSBlockFactory();
virtual ~GNSSBlockFactory();
std::unique_ptr<GNSSBlockInterface> GetSignalSource(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue, int ID=-1);
boost::shared_ptr<gr::msg_queue> queue, int ID = -1);
std::unique_ptr<GNSSBlockInterface> GetSignalConditioner(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue, int ID=-1);
boost::shared_ptr<gr::msg_queue> queue, int ID = -1);
std::unique_ptr<GNSSBlockInterface> GetPVT(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue);

View File

@ -54,16 +54,13 @@ GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configurati
connected_ = false;
running_ = false;
configuration_ = configuration;
//std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_ = std::make_shared<std::vector<std::shared_ptr<GNSSBlockInterface>>>();
queue_ = queue;
init();
}
GNSSFlowgraph::~GNSSFlowgraph()
{
//blocks_->clear();
}
{}
void GNSSFlowgraph::start()
{
@ -87,6 +84,7 @@ void GNSSFlowgraph::start()
running_ = true;
}
void GNSSFlowgraph::stop()
{
for (unsigned int i = 0; i < channels_count_; i++)
@ -129,7 +127,6 @@ void GNSSFlowgraph::connect()
}
// Signal Source > Signal conditioner >
for (int i = 0; i < sources_count_; i++)
{
try
@ -149,9 +146,6 @@ void GNSSFlowgraph::connect()
{
try
{
//auto chan_ = std::move(blocks_->at(i));
//std::shared_ptr<ChannelInterface> chan = std::dynamic_pointer_cast<ChannelInterface>(chan_);
//channels_.push_back(chan);
channels_.at(i)->connect(top_block_);
}
catch (std::exception& e)
@ -165,7 +159,6 @@ void GNSSFlowgraph::connect()
try
{
//observables_ = std::move(blocks_->at(2));
observables_->connect(top_block_);
}
catch (std::exception& e)
@ -179,7 +172,6 @@ void GNSSFlowgraph::connect()
// Signal Source > Signal conditioner >> Channels >> Observables > PVT
try
{
//pvt_ = std::move(blocks_->at(3));
pvt_->connect(top_block_);
}
catch (std::exception& e)
@ -193,7 +185,6 @@ void GNSSFlowgraph::connect()
// Signal Source > Signal conditioner >> Channels >> Observables > PVT > Output Filter
try
{
//output_filter_ = std::move(blocks_->at(4));
output_filter_->connect(top_block_);
}
catch (std::exception& e)
@ -207,10 +198,8 @@ void GNSSFlowgraph::connect()
DLOG(INFO) << "blocks connected internally";
// Signal Source (i) > Signal conditioner (i) >
for (int i = 0; i < sources_count_; i++)
{
try
{
//TODO: Remove this array implementation and create generic multistream connector
@ -247,7 +236,7 @@ void GNSSFlowgraph::connect()
for (unsigned int i = 0; i < channels_count_; i++)
{
selected_signal_source = configuration_->property("Channel" + boost::lexical_cast<std::string>(i) +".SignalSource_ID", 0);
selected_signal_source = configuration_->property("Channel" + boost::lexical_cast<std::string>(i) + ".SignalSource_ID", 0);
try
{
top_block_->connect(sig_conditioner_.at(selected_signal_source)->get_right_block(), 0,
@ -255,13 +244,13 @@ void GNSSFlowgraph::connect()
}
catch (std::exception& e)
{
LOG(WARNING) << "Can't connect signal conditioner "<<selected_signal_source<<" to channel " << i;
LOG(WARNING) << "Can't connect signal conditioner " << selected_signal_source << " to channel " << i;
LOG(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
DLOG(INFO) << "signal conditioner "<<selected_signal_source<<" connected to channel " << i;
DLOG(INFO) << "signal conditioner " << selected_signal_source << " connected to channel " << i;
// Signal Source > Signal conditioner >> Channels >> Observables
try
@ -279,7 +268,7 @@ void GNSSFlowgraph::connect()
//discriminate between systems
//TODO: add a specific string member to the channel template, and not re-use the implementation field!
while (channels_.at(i)->implementation()!= available_GNSS_signals_.front().get_satellite().get_system())
while (channels_.at(i)->implementation() != available_GNSS_signals_.front().get_satellite().get_system())
{
available_GNSS_signals_.push_back(available_GNSS_signals_.front());
available_GNSS_signals_.pop_front();
@ -300,8 +289,8 @@ void GNSSFlowgraph::connect()
LOG(INFO) << "Channel " << i
<< " connected to observables in standby mode";
}
}
/*
* Connect the observables output of each channel to the PVT block
*/
@ -461,17 +450,19 @@ void GNSSFlowgraph::init()
// 1. read the number of RF front-ends available (one file_source per RF front-end)
sources_count_ = configuration_->property("Receiver.sources_count", 1);
if (sources_count_>1)
if (sources_count_ > 1)
{
for (int i = 0; i < sources_count_; i++)
{
std::cout<<"creating source "<<i<<std::endl;
sig_source_.push_back(block_factory_->GetSignalSource(configuration_, queue_,i));
std::cout << "Creating signal source " << i << std::endl;
sig_source_.push_back(block_factory_->GetSignalSource(configuration_, queue_, i));
sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_, queue_, i));
}
}else{
}
else
{
//backwards compatibility for old config files
sig_source_.push_back(block_factory_->GetSignalSource(configuration_, queue_,-1));
sig_source_.push_back(block_factory_->GetSignalSource(configuration_, queue_, -1));
sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_, queue_, -1));
}
@ -498,6 +489,7 @@ void GNSSFlowgraph::init()
DLOG(INFO) << "Blocks instantiated. " << channels_count_ << " channels.";
}
void GNSSFlowgraph::set_signals_list()
{
/*
@ -569,8 +561,8 @@ 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")));
available_GNSS_signals_.push_back(Gnss_Signal(Gnss_Satellite(std::string("Galileo"),
*available_gnss_prn_iter), default_signal));
}
@ -611,17 +603,16 @@ void GNSSFlowgraph::set_signals_list()
}
// **** FOR DEBUGGING THE LIST OF GNSS SIGNALS ****
// std::cout<<"default_system="<<default_system<<std::endl;
// std::cout<<"default_signal="<<default_signal<<std::endl;
// std::list<Gnss_Signal>::iterator available_gnss_list_iter;
// for (available_gnss_list_iter = available_GNSS_signals_.begin(); available_gnss_list_iter
// != available_GNSS_signals_.end(); available_gnss_list_iter++)
// {
// std::cout << *available_gnss_list_iter << std::endl;
// }
// **** FOR DEBUGGING THE LIST OF GNSS SIGNALS ****
// std::cout<<"default_system="<<default_system<<std::endl;
// std::cout<<"default_signal="<<default_signal<<std::endl;
// std::list<Gnss_Signal>::iterator available_gnss_list_iter;
// for (available_gnss_list_iter = available_GNSS_signals_.begin(); available_gnss_list_iter
// != available_GNSS_signals_.end(); available_gnss_list_iter++)
// {
// std::cout << *available_gnss_list_iter << std::endl;
// }
}

View File

@ -124,7 +124,6 @@ private:
std::string config_file_;
std::shared_ptr<ConfigurationInterface> configuration_;
std::shared_ptr<GNSSBlockFactory> block_factory_;
//std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_ = std::make_shared<std::vector<std::shared_ptr<GNSSBlockInterface>>>();
std::vector<std::shared_ptr<GNSSBlockInterface>> sig_source_;
std::vector<std::shared_ptr<GNSSBlockInterface>> sig_conditioner_;