Re: 3.9 Setup for OOT development

2021-02-05 Thread Gavin Jacobs
As promised, here is a link to the source for a simple OOT module/block that 
works on GNU Radio 3.9. The code shows how to handle variable # of inputs, and 
how to setup a callback when a parameter changes during runtime. You can find 
the block at: https://github.com/eejake52/gr-stream
There is a branch for the version that worked on 3.7, but I didn't make a 
branch for 3.8.
Hope that helps someone.

Jake




Re: 3.9 Setup for OOT development

2021-02-04 Thread Ron Economos
If you're converting from GNU Radio 3.7, you can automatically convert 
your .xml files into .yml files with the command:



gr_modtool update --complete


Just run it in the old OOT directory and copy over the .yml files to 
your new OOT. It does a very good (although not always perfect) job of 
converting.



Ron


On 2/4/21 14:37, Gavin Jacobs wrote:
I made some progress on this and now I have my OOT module/block 
working on Ubuntu 20.4, GNU Radio 3.9, written in C++, with callbacks 
and variable # of inputs.


There are two key things to report.
First is the workflow. None of the tutorials on the wiki (that I 
found) were complete, but eventually I got it working as follows:


cd 
gr_modtool newmod
/* < choose modulename > */
cd gr-modulename
gr_modtool add
/* < answer questions about blockname > */
/* < edit files:
    ./include/modulename/blockname.h
    ./lib/blockname_impl.h
    ./lib/blockname_impl.cc
    ./grc/modulename_blockname.block.yml
   > */
gr_modtool bind blockname
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig

NB - the 'bind' step must be done AFTER you edit the blockname.h file, 
and BEFORE you run cmake. So, if you make a mistake in the blockname.h 
file, you have to delete the build directory and go back to the bind 
step in the above sequence.


Second, the description of how to configure the yml file did not 
address variable number of inputs, nor callbacks. Here is a working 
example that shows both:


id: stream_select
label: Select
category: '[Stream]'

templates:
  imports: import stream
  make: stream.select(${qty}, ${ins})
  callbacks:
  - set_ins(${ins})

#  Make one 'parameters' list entry for every parameter you want 
settable from the GUI.

#     Keys include:
#     * id (makes the value accessible as keyname, e.g. in the make entry)
#     * label (label shown in the GUI)
#     * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
parameters:
- id: qty
  label: 'Number of Inputs'
  dtype: int
  default: 2

- id: ins
  label: 'Input Selector'
  dtype: int
  default: 0

#  Make one 'inputs' list entry per input and one 'outputs' list entry 
per output.

#  Keys include:
#      * label (an identifier for the GUI)
#      * domain (optional - stream or message. Default is stream)
#      * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
#      * vlen (optional - data stream vector length. Default is 1)
#      * optional (optional - set to 1 for optional inputs. Default is 0)
inputs:
- label: in
  dtype: float
  multiplicity: ${ qty }

outputs:
- label: out
  dtype: float

#  'file_format' specifies the version of the GRC yml format used in 
the file

#  and should usually not be changed.
file_format: 1

NB - I should have used a better id for the second parameter (ins) - 
do not confuse that with the in and out definitions.


Hope that helps,
Gavin






Re: 3.9 Setup for OOT development

2021-02-04 Thread Gavin Jacobs
I made some progress on this and now I have my OOT module/block working on 
Ubuntu 20.4, GNU Radio 3.9, written in C++, with callbacks and variable # of 
inputs.

There are two key things to report.
First is the workflow. None of the tutorials on the wiki (that I found) were 
complete, but eventually I got it working as follows:

cd 
gr_modtool newmod
/* < choose modulename > */
cd gr-modulename
gr_modtool add
/* < answer questions about blockname > */
/* < edit files:
./include/modulename/blockname.h
./lib/blockname_impl.h
./lib/blockname_impl.cc
./grc/modulename_blockname.block.yml
   > */
gr_modtool bind blockname
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig

NB - the 'bind' step must be done AFTER you edit the blockname.h file, and 
BEFORE you run cmake. So, if you make a mistake in the blockname.h file, you 
have to delete the build directory and go back to the bind step in the above 
sequence.

Second, the description of how to configure the yml file did not address 
variable number of inputs, nor callbacks. Here is a working example that shows 
both:

id: stream_select
label: Select
category: '[Stream]'

templates:
  imports: import stream
  make: stream.select(${qty}, ${ins})
  callbacks:
  - set_ins(${ins})

#  Make one 'parameters' list entry for every parameter you want settable from 
the GUI.
# Keys include:
# * id (makes the value accessible as keyname, e.g. in the make entry)
# * label (label shown in the GUI)
# * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
parameters:
- id: qty
  label: 'Number of Inputs'
  dtype: int
  default: 2

- id: ins
  label: 'Input Selector'
  dtype: int
  default: 0

#  Make one 'inputs' list entry per input and one 'outputs' list entry per 
output.
#  Keys include:
#  * label (an identifier for the GUI)
#  * domain (optional - stream or message. Default is stream)
#  * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
#  * vlen (optional - data stream vector length. Default is 1)
#  * optional (optional - set to 1 for optional inputs. Default is 0)
inputs:
- label: in
  dtype: float
  multiplicity: ${ qty }

outputs:
- label: out
  dtype: float

#  'file_format' specifies the version of the GRC yml format used in the file
#  and should usually not be changed.
file_format: 1

NB - I should have used a better id for the second parameter (ins) - do not 
confuse that with the in and out definitions.

Hope that helps,
Gavin






Re: 3.9 Setup for OOT development

2021-01-23 Thread Gavin Jacobs
@Criss Swaim - you were partly right. The problem was 
in the yml file, but not because I skipped that makeyaml step. The 'gr_modtool 
add' step provides a template yml file, which is a better starting point than 
the output of  'gr_modtool makeyaml'. The output of the latter does not include 
the "templates" section.

So, I used the instructions found here
https://wiki.gnuradio.org/index.php/YAML_GRC#Templates
and here
https://wiki.gnuradio.org/index.php/Guided_Tutorial_GNU_Radio_in_C%2B%2B#Step_4_bis:_Flesh_out_the_YAML_file

That made some progress! Now I can get the module/block onto the flowgraph and 
connect the inputs & outputs.
But when I try to execute the flow graph I get this error:
Generating: '/home/gavin/GNU_Stuff/GRC/U39/U39.py'
Executing: /usr/bin/python3 -u /home/gavin/GNU_Stuff/GRC/U39/U39.py
Warning: failed to XInitThreads()
Traceback (most recent call last):
  File "/home/gavin/GNU_Stuff/GRC/U39/U39.py", line 35, in 
import tooltest
ModuleNotFoundError: No module named 'tooltest'

Note: the XInitThreads happens all the time and other flowgraphs work fine 
inspite of it.

Next I compared my yml file (see below) to the in-tree ABS block and discovered 
that all the gnuradio blocks have a  new keyword "flags" and a new section 
called "cpp_templates:", so I copied those to my file. But of course, that 
didn't help because it points to the location of the gnuradio modules/blocks, 
and I need to edit it - but I don't quite see what I should put in there.

So, questions:

  *   anyone have an example yml file of an OOT module/block for 3.9?
  *   what do the "flags" mean?
  *   what should I put in the "cpp_template" section?

Thanks,
Gavin


Here is my yml file:

id: tooltest_wire
label: wire
category: '[tooltest]'
flags: [ python, cpp ]

templates:
  imports: import tooltest
  make: tooltest.wire(${k})

cpp_templates:
  includes: ['#include ']
  declarations: 'blocks::tooltest_wire:sptr ${id};'
  make: 'this->${id} = blocks::tooltest_wire::make(${k});'

#  Make one 'parameters' list entry for every parameter you want settable from 
the GUI.
# Keys include:
# * id (makes the value accessible as keyname, e.g. in the make entry)
# * label (label shown in the GUI)
# * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
parameters:
- id: k
  label: Scale Factor
  dtype: float
  default:  '1'

#  Make one 'inputs' list entry per input and one 'outputs' list entry per 
output.
#  Keys include:
#  * label (an identifier for the GUI)
#  * domain (optional - stream or message. Default is stream)
#  * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
#  * vlen (optional - data stream vector length. Default is 1)
#  * optional (optional - set to 1 for optional inputs. Default is 0)
inputs:
-   label: in
domain: stream
dtype: float

outputs:
-   label: out
domain: stream
dtype: float

#  'file_format' specifies the version of the GRC yml format used in the file
#  and should usually not be changed.
file_format: 1





Guided Tutorial GNU Radio in C++ - GNU 
Radio
Note: the get_minimum_distances function declaration also needs to be added to 
the class header (my_qpsk_demod_cb_impl.h).The function get_minimum_distances 
is a maximum likelihood decoder for the QPSK demodulater. Theoretically, the 
function should compute the distance from each ideal QPSK symbol to the 
received symbol (It is mathematically equivalent to determining the Voronoi 
regions of the ...
wiki.gnuradio.org


YAML GRC - GNU Radio
Starting with release 3.8, YAML replaces XML as the file format for GNU Radio 
Companion. This is triggered by switching from Cheetah to Mako as the 
templating engine, since Cheetah does not support Python 3.
wiki.gnuradio.org



Re: 3.9 Setup for OOT development

2021-01-22 Thread Criss Swaim

  
  
I have
  not used 3.9, but I have seen this behavior in 3.8 when the 

gr_modtool
  makeyaml blockname
step
  was skipped.


I would
  suggest running this step then re-make/make install.


After
  running this you should see the input/output parameters
  defined in the yaml file

Criss Swaim
csw...@tpginc.net
cell: 505.301.5701
On 1/22/2021 4:07 PM, Gavin Jacobs
  wrote:


  
  
  
You may recall that I was asking about gr_modtool a week ago.
I've made some progress and I think I'm very close to making my
block work. I'm using Ubuntu Desktop 20.04 in a Virtual Machine,
with GNU Radio 3.9.0.0git~master~14059~focal.
  

  
  
Here is what I've learned so far:
  

  
  
packages needed: git doxygen clang-format cmake pybind11-dev
python3-pygccxml liborc-0.4-dev


workflow:


cd ~/modules
gr_modtool newmod modulename
cd gr-modulename
gr_modtool add blockname
  < answer questions about blockname >
  < edit ./lib/blockname_impl.h ./lib/blockname_impl.cc
  ./include/modulename/blockname.h >
gr_modtool makeyaml
  < edit ./grc/modulename_blockname.block.yml
gr_modtool bind blockname
mkdir build
cd build
cmake ../
  < check for errors; ignore '-- Could NOT find MPIR
  ...'
make
sudo make install
sudo ldconfig (needed once on ubuntu, after initial 'sudo
  make install')
 < check gnuradio-companion for
  modulename->blockname; test blockname >

  
  
My block is a trivial block that copies a float input to a float
output. There are no parameters. I've gone through the above
steps without errors, and I get to the very end, where I can see
the block in the gnuradio-companion list, BUT when I try to add
it to a flowgraph, it won't show up on the canvas. I've tried
double-click and drag/drop, but neither puts the block in the
flowgraph.
  

  
  
I would like to hear from anyone who has built an OOT block from
scratch, using 3.9.0 gr_modtool.
  
Is the above procedure correct?
  
What might cause the block to not load?
  

  
  
Assuming I get it working, is there a page planned on the wiki
where I can document the procedures, tips, and pitfalls(I've
found a few)?
  

  
  
Thanks,
  
Gavin
  

  
  

  
  

  
  

  
  

  

  




3.9 Setup for OOT development

2021-01-22 Thread Gavin Jacobs
You may recall that I was asking about gr_modtool a week ago. I've made some 
progress and I think I'm very close to making my block work. I'm using Ubuntu 
Desktop 20.04 in a Virtual Machine, with GNU Radio 
3.9.0.0git~master~14059~focal.

Here is what I've learned so far:

packages needed: git doxygen clang-format cmake pybind11-dev python3-pygccxml 
liborc-0.4-dev

workflow:

cd ~/modules
gr_modtool newmod modulename
cd gr-modulename
gr_modtool add blockname
  < answer questions about blockname >
  < edit ./lib/blockname_impl.h ./lib/blockname_impl.cc 
./include/modulename/blockname.h >
gr_modtool makeyaml
  < edit ./grc/modulename_blockname.block.yml
gr_modtool bind blockname
mkdir build
cd build
cmake ../
  < check for errors; ignore '-- Could NOT find MPIR ...'
make
sudo make install
sudo ldconfig (needed once on ubuntu, after initial 'sudo make install')
 < check gnuradio-companion for modulename->blockname; test blockname >

My block is a trivial block that copies a float input to a float output. There 
are no parameters. I've gone through the above steps without errors, and I get 
to the very end, where I can see the block in the gnuradio-companion list, BUT 
when I try to add it to a flowgraph, it won't show up on the canvas. I've tried 
double-click and drag/drop, but neither puts the block in the flowgraph.

I would like to hear from anyone who has built an OOT block from scratch, using 
3.9.0 gr_modtool.
Is the above procedure correct?
What might cause the block to not load?

Assuming I get it working, is there a page planned on the wiki where I can 
document the procedures, tips, and pitfalls(I've found a few)?

Thanks,
Gavin







Re: 3.9 Setup for OOT development

2021-01-14 Thread Cinaed Simson



On 1/14/21 10:52 AM, Gavin Jacobs wrote:

Cinaed (or anyone who has used gr_modtool in v3.9)

 1. So, I can ignore mpir. Is this a bug in gr_modtool? i.e. why is it
trying to find it if it isn't needed?



You don't have MPIR - you have MPLIB instead. It's not a bug.


 1. Per your suggestion, I installed python3-pygccxml and that
eliminated that error. Thanks!
 2. In my new module, the file: lib/CMakeLists.txt was created by
gr_modtool, I didn't have any say in that file. I just barely know
how to invoke cmake, let alone how to debug it. Does the output



I can't help you with the gr_modtool. It depends on the inputs you 
provide and  your requirements.  And I've never used gr_modtool.


-- CInaed




Date: Wed, 13 Jan 2021 16:50:53 -0800
From: Cinaed Simson 
To: discuss-gnuradio@gnu.org
Subject: Re: 3.9 Setup for OOT development
Message-ID: <8a5878a2-b0d8-1e43-9836-ea58da17c...@gmail.com>
Content-Type: text/plain; charset="windows-1252"; Format="flowed"

Hi Gavin - you can probably ignore the first error - there are 2
possible entries for multiple precision libraries.

And I believe you need pygccxml for OOT development in 3.9

Try

   apt install python3-pygccxml

you can always uninstall it.

Also it appears the you may be trying to use an old nonexistent path in
lib/CMakeLists.txtfile?

-- Cinaed

On 1/13/21 12:32 PM, Gavin Jacobs wrote:
> CMake Error in lib/CMakeLists.txt:
>   Imported target "gnuradio::gnuradio-runtime" includes non-existent 
path

>     "/include"
>   in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:






Re: 3.9 Setup for OOT development

2021-01-14 Thread Marcus Müller
Hi Gavin,

On 14.01.21 19:52, Gavin Jacobs wrote:
> Cinaed (or anyone who has used gr_modtool in v3.9)
> 
>  1. So, I can ignore mpir. Is this a bug in gr_modtool?

No!

>  i.e. why is it
> trying to find it if it isn't needed?


MPIR is one of two options for a specific functionality (GMP being the
other option).

>  2. Per your suggestion, I installed python3-pygccxml and that
> eliminated that error. Thanks!

Glad to hear this works out so well!

Best regards,
Marcus



Re: 3.9 Setup for OOT development

2021-01-14 Thread Gavin Jacobs
Cinaed (or anyone who has used gr_modtool in v3.9)

  1.  So, I can ignore mpir. Is this a bug in gr_modtool? i.e. why is it trying 
to find it if it isn't needed?
  2.  Per your suggestion, I installed python3-pygccxml and that eliminated 
that error. Thanks!
  3.  In my new module, the file: lib/CMakeLists.txt was created by gr_modtool, 
I didn't have any say in that file. I just barely know how to invoke cmake, let 
alone how to debug it. Does the output from gr_modtool v3.9 need to be edited? 
If so, can someone help me to identify what needs to be fixed?

Gavin


Date: Wed, 13 Jan 2021 16:50:53 -0800
From: Cinaed Simson 
To: discuss-gnuradio@gnu.org
Subject: Re: 3.9 Setup for OOT development
Message-ID: <8a5878a2-b0d8-1e43-9836-ea58da17c...@gmail.com>
Content-Type: text/plain; charset="windows-1252"; Format="flowed"

Hi Gavin - you can probably ignore the first error - there are 2
possible entries for multiple precision libraries.

And I believe you need pygccxml for OOT development in  3.9

Try

   apt install python3-pygccxml

you can always uninstall it.

Also it appears the you may be trying to use an old nonexistent path in
lib/CMakeLists.txtfile?

-- Cinaed

On 1/13/21 12:32 PM, Gavin Jacobs wrote:
> CMake Error in lib/CMakeLists.txt:
>   Imported target "gnuradio::gnuradio-runtime" includes non-existent path
> "/include"
>   in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:




Re: 3.9 Setup for OOT development

2021-01-13 Thread Cinaed Simson
Hi Gavin - you can probably ignore the first error - there are 2 
possible entries for multiple precision libraries.


And I believe you need pygccxml for OOT development in  3.9

Try

  apt install python3-pygccxml

you can always uninstall it.

Also it appears the you may be trying to use an old nonexistent path in 
lib/CMakeLists.txtfile?


-- Cinaed

On 1/13/21 12:32 PM, Gavin Jacobs wrote:

CMake Error in lib/CMakeLists.txt:
  Imported target "gnuradio::gnuradio-runtime" includes non-existent path
    "/include"
  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:




3.9 Setup for OOT development

2021-01-13 Thread Gavin Jacobs
I am planning to update an OOT module I wrote 4 years ago. I setup a laptop 
with a fresh install of Ubuntu 20.04 to use for development. I installed GNU 
Radio 3.8, but then I decided to go with 3.9, so I removed 3.8, and installed 
3.9 from the PPA. Then I ran
modtool newmod streamx ...
cd streamx
modtool add ...
modtool  bind ...

and then tried
mkdir build
cd build
cmake ../

I didn't have cmake, so I installed that, and then doxygen, and then some 
others. Still getting errors so I installed ALL the dependencies for building 
GNU Radio as described here 
https://wiki.gnuradio.org/index.php/UbuntuInstall#Focal_Fossa_.2820.04.29.

I'm still getting the following errors from cmake
<...>
-- Checking for module 'mpir >= 3.0'
--   No package 'mpir' found
-- Could NOT find MPIR (missing: MPIRXX_LIBRARY MPIR_LIBRARY MPIR_INCLUDE_DIR)
<...>
-- Python checking for pygccxml - not found
<...>
CMake Error in lib/CMakeLists.txt:
  Imported target "gnuradio::gnuradio-runtime" includes non-existent path
"/include"
  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

So, do I need mpir and pygccxml? If yes, where to find them and how to install?

How do I investigate the missing /include? I can see the include directory in 
my new streamx module, it's exactly where modtool put it.


Thanks,
Gavin


UbuntuInstall - GNU 
Radio
Building GNU Radio on Ubuntu Linux []. GNU Radio works well on all Ubuntu 
versions from 10.04 upward. It is also possible to install GNU Radio on older 
releases of Ubuntu (see #Building_GNU_Radio_on_Legacy_Ubuntu).However, we may 
not be able to provide sufficient support for legacy OS.
wiki.gnuradio.org



InstallingGR - GNU Radio
>From Binaries []. The recommended way to install GNU Radio on most platforms 
>is using already available binary packages (see Ubuntu PPA Installation).For 
>some platforms there are no binaries provided by available package managers or 
>the GNU Radio project.
wiki.gnuradio.org