From 85a0bfe276d33cb2b091a4dc0a847cc918a0d146 Mon Sep 17 00:00:00 2001 From: NeuroForLunch Date: Mon, 31 May 2021 23:56:36 -0700 Subject: [PATCH] remove UHD requirement --- CMakeLists.txt | 1 - MANIFEST.md | 4 +- README.md | 9 +- examples/arch_makepkg/PKGBUILD | 4 +- grc/CMakeLists.txt | 5 +- grc/radar_usrp_echotimer_cc.block.yml | 264 +++++----- include/radar/CMakeLists.txt | 5 +- include/radar/usrp_echotimer_cc.h | 158 +++--- lib/CMakeLists.txt | 5 +- lib/usrp_echotimer_cc_impl.cc | 710 +++++++++++++------------- lib/usrp_echotimer_cc_impl.h | 224 ++++---- python/CMakeLists.txt | 2 +- python/qa_usrp_echotimer_cc.py | 50 +- swig/radar_swig.i | 6 +- 14 files changed, 725 insertions(+), 722 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6774bff..a2ffa61b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,7 +134,6 @@ endif(APPLE) # Find gnuradio build dependencies ######################################################################## find_package(Doxygen) -find_package(UHD) find_package(FFTW3f) ######################################################################## diff --git a/MANIFEST.md b/MANIFEST.md index cbe11d97..78fea684 100644 --- a/MANIFEST.md +++ b/MANIFEST.md @@ -2,7 +2,6 @@ title: gr-radar brief: GNU Radio Radar Toolbox tags: - radar - - UHD author: - Stefan Wunsch copyright_owner: @@ -10,13 +9,12 @@ copyright_owner: - Communications Engineering Lab (CEL) at Karlsruhe Institute of Technology (KIT) dependencies (most of them are needed by GNU Radio 3.8 and are included transitively): - gnuradio maint-3.8 - - UHD = 3.15 - QT 5.10.1 - Qwt = 6.1.0 - python-matplotlib repo: https://github.com/kit-cel/gr-radar website: https://grradar.wordpress.com -gr_supported_version: v3.7, v3.8 +gr_supported_version: v3.8 --- The *gr-radar* project provides a toolbox of commonly used radar algorithms. An important part is the *UHD Echotimer*, which enables a synchronized TX and RX stream from USRPs to ensure a constant phase relation in measurements. Example flowgraphs for CW, Dual CW, FSK, FMCW and OFDM radar are given and partly tested on hardware. GUI elements for target representation and further signal processing algorithms such as target tracking are implemented. Check out the project website for example videos and further information. diff --git a/README.md b/README.md index 8805d2ae..1e873a95 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ Change to any folder in your home directory and enter following commands in your `cmake ../` // build makefiles `make` // build toolbox -Some testcases use huge buffer sizes. Therefore you have to increse the maximum size of a single shared memory segment. Run following line to fix that. Additionally the script configures some USRP stuff. All changes will be resetted after reboot. +Some testcases use huge buffer sizes. Therefore you have to increase the maximum size of a single shared memory segment. Run following line to fix that. Additionally the script configures some USRP stuff. All changes will be reset after reboot. `sudo ./../examples/setup/setup_core` -Now you can run all testcases and install the toolbox. If `ctest` responds with '100% tests passed' the toolbox should be build correctly. +Now you can run all test cases and install the toolbox. If `ctest` responds with '100% tests passed' the toolbox should be build correctly. `ctest` // run tests `sudo make install` // install toolbox @@ -29,8 +29,7 @@ For full documentation build the toolbox and open `build/docs/doxygen/html/index **Development platform** GNU Radio maint-3.8 -UHD 3.15 -Ubuntu 18.04 +Ubuntu 20.04 **Dependencies** Qt 5.10.1 @@ -38,7 +37,7 @@ Qwt 6.1.0 python-matplotlib -Qt and Qwt should be installed with GNU Radio. python-matplotlib is included in some testcases. +Qt and Qwt should be installed with GNU Radio. python-matplotlib is included in some test cases. **Contact** Stefan Wunsch diff --git a/examples/arch_makepkg/PKGBUILD b/examples/arch_makepkg/PKGBUILD index 15e35b33..ecfa891e 100644 --- a/examples/arch_makepkg/PKGBUILD +++ b/examples/arch_makepkg/PKGBUILD @@ -3,10 +3,10 @@ _gitname=gr-radar pkgver=git pkgrel=1 pkgdesc="GNU Radio Radar Toolbox" -arch=('x86_64') +arch=('amd64') url="https://grradar.wordpress.com" license=('GPL') -depends=('fftw' 'qwt' 'qt4' 'libuhd' 'python2-matplotlib') +depends=('fftw' 'qwt' 'qt4' 'libuhd' 'python3-matplotlib') makedepends=('git' 'cmake' 'make') optdepends=() source=("git://github.com/kit-cel/gr-radar") diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt index 6d6463b9..bc4c88d8 100644 --- a/grc/CMakeLists.txt +++ b/grc/CMakeLists.txt @@ -18,6 +18,10 @@ # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. +# Removed from the following list until fix is implemented +# radar_usrp_echotimer_cc.block.yml +#--------------------------------------------------------- + install(FILES radar_signal_generator_cw_c.block.yml radar_signal_generator_fmcw_c.block.yml @@ -30,7 +34,6 @@ install(FILES radar_signal_generator_fsk_c.block.yml radar_split_fsk_cc.block.yml radar_estimator_fsk.block.yml - radar_usrp_echotimer_cc.block.yml radar_estimator_fmcw.block.yml radar_signal_generator_sync_pulse_c.block.yml radar_estimator_sync_pulse_c.block.yml diff --git a/grc/radar_usrp_echotimer_cc.block.yml b/grc/radar_usrp_echotimer_cc.block.yml index e05e3e5f..3180895f 100644 --- a/grc/radar_usrp_echotimer_cc.block.yml +++ b/grc/radar_usrp_echotimer_cc.block.yml @@ -1,132 +1,132 @@ -# auto-generated by grc.converter - -id: radar_usrp_echotimer_cc -label: USRP Echotimer -category: '[RADAR]/RADAR' - -parameters: -- id: samp_rate - label: Sample rate - dtype: int -- id: center_freq - label: Center frequency - dtype: float -- id: num_delay_samps - label: Number delay samples - dtype: int - default: '0' -- id: args_tx - label: TX Arguments - dtype: string - default: '''addr=192.168.xx.xx''' - hide: part -- id: wire_tx - label: TX Wire - dtype: string - default: '''''' - hide: part -- id: clock_source_tx - label: TX Clock source - dtype: string - default: '''internal''' - hide: part -- id: time_source_tx - label: TX Time source - dtype: string - default: '''none''' - hide: part -- id: antenna_tx - label: TX Antenna - dtype: string - hide: part -- id: gain_tx - label: TX Gain - dtype: float - hide: part -- id: timeout_tx - label: TX Timeout - dtype: float - default: '0.1' - hide: part -- id: wait_tx - label: TX Wait to start - dtype: float - default: '0.05' - hide: part -- id: lo_offset_tx - label: TX Lo offset - dtype: float - default: '0' - hide: part -- id: args_rx - label: RX Arguments - dtype: string - default: '''addr=192.168.xx.xx''' - hide: part -- id: wire_rx - label: RX Wire - dtype: string - default: '''''' - hide: part -- id: clock_source_rx - label: RX Clock source - dtype: string - default: '''mimo''' - hide: part -- id: time_source_rx - label: RX Time Source - dtype: string - default: '''mimo''' - hide: part -- id: antenna_rx - label: RX Antenna - dtype: string - hide: part -- id: gain_rx - label: RX Gain - dtype: float - hide: part -- id: timeout_rx - label: RX Timeout - dtype: float - default: '0.1' - hide: part -- id: wait_rx - label: RX Wait to start - dtype: float - default: '0.05' - hide: part -- id: lo_offset_rx - label: RX Lo offset - dtype: float - default: '0' - hide: part -- id: len_key - label: Packet length key - dtype: string - default: '"packet_len"' - hide: part - -inputs: -- label: IQ in - domain: stream - dtype: complex - -outputs: -- label: IQ out - domain: stream - dtype: complex - -templates: - imports: import radar - make: radar.usrp_echotimer_cc(${samp_rate}, ${center_freq}, ${num_delay_samps}, - ${args_tx}, ${wire_tx}, ${clock_source_tx}, ${time_source_tx}, ${antenna_tx}, - ${gain_tx}, ${timeout_tx}, ${wait_tx}, ${lo_offset_tx}, ${args_rx}, ${wire_rx}, - ${clock_source_rx}, ${time_source_rx}, ${antenna_rx}, ${gain_rx}, ${timeout_rx}, - ${wait_rx}, ${lo_offset_rx}, ${len_key}) - callbacks: - - set_num_delay_samps(${num_delay_samps}) - - set_tx_gain(${gain_tx}) - - set_rx_gain(${gain_rx}) - -file_format: 1 +# # auto-generated by grc.converter +# +# id: radar_usrp_echotimer_cc +# label: USRP Echotimer +# category: '[RADAR]/RADAR' +# +# parameters: +# - id: samp_rate +# label: Sample rate +# dtype: int +# - id: center_freq +# label: Center frequency +# dtype: float +# - id: num_delay_samps +# label: Number delay samples +# dtype: int +# default: '0' +# - id: args_tx +# label: TX Arguments +# dtype: string +# default: '''addr=192.168.xx.xx''' +# hide: part +# - id: wire_tx +# label: TX Wire +# dtype: string +# default: '''''' +# hide: part +# - id: clock_source_tx +# label: TX Clock source +# dtype: string +# default: '''internal''' +# hide: part +# - id: time_source_tx +# label: TX Time source +# dtype: string +# default: '''none''' +# hide: part +# - id: antenna_tx +# label: TX Antenna +# dtype: string +# hide: part +# - id: gain_tx +# label: TX Gain +# dtype: float +# hide: part +# - id: timeout_tx +# label: TX Timeout +# dtype: float +# default: '0.1' +# hide: part +# - id: wait_tx +# label: TX Wait to start +# dtype: float +# default: '0.05' +# hide: part +# - id: lo_offset_tx +# label: TX Lo offset +# dtype: float +# default: '0' +# hide: part +# - id: args_rx +# label: RX Arguments +# dtype: string +# default: '''addr=192.168.xx.xx''' +# hide: part +# - id: wire_rx +# label: RX Wire +# dtype: string +# default: '''''' +# hide: part +# - id: clock_source_rx +# label: RX Clock source +# dtype: string +# default: '''mimo''' +# hide: part +# - id: time_source_rx +# label: RX Time Source +# dtype: string +# default: '''mimo''' +# hide: part +# - id: antenna_rx +# label: RX Antenna +# dtype: string +# hide: part +# - id: gain_rx +# label: RX Gain +# dtype: float +# hide: part +# - id: timeout_rx +# label: RX Timeout +# dtype: float +# default: '0.1' +# hide: part +# - id: wait_rx +# label: RX Wait to start +# dtype: float +# default: '0.05' +# hide: part +# - id: lo_offset_rx +# label: RX Lo offset +# dtype: float +# default: '0' +# hide: part +# - id: len_key +# label: Packet length key +# dtype: string +# default: '"packet_len"' +# hide: part +# +# inputs: +# - label: IQ in +# domain: stream +# dtype: complex +# +# outputs: +# - label: IQ out +# domain: stream +# dtype: complex +# +# templates: +# imports: import radar +# make: radar.usrp_echotimer_cc(${samp_rate}, ${center_freq}, ${num_delay_samps}, +# ${args_tx}, ${wire_tx}, ${clock_source_tx}, ${time_source_tx}, ${antenna_tx}, +# ${gain_tx}, ${timeout_tx}, ${wait_tx}, ${lo_offset_tx}, ${args_rx}, ${wire_rx}, +# ${clock_source_rx}, ${time_source_rx}, ${antenna_rx}, ${gain_rx}, ${timeout_rx}, +# ${wait_rx}, ${lo_offset_rx}, ${len_key}) +# callbacks: +# - set_num_delay_samps(${num_delay_samps}) +# - set_tx_gain(${gain_tx}) +# - set_rx_gain(${gain_rx}) +# +# file_format: 1 diff --git a/include/radar/CMakeLists.txt b/include/radar/CMakeLists.txt index 0385c145..1ef23e87 100644 --- a/include/radar/CMakeLists.txt +++ b/include/radar/CMakeLists.txt @@ -18,6 +18,10 @@ # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. +# Removed until fix is implemented +# usrp_echotimer_cc.h + + ######################################################################## # Install public header files ######################################################################## @@ -34,7 +38,6 @@ install(FILES signal_generator_fsk_c.h split_fsk_cc.h estimator_fsk.h - usrp_echotimer_cc.h estimator_fmcw.h signal_generator_sync_pulse_c.h estimator_sync_pulse_c.h diff --git a/include/radar/usrp_echotimer_cc.h b/include/radar/usrp_echotimer_cc.h index 6826d5ec..83dbbf14 100644 --- a/include/radar/usrp_echotimer_cc.h +++ b/include/radar/usrp_echotimer_cc.h @@ -1,79 +1,79 @@ -/* -*- c++ -*- */ -/* - * Copyright 2014 Communications Engineering Lab, KIT. - * - * This 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, or (at your option) - * any later version. - * - * This software 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 this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_RADAR_USRP_ECHOTIMER_CC_H -#define INCLUDED_RADAR_USRP_ECHOTIMER_CC_H - -#include -#include - -namespace gr { -namespace radar { - -/*! - * \brief <+description of block+> - * \ingroup radar - * - */ -class RADAR_API usrp_echotimer_cc : virtual public gr::tagged_stream_block -{ -public: - typedef boost::shared_ptr sptr; - - /*! - * \brief Return a shared_ptr to a new instance of radar::usrp_echotimer_cc. - * - * To avoid accidental use of raw pointers, radar::usrp_echotimer_cc's - * constructor is in a private implementation - * class. radar::usrp_echotimer_cc::make is the public interface for - * creating new instances. - */ - static sptr make(int samp_rate, - float center_freq, - int num_delay_samps, - std::string args_tx, - std::string wire_tx, - std::string clock_source_tx, - std::string time_source_tx, - std::string antenna_tx, - float gain_tx, - float timeout_tx, - float wait_tx, - float lo_offset_tx, - std::string args_rx, - std::string wire_rx, - std::string clock_source_rx, - std::string time_source_rx, - std::string antenna_rx, - float gain_rx, - float timeout_rx, - float wait_rx, - float lo_offset_rx, - const std::string& len_key = "packet_len"); - - virtual void set_num_delay_samps(int num_samps) = 0; - virtual void set_rx_gain(float gain) = 0; - virtual void set_tx_gain(float gain) = 0; -}; - -} // namespace radar -} // namespace gr - -#endif /* INCLUDED_RADAR_USRP_ECHOTIMER_CC_H */ +// /* -*- c++ -*- */ +// /* +// * Copyright 2014 Communications Engineering Lab, KIT. +// * +// * This 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, or (at your option) +// * any later version. +// * +// * This software 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 this software; see the file COPYING. If not, write to +// * the Free Software Foundation, Inc., 51 Franklin Street, +// * Boston, MA 02110-1301, USA. +// */ +// +// #ifndef INCLUDED_RADAR_USRP_ECHOTIMER_CC_H +// #define INCLUDED_RADAR_USRP_ECHOTIMER_CC_H +// +// #include +// #include +// +// namespace gr { +// namespace radar { +// +// /*! +// * \brief <+description of block+> +// * \ingroup radar +// * +// */ +// class RADAR_API usrp_echotimer_cc : virtual public gr::tagged_stream_block +// { +// public: +// typedef boost::shared_ptr sptr; +// +// /*! +// * \brief Return a shared_ptr to a new instance of radar::usrp_echotimer_cc. +// * +// * To avoid accidental use of raw pointers, radar::usrp_echotimer_cc's +// * constructor is in a private implementation +// * class. radar::usrp_echotimer_cc::make is the public interface for +// * creating new instances. +// */ +// static sptr make(int samp_rate, +// float center_freq, +// int num_delay_samps, +// std::string args_tx, +// std::string wire_tx, +// std::string clock_source_tx, +// std::string time_source_tx, +// std::string antenna_tx, +// float gain_tx, +// float timeout_tx, +// float wait_tx, +// float lo_offset_tx, +// std::string args_rx, +// std::string wire_rx, +// std::string clock_source_rx, +// std::string time_source_rx, +// std::string antenna_rx, +// float gain_rx, +// float timeout_rx, +// float wait_rx, +// float lo_offset_rx, +// const std::string& len_key = "packet_len"); +// +// virtual void set_num_delay_samps(int num_samps) = 0; +// virtual void set_rx_gain(float gain) = 0; +// virtual void set_tx_gain(float gain) = 0; +// }; +// +// } // namespace radar +// } // namespace gr +// +// #endif /* INCLUDED_RADAR_USRP_ECHOTIMER_CC_H */ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index d85b5590..eafbdb50 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -48,7 +48,6 @@ list(APPEND radar_sources signal_generator_fsk_c_impl.cc split_fsk_cc_impl.cc estimator_fsk_impl.cc - usrp_echotimer_cc_impl.cc estimator_fmcw_impl.cc signal_generator_sync_pulse_c_impl.cc estimator_sync_pulse_c_impl.cc @@ -68,6 +67,8 @@ list(APPEND radar_sources estimator_rcs_impl.cc trigger_command_impl.cc ) + # Removed from above list until fix is implemented + # usrp_echotimer_cc_impl.cc set(radar_sources "${radar_sources}" PARENT_SCOPE) if(NOT radar_sources) @@ -77,7 +78,7 @@ endif(NOT radar_sources) add_library(gnuradio-radar SHARED ${radar_sources}) target_link_libraries(gnuradio-radar PUBLIC - gnuradio::gnuradio-runtime ${QT_LIBRARIES} fftw3f::fftw3f UHD::UHD qwt::qwt + gnuradio::gnuradio-runtime ${QT_LIBRARIES} fftw3f::fftw3f qwt::qwt ) target_include_directories(gnuradio-radar PUBLIC $ diff --git a/lib/usrp_echotimer_cc_impl.cc b/lib/usrp_echotimer_cc_impl.cc index d17fa929..bd0b5022 100644 --- a/lib/usrp_echotimer_cc_impl.cc +++ b/lib/usrp_echotimer_cc_impl.cc @@ -1,355 +1,355 @@ -/* -*- c++ -*- */ -/* - * Copyright 2014 Communications Engineering Lab, KIT. - * - * This 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, or (at your option) - * any later version. - * - * This software 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 this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "usrp_echotimer_cc_impl.h" -#include -#include - -namespace gr { -namespace radar { - -usrp_echotimer_cc::sptr usrp_echotimer_cc::make(int samp_rate, - float center_freq, - int num_delay_samps, - std::string args_tx, - std::string wire_tx, - std::string clock_source_tx, - std::string time_source_tx, - std::string antenna_tx, - float gain_tx, - float timeout_tx, - float wait_tx, - float lo_offset_tx, - std::string args_rx, - std::string wire_rx, - std::string clock_source_rx, - std::string time_source_rx, - std::string antenna_rx, - float gain_rx, - float timeout_rx, - float wait_rx, - float lo_offset_rx, - const std::string& len_key) -{ - return gnuradio::get_initial_sptr(new usrp_echotimer_cc_impl(samp_rate, - center_freq, - num_delay_samps, - args_tx, - wire_tx, - clock_source_tx, - time_source_tx, - antenna_tx, - gain_tx, - timeout_tx, - wait_tx, - lo_offset_tx, - args_rx, - wire_rx, - clock_source_rx, - time_source_rx, - antenna_rx, - gain_rx, - timeout_rx, - wait_rx, - lo_offset_rx, - len_key)); -} - -/* - * The private constructor - */ -usrp_echotimer_cc_impl::usrp_echotimer_cc_impl(int samp_rate, - float center_freq, - int num_delay_samps, - std::string args_tx, - std::string wire_tx, - std::string clock_source_tx, - std::string time_source_tx, - std::string antenna_tx, - float gain_tx, - float timeout_tx, - float wait_tx, - float lo_offset_tx, - std::string args_rx, - std::string wire_rx, - std::string clock_source_rx, - std::string time_source_rx, - std::string antenna_rx, - float gain_rx, - float timeout_rx, - float wait_rx, - float lo_offset_rx, - const std::string& len_key) - : gr::tagged_stream_block("usrp_echotimer_cc", - gr::io_signature::make(1, 1, sizeof(gr_complex)), - gr::io_signature::make(1, 1, sizeof(gr_complex)), - len_key) -{ - d_samp_rate = samp_rate; - d_center_freq = center_freq; - d_num_delay_samps = num_delay_samps; - d_out_buffer.resize(0); - - //***** Setup USRP TX *****// - - d_args_tx = args_tx; - d_wire_tx = wire_tx; - d_clock_source_tx = clock_source_tx; - d_time_source_tx = time_source_tx; - d_antenna_tx = antenna_tx; - d_lo_offset_tx = lo_offset_tx; - d_gain_tx = gain_tx; - d_timeout_tx = timeout_tx; // timeout for sending - d_wait_tx = wait_tx; // secs to wait befor sending - - // Setup USRP TX: args (addr,...) - d_usrp_tx = uhd::usrp::multi_usrp::make(d_args_tx); - std::cout << "Using USRP Device (TX): " << std::endl - << d_usrp_tx->get_pp_string() << std::endl; - - // Setup USRP TX: sample rate - std::cout << "Setting TX Rate: " << d_samp_rate << std::endl; - d_usrp_tx->set_tx_rate(d_samp_rate); - std::cout << "Actual TX Rate: " << d_usrp_tx->get_tx_rate() << std::endl; - - // Setup USRP TX: gain - set_tx_gain(d_gain_tx); - - // Setup USRP TX: tune request - d_tune_request_tx = - uhd::tune_request_t(d_center_freq); // FIXME: add alternative tune requests - d_usrp_tx->set_tx_freq(d_tune_request_tx); - - // Setup USRP TX: antenna - d_usrp_tx->set_tx_antenna(d_antenna_tx); - - // Setup USRP TX: clock source - d_usrp_tx->set_clock_source(d_clock_source_tx); // Set TX clock, TX is master - - // Setup USRP TX: time source - d_usrp_tx->set_time_source(d_time_source_tx); // Set TX time, TX is master - - // Setup USRP TX: timestamp - if (d_time_source_tx != "gpsdo") { - d_usrp_tx->set_time_now( - uhd::time_spec_t(0.0)); // Do set time on startup if not gpsdo is activated. - } - - // Setup transmit streamer - uhd::stream_args_t stream_args_tx("fc32", d_wire_tx); // complex floats - d_tx_stream = d_usrp_tx->get_tx_stream(stream_args_tx); - - //***** Setup USRP RX *****// - - d_args_rx = args_rx; - d_wire_rx = wire_rx; - d_clock_source_rx = clock_source_rx; - d_time_source_rx = time_source_rx; - d_antenna_rx = antenna_rx; - d_lo_offset_rx = lo_offset_rx; - d_gain_rx = gain_rx; - d_timeout_rx = timeout_rx; // timeout for receiving - d_wait_rx = wait_rx; // secs to wait befor receiving - - // Setup USRP RX: args (addr,...) - d_usrp_rx = uhd::usrp::multi_usrp::make(d_args_rx); - std::cout << "Using USRP Device (RX): " << std::endl - << d_usrp_rx->get_pp_string() << std::endl; - - // Setup USRP RX: sample rate - std::cout << "Setting RX Rate: " << d_samp_rate << std::endl; - d_usrp_rx->set_rx_rate(d_samp_rate); - std::cout << "Actual RX Rate: " << d_usrp_rx->get_rx_rate() << std::endl; - - // Setup USRP RX: gain - set_rx_gain(d_gain_rx); - - // Setup USRP RX: tune request - d_tune_request_rx = uhd::tune_request_t( - d_center_freq, d_lo_offset_rx); // FIXME: add alternative tune requests - d_usrp_rx->set_rx_freq(d_tune_request_rx); - - // Setup USRP RX: antenna - d_usrp_rx->set_rx_antenna(d_antenna_rx); - - // Setup USRP RX: clock source - d_usrp_rx->set_clock_source(d_clock_source_rx); // RX is slave, clock is set on TX - - // Setup USRP RX: time source - d_usrp_rx->set_time_source(d_time_source_rx); - - // Setup receive streamer - uhd::stream_args_t stream_args_rx("fc32", d_wire_rx); // complex floats - std::vector channel_nums; - channel_nums.push_back(0); // define channel! - stream_args_rx.channels = channel_nums; - d_rx_stream = d_usrp_rx->get_rx_stream(stream_args_rx); - - //***** Misc *****// - - // Setup rx_time pmt - d_time_key = pmt::string_to_symbol("rx_time"); - d_srcid = pmt::string_to_symbol("usrp_echotimer"); - - // Setup thread priority - // uhd::set_thread_priority_safe(); // necessary? doesnt work... - - // Sleep to get sync done - boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); // FIXME: necessary? -} - -/* - * Our virtual destructor. - */ -usrp_echotimer_cc_impl::~usrp_echotimer_cc_impl() {} - -int usrp_echotimer_cc_impl::calculate_output_stream_length( - const gr_vector_int& ninput_items) -{ - int noutput_items = ninput_items[0]; - return noutput_items; -} - -void usrp_echotimer_cc_impl::set_num_delay_samps(int num_samps) -{ - d_num_delay_samps = num_samps; -} - -void usrp_echotimer_cc_impl::set_rx_gain(float gain) { d_usrp_rx->set_rx_gain(gain); } - -void usrp_echotimer_cc_impl::set_tx_gain(float gain) { d_usrp_tx->set_tx_gain(gain); } - -void usrp_echotimer_cc_impl::send() -{ - // Setup metadata for first package - d_metadata_tx.start_of_burst = true; - d_metadata_tx.end_of_burst = false; - d_metadata_tx.has_time_spec = true; - d_metadata_tx.time_spec = - d_time_now_tx + uhd::time_spec_t(d_wait_tx); // Timespec needed? - - // Send input buffer - size_t num_acc_samps = 0; // Number of accumulated samples - size_t num_tx_samps, total_num_samps; - total_num_samps = d_noutput_items_send; - // Data to USRP - num_tx_samps = d_tx_stream->send(d_in_send, - total_num_samps, - d_metadata_tx, - total_num_samps / (float)d_samp_rate + d_timeout_tx); - // Get timeout - if (num_tx_samps < total_num_samps) - std::cerr << "Send timeout..." << std::endl; - - // send a mini EOB packet - d_metadata_tx.start_of_burst = false; - d_metadata_tx.end_of_burst = true; - d_metadata_tx.has_time_spec = false; - d_tx_stream->send("", 0, d_metadata_tx); -} - -void usrp_echotimer_cc_impl::receive() -{ - // Setup RX streaming - size_t total_num_samps = d_noutput_items_recv; - uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE); - stream_cmd.num_samps = total_num_samps; - stream_cmd.stream_now = false; - stream_cmd.time_spec = d_time_now_rx + uhd::time_spec_t(d_wait_rx); - d_rx_stream->issue_stream_cmd(stream_cmd); - - size_t num_rx_samps; - // Receive a packet - num_rx_samps = d_rx_stream->recv(d_out_recv, - total_num_samps, - d_metadata_rx, - total_num_samps / (float)d_samp_rate + d_timeout_rx); - - // Save timestamp - d_time_val = - pmt::make_tuple(pmt::from_uint64(d_metadata_rx.time_spec.get_full_secs()), - pmt::from_double(d_metadata_rx.time_spec.get_frac_secs())); - - // Handle the error code - if (d_metadata_rx.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE) { - throw std::runtime_error( - str(boost::format("Receiver error %s") % d_metadata_rx.strerror())); - } - - if (num_rx_samps < total_num_samps) - std::cerr << "Receive timeout before all samples received..." << std::endl; -} - -int usrp_echotimer_cc_impl::work(int noutput_items, - gr_vector_int& ninput_items, - gr_vector_const_void_star& input_items, - gr_vector_void_star& output_items) -{ - gr_complex* in = (gr_complex*)input_items[0]; // remove const - gr_complex* out = (gr_complex*)output_items[0]; - - // Set output items on packet length - noutput_items = ninput_items[0]; - - // Resize output buffer - if (d_out_buffer.size() != noutput_items) - d_out_buffer.resize(noutput_items); - - // Get time from USRP TX - d_time_now_tx = d_usrp_tx->get_time_now(); - d_time_now_rx = d_time_now_tx; - - // Send thread - d_in_send = in; - d_noutput_items_send = noutput_items; - d_thread_send = gr::thread::thread(boost::bind(&usrp_echotimer_cc_impl::send, this)); - - // Receive thread - d_out_recv = &d_out_buffer[0]; - d_noutput_items_recv = noutput_items; - d_thread_recv = - gr::thread::thread(boost::bind(&usrp_echotimer_cc_impl::receive, this)); - - // Wait for threads to complete - d_thread_send.join(); - d_thread_recv.join(); - - // Shift of number delay samples (fill with zeros) - memcpy(out, - &d_out_buffer[0] + d_num_delay_samps, - (noutput_items - d_num_delay_samps) * - sizeof(gr_complex)); // push buffer to output - memset(out + (noutput_items - d_num_delay_samps), - 0, - d_num_delay_samps * sizeof(gr_complex)); // set zeros - - // Setup rx_time tag - add_item_tag(0, nitems_written(0), d_time_key, d_time_val, d_srcid); - - // Tell runtime system how many output items we produced. - return noutput_items; -} - -} /* namespace radar */ -} /* namespace gr */ +// /* -*- c++ -*- */ +// /* +// * Copyright 2014 Communications Engineering Lab, KIT. +// * +// * This 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, or (at your option) +// * any later version. +// * +// * This software 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 this software; see the file COPYING. If not, write to +// * the Free Software Foundation, Inc., 51 Franklin Street, +// * Boston, MA 02110-1301, USA. +// */ +// +// #ifdef HAVE_CONFIG_H +// #include "config.h" +// #endif +// +// #include "usrp_echotimer_cc_impl.h" +// #include +// #include +// +// namespace gr { +// namespace radar { +// +// usrp_echotimer_cc::sptr usrp_echotimer_cc::make(int samp_rate, +// float center_freq, +// int num_delay_samps, +// std::string args_tx, +// std::string wire_tx, +// std::string clock_source_tx, +// std::string time_source_tx, +// std::string antenna_tx, +// float gain_tx, +// float timeout_tx, +// float wait_tx, +// float lo_offset_tx, +// std::string args_rx, +// std::string wire_rx, +// std::string clock_source_rx, +// std::string time_source_rx, +// std::string antenna_rx, +// float gain_rx, +// float timeout_rx, +// float wait_rx, +// float lo_offset_rx, +// const std::string& len_key) +// { +// return gnuradio::get_initial_sptr(new usrp_echotimer_cc_impl(samp_rate, +// center_freq, +// num_delay_samps, +// args_tx, +// wire_tx, +// clock_source_tx, +// time_source_tx, +// antenna_tx, +// gain_tx, +// timeout_tx, +// wait_tx, +// lo_offset_tx, +// args_rx, +// wire_rx, +// clock_source_rx, +// time_source_rx, +// antenna_rx, +// gain_rx, +// timeout_rx, +// wait_rx, +// lo_offset_rx, +// len_key)); +// } +// +// /* +// * The private constructor +// */ +// usrp_echotimer_cc_impl::usrp_echotimer_cc_impl(int samp_rate, +// float center_freq, +// int num_delay_samps, +// std::string args_tx, +// std::string wire_tx, +// std::string clock_source_tx, +// std::string time_source_tx, +// std::string antenna_tx, +// float gain_tx, +// float timeout_tx, +// float wait_tx, +// float lo_offset_tx, +// std::string args_rx, +// std::string wire_rx, +// std::string clock_source_rx, +// std::string time_source_rx, +// std::string antenna_rx, +// float gain_rx, +// float timeout_rx, +// float wait_rx, +// float lo_offset_rx, +// const std::string& len_key) +// : gr::tagged_stream_block("usrp_echotimer_cc", +// gr::io_signature::make(1, 1, sizeof(gr_complex)), +// gr::io_signature::make(1, 1, sizeof(gr_complex)), +// len_key) +// { +// d_samp_rate = samp_rate; +// d_center_freq = center_freq; +// d_num_delay_samps = num_delay_samps; +// d_out_buffer.resize(0); +// +// //***** Setup USRP TX *****// +// +// d_args_tx = args_tx; +// d_wire_tx = wire_tx; +// d_clock_source_tx = clock_source_tx; +// d_time_source_tx = time_source_tx; +// d_antenna_tx = antenna_tx; +// d_lo_offset_tx = lo_offset_tx; +// d_gain_tx = gain_tx; +// d_timeout_tx = timeout_tx; // timeout for sending +// d_wait_tx = wait_tx; // secs to wait befor sending +// +// // Setup USRP TX: args (addr,...) +// d_usrp_tx = uhd::usrp::multi_usrp::make(d_args_tx); +// std::cout << "Using USRP Device (TX): " << std::endl +// << d_usrp_tx->get_pp_string() << std::endl; +// +// // Setup USRP TX: sample rate +// std::cout << "Setting TX Rate: " << d_samp_rate << std::endl; +// d_usrp_tx->set_tx_rate(d_samp_rate); +// std::cout << "Actual TX Rate: " << d_usrp_tx->get_tx_rate() << std::endl; +// +// // Setup USRP TX: gain +// set_tx_gain(d_gain_tx); +// +// // Setup USRP TX: tune request +// d_tune_request_tx = +// uhd::tune_request_t(d_center_freq); // FIXME: add alternative tune requests +// d_usrp_tx->set_tx_freq(d_tune_request_tx); +// +// // Setup USRP TX: antenna +// d_usrp_tx->set_tx_antenna(d_antenna_tx); +// +// // Setup USRP TX: clock source +// d_usrp_tx->set_clock_source(d_clock_source_tx); // Set TX clock, TX is master +// +// // Setup USRP TX: time source +// d_usrp_tx->set_time_source(d_time_source_tx); // Set TX time, TX is master +// +// // Setup USRP TX: timestamp +// if (d_time_source_tx != "gpsdo") { +// d_usrp_tx->set_time_now( +// uhd::time_spec_t(0.0)); // Do set time on startup if not gpsdo is activated. +// } +// +// // Setup transmit streamer +// uhd::stream_args_t stream_args_tx("fc32", d_wire_tx); // complex floats +// d_tx_stream = d_usrp_tx->get_tx_stream(stream_args_tx); +// +// //***** Setup USRP RX *****// +// +// d_args_rx = args_rx; +// d_wire_rx = wire_rx; +// d_clock_source_rx = clock_source_rx; +// d_time_source_rx = time_source_rx; +// d_antenna_rx = antenna_rx; +// d_lo_offset_rx = lo_offset_rx; +// d_gain_rx = gain_rx; +// d_timeout_rx = timeout_rx; // timeout for receiving +// d_wait_rx = wait_rx; // secs to wait befor receiving +// +// // Setup USRP RX: args (addr,...) +// d_usrp_rx = uhd::usrp::multi_usrp::make(d_args_rx); +// std::cout << "Using USRP Device (RX): " << std::endl +// << d_usrp_rx->get_pp_string() << std::endl; +// +// // Setup USRP RX: sample rate +// std::cout << "Setting RX Rate: " << d_samp_rate << std::endl; +// d_usrp_rx->set_rx_rate(d_samp_rate); +// std::cout << "Actual RX Rate: " << d_usrp_rx->get_rx_rate() << std::endl; +// +// // Setup USRP RX: gain +// set_rx_gain(d_gain_rx); +// +// // Setup USRP RX: tune request +// d_tune_request_rx = uhd::tune_request_t( +// d_center_freq, d_lo_offset_rx); // FIXME: add alternative tune requests +// d_usrp_rx->set_rx_freq(d_tune_request_rx); +// +// // Setup USRP RX: antenna +// d_usrp_rx->set_rx_antenna(d_antenna_rx); +// +// // Setup USRP RX: clock source +// d_usrp_rx->set_clock_source(d_clock_source_rx); // RX is slave, clock is set on TX +// +// // Setup USRP RX: time source +// d_usrp_rx->set_time_source(d_time_source_rx); +// +// // Setup receive streamer +// uhd::stream_args_t stream_args_rx("fc32", d_wire_rx); // complex floats +// std::vector channel_nums; +// channel_nums.push_back(0); // define channel! +// stream_args_rx.channels = channel_nums; +// d_rx_stream = d_usrp_rx->get_rx_stream(stream_args_rx); +// +// //***** Misc *****// +// +// // Setup rx_time pmt +// d_time_key = pmt::string_to_symbol("rx_time"); +// d_srcid = pmt::string_to_symbol("usrp_echotimer"); +// +// // Setup thread priority +// // uhd::set_thread_priority_safe(); // necessary? doesnt work... +// +// // Sleep to get sync done +// boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); // FIXME: necessary? +// } +// +// /* +// * Our virtual destructor. +// */ +// usrp_echotimer_cc_impl::~usrp_echotimer_cc_impl() {} +// +// int usrp_echotimer_cc_impl::calculate_output_stream_length( +// const gr_vector_int& ninput_items) +// { +// int noutput_items = ninput_items[0]; +// return noutput_items; +// } +// +// void usrp_echotimer_cc_impl::set_num_delay_samps(int num_samps) +// { +// d_num_delay_samps = num_samps; +// } +// +// void usrp_echotimer_cc_impl::set_rx_gain(float gain) { d_usrp_rx->set_rx_gain(gain); } +// +// void usrp_echotimer_cc_impl::set_tx_gain(float gain) { d_usrp_tx->set_tx_gain(gain); } +// +// void usrp_echotimer_cc_impl::send() +// { +// // Setup metadata for first package +// d_metadata_tx.start_of_burst = true; +// d_metadata_tx.end_of_burst = false; +// d_metadata_tx.has_time_spec = true; +// d_metadata_tx.time_spec = +// d_time_now_tx + uhd::time_spec_t(d_wait_tx); // Timespec needed? +// +// // Send input buffer +// size_t num_acc_samps = 0; // Number of accumulated samples +// size_t num_tx_samps, total_num_samps; +// total_num_samps = d_noutput_items_send; +// // Data to USRP +// num_tx_samps = d_tx_stream->send(d_in_send, +// total_num_samps, +// d_metadata_tx, +// total_num_samps / (float)d_samp_rate + d_timeout_tx); +// // Get timeout +// if (num_tx_samps < total_num_samps) +// std::cerr << "Send timeout..." << std::endl; +// +// // send a mini EOB packet +// d_metadata_tx.start_of_burst = false; +// d_metadata_tx.end_of_burst = true; +// d_metadata_tx.has_time_spec = false; +// d_tx_stream->send("", 0, d_metadata_tx); +// } +// +// void usrp_echotimer_cc_impl::receive() +// { +// // Setup RX streaming +// size_t total_num_samps = d_noutput_items_recv; +// uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE); +// stream_cmd.num_samps = total_num_samps; +// stream_cmd.stream_now = false; +// stream_cmd.time_spec = d_time_now_rx + uhd::time_spec_t(d_wait_rx); +// d_rx_stream->issue_stream_cmd(stream_cmd); +// +// size_t num_rx_samps; +// // Receive a packet +// num_rx_samps = d_rx_stream->recv(d_out_recv, +// total_num_samps, +// d_metadata_rx, +// total_num_samps / (float)d_samp_rate + d_timeout_rx); +// +// // Save timestamp +// d_time_val = +// pmt::make_tuple(pmt::from_uint64(d_metadata_rx.time_spec.get_full_secs()), +// pmt::from_double(d_metadata_rx.time_spec.get_frac_secs())); +// +// // Handle the error code +// if (d_metadata_rx.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE) { +// throw std::runtime_error( +// str(boost::format("Receiver error %s") % d_metadata_rx.strerror())); +// } +// +// if (num_rx_samps < total_num_samps) +// std::cerr << "Receive timeout before all samples received..." << std::endl; +// } +// +// int usrp_echotimer_cc_impl::work(int noutput_items, +// gr_vector_int& ninput_items, +// gr_vector_const_void_star& input_items, +// gr_vector_void_star& output_items) +// { +// gr_complex* in = (gr_complex*)input_items[0]; // remove const +// gr_complex* out = (gr_complex*)output_items[0]; +// +// // Set output items on packet length +// noutput_items = ninput_items[0]; +// +// // Resize output buffer +// if (d_out_buffer.size() != noutput_items) +// d_out_buffer.resize(noutput_items); +// +// // Get time from USRP TX +// d_time_now_tx = d_usrp_tx->get_time_now(); +// d_time_now_rx = d_time_now_tx; +// +// // Send thread +// d_in_send = in; +// d_noutput_items_send = noutput_items; +// d_thread_send = gr::thread::thread(boost::bind(&usrp_echotimer_cc_impl::send, this)); +// +// // Receive thread +// d_out_recv = &d_out_buffer[0]; +// d_noutput_items_recv = noutput_items; +// d_thread_recv = +// gr::thread::thread(boost::bind(&usrp_echotimer_cc_impl::receive, this)); +// +// // Wait for threads to complete +// d_thread_send.join(); +// d_thread_recv.join(); +// +// // Shift of number delay samples (fill with zeros) +// memcpy(out, +// &d_out_buffer[0] + d_num_delay_samps, +// (noutput_items - d_num_delay_samps) * +// sizeof(gr_complex)); // push buffer to output +// memset(out + (noutput_items - d_num_delay_samps), +// 0, +// d_num_delay_samps * sizeof(gr_complex)); // set zeros +// +// // Setup rx_time tag +// add_item_tag(0, nitems_written(0), d_time_key, d_time_val, d_srcid); +// +// // Tell runtime system how many output items we produced. +// return noutput_items; +// } +// +// } /* namespace radar */ +// } /* namespace gr */ diff --git a/lib/usrp_echotimer_cc_impl.h b/lib/usrp_echotimer_cc_impl.h index 6857df07..2a8ae7b6 100644 --- a/lib/usrp_echotimer_cc_impl.h +++ b/lib/usrp_echotimer_cc_impl.h @@ -1,112 +1,112 @@ -/* -*- c++ -*- */ -/* - * Copyright 2014 Communications Engineering Lab, KIT. - * - * This 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, or (at your option) - * any later version. - * - * This software 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 this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_RADAR_USRP_ECHOTIMER_CC_IMPL_H -#define INCLUDED_RADAR_USRP_ECHOTIMER_CC_IMPL_H - -#include - -#include -#include - -namespace gr { -namespace radar { - -class usrp_echotimer_cc_impl : public usrp_echotimer_cc -{ -private: - // Nothing to declare in this block. - -protected: - int calculate_output_stream_length(const gr_vector_int& ninput_items); - -public: - usrp_echotimer_cc_impl(int samp_rate, - float center_freq, - int num_delay_samps, - std::string args_tx, - std::string wire_tx, - std::string clock_source_tx, - std::string time_source_tx, - std::string antenna_tx, - float gain_tx, - float timeout_tx, - float wait_tx, - float lo_offset_tx, - std::string args_rx, - std::string wire_rx, - std::string clock_source_rx, - std::string time_source_rx, - std::string antenna_rx, - float gain_rx, - float timeout_rx, - float wait_rx, - float lo_offset_rx, - const std::string& len_key); - ~usrp_echotimer_cc_impl(); - void send(); - void receive(); - void set_num_delay_samps(int num_samps); - void set_rx_gain(float gain); - void set_tx_gain(float gain); - - int d_samp_rate; - float d_center_freq; - int d_num_delay_samps; - std::vector d_out_buffer; - - std::string d_args_tx, d_args_rx; - std::string d_clock_source_tx, d_clock_source_rx; - std::string d_wire_tx, d_wire_rx; - std::string d_antenna_tx, d_antenna_rx; - std::string d_time_source_tx, d_time_source_rx; - uhd::usrp::multi_usrp::sptr d_usrp_tx, d_usrp_rx; - uhd::tune_request_t d_tune_request_tx, d_tune_request_rx; - uhd::tx_streamer::sptr d_tx_stream; - uhd::rx_streamer::sptr d_rx_stream; - uhd::tx_metadata_t d_metadata_tx; - uhd::rx_metadata_t d_metadata_rx; - double d_lo_offset_tx, d_lo_offset_rx; - float d_timeout_tx, d_timeout_rx; - float d_wait_tx, d_wait_rx; - float d_gain_tx, d_gain_rx; - - uhd::time_spec_t d_time_now_tx, d_time_now_rx; - - gr::thread::thread d_thread_recv; - gr_complex* d_out_recv; - int d_noutput_items_recv; - pmt::pmt_t d_time_key, d_time_val, d_srcid; - - gr::thread::thread d_thread_send; - gr_complex* d_in_send; - int d_noutput_items_send; - - // Where all the action really happens - int work(int noutput_items, - gr_vector_int& ninput_items, - gr_vector_const_void_star& input_items, - gr_vector_void_star& output_items); -}; - -} // namespace radar -} // namespace gr - -#endif /* INCLUDED_RADAR_USRP_ECHOTIMER_CC_IMPL_H */ +// /* -*- c++ -*- */ +// /* +// * Copyright 2014 Communications Engineering Lab, KIT. +// * +// * This 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, or (at your option) +// * any later version. +// * +// * This software 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 this software; see the file COPYING. If not, write to +// * the Free Software Foundation, Inc., 51 Franklin Street, +// * Boston, MA 02110-1301, USA. +// */ +// +// #ifndef INCLUDED_RADAR_USRP_ECHOTIMER_CC_IMPL_H +// #define INCLUDED_RADAR_USRP_ECHOTIMER_CC_IMPL_H +// +// #include +// +// #include +// #include +// +// namespace gr { +// namespace radar { +// +// class usrp_echotimer_cc_impl : public usrp_echotimer_cc +// { +// private: +// // Nothing to declare in this block. +// +// protected: +// int calculate_output_stream_length(const gr_vector_int& ninput_items); +// +// public: +// usrp_echotimer_cc_impl(int samp_rate, +// float center_freq, +// int num_delay_samps, +// std::string args_tx, +// std::string wire_tx, +// std::string clock_source_tx, +// std::string time_source_tx, +// std::string antenna_tx, +// float gain_tx, +// float timeout_tx, +// float wait_tx, +// float lo_offset_tx, +// std::string args_rx, +// std::string wire_rx, +// std::string clock_source_rx, +// std::string time_source_rx, +// std::string antenna_rx, +// float gain_rx, +// float timeout_rx, +// float wait_rx, +// float lo_offset_rx, +// const std::string& len_key); +// ~usrp_echotimer_cc_impl(); +// void send(); +// void receive(); +// void set_num_delay_samps(int num_samps); +// void set_rx_gain(float gain); +// void set_tx_gain(float gain); +// +// int d_samp_rate; +// float d_center_freq; +// int d_num_delay_samps; +// std::vector d_out_buffer; +// +// std::string d_args_tx, d_args_rx; +// std::string d_clock_source_tx, d_clock_source_rx; +// std::string d_wire_tx, d_wire_rx; +// std::string d_antenna_tx, d_antenna_rx; +// std::string d_time_source_tx, d_time_source_rx; +// uhd::usrp::multi_usrp::sptr d_usrp_tx, d_usrp_rx; +// uhd::tune_request_t d_tune_request_tx, d_tune_request_rx; +// uhd::tx_streamer::sptr d_tx_stream; +// uhd::rx_streamer::sptr d_rx_stream; +// uhd::tx_metadata_t d_metadata_tx; +// uhd::rx_metadata_t d_metadata_rx; +// double d_lo_offset_tx, d_lo_offset_rx; +// float d_timeout_tx, d_timeout_rx; +// float d_wait_tx, d_wait_rx; +// float d_gain_tx, d_gain_rx; +// +// uhd::time_spec_t d_time_now_tx, d_time_now_rx; +// +// gr::thread::thread d_thread_recv; +// gr_complex* d_out_recv; +// int d_noutput_items_recv; +// pmt::pmt_t d_time_key, d_time_val, d_srcid; +// +// gr::thread::thread d_thread_send; +// gr_complex* d_in_send; +// int d_noutput_items_send; +// +// // Where all the action really happens +// int work(int noutput_items, +// gr_vector_int& ninput_items, +// gr_vector_const_void_star& input_items, +// gr_vector_void_star& output_items); +// }; +// +// } // namespace radar +// } // namespace gr +// +// #endif /* INCLUDED_RADAR_USRP_ECHOTIMER_CC_IMPL_H */ diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index d86d575f..21c8dc5d 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -51,7 +51,7 @@ GR_ADD_TEST(qa_static_target_simulator_cc ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_S GR_ADD_TEST(qa_signal_generator_fsk_c ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_signal_generator_fsk_c.py) GR_ADD_TEST(qa_split_fsk_cc ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_split_fsk_cc.py) GR_ADD_TEST(qa_estimator_fsk ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_estimator_fsk.py) -GR_ADD_TEST(qa_usrp_echotimer_cc ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_usrp_echotimer_cc.py) +# GR_ADD_TEST(qa_usrp_echotimer_cc ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_usrp_echotimer_cc.py) GR_ADD_TEST(qa_estimator_fmcw ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_estimator_fmcw.py) GR_ADD_TEST(qa_signal_generator_sync_pulse_c ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_signal_generator_sync_pulse_c.py) GR_ADD_TEST(qa_estimator_sync_pulse_c ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_estimator_sync_pulse_c.py) diff --git a/python/qa_usrp_echotimer_cc.py b/python/qa_usrp_echotimer_cc.py index 36a7dd14..dc8d8e29 100755 --- a/python/qa_usrp_echotimer_cc.py +++ b/python/qa_usrp_echotimer_cc.py @@ -1,41 +1,41 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# +# # Copyright 2014 Communications Engineering Lab, KIT. -# +# # This 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, or (at your option) # any later version. -# +# # This software 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 this software; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# -from gnuradio import gr, gr_unittest -from gnuradio import blocks -import radar_swig as radar - -class qa_usrp_echotimer_cc (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001_t (self): - # set up fg - self.tb.run () - # check data - - -if __name__ == '__main__': - gr_unittest.run(qa_usrp_echotimer_cc, "qa_usrp_echotimer_cc.xml") +# from gnuradio import gr, gr_unittest +# from gnuradio import blocks +# import radar_swig as radar +# +# class qa_usrp_echotimer_cc (gr_unittest.TestCase): +# +# def setUp (self): +# self.tb = gr.top_block () +# +# def tearDown (self): +# self.tb = None +# +# def test_001_t (self): +# # set up fg +# self.tb.run () +# # check data +# +# +# if __name__ == '__main__': +# gr_unittest.run(qa_usrp_echotimer_cc, "qa_usrp_echotimer_cc.xml") diff --git a/swig/radar_swig.i b/swig/radar_swig.i index 9fce5357..72d521f9 100644 --- a/swig/radar_swig.i +++ b/swig/radar_swig.i @@ -19,7 +19,7 @@ #include "radar/signal_generator_fsk_c.h" #include "radar/split_fsk_cc.h" #include "radar/estimator_fsk.h" -#include "radar/usrp_echotimer_cc.h" +// #include "radar/usrp_echotimer_cc.h" #include "radar/estimator_fmcw.h" #include "radar/signal_generator_sync_pulse_c.h" #include "radar/estimator_sync_pulse_c.h" @@ -66,8 +66,8 @@ GR_SWIG_BLOCK_MAGIC2(radar, signal_generator_fsk_c); GR_SWIG_BLOCK_MAGIC2(radar, split_fsk_cc); %include "radar/estimator_fsk.h" GR_SWIG_BLOCK_MAGIC2(radar, estimator_fsk); -%include "radar/usrp_echotimer_cc.h" -GR_SWIG_BLOCK_MAGIC2(radar, usrp_echotimer_cc); +// %include "radar/usrp_echotimer_cc.h" +// GR_SWIG_BLOCK_MAGIC2(radar, usrp_echotimer_cc); %include "radar/estimator_fmcw.h" GR_SWIG_BLOCK_MAGIC2(radar, estimator_fmcw);