mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 20:20:35 +00:00
Merge branch 'antonioramosdet-fractional_resampler' into next
This commit is contained in:
commit
199b1a9cff
@ -5,7 +5,7 @@
|
|||||||
INCLUDE(FindPkgConfig)
|
INCLUDE(FindPkgConfig)
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
# if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list
|
# if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list
|
||||||
if(NOT GR_REQUIRED_COMPONENTS)
|
if(NOT GR_REQUIRED_COMPONENTS)
|
||||||
set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FFT FILTER PMT FEC TRELLIS UHD)
|
set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FFT FILTER PMT FEC TRELLIS UHD)
|
||||||
endif()
|
endif()
|
||||||
@ -164,4 +164,17 @@ if(NOT PC_GNURADIO_RUNTIME_VERSION)
|
|||||||
if(GNURADIO_VERSION_GREATER_THAN_373)
|
if(GNURADIO_VERSION_GREATER_THAN_373)
|
||||||
set(PC_GNURADIO_RUNTIME_VERSION "3.7.4+")
|
set(PC_GNURADIO_RUNTIME_VERSION "3.7.4+")
|
||||||
endif(GNURADIO_VERSION_GREATER_THAN_373)
|
endif(GNURADIO_VERSION_GREATER_THAN_373)
|
||||||
endif(NOT PC_GNURADIO_RUNTIME_VERSION)
|
|
||||||
|
find_file(GNURADIO_VERSION_GREATER_THAN_38
|
||||||
|
NAMES gnuradio/filter/mmse_resampler_cc.h
|
||||||
|
HINTS $ENV{GNURADIO_RUNTIME_DIR}/include
|
||||||
|
${CMAKE_INSTALL_PREFIX}/include
|
||||||
|
${GNURADIO_INSTALL_PREFIX}/include
|
||||||
|
PATHS /usr/local/include
|
||||||
|
/usr/include
|
||||||
|
${GNURADIO_INSTALL_PREFIX}/include
|
||||||
|
)
|
||||||
|
if(GNURADIO_VERSION_GREATER_THAN_38)
|
||||||
|
set(PC_GNURADIO_RUNTIME_VERSION "3.8.0+")
|
||||||
|
endif(GNURADIO_VERSION_GREATER_THAN_38)
|
||||||
|
endif(NOT PC_GNURADIO_RUNTIME_VERSION)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2012-2015 (see AUTHORS file for a list of contributors)
|
# Copyright (C) 2012-2018 (see AUTHORS file for a list of contributors)
|
||||||
#
|
#
|
||||||
# This file is part of GNSS-SDR.
|
# This file is part of GNSS-SDR.
|
||||||
#
|
#
|
||||||
@ -16,7 +16,10 @@
|
|||||||
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
set(RESAMPLER_ADAPTER_SOURCES direct_resampler_conditioner.cc )
|
set(RESAMPLER_ADAPTER_SOURCES
|
||||||
|
direct_resampler_conditioner.cc
|
||||||
|
fractional_resampler_conditioner.cc
|
||||||
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
@ -28,6 +31,12 @@ include_directories(
|
|||||||
${VOLK_INCLUDE_DIRS}
|
${VOLK_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.13" )
|
||||||
|
add_definitions( -DGR_GREATER_38=1 )
|
||||||
|
endif(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.13" )
|
||||||
|
|
||||||
|
|
||||||
file(GLOB RESAMPLER_ADAPTER_HEADERS "*.h")
|
file(GLOB RESAMPLER_ADAPTER_HEADERS "*.h")
|
||||||
list(SORT RESAMPLER_ADAPTER_HEADERS)
|
list(SORT RESAMPLER_ADAPTER_HEADERS)
|
||||||
add_library(resampler_adapters ${RESAMPLER_ADAPTER_SOURCES} ${RESAMPLER_ADAPTER_HEADERS})
|
add_library(resampler_adapters ${RESAMPLER_ADAPTER_SOURCES} ${RESAMPLER_ADAPTER_HEADERS})
|
||||||
|
@ -0,0 +1,128 @@
|
|||||||
|
/*!
|
||||||
|
* \file fractional_resampler_conditioner.cc
|
||||||
|
* \brief Implementation of an adapter of a fractional resampler conditioner block
|
||||||
|
* to a SignalConditionerInterface
|
||||||
|
* \author Antonio Ramos, 2018. antonio.ramos(at)cttc.es
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2018 (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 "fractional_resampler_conditioner.h"
|
||||||
|
#include <cmath>
|
||||||
|
#include <limits>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
#include <gnuradio/blocks/file_sink.h>
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
FractionalResamplerConditioner::FractionalResamplerConditioner(
|
||||||
|
ConfigurationInterface* configuration, std::string role,
|
||||||
|
unsigned int in_stream, unsigned int out_stream) :
|
||||||
|
role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||||
|
{
|
||||||
|
std::string default_item_type = "gr_complex";
|
||||||
|
std::string default_dump_file = "./data/signal_conditioner.dat";
|
||||||
|
double fs_in_deprecated, fs_in;
|
||||||
|
fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000.0);
|
||||||
|
fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||||
|
sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", 4000000.0);
|
||||||
|
sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", fs_in);
|
||||||
|
if(std::fabs(fs_in - sample_freq_out_) > std::numeric_limits<double>::epsilon())
|
||||||
|
{
|
||||||
|
std::string aux_warn = "CONFIGURATION WARNING: Parameters GNSS-SDR.internal_fs_sps and "
|
||||||
|
+ role_ + ".sample_freq_out are not set to the same value!" ;
|
||||||
|
LOG(WARNING) << aux_warn;
|
||||||
|
std::cout << aux_warn << std::endl;
|
||||||
|
}
|
||||||
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
DLOG(INFO) << "dump_ is " << dump_;
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||||
|
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
#ifdef GR_GREATER_38
|
||||||
|
resampler_ = gr::filter::mmse_resampler_cc::make(0.0, sample_freq_in_ / sample_freq_out_);
|
||||||
|
#else
|
||||||
|
resampler_ = gr::filter::fractional_resampler_cc::make(0.0, sample_freq_in_ / sample_freq_out_);
|
||||||
|
#endif
|
||||||
|
DLOG(INFO) << "sample_freq_in " << sample_freq_in_;
|
||||||
|
DLOG(INFO) << "sample_freq_out" << sample_freq_out_;
|
||||||
|
DLOG(INFO) << "Item size " << item_size_;
|
||||||
|
DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG(WARNING) << item_type_ << " unrecognized item type for resampler";
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
}
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
||||||
|
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
|
||||||
|
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FractionalResamplerConditioner::~FractionalResamplerConditioner() {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void FractionalResamplerConditioner::connect(gr::top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(resampler_, 0, file_sink_, 0);
|
||||||
|
DLOG(INFO) << "connected resampler to file sink";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "nothing to connect internally";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FractionalResamplerConditioner::disconnect(gr::top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(resampler_, 0, file_sink_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr::basic_block_sptr FractionalResamplerConditioner::get_left_block()
|
||||||
|
{
|
||||||
|
return resampler_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr::basic_block_sptr FractionalResamplerConditioner::get_right_block()
|
||||||
|
{
|
||||||
|
return resampler_;
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
/*!
|
||||||
|
* \file fractional_resampler_conditioner.h
|
||||||
|
* \brief Interface of an adapter of a fractional resampler conditioner block
|
||||||
|
* to a SignalConditionerInterface
|
||||||
|
* \author Antonio Ramos, 2018. antonio.ramos(at)cttc.es
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2018 (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_FRACTIONAL_RESAMPLER_CONDITIONER_H_
|
||||||
|
#define GNSS_SDR_FRACTIONAL_RESAMPLER_CONDITIONER_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#ifdef GR_GREATER_38
|
||||||
|
#include <gnuradio/filter/mmse_resampler_cc.h>
|
||||||
|
#else
|
||||||
|
#include <gnuradio/filter/fractional_resampler_cc.h>
|
||||||
|
#endif
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Interface of an adapter of a fractional resampler conditioner block
|
||||||
|
* to a SignalConditionerInterface
|
||||||
|
*/
|
||||||
|
class FractionalResamplerConditioner: public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FractionalResamplerConditioner(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_stream,
|
||||||
|
unsigned int out_stream);
|
||||||
|
|
||||||
|
virtual ~FractionalResamplerConditioner();
|
||||||
|
|
||||||
|
inline std::string role() override
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string implementation() override
|
||||||
|
{
|
||||||
|
return "Fractional_Resampler";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline size_t item_size() override
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr::top_block_sptr top_block) override;
|
||||||
|
void disconnect(gr::top_block_sptr top_block) override;
|
||||||
|
gr::basic_block_sptr get_left_block() override;
|
||||||
|
gr::basic_block_sptr get_right_block() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string role_;
|
||||||
|
unsigned int in_stream_;
|
||||||
|
unsigned int out_stream_;
|
||||||
|
std::string item_type_;
|
||||||
|
size_t item_size_;
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
double sample_freq_in_;
|
||||||
|
double sample_freq_out_;
|
||||||
|
#ifdef GR_GREATER_38
|
||||||
|
gr::filter::mmse_resampler_cc::sptr resampler_;
|
||||||
|
#else
|
||||||
|
gr::filter::fractional_resampler_cc::sptr resampler_;
|
||||||
|
#endif
|
||||||
|
gr::block_sptr file_sink_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*GNSS_SDR_FRACTIONAL_RESAMPLER_CONDITIONER_H_*/
|
@ -92,6 +92,10 @@ endif(ENABLE_FMCOMMS2)
|
|||||||
|
|
||||||
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
|
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
|
if(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.13" )
|
||||||
|
add_definitions( -DGR_GREATER_38=1 )
|
||||||
|
endif(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.13" )
|
||||||
|
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
@ -62,6 +62,7 @@
|
|||||||
#include "ishort_to_cshort.h"
|
#include "ishort_to_cshort.h"
|
||||||
#include "ishort_to_complex.h"
|
#include "ishort_to_complex.h"
|
||||||
#include "direct_resampler_conditioner.h"
|
#include "direct_resampler_conditioner.h"
|
||||||
|
#include "fractional_resampler_conditioner.h"
|
||||||
#include "fir_filter.h"
|
#include "fir_filter.h"
|
||||||
#include "freq_xlating_fir_filter.h"
|
#include "freq_xlating_fir_filter.h"
|
||||||
#include "beamformer_filter.h"
|
#include "beamformer_filter.h"
|
||||||
@ -1170,6 +1171,13 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
|
|||||||
block = std::move(block_);
|
block = std::move(block_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (implementation.compare("Fractional_Resampler") == 0)
|
||||||
|
{
|
||||||
|
std::unique_ptr<GNSSBlockInterface> block_(new FractionalResamplerConditioner(configuration.get(), role,
|
||||||
|
in_streams, out_streams));
|
||||||
|
block = std::move(block_);
|
||||||
|
}
|
||||||
|
|
||||||
// ACQUISITION BLOCKS ---------------------------------------------------------
|
// ACQUISITION BLOCKS ---------------------------------------------------------
|
||||||
else if (implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0)
|
else if (implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user