当前位置:网站首页>Gnuradio 3.9 using OOT custom module problem record

Gnuradio 3.9 using OOT custom module problem record

2022-07-08 01:22:00 You roll, I don't roll

Recently due to GR3.8 If there is a problem with the convolutional coding module in  GR3.9 , Find out  GR3.9 It can be used normally. , About   GR3.8 Why the convolutional coding module in can't be used, let's not delve into it first , Before written  GR3.8 To write OOT The process of , GR3.9 To write OOT Follow 3.8 Not much difference , But some modifications need attention .

Catalog

1、 The issue of relying on versions

2、 Every time you modify the public header file, you need to re bind binding

3、 Everything has passed the compilation , There is a problem when using


1、 The issue of relying on versions

(GNURadio3.9.3 There is a problem , but 3.9.4 This problem has been solved , If you want to save trouble, you can directly change to a new version ~)

GR3.9 And  GR3.8 A very important difference is python And C++ The way of interface has changed , GR3.8 It uses swig , and  GR3.9 It uses pybind11, If you don't know these two, it's not a problem , Relevant interfaces will be provided by gr_modtool Done automatically , We don't need to care about how to achieve it .  But according to the tutorial on the official website , GR3.9 need  pybind11 Version of >= 2.5.0,

Above said ubuntu20.04 Medium pybind11 Has been upgraded to 2.5.0, But what I checked was 2.4.3 Version of , As for why we don't know , So simply install a new source code , It's not too much trouble ~ The process is as follows :

curl -Lo pybind11.tar.gz https://github.com/pybind/pybind11/archive/v2.5.0.tar.gz 
mkdir pybind11 && tar xzf pybind11.tar.gz -C pybind11 --strip-components=1 && cd pybind11
mkdir build && cd build 
cmake .. -DCMAKE_BUILD_TYPE=Release -DPYBIND11_TEST=OFF 
make
sudo make install 

Note that the first line of command is to download the compressed package file from the specified website and rename it pybind11.tar.gz. However, the download may fail due to network reasons , At this time, you can download manually. The download address is the one in the command line :

https://github.com/pybind/pybind11/archive/v2.5.0.tar.gz 

Please rename it to  pybind11.tar.gz Then execute the following commands .

2、 Every time you modify the public header file, you need to re bind binding

Don't ask me what is a public header , I'm not sure ... Literally, my understanding is that you may have created module Of include/ The header file in the folder is the public header file , Because the files here can be used by all the files you create later block Use , I'm really smart / dog's head . That is to say, every time you modify the contents of the header file here, you should execute the following command to rebind :

gr_modtool bind [blockname]

hold  [blockname] Change to the corresponding block That's the name of . The reason can be explained on the official website .

This is a bit of a hole , If you don't notice, it will be CMake When I encountered a problem like the following :

......
CMake Error at /usr/local/lib/cmake/gnuradio/GrPybind.cmake:201 (message):
  Python bindings for my_header_payload_demux.h are out of sync
Call Stack (most recent call first):
  python/bindings/CMakeLists.txt:34 (GR_PYBIND_MAKE_OOT)
......

You think it's over ? No , There may be bug Waiting for you , I'm doing bind Encountered the following problem when :

Error: Can't parse input signature.
Error: Can't parse output signature.
Writing binding code to ./python/bindings/my_header_payload_demux_python.cc
Writing binding code to ./python/bindings/docstrings/my_header_payload_demux_pydoc_template.h

It's these two error , I can't parse my input and output ? Before, in my This blog Similar problems have been recorded in , But the solution at that time can't be used now , I didn't care about him , Because look at the back log The information was successful , Later facts prove , These two error It really doesn't matter , Let them put off the show , Let's take it as if we didn't see it .

3、 Everything has passed the compilation , There is a problem when using

The error of my question is like this :

AttributeError: 'myDemux.myDemux_python.my_header_payload_demux' object has no attribute 'to_basic_block'

Just like shape. :AttributeError: '×××' object has no attribute 'to_basic_block' Such a mistake , This is again binding There's something wrong with the document ( Mo panic ,bind Just these questions , No other problems have been found so far ), The solution is still on the official website :

  Just need to put  python/bindings/[blockname]_python.cc Add these parameters to the corresponding positions in the file :

gr::sync_block,
gr::block,
gr::basic_block,

Let me show you the effect after I finish :

Did you find that I commented out one  gr::sync_block Parameters , you 're right , If I don't comment out this parameter , When I recompile the code, the following will appear bug :

/home/wsx/USRPworkarea/mymodule/gr-myDemux/python/bindings/my_header_payload_demux_python.cc:37:23: error: ‘sync_block’ is not a member of ‘gr’
   37 |                   gr::sync_block,
      |                       ^~~~~~~~~~
/home/wsx/USRPworkarea/mymodule/gr-myDemux/python/bindings/my_header_payload_demux_python.cc:37:23: error: ‘sync_block’ is not a member of ‘gr’

Then I commented it out , Then recompile and install it again , I won't delve into the specific reasons . 

Reference resources :

GNU Radio 3.9 OOT Module Porting Guide - GNU Radio

Re: issues porting C++ OOT to 3.9 - fails at runtime import

https://github.com/gnuradio/gnuradio/issues/4773

( Brothers, if you encounter relevant problems, welcome to communicate ~)

原网站

版权声明
本文为[You roll, I don't roll]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130542480618.html