Skip to content

Commit

Permalink
Merge branch 'bleeding' into marathon
Browse files Browse the repository at this point in the history
  • Loading branch information
maiconkist authored Apr 4, 2019
2 parents 2dfd9fb + e710fc5 commit 4113834
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 38 deletions.
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
dist: xenial
sudo: required

before_script:
- sudo apt-get -qq update
- sudo apt-get install -qq build-essential cmake libfftw3-dev uhd-host libuhd-dev gnuradio-dev libopencv-dev libzmqpp-dev swig
language: cpp
script:
- mkdir build
- pushd build
- cmake ..
- make
- sudo make install
- sudo ldconfig
- popd
- mkdir grc_blocks/build/
- cd grc_blocks/build/
- cmake ../
- make
- sudo make install
- sudo ldconfig
123 changes: 123 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# gr-hydra

[![Build Status](https://travis-ci.org/maiconkist/gr-hydra.svg?branch=bleeding)](https://travis-ci.org/maiconkist/gr-hydra)


## GETTING STARTED

### REQUIRED LIBS

* build-essential
* cmake
* libfftw3-dev
* uhd-host
* libuhd-dev
* gnuradio-dev
* libopencv-dev
* libzmqpp-dev
* swig

```
sudo apt install build-essential cmake libfftw3-dev uhd-host libuhd-dev gnuradio-dev libopencv-dev libzmqpp-dev swig
```

## INSTALLATION

#### STANDARD VERSION - NO GNURADIO SUPPORT

Clone the repository and enter in the created folder (default: gr-hydra). Execute the following commands:

```
mkdir build; cd build;
cmake ../
make
sudo make install
sudo ldconfig
```

#### WITH GNURADIO SUPPORT

First install the STANDARD VERSION. Go to gr-hydra/grc_blocks and execute the following commands:

```
mkdir build; cd build;
cmake ../
make
sudo make install
```

## RUNNING THE EXAMPLES

### NOMENCLATURE

For all examples we:

- We associate a terminal ID to a all terminals open in the form **T_n**, where **n** is the terminal number. Wherewer needed we are going to refer to a specific terminal by specifying its ID.

- refer to **USRP_n** as a pair of **PC+USRP**, where **n** indentifies one of the pair. Ex: USRP_1 is what you consider your 1st PC+USRP, while **USRP_2** is your second. Whenever we refer to **USRP_1** you execute the instructions in that machine.


### EXAMPLE 1
#### HARDWARE REQUIREMENTS: 2x [USRP] -- IDEAL: 3x [USRP]


1. Open a terminal in USRP_1 (**T1**). Start the Hydra-Server flowgraph:
```
python grc_blocks/app/hydra_gr_server_example.py
```
2. Open a terminal in USRP_1 (**T2**). Start the client that request 2 end-to-end TX/RX slices:
```
python grc_blocks/app/hydra_gr_client_2tx_2rx_pdu_gen.py
```
3. Open a terminal in USRP_2 (**T3**). Start the flowgraph that receives the messages (PDU) transmitted in slice 1:
```
python grc_blocks/app/usrp_vr1_pdu_gen.grc
```
4. In **T3** you should see the log of messages being received from USRP_1:
```
LOG
LOG
LOG
LOG
```
5. In **T2** you should see the log of messages being received from USRP_2:
```
LOG
LOG
LOG
LOG
```
6. If you have only 2 USRP: stop the flowgraph in **T3**. Otherwise go to next step.
7. Open a terminal (**T4**) in USRP_3 (or USRP_2 if you have only 2 USRPs). Start the flowgraph that receives the messages (PDU) transmitted in slice 2:
```
python grc_blocks/app/usrp_vr2_pdu_gen.grc
```
8. In **T2** you should see the log of messages being received from **USRP_3** (or **USRP_2**):
```
LOG
LOG
LOG
LOG
```
9. In **T4** you should see the log of messages being received from USRP_1:
```
LOG
LOG
LOG
LOG
```


### EXAMPLE 2
#### HARDWARE REQUIREMENTS:


## LICENSE

## ACKNOWLEDGEMENTS

## TROUBLESHOOTING

* Cmake cannot find FFTW ?

Put the file in https://github.com/jedbrown/cmake-modules/blob/master/FindFFTW.cmake in the folder /usr/share/cmake-2.8/Modules/
13 changes: 0 additions & 13 deletions README.txt

This file was deleted.

10 changes: 0 additions & 10 deletions grc_blocks/lib/hydra_gr_client_sink_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,14 @@ hydra_gr_client_sink_impl::start_client(double d_center_frequency,
if (!err)
{
std::cout << boost::format("host: %s - port: %d") % g_host % rx_conf.server_port << std::endl;
#if 0
d_tcp_sink = gr::blocks::tcp_server_sink::make(sizeof(gr_complex),
g_host,
rx_conf.server_port,
true);

connect(self(), 0, d_tcp_sink, 0);
#endif

#if 1
std::string addr = "tcp://" + g_host + ":" + std::to_string(rx_conf.server_port);
std::cout << "addr: " << addr << std::endl;
gr::zeromq::push_sink::sptr d_sink = gr::zeromq::push_sink::make(sizeof(gr_complex),
1,
const_cast<char *>(addr.c_str()));

connect(self(), 0, d_sink, 0);
#endif
std::cout << "Client Sink initialized successfully." << std::endl;
}
else
Expand Down
2 changes: 0 additions & 2 deletions grc_blocks/lib/hydra_gr_client_sink_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "hydra/hydra_gr_client_sink.h"
#include "hydra/hydra_client.h"

#include <gnuradio/blocks/tcp_server_sink.h>
#include <chrono>

using namespace hydra;
Expand Down Expand Up @@ -35,7 +34,6 @@ class hydra_gr_client_sink_impl : public hydra_gr_client_sink
virtual bool stop();

private:
gr::blocks::tcp_server_sink::sptr d_tcp_sink;
std::unique_ptr<hydra_client> client;
std::string g_host;
};
Expand Down
13 changes: 4 additions & 9 deletions include/hydra/hydra_hypervisor.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
/*
/*
* Copyright 2016 Trinity Connect Centre.
*
*
* HyDRA 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.
*
*
* HyDRA 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,
Expand Down Expand Up @@ -52,11 +52,6 @@ class Hypervisor
*/
void attach_virtual_radio(VirtualRadioPtr vr);
bool detach_virtual_radio(size_t radio_id);

/**
* @param idx
* @return vradio_ptr to VR
*/
VirtualRadioPtr const get_vradio(size_t idx);

/** Called by Virtual Radio instances to notify changes
Expand Down
4 changes: 0 additions & 4 deletions lib/hydra_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ HydraCore::set_rx_resources(uhd_hydra_sptr usrp,
{
// Initialise the RX resources
p_resource_manager->set_rx_resources(d_centre_freq, d_bandwidth);

usrp->set_rx_config(d_centre_freq, d_bandwidth, 0);
p_hypervisor->set_rx_resources(usrp, d_centre_freq, d_bandwidth, u_fft_size);

// Toggle flag
Expand All @@ -37,8 +35,6 @@ HydraCore::set_tx_resources(uhd_hydra_sptr usrp,
{
// Initialise the RX resources
p_resource_manager->set_tx_resources(d_centre_freq, d_bandwidth);

usrp->set_tx_config(d_centre_freq, d_bandwidth, 0.6);
p_hypervisor->set_tx_resources(usrp, d_centre_freq, d_bandwidth, u_fft_size);

// Toggle flag
Expand Down
2 changes: 2 additions & 0 deletions lib/hydra_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ HydraMain::set_rx_config(uhd_hydra_sptr usrp,
unsigned int u_fft_size)
{
// Configure receiver resources
usrp->set_rx_config(d_cf, d_bw, 0);
core->set_rx_resources(usrp, d_cf, d_bw, u_fft_size);
}

Expand All @@ -32,6 +33,7 @@ void HydraMain::set_tx_config(uhd_hydra_sptr usrp,

{
// Configure transmitter resources
usrp->set_tx_config(d_cf, d_bw, 0.6);
core->set_tx_resources(usrp, d_cf, d_bw, u_fft_size);
}

Expand Down

0 comments on commit 4113834

Please sign in to comment.