mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 04:00:34 +00:00
cleaning flowgraph
This commit is contained in:
parent
6b1c12f111
commit
5bde2595af
@ -110,11 +110,9 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetSignalSource(
|
||||
std::shared_ptr<ConfigurationInterface> configuration, boost::shared_ptr<gr::msg_queue> queue)
|
||||
{
|
||||
std::string default_implementation = "File_Signal_Source";
|
||||
std::string implementation = configuration->property(
|
||||
"SignalSource.implementation", default_implementation);
|
||||
std::string implementation = configuration->property("SignalSource.implementation", default_implementation);
|
||||
LOG(INFO) << "Getting SignalSource with implementation " << implementation;
|
||||
return GetBlock(configuration, "SignalSource", implementation, 0, 1,
|
||||
queue);
|
||||
return GetBlock(configuration, "SignalSource", implementation, 0, 1, queue);
|
||||
}
|
||||
|
||||
|
||||
@ -148,7 +146,6 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetSignalConditioner(
|
||||
<< data_type_adapter << ", InputFilter implementation: "
|
||||
<< input_filter << ", and Resampler implementation: "
|
||||
<< resampler;
|
||||
//std::unique_ptr<GNSSBlockInterface> conditioner_;
|
||||
|
||||
if(signal_conditioner.compare("Array_Signal_Conditioner") == 0)
|
||||
{
|
||||
@ -569,7 +566,7 @@ std::unique_ptr<AcquisitionInterface> GNSSBlockFactory::GetAcqBlock(
|
||||
{
|
||||
std::unique_ptr<AcquisitionInterface> block;
|
||||
// ACQUISITION BLOCKS ---------------------------------------------------------
|
||||
if (implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0)
|
||||
if (implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0)
|
||||
{
|
||||
std::unique_ptr<AcquisitionInterface> block_(new GpsL1CaPcpsAcquisition(configuration.get(), role, in_streams,
|
||||
out_streams, queue));
|
||||
@ -695,6 +692,7 @@ std::unique_ptr<TrackingInterface> GNSSBlockFactory::GetTrkBlock(
|
||||
return std::move(block);
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<TelemetryDecoderInterface> GNSSBlockFactory::GetTlmBlock(
|
||||
std::shared_ptr<ConfigurationInterface> configuration,
|
||||
std::string role,
|
||||
|
@ -68,10 +68,8 @@ public:
|
||||
std::unique_ptr<GNSSBlockInterface> GetChannel(std::shared_ptr<ConfigurationInterface> configuration,
|
||||
std::string acq, std::string trk, std::string tlm, int channel,
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
//std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GetChannels(std::shared_ptr<ConfigurationInterface> configuration,
|
||||
//std::vector<std::unique_ptr<GNSSBlockInterface>> GetChannels(std::shared_ptr<ConfigurationInterface> configuration,
|
||||
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GetChannels(std::shared_ptr<ConfigurationInterface> configuration,
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
/*
|
||||
* \brief Returns the block with the required configuration and implementation
|
||||
*/
|
||||
|
@ -54,7 +54,8 @@ GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configurati
|
||||
connected_ = false;
|
||||
running_ = false;
|
||||
configuration_ = configuration;
|
||||
//blocks_ = new std::vector<GNSSBlockInterface*>();
|
||||
|
||||
|
||||
std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_ = std::make_shared<std::vector<std::shared_ptr<GNSSBlockInterface>>>();
|
||||
queue_ = queue;
|
||||
init();
|
||||
@ -63,12 +64,7 @@ GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configurati
|
||||
|
||||
GNSSFlowgraph::~GNSSFlowgraph()
|
||||
{
|
||||
for (unsigned int i = 0; i < blocks_->size(); i++)
|
||||
{
|
||||
//delete blocks_->at(i);
|
||||
}
|
||||
blocks_->clear();
|
||||
//delete blocks_;
|
||||
}
|
||||
|
||||
|
||||
@ -130,7 +126,6 @@ void GNSSFlowgraph::connect()
|
||||
|
||||
try
|
||||
{
|
||||
// sig_source_ = signal_source();
|
||||
sig_source_ = std::move(blocks_->at(0));
|
||||
sig_source_->connect(top_block_);
|
||||
}
|
||||
@ -160,9 +155,8 @@ void GNSSFlowgraph::connect()
|
||||
{
|
||||
try
|
||||
{
|
||||
auto chan_ = std::move(blocks_->at(i + 5));
|
||||
std::shared_ptr<ChannelInterface> chan = std::dynamic_pointer_cast<ChannelInterface>(chan_);
|
||||
|
||||
auto chan_ = std::move(blocks_->at(i + 5));
|
||||
std::shared_ptr<ChannelInterface> chan = std::dynamic_pointer_cast<ChannelInterface>(chan_);
|
||||
channels_.push_back(chan);
|
||||
channels_.at(i)->connect(top_block_);
|
||||
}
|
||||
@ -207,7 +201,6 @@ void GNSSFlowgraph::connect()
|
||||
{
|
||||
output_filter_ = std::move(blocks_->at(4));
|
||||
output_filter_->connect(top_block_);
|
||||
std::cout << "helllllout" << std::endl;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
@ -220,8 +213,6 @@ void GNSSFlowgraph::connect()
|
||||
DLOG(INFO) << "blocks connected internally";
|
||||
|
||||
// Signal Source > Signal conditioner >
|
||||
|
||||
std::cout<< sig_source_->implementation().c_str() <<std::endl;
|
||||
try
|
||||
{
|
||||
if(sig_source_->implementation().compare("Raw_Array_Signal_Source") == 0)
|
||||
@ -237,7 +228,6 @@ void GNSSFlowgraph::connect()
|
||||
else
|
||||
{
|
||||
//single channel
|
||||
// std::cout<<"NORMAL MODE"<<std::endl;
|
||||
top_block_->connect(sig_source_->get_right_block(), 0, sig_conditioner_->get_left_block(), 0);
|
||||
}
|
||||
|
||||
@ -282,12 +272,12 @@ void GNSSFlowgraph::connect()
|
||||
top_block_->disconnect_all();
|
||||
return;
|
||||
}
|
||||
std::cout<<"NORMAL MODE"<<std::endl;
|
||||
|
||||
channels_.at(i)->set_signal(available_GNSS_signals_.front());
|
||||
LOG(INFO) << "Channel " << i << " assigned to " << available_GNSS_signals_.front();
|
||||
available_GNSS_signals_.pop_front();
|
||||
channels_.at(i)->start();
|
||||
std::cout<<"NORMAL MODE"<<std::endl;
|
||||
|
||||
if (channels_state_[i] == 1)
|
||||
{
|
||||
channels_.at(i)->start_acquisition();
|
||||
@ -452,28 +442,19 @@ void GNSSFlowgraph::set_configuration(std::shared_ptr<ConfigurationInterface> co
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::signal_source()
|
||||
{
|
||||
//std::shared_ptr<GNSSBlockInterface> cond_ { blocks_->at(0) };
|
||||
//return cond_;
|
||||
//return blocks_->at(0);
|
||||
//std::shared_ptr<GNSSBlockInterface> source_ = std::make_shared<std::shared_ptr<GNSSBlockInterface>>();
|
||||
|
||||
//auto source_ = std::move(blocks_->at(0));
|
||||
sig_source_ = std::move(blocks_->at(0));
|
||||
//sig_source_ =
|
||||
//std::cout << source_->implementation().c_str() << std::endl;
|
||||
auto sig_source_ = std::move(blocks_->at(0));
|
||||
return std::move(sig_source_);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::signal_conditioner()
|
||||
{
|
||||
auto cond_ = std::move(blocks_->at(1));
|
||||
return std::move(cond_);
|
||||
auto sig_conditioner_ = std::move(blocks_->at(1));
|
||||
return std::move(sig_conditioner_);
|
||||
}
|
||||
|
||||
|
||||
@ -489,15 +470,15 @@ std::shared_ptr<ChannelInterface> GNSSFlowgraph::channel(unsigned int index)
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::observables()
|
||||
{
|
||||
auto obs_ = std::move(blocks_->at(2));
|
||||
return std::move(obs_);
|
||||
observables_ = std::move(blocks_->at(2));
|
||||
return std::move(observables_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::pvt()
|
||||
{
|
||||
auto pvt_ = std::move(blocks_->at(3));
|
||||
pvt_ = std::move(blocks_->at(3));
|
||||
return std::move(pvt_);
|
||||
}
|
||||
|
||||
@ -508,7 +489,7 @@ std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::output_filter()
|
||||
auto output_ = std::move(blocks_->at(4));
|
||||
return std::move(output_);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
void GNSSFlowgraph::init()
|
||||
@ -530,12 +511,9 @@ void GNSSFlowgraph::init()
|
||||
blocks_->push_back(pvt_);
|
||||
blocks_->push_back(output_);
|
||||
|
||||
|
||||
std::shared_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = block_factory_->GetChannels(configuration_, queue_);
|
||||
|
||||
channels_count_ = channels->size();
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < channels_count_; i++)
|
||||
{
|
||||
std::shared_ptr<GNSSBlockInterface> chan_ = std::move(channels->at(i));
|
||||
@ -545,14 +523,11 @@ void GNSSFlowgraph::init()
|
||||
top_block_ = gr::make_top_block("GNSSFlowgraph");
|
||||
|
||||
// fill the available_GNSS_signals_ queue with the satellites ID's to be searched by the acquisition
|
||||
|
||||
set_signals_list();
|
||||
set_channels_state();
|
||||
|
||||
applied_actions_ = 0;
|
||||
std::vector<std::shared_ptr<ChannelInterface>> channels_(channels_count_);
|
||||
|
||||
//std::shared_ptr<GNSSBlockInterface> sig_source_ = signal_source();
|
||||
DLOG(INFO) << "Blocks instantiated. " << channels_count_ << " channels.";
|
||||
}
|
||||
|
||||
|
@ -93,12 +93,19 @@ public:
|
||||
|
||||
void set_configuration(std::shared_ptr<ConfigurationInterface> configuration);
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> signal_source();
|
||||
/*std::shared_ptr<GNSSBlockInterface> signal_source();
|
||||
std::shared_ptr<GNSSBlockInterface> signal_conditioner();
|
||||
std::shared_ptr<ChannelInterface> channel(unsigned int index);
|
||||
std::shared_ptr<GNSSBlockInterface> observables();
|
||||
std::shared_ptr<GNSSBlockInterface> pvt();
|
||||
std::shared_ptr<GNSSBlockInterface> output_filter();
|
||||
std::shared_ptr<GNSSBlockInterface> output_filter();*/
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> sig_source_;
|
||||
std::shared_ptr<GNSSBlockInterface> sig_conditioner_;
|
||||
std::shared_ptr<GNSSBlockInterface> observables_;
|
||||
std::shared_ptr<GNSSBlockInterface> pvt_;
|
||||
std::shared_ptr<GNSSBlockInterface> output_filter_;
|
||||
std::vector<std::shared_ptr<ChannelInterface>> channels_;
|
||||
|
||||
unsigned int applied_actions()
|
||||
{
|
||||
@ -132,15 +139,13 @@ 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::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_ = std::make_shared<std::vector<std::shared_ptr<GNSSBlockInterface>>>();
|
||||
std::shared_ptr<GNSSBlockInterface> sig_source_;
|
||||
/* std::shared_ptr<GNSSBlockInterface> sig_source_;
|
||||
std::shared_ptr<GNSSBlockInterface> sig_conditioner_;
|
||||
std::shared_ptr<GNSSBlockInterface> observables_;
|
||||
std::shared_ptr<GNSSBlockInterface> pvt_;
|
||||
std::shared_ptr<GNSSBlockInterface> output_filter_;
|
||||
//std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> channels_;
|
||||
std::vector<std::shared_ptr<ChannelInterface>> channels_;
|
||||
std::vector<std::shared_ptr<ChannelInterface>> channels_; */
|
||||
gr::top_block_sptr top_block_;
|
||||
boost::shared_ptr<gr::msg_queue> queue_;
|
||||
std::list<Gnss_Signal> available_GNSS_signals_;
|
||||
|
@ -56,36 +56,37 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStop)
|
||||
config->set_property("SignalSource.filename", filename);
|
||||
config->set_property("SignalConditioner.implementation", "Pass_Through");
|
||||
config->set_property("Channels.count", "2");
|
||||
config->set_property("Channels.acquisition.implementation", "Pass_Through");
|
||||
config->set_property("Channels.tracking.implementation", "Pass_Through");
|
||||
config->set_property("Channels.telemetry.implementation", "Pass_Through");
|
||||
config->set_property("Channels.observables.implementation", "Pass_Through");
|
||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
config->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
|
||||
config->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
//config->set_property("Channels.observables.implementation", "Pass_Through");
|
||||
config->set_property("Observables.implementation", "GPS_L1_CA_Observables");
|
||||
config->set_property("PVT.implementation", "GPS_L1_CA_PVT");
|
||||
config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter");
|
||||
|
||||
GNSSFlowgraph* flowgraph = new GNSSFlowgraph(config, gr::msg_queue::make(0));
|
||||
|
||||
EXPECT_STREQ("File_Signal_Source", flowgraph->signal_source()->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", flowgraph->signal_conditioner()->implementation().c_str());
|
||||
EXPECT_STREQ("Channel", flowgraph->channel(0)->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(0))->acquisition()->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(0))->tracking()->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(0))->telemetry()->implementation().c_str());
|
||||
EXPECT_STREQ("Channel", flowgraph->channel(1)->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(1))->acquisition()->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(1))->tracking()->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(1))->telemetry()->implementation().c_str());
|
||||
EXPECT_STREQ("GPS_L1_CA_Observables", flowgraph->observables()->implementation().c_str());
|
||||
EXPECT_STREQ("GPS_L1_CA_PVT", flowgraph->pvt()->implementation().c_str());
|
||||
EXPECT_STREQ("Null_Sink_Output_Filter", flowgraph->output_filter()->implementation().c_str());
|
||||
|
||||
EXPECT_NO_THROW(flowgraph->connect());
|
||||
std::shared_ptr<GNSSFlowgraph> flowgraph = std::make_shared<GNSSFlowgraph>(config, gr::msg_queue::make(0));
|
||||
flowgraph->set_configuration(config);
|
||||
EXPECT_NO_THROW(flowgraph->connect());
|
||||
EXPECT_TRUE(flowgraph->connected());
|
||||
EXPECT_STREQ("File_Signal_Source", flowgraph->sig_source_->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", flowgraph->sig_conditioner_->implementation().c_str());
|
||||
EXPECT_STREQ("Channel", flowgraph->channels_.at(0)->implementation().c_str());
|
||||
// EXPECT_STREQ("Pass_Through", (flowgraph->channel(0)->acquisition()->implementation().c_str()));
|
||||
// EXPECT_STREQ("Pass_Through", (flowgraph->channel(0)->tracking()->implementation().c_str());
|
||||
// EXPECT_STREQ("Pass_Through", (flowgraph->channel(0)->telemetry()->implementation().c_str());
|
||||
EXPECT_STREQ("Channel", flowgraph->channels_.at(1)->implementation().c_str());
|
||||
// EXPECT_STREQ("Pass_Through", (flowgraph->channel(1)->acquisition()->implementation().c_str());
|
||||
// EXPECT_STREQ("Pass_Through", (flowgraph->channel(1)->tracking()->implementation().c_str());
|
||||
// EXPECT_STREQ("Pass_Through", (flowgraph->channel(1)->telemetry()->implementation().c_str());
|
||||
EXPECT_STREQ("GPS_L1_CA_Observables", flowgraph->observables_->implementation().c_str());
|
||||
EXPECT_STREQ("GPS_L1_CA_PVT", flowgraph->pvt_->implementation().c_str());
|
||||
EXPECT_STREQ("Null_Sink_Output_Filter", flowgraph->output_filter_->implementation().c_str());
|
||||
|
||||
|
||||
EXPECT_NO_THROW(flowgraph->start());
|
||||
EXPECT_TRUE(flowgraph->running());
|
||||
flowgraph->stop();
|
||||
EXPECT_FALSE(flowgraph->running());
|
||||
|
||||
delete flowgraph;
|
||||
//delete flowgraph;
|
||||
}
|
||||
|
@ -285,11 +285,8 @@ TEST(GNSS_Block_Factory_Test, InstantiateChannels)
|
||||
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
||||
std::unique_ptr<GNSSBlockFactory> factory;
|
||||
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = std::move(factory->GetChannels(configuration, queue));
|
||||
|
||||
EXPECT_EQ((unsigned int) 2, channels->size());
|
||||
|
||||
channels->erase(channels->begin(), channels->end());
|
||||
//channels->clear();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user