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

components of CTTC experimental GNSS antenna array signal source adapter for GNSS-SDR. Not usable yet!

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@481 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Javier Arribas 2014-02-17 18:53:45 +00:00
parent 0286006b8e
commit ae053127b4
9 changed files with 439 additions and 1 deletions

View File

@ -16,4 +16,5 @@
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
add_subdirectory(adapters)
add_subdirectory(adapters)
add_subdirectory(gnuradio_blocks)

View File

@ -0,0 +1,32 @@
# Copyright (C) 2012-2013 (see AUTHORS file for a list of contributors)
#
# 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/>.
#
set(INPUT_FILTER_GR_BLOCKS_SOURCES
beamformer.cc
)
include_directories(
$(CMAKE_CURRENT_SOURCE_DIR)
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
)
add_library(input_filter_gr_blocks ${INPUT_FILTER_GR_BLOCKS_SOURCES})
target_link_libraries(input_filter_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES})

View File

@ -0,0 +1,72 @@
/*!
* \file beamformer.cc
*
* \brief Unpacks byte samples to NSR 2 bits samples
* \author Javier Arribas jarribas (at) cttc.es
* -------------------------------------------------------------------------
*
* 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 "beamformer.h"
#include <iostream>
#include <gnuradio/io_signature.h>
beamformer_sptr make_beamformer()
{
return beamformer_sptr(new beamformer());
}
beamformer::beamformer()
: gr::sync_block("beamformer",
gr::io_signature::make(8, 8,sizeof(gr_complex)),
gr::io_signature::make(1, 1,sizeof(gr_complex)))
{
}
beamformer::~beamformer()
{
}
int beamformer::work(int noutput_items,gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
//gr_complex *out = (gr_complex *) output_items[0];
// channel output buffers
// gr_complex *ch1 = (gr_complex *) output_items[0];
// gr_complex *ch2 = (gr_complex *) output_items[1];
// gr_complex *ch3 = (gr_complex *) output_items[2];
// gr_complex *ch4 = (gr_complex *) output_items[3];
// gr_complex *ch5 = (gr_complex *) output_items[4];
// gr_complex *ch6 = (gr_complex *) output_items[5];
// gr_complex *ch7 = (gr_complex *) output_items[6];
// gr_complex *ch8 = (gr_complex *) output_items[7];
return noutput_items;
}

View File

@ -0,0 +1,57 @@
/*!
* \file beamformer.h
*
* \brief Simple spatial filter using RAW array input and beamforming coefficients
* \author Javier Arribas jarribas (at) cttc.es
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2014 (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_BEAMFORMER_H
#define GNSS_SDR_BEAMFORMER_H
#include <gnuradio/sync_block.h>
class beamformer;
typedef boost::shared_ptr<beamformer> beamformer_sptr;
beamformer_sptr make_beamformer();
/*!
* \brief This class implements a real-time software-defined spatial filter using the CTTC GNSS experimental antenna array input and a set of dynamically reloadable weights
*/
class beamformer: public gr::sync_block
{
private:
friend beamformer_sptr
make_beamformer_sptr();
public:
beamformer();
~beamformer();
int work (int noutput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
#endif

View File

@ -51,6 +51,33 @@ if($ENV{GN3S_DRIVER})
)
endif($ENV{GN3S_DRIVER})
if($ENV{RAW_ARRAY_DRIVER})
##############################################
# GRDBFCTTC GNSS EXPERIMENTAL ARRAY PROTOTYPE
##############################################
# find_package(GrDbfcttc)
# if not found, build it with ExternalPackage_Add
include(ExternalProject)
ExternalProject_Add(
gr-dbfcttc
SOURCE_DIR ${CMAKE_SOURCE_DIR}/drivers/gr-dbfcttc
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../../gr-dbfcttc
UPDATE_COMMAND ""
PATCH_COMMAND ""
INSTALL_COMMAND ""
)
# Set up variables
#set(GRDBFCTTC_INCLUDE_DIRS ${GRDBFCTTC_DIR}/include ${GRDBFCTTC_DIR} ${GRDBFCTTC_DIR}/src)
#set(GRDBFCTTC_LIBRARIES
# "${CMAKE_CURRENT_BINARY_DIR}/../../../../gr-dbfcttc/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gr-dbfcttc${CMAKE_SHARED_LIBRARY_SUFFIX}"
#)
#set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GRDBFCTTC_LIBRARIES})
#set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${GRDBFCTTC_INCLUDE_DIRS})
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} raw_array_signal_source.cc)
endif($ENV{RAW_ARRAY_DRIVER})
if($ENV{RTLSDR_DRIVER})

View File

@ -0,0 +1,142 @@
/*!
* \file raw_array_signal_source.cc
* \brief CTTC Experimental GNSS 8 channels array signal source
* \author Javier Arribas, jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2014 (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 "raw_array_signal_source.h"
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/msg_queue.h>
#include <dbfcttc/raw_array.h>
#include "configuration_interface.h"
#include <glog/log_severity.h>
#include <glog/logging.h>
using google::LogMessage;
RawArraySignalSource::RawArraySignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, unsigned int out_stream, gr::msg_queue::sptr queue) :
role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
{
std::string default_item_type = "gr_complex";
std::string default_dump_file = "./data/raw_array_source.dat";
item_type_ = configuration->property(role + ".item_type", default_item_type);
//dump_ = configuration->property(role + ".dump", false);
//dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
dump_=false;
std::string eth_device_;
eth_device_ = configuration->property(role + ".ethernet_dev", "eth0");
int channels_;
channels_ = configuration->property(role + ".channels", 8);
int snapshots_per_frame_;
snapshots_per_frame_ = configuration->property(role + ".snapshots_per_frame", 80);
int inter_frame_delay_;
inter_frame_delay_ = configuration->property(role + ".inter_frame_delay", 10);
int sampling_freq_;
sampling_freq_ = configuration->property(role + ".sampling_freq", 5000000);
if (item_type_.compare("gr_complex") == 0)
{
item_size_ = sizeof(gr_complex);
raw_array_source_ = gr::dbfcttc::raw_array::make(eth_device_.c_str(),channels_,snapshots_per_frame_,inter_frame_delay_,sampling_freq_);
DLOG(INFO) << "Item size " << item_size_;
DLOG(INFO) << "raw_array_source(" << raw_array_source_->unique_id() << ")";
}
// else if (item_type_.compare("short") == 0)
// {
// item_size_ = sizeof(short);
// resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_,
// sample_freq_out_);
// }
else
{
LOG_AT_LEVEL(WARNING) << item_type_
<< " unrecognized item type for raw_array_source_";
item_size_ = sizeof(gr_complex);
}
if (dump_)
{
//TODO: multichannel recorder
DLOG(INFO) << "Dumping output into file " << dump_filename_;
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
}
if (dump_)
{
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
}
}
RawArraySignalSource::~RawArraySignalSource()
{}
void RawArraySignalSource::connect(gr::top_block_sptr top_block)
{
if (dump_)
{
//TODO: multichannel recorder
top_block->connect(raw_array_source_, 0, file_sink_, 0);
DLOG(INFO) << "connected raw_array_source_ to file sink";
}
else
{
DLOG(INFO) << "nothing to connect internally";
}
}
void RawArraySignalSource::disconnect(gr::top_block_sptr top_block)
{
if (dump_)
{
//TODO: multichannel recorder
top_block->disconnect(raw_array_source_, 0, file_sink_, 0);
}
}
gr::basic_block_sptr RawArraySignalSource::get_left_block()
{
LOG_AT_LEVEL(WARNING) << "Left block of a signal source should not be retrieved";
return gr::block_sptr();
}
gr::basic_block_sptr RawArraySignalSource::get_right_block()
{
return raw_array_source_;
}

View File

@ -0,0 +1,90 @@
/*!
* \file raw_array_signal_source.h
* \brief CTTC Experimental GNSS 8 channels array signal source
* \author Javier Arribas, jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2014 (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 RAW_ARRAY_SIGNAL_SOURCE_H_
#define RAW_ARRAY_SIGNAL_SOURCE_H_
#include <string>
#include <gnuradio/hier_block2.h>
#include <gnuradio/msg_queue.h>
#include <gnuradio/blocks/file_sink.h>
#include "gnss_block_interface.h"
class ConfigurationInterface;
/*!
* \brief This class reads samples from a GN3S USB dongle, a RF front-end signal sampler
*/
class RawArraySignalSource: public GNSSBlockInterface
{
public:
RawArraySignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream,
unsigned int out_stream, gr::msg_queue::sptr queue);
virtual ~RawArraySignalSource();
std::string role()
{
return role_;
}
/*!
* \brief Returns "RawArraySignalSource".
*/
std::string implementation()
{
return "RawArraySignalSource";
}
size_t item_size()
{
return item_size_;
}
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();
private:
std::string role_;
unsigned int in_stream_;
unsigned int out_stream_;
std::string item_type_;
size_t item_size_;
long samples_;
bool dump_;
std::string dump_filename_;
gr::block_sptr raw_array_source_;
gr::blocks::file_sink::sptr file_sink_;
boost::shared_ptr<gr::msg_queue> queue_;
};
#endif /*RAW_ARRAY_SIGNAL_SOURCE_H_*/

View File

@ -74,6 +74,11 @@ if( GN3S_DRIVER )
add_definitions(-DGN3S_DRIVER=1)
endif( GN3S_DRIVER )
if( RAW_ARRAY_DRIVER )
message(STATUS "Support for CTTC RAW ARRAY enabled" )
add_definitions(-DRAW_ARRAY_DRIVER=1)
endif( RAW_ARRAY_DRIVER )
#Enable RTL-SDR module if the flag is present
if( $ENV{RTLSDR_DRIVER} )
message(STATUS "Support for RF front-end based on RTL dongle enabled" )

View File

@ -85,6 +85,10 @@
#include "gn3s_signal_source.h"
#endif
#if RAW_ARRAY_DRIVER
#include "raw_array_signal_source.h"
#endif
#if RTLSDR_DRIVER
#include "rtlsdr_signal_source.h"
#endif
@ -316,6 +320,14 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock(
}
#endif
#if RAW_ARRAY_DRIVER
else if (implementation.compare("Raw_Array_Signal_Source") == 0)
{
block = new RawArraySignalSource(configuration, role, in_streams,
out_streams, queue);
}
#endif
#if RTLSDR_DRIVER
else if (implementation.compare("Rtlsdr_Signal_Source") == 0)
{