mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-04-12 22:03:20 +00:00
Major changes. Signal Conditioner holds now blocks to change data type, filter and resample input data.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@172 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
9eac86f3f2
commit
d5655f27df
@ -33,6 +33,8 @@ project : requirements
|
||||
<include>src/algorithms/PVT/adapters
|
||||
<include>src/algorithms/PVT/gnuradio_blocks
|
||||
<include>src/algorithms/PVT/libs
|
||||
<include>src/algorithms/resampler/adapters
|
||||
<include>src/algorithms/resampler/gnuradio_blocks
|
||||
<include>src/algorithms/signal_source/adapters
|
||||
<include>src/algorithms/signal_source/gnuradio_blocks
|
||||
<include>src/algorithms/telemetry_decoder/adapters
|
||||
|
@ -1,3 +1,3 @@
|
||||
project : build-dir ../../../../build ;
|
||||
|
||||
obj direct_resampler_conditioner : direct_resampler_conditioner.cc ;
|
||||
obj signal_conditioner : signal_conditioner.cc ;
|
121
src/algorithms/conditioner/adapters/signal_conditioner.cc
Normal file
121
src/algorithms/conditioner/adapters/signal_conditioner.cc
Normal file
@ -0,0 +1,121 @@
|
||||
/*!
|
||||
* \file signal_conditioner.cc
|
||||
* \brief It holds blocks to change data type, filter and resample input data.
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "signal_conditioner.h"
|
||||
#include "gnss_flowgraph.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <gnuradio/gr_io_signature.h>
|
||||
#include <gnuradio/gr_message.h>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
// Constructor
|
||||
SignalConditioner::SignalConditioner(ConfigurationInterface *configuration,
|
||||
GNSSBlockInterface *data_type_adapt, GNSSBlockInterface *in_filt,
|
||||
GNSSBlockInterface *res, std::string role, std::string implementation,
|
||||
gr_msg_queue_sptr queue) : data_type_adapt_(data_type_adapt),
|
||||
in_filt_(in_filt), res_(res), role_(role), implementation_(implementation),
|
||||
queue_(queue)
|
||||
{
|
||||
// stop_ = false;
|
||||
connected_ = false;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
SignalConditioner::~SignalConditioner()
|
||||
{
|
||||
delete data_type_adapt_;
|
||||
delete in_filt_;
|
||||
delete res_;
|
||||
}
|
||||
|
||||
void SignalConditioner::connect(gr_top_block_sptr top_block)
|
||||
{
|
||||
|
||||
if (connected_)
|
||||
{
|
||||
LOG_AT_LEVEL(WARNING) << "Signal conditioner already connected internally";
|
||||
return;
|
||||
}
|
||||
|
||||
data_type_adapt_->connect(top_block);
|
||||
in_filt_->connect(top_block);
|
||||
res_->connect(top_block);
|
||||
|
||||
top_block->connect(data_type_adapt_->get_right_block(), 0,
|
||||
in_filt_->get_left_block(), 0);
|
||||
DLOG(INFO) << "data_type_adapter -> input_filter";
|
||||
|
||||
top_block->connect(in_filt_->get_right_block(), 0,
|
||||
res_->get_left_block(), 0);
|
||||
DLOG(INFO) << "input_filter -> resampler";
|
||||
|
||||
connected_ = true;
|
||||
}
|
||||
|
||||
void SignalConditioner::disconnect(gr_top_block_sptr top_block)
|
||||
{
|
||||
|
||||
if (!connected_)
|
||||
{
|
||||
LOG_AT_LEVEL(WARNING) << "Signal conditioner already disconnected internally";
|
||||
return;
|
||||
}
|
||||
|
||||
top_block->disconnect(data_type_adapt_->get_right_block(), 0,
|
||||
in_filt_->get_left_block(), 0);
|
||||
top_block->disconnect(in_filt_->get_right_block(), 0,
|
||||
res_->get_left_block(), 0);
|
||||
|
||||
data_type_adapt_->disconnect(top_block);
|
||||
in_filt_->disconnect(top_block);
|
||||
res_->disconnect(top_block);
|
||||
|
||||
connected_ = false;
|
||||
}
|
||||
|
||||
gr_basic_block_sptr SignalConditioner::get_left_block()
|
||||
{
|
||||
return data_type_adapt_->get_left_block();
|
||||
}
|
||||
|
||||
|
||||
|
||||
gr_basic_block_sptr SignalConditioner::get_right_block()
|
||||
{
|
||||
return res_->get_right_block();
|
||||
}
|
||||
|
97
src/algorithms/conditioner/adapters/signal_conditioner.h
Normal file
97
src/algorithms/conditioner/adapters/signal_conditioner.h
Normal file
@ -0,0 +1,97 @@
|
||||
/*!
|
||||
* \file signal_conditioner.h
|
||||
* \brief It holds blocks to change data type, filter and resample input data.
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_SIGNAL_CONDITIONER_H_
|
||||
#define GNSS_SDR_SIGNAL_CONDITIONER_H_
|
||||
|
||||
#include <gnuradio/gr_null_sink.h>
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
#include "gnss_block_interface.h"
|
||||
#include "control_message_factory.h"
|
||||
//#include "gnss_signal.h"
|
||||
//#include "gnss_synchro.h"
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
class AcquisitionInterface;
|
||||
class TrackingInterface;
|
||||
class TelemetryDecoderInterface;
|
||||
|
||||
class SignalConditioner: public GNSSBlockInterface
|
||||
{
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
SignalConditioner(ConfigurationInterface *configuration,
|
||||
GNSSBlockInterface *data_type_adapt, GNSSBlockInterface *in_filt,
|
||||
GNSSBlockInterface *res, std::string role, std::string implementation,
|
||||
gr_msg_queue_sptr queue);
|
||||
|
||||
//! Virtual destructor
|
||||
virtual ~SignalConditioner();
|
||||
|
||||
void connect(gr_top_block_sptr top_block);
|
||||
void disconnect(gr_top_block_sptr top_block);
|
||||
gr_basic_block_sptr get_left_block();
|
||||
gr_basic_block_sptr get_right_block();
|
||||
|
||||
std::string role(){ return role_; }
|
||||
|
||||
std::string implementation(){ return "Signal_Conditioner"; }
|
||||
|
||||
size_t item_size(){ return 0; }
|
||||
|
||||
GNSSBlockInterface *data_type_adapter(){ return data_type_adapt_; }
|
||||
|
||||
GNSSBlockInterface *input_filter(){ return in_filt_; }
|
||||
|
||||
GNSSBlockInterface *resampler(){ return res_; }
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
GNSSBlockInterface *data_type_adapt_;
|
||||
GNSSBlockInterface *in_filt_;
|
||||
GNSSBlockInterface *res_;
|
||||
|
||||
std::string role_;
|
||||
std::string implementation_;
|
||||
|
||||
bool connected_;
|
||||
//bool stop_;
|
||||
gr_msg_queue_sptr queue_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /*GNSS_SDR_SIGNAL_CONDITIONER_H_*/
|
@ -1,2 +1,2 @@
|
||||
#build-project adapters ;
|
||||
build-project adapters ;
|
||||
#build-project gnuradio_blocks ;
|
||||
|
@ -2,6 +2,7 @@ build-project acquisition ;
|
||||
build-project channel ;
|
||||
build-project conditioner ;
|
||||
build-project libs ;
|
||||
build-project resampler ;
|
||||
build-project signal_source ;
|
||||
build-project tracking ;
|
||||
build-project telemetry_decoder ;
|
||||
|
@ -50,7 +50,7 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
|
||||
std::string default_item_type = "short";
|
||||
std::string default_item_type = "gr_complex";
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
vector_size_ = configuration->property(role + ".vector_size", 1);
|
||||
|
3
src/algorithms/resampler/adapters/jamfile.jam
Normal file
3
src/algorithms/resampler/adapters/jamfile.jam
Normal file
@ -0,0 +1,3 @@
|
||||
project : build-dir ../../../../build ;
|
||||
|
||||
obj direct_resampler_conditioner : direct_resampler_conditioner.cc ;
|
4
src/algorithms/resampler/gnuradio_blocks/jamfile.jam
Normal file
4
src/algorithms/resampler/gnuradio_blocks/jamfile.jam
Normal file
@ -0,0 +1,4 @@
|
||||
project : build-dir ../../../../build ;
|
||||
|
||||
obj direct_resampler_conditioner_cc : direct_resampler_conditioner_cc.cc ;
|
||||
#obj direct_resampler_conditioner_ss : direct_resampler_conditioner_ss.cc ;
|
@ -1,2 +1,2 @@
|
||||
#build-project adapters ;
|
||||
#build-project gnuradio_blocks ;
|
||||
build-project adapters ;
|
||||
build-project gnuradio_blocks ;
|
||||
|
@ -48,7 +48,8 @@
|
||||
#include "file_output_filter.h"
|
||||
#include "channel.h"
|
||||
//#include "usrp1_signal_source.h"
|
||||
//#include "direct_resampler_conditioner.h"
|
||||
#include "signal_conditioner.h"
|
||||
#include "direct_resampler_conditioner.h"
|
||||
#include "gps_l1_ca_gps_sdr_acquisition.h"
|
||||
#include "gps_l1_ca_pcps_acquisition.h"
|
||||
#include "gps_l1_ca_tong_pcps_acquisition.h"
|
||||
@ -90,14 +91,24 @@ GNSSBlockInterface* GNSSBlockFactory::GetSignalConditioner(
|
||||
{
|
||||
|
||||
std::string default_implementation = "Pass_Through";
|
||||
std::string implementation = configuration->property(
|
||||
"SignalConditioner.implementation", default_implementation);
|
||||
std::string data_type_adapter = configuration->property(
|
||||
"DataTypeAdapter.implementation", default_implementation);
|
||||
std::string input_filter = configuration->property(
|
||||
"InputFilter.implementation", default_implementation);
|
||||
std::string resampler = configuration->property(
|
||||
"Resampler.implementation", default_implementation);
|
||||
|
||||
DLOG(INFO) << "Getting SignalConditioner with implementation "
|
||||
<< implementation;
|
||||
DLOG(INFO) << "Getting SignalConditioner with DataTypeAdapter implementation: "
|
||||
<< data_type_adapter << ", InputFilter implementation: "
|
||||
<< input_filter << ", and Resampler implementation: "
|
||||
<< resampler;
|
||||
|
||||
return new SignalConditioner(configuration, GetBlock(configuration,
|
||||
"DataTypeAdapter", data_type_adapter, 1, 1, queue), GetBlock(
|
||||
configuration,"InputFilter", input_filter, 1, 1, queue),
|
||||
GetBlock(configuration,"Resampler", resampler, 1, 1, queue),
|
||||
"SignalConditioner", "Signal_Conditioner", queue);
|
||||
|
||||
return GetBlock(configuration, "SignalConditioner", implementation, 1, 1,
|
||||
queue);
|
||||
}
|
||||
|
||||
GNSSBlockInterface* GNSSBlockFactory::GetObservables(
|
||||
@ -163,7 +174,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetChannel(
|
||||
DLOG(INFO) << "Instantiating channel " << id;
|
||||
|
||||
return new Channel(configuration, channel, GetBlock(configuration,
|
||||
"SignalConditioner", "Pass_Through", 1, 1, queue),
|
||||
"Channel", "Pass_Through", 1, 1, queue),
|
||||
(AcquisitionInterface*)GetBlock(configuration, "Acquisition",
|
||||
acq, 1, 1, queue), (TrackingInterface*)GetBlock(
|
||||
configuration, "Tracking", trk, 1, 1, queue),
|
||||
@ -223,8 +234,16 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock(
|
||||
{
|
||||
GNSSBlockInterface* block = NULL; //Change to nullptr when available in compilers (C++11)
|
||||
|
||||
//PASS THROUGH ----------------------------------------------------------------
|
||||
|
||||
if (implementation.compare("Pass_Through") == 0)
|
||||
{
|
||||
block = new Pass_Through(configuration, role, in_streams, out_streams);
|
||||
|
||||
}
|
||||
|
||||
// SIGNAL SOURCES -------------------------------------------------------------
|
||||
if (implementation.compare("File_Signal_Source") == 0)
|
||||
else if (implementation.compare("File_Signal_Source") == 0)
|
||||
{
|
||||
block = new FileSignalSource(configuration, role, in_streams,
|
||||
out_streams, queue);
|
||||
@ -238,20 +257,19 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock(
|
||||
|
||||
//! \todo Create a UHD block
|
||||
|
||||
// SIGNAL CONDITIONERS ---------------------------------------------------------
|
||||
// DATA TYPE ADAPTER -----------------------------------------------------------
|
||||
|
||||
else if (implementation.compare("Pass_Through") == 0)
|
||||
// INPUT FILTER ----------------------------------------------------------------
|
||||
|
||||
// RESAMPLER -------------------------------------------------------------------
|
||||
|
||||
|
||||
else if (implementation.compare("Direct_Resampler") == 0)
|
||||
{
|
||||
block = new Pass_Through(configuration, role, in_streams, out_streams);
|
||||
|
||||
block = new DirectResamplerConditioner(configuration, role,
|
||||
in_streams, out_streams);
|
||||
}
|
||||
|
||||
// else if (implementation.compare("Direct_Resampler") == 0)
|
||||
// {
|
||||
// block = new DirectResamplerConditioner(configuration, role,
|
||||
// in_streams, out_streams);
|
||||
// }
|
||||
|
||||
// ACQUISITION BLOCKS ---------------------------------------------------------
|
||||
|
||||
// else if (implementation.compare("GPS_L1_CA_GPS_SDR_Acquisition") == 0)
|
||||
|
@ -9,9 +9,7 @@ exe gnss-sdr : main.cc
|
||||
#../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_tong_pcps_acquisition_cc
|
||||
../algorithms/channel/adapters//channel
|
||||
../algorithms/channel/libs//gps_l1_ca_channel_fsm
|
||||
#../algorithms/conditioner/adapters//direct_resampler_conditioner
|
||||
#../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_cc
|
||||
#../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_ss
|
||||
../algorithms/conditioner/adapters//signal_conditioner
|
||||
../algorithms/libs//gps_sdr_signal_processing
|
||||
../algorithms/libs//gnss_sdr_valve
|
||||
../algorithms/libs//pass_through
|
||||
@ -22,6 +20,9 @@ exe gnss-sdr : main.cc
|
||||
../algorithms/PVT/libs//gps_l1_ca_ls_pvt
|
||||
../algorithms/output_filter/adapters//file_output_filter
|
||||
../algorithms/output_filter/adapters//null_sink_output_filter
|
||||
../algorithms/resampler/adapters//direct_resampler_conditioner
|
||||
../algorithms/resampler/gnuradio_blocks//direct_resampler_conditioner_cc
|
||||
#../algorithms/resampler/gnuradio_blocks//direct_resampler_conditioner_ss
|
||||
../algorithms/signal_source/adapters//file_signal_source
|
||||
#../algorithms/signal_source/adapters//usrp1_signal_source
|
||||
../algorithms/telemetry_decoder/adapters//gps_l1_ca_telemetry_decoder
|
||||
|
@ -10,9 +10,7 @@ exe run_tests : test_main.cc
|
||||
#../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_tong_pcps_acquisition_cc
|
||||
../algorithms/channel/adapters//channel
|
||||
../algorithms/channel/libs//gps_l1_ca_channel_fsm
|
||||
#../algorithms/conditioner/adapters//direct_resampler_conditioner
|
||||
#../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_cc
|
||||
#../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_ss
|
||||
../algorithms/conditioner/adapters//signal_conditioner
|
||||
../algorithms/libs//gps_sdr_signal_processing
|
||||
../algorithms/libs//gnss_sdr_valve
|
||||
../algorithms/libs//pass_through
|
||||
@ -23,6 +21,9 @@ exe run_tests : test_main.cc
|
||||
../algorithms/PVT/libs//gps_l1_ca_ls_pvt
|
||||
../algorithms/output_filter/adapters//file_output_filter
|
||||
../algorithms/output_filter/adapters//null_sink_output_filter
|
||||
../algorithms/resampler/adapters//direct_resampler_conditioner
|
||||
../algorithms/resampler/gnuradio_blocks//direct_resampler_conditioner_cc
|
||||
#../algorithms/resampler/gnuradio_blocks//direct_resampler_conditioner_ss
|
||||
../algorithms/signal_source/adapters//file_signal_source
|
||||
#../algorithms/signal_source/adapters//usrp1_signal_source
|
||||
../algorithms/telemetry_decoder/adapters//gps_l1_ca_telemetry_decoder
|
||||
|
Loading…
x
Reference in New Issue
Block a user