mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-29 22:42:59 +00:00
New Teleorbit Flexiband adapter for Teleorbit Flexiband frontends
(optional signal source). It requires a external GNU Radio driver.
This commit is contained in:
@@ -51,6 +51,28 @@ if(ENABLE_GN3S)
|
||||
)
|
||||
endif(ENABLE_GN3S)
|
||||
|
||||
if(ENABLE_FLEXIBAND)
|
||||
##############################################
|
||||
# TELEORBIT FLEXIBAND FRONTEND ADAPTER
|
||||
##############################################
|
||||
if(OS_IS_MACOSX)
|
||||
set(MACOSX_ARGS "-DCMAKE_CXX_COMPILER=/usr/bin/clang++")
|
||||
endif(OS_IS_MACOSX)
|
||||
find_package(teleorbit REQUIRED)
|
||||
if(NOT TELEORBIT_FOUND)
|
||||
message(FATAL_ERROR "Teleorbit Flexiband GNURadio driver required to build gnss-sdr with the optional FLEXIBAND adapter")
|
||||
endif(NOT TELEORBIT_FOUND)
|
||||
|
||||
# Set up variables
|
||||
set(FLEXIBAND_DRIVER_INCLUDE_DIRS
|
||||
${OPT_DRIVER_INCLUDE_DIRS}
|
||||
${TELEORBIT_INCLUDE_DIR}/teleorbit
|
||||
)
|
||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${TELEORBIT_LIBRARIES})
|
||||
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${FLEXIBAND_DRIVER_INCLUDE_DIRS})
|
||||
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} flexiband_signal_source.cc)
|
||||
endif(ENABLE_FLEXIBAND)
|
||||
|
||||
|
||||
if(ENABLE_ARRAY)
|
||||
##############################################
|
||||
|
||||
146
src/algorithms/signal_source/adapters/flexiband_signal_source.cc
Normal file
146
src/algorithms/signal_source/adapters/flexiband_signal_source.cc
Normal file
@@ -0,0 +1,146 @@
|
||||
/*!
|
||||
* \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-2015 (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 "flexiband_signal_source.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <glog/logging.h>
|
||||
#include <teleorbit/frontend.h>
|
||||
#include "configuration_interface.h"
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
FlexibandSignalSource::FlexibandSignalSource(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 = "byte";
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
|
||||
std::string default_firmware_file = "flexiband_I-1b.bit";
|
||||
firmware_filename_ = configuration->property(role + ".firmware_file", default_firmware_file);
|
||||
|
||||
gain1_ = configuration->property(role + ".gain1", 0); // check gain DAC values for Flexiband frontend!
|
||||
gain2_ = configuration->property(role + ".gain2", 0); // check gain DAC values for Flexiband frontend!
|
||||
gain3_ = configuration->property(role + ".gain3", 0); // check gain DAC values for Flexiband frontend!
|
||||
|
||||
AGC_ = configuration->property(role + ".AGC", true); // enabed AGC by default
|
||||
|
||||
usb_packet_buffer_size_ =configuration->property(role + ".usb_packet_buffer", 128);
|
||||
|
||||
RF_channels_ = configuration->property(role + ".RF_channels", 1);
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
flexiband_source_ = gr::teleorbit::frontend::make(firmware_filename_.c_str(),gain1_,gain2_,gain3_, AGC_, usb_packet_buffer_size_);
|
||||
|
||||
//create I, Q -> gr_complex type conversion blocks
|
||||
for (int n=0;n<(RF_channels_*2);n++)
|
||||
{
|
||||
char_to_float.push_back(gr::blocks::char_to_float::make());
|
||||
float_to_complex_.push_back(gr::blocks::float_to_complex::make());
|
||||
}
|
||||
|
||||
for (int n=0;n<(RF_channels_);n++)
|
||||
{
|
||||
float_to_complex_.push_back(gr::blocks::float_to_complex::make());
|
||||
}
|
||||
|
||||
DLOG(INFO) << "Item size " << item_size_;
|
||||
DLOG(INFO) << "Firmware file "<<firmware_filename_;
|
||||
DLOG(INFO) << "flexiband_source_(" << flexiband_source_->unique_id() << ")";
|
||||
|
||||
}else
|
||||
{
|
||||
LOG(WARNING) << item_type_ << " unrecognized item type for flexiband_source_";
|
||||
item_size_ = sizeof(gr_complex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
FlexibandSignalSource::~FlexibandSignalSource()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
void FlexibandSignalSource::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
for (int n=0;n<(RF_channels_*2);n++)
|
||||
{
|
||||
top_block->connect(flexiband_source_, n, char_to_float.at(n), 0);
|
||||
DLOG(INFO) << "connected flexiband_source_ to char_to_float CH"<<n;
|
||||
}
|
||||
for (int n=0;n<RF_channels_;n++)
|
||||
{
|
||||
top_block->connect(char_to_float.at(n*2), 0, float_to_complex_.at(n*2), 0);
|
||||
top_block->connect(char_to_float.at(n*2+1), 0, float_to_complex_.at(n*2+1), 0);
|
||||
DLOG(INFO) << "connected char_to_float to float_to_complex_ CH"<<n;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FlexibandSignalSource::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
for (int n=0;n<(RF_channels_*2);n++)
|
||||
{
|
||||
top_block->disconnect(flexiband_source_, n, char_to_float.at(n), 0);
|
||||
DLOG(INFO) << "disconnect flexiband_source_ to char_to_float CH"<<n;
|
||||
}
|
||||
for (int n=0;n<RF_channels_;n++)
|
||||
{
|
||||
top_block->disconnect(char_to_float.at(n*2), 0, float_to_complex_.at(n*2), 0);
|
||||
top_block->disconnect(char_to_float.at(n*2+1), 0, float_to_complex_.at(n*2+1), 0);
|
||||
DLOG(INFO) << "disconnect char_to_float to float_to_complex_ CH"<<n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr FlexibandSignalSource::get_left_block()
|
||||
{
|
||||
LOG(WARNING) << "Left block of a signal source should not be retrieved";
|
||||
return gr::block_sptr();
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr FlexibandSignalSource::get_right_block()
|
||||
{
|
||||
return get_right_block(0);
|
||||
}
|
||||
|
||||
gr::basic_block_sptr FlexibandSignalSource::get_right_block(int RF_channel)
|
||||
{
|
||||
return float_to_complex_.at(RF_channel);
|
||||
}
|
||||
|
||||
106
src/algorithms/signal_source/adapters/flexiband_signal_source.h
Normal file
106
src/algorithms/signal_source/adapters/flexiband_signal_source.h
Normal file
@@ -0,0 +1,106 @@
|
||||
/*!
|
||||
* \file raw_array_signal_source.h
|
||||
* \brief Signal Source adapter for the Teleorbit Flexiband front-end device.
|
||||
* This adapter requires a Flexiband GNURadio driver installed (not included with GNSS-SDR)
|
||||
* \author Javier Arribas, jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2015 (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 FLEXIBAND_SIGNAL_SOURCE_H_
|
||||
#define FLEXIBAND_SIGNAL_SOURCE_H_
|
||||
|
||||
#include <string>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/char_to_float.h>
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <vector>
|
||||
#include "gnss_block_interface.h"
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
/*!
|
||||
* \brief This class configures and reads samples from Teleorbit Flexiband front-end.
|
||||
* This software requires a Flexiband GNURadio driver installed (not included with GNSS-SDR).
|
||||
*/
|
||||
class FlexibandSignalSource: public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
FlexibandSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
unsigned int out_stream, gr::msg_queue::sptr queue);
|
||||
|
||||
virtual ~FlexibandSignalSource();
|
||||
std::string role()
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "FlexibandSignalSource".
|
||||
*/
|
||||
std::string implementation()
|
||||
{
|
||||
return "Flexiband_Signal_Source";
|
||||
}
|
||||
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();
|
||||
gr::basic_block_sptr get_right_block(int RF_channel);
|
||||
|
||||
private:
|
||||
std::string role_;
|
||||
unsigned int in_stream_;
|
||||
unsigned int out_stream_;
|
||||
std::string item_type_;
|
||||
size_t item_size_;
|
||||
|
||||
std::string firmware_filename_;
|
||||
int gain1_;
|
||||
int gain2_;
|
||||
int gain3_;
|
||||
int usb_packet_buffer_size_;
|
||||
bool AGC_;
|
||||
|
||||
int RF_channels_;
|
||||
|
||||
gr::block_sptr flexiband_source_;
|
||||
|
||||
std::vector<boost::shared_ptr<gr::block>> char_to_float;
|
||||
std::vector<boost::shared_ptr<gr::block>> float_to_complex_;
|
||||
|
||||
boost::shared_ptr<gr::msg_queue> queue_;
|
||||
};
|
||||
|
||||
#endif /*FLEXIBAND_SIGNAL_SOURCE_H_*/
|
||||
Reference in New Issue
Block a user