当前位置:网站首页>Gnuradio3.9.4 create OOT module instances
Gnuradio3.9.4 create OOT module instances
2022-07-08 01:22:00 【You roll, I don't roll】
Catalog
1、 Create your own block( Be careful module And block The difference between )
1.2、 In the created myDemux Created in block
2、 Modify the corresponding code
3、 Compilation and installation
This tutorial is a record based on the actual experience of the Laboratory . It is mainly recorded after modifying the source code of a module , How to create a new copy of the module to replace the original instead of overwriting ( The original module code is not modified ).
in application , We changed it gnuradio Of Header/Payload Demux Module source code , But I don't want to directly cover the original code , Therefore, you need to create a named my Header/Payload Demux Custom modules for , Create a process in this record for future reference .
Before written How to be in GR3.8 Created in OOT modular , Actually GR3.9 Created in OOT Methods and 3.8 Almost the same as , The main difference is GR3.9 in python And C++ The binding method is different ,3.8 It's using swing,3.9 It's using pybind11, But this does not need us to consider , The program will run automatically python And C++ The binding of . So there is no difference on the whole .
This process only records the method , Don't talk . See the details as follows :
1、 Create your own block( Be careful module And block The difference between )
1.1、 establish module
Create a new folder to store the compiled modules , Be careful not to be associated with gnuradio Same folder , Execute the following command , First create a new one called myDemux Of module.
cd Your folder
gr_modtool newmod myDemux
Get into module in
cd gr-myDemux/
1.2、 In the created myDemux Created in block
Then add block, be known as my_header_payload_demux
[email protected]:~/USRPWorkArea/mymodule/gr-myDemux$ gr_modtool add -t general -l cpp my_header_payload_demux
GNU Radio module name identified: myDemux
Language: C++
Block/code identifier: my_header_payload_demux
Please specify the copyright holder:
Enter valid argument list, including default arguments:
Add Python QA code? [Y/n] y
Add C++ QA code? [y/N] n
Adding file 'lib/my_header_payload_demux_impl.h'...
Adding file 'lib/my_header_payload_demux_impl.cc'...
Adding file 'include/myDemux/my_header_payload_demux.h'...
Adding file 'python/bindings/docstrings/my_header_payload_demux_pydoc_template.h'...
Adding file 'python/bindings/my_header_payload_demux_python.cc'...
Adding file 'python/qa_my_header_payload_demux.py'...
Editing python/CMakeLists.txt...
Adding file 'grc/myDemux_my_header_payload_demux.block.yml'...
Editing grc/CMakeLists.txt...
2、 Modify the corresponding code
2.1、 modify C++ Code
Edit related documents , It is recommended to use VSCode, Why not? , Just be convenient , Other editors also work
You need to add
gr-digital / lib / header_payload_demux_impl.cc
gr-digital / lib / header_payload_demux_impl.h
include / gnuradio / digital / header_payload_demux.h
Copy the contents of three files to the created block The corresponding position of , Then modify the corresponding source code , Pay attention to modifying some Class name 、 Namespace namespace、 Include header file The content such as . Here are just a few places that are easy to ignore
1、 The original namespace :
namespace gr {
namespace digital {
......
}
}
To be changed to ( Every C++ All documents should be modified ):
namespace gr {
namespace myDemux {
......
}
}
2、 And the original header_payload_demux_impl.cpp All of the documents header_payload_demux Fields need to be changed to my_header_payload_demux.
3、 Just keep the predefined names in the header file as they were created
#ifndef INCLUDED_MYDEMUX_MY_HEADER_PAYLOAD_DEMUX_IMPL_H
#define INCLUDED_MYDEMUX_MY_HEADER_PAYLOAD_DEMUX_IMPL_H
.......
#endif /* INCLUDED_MYDEMUX_MY_HEADER_PAYLOAD_DEMUX_IMPL_H */
2.2、 modify yaml file
in addition , In the source code grc / digital_header_payload_demux.block.yml Copy the contents of to the created block The corresponding position of , And pay attention to modifying all of them and header_payload_demux The relevant content is my_header_payload_demux; modify primary label label Header/Payload Demux by my_header_payload_demux; And then there is import The label also needs to be modified to
imports: import myDemux
in addition cpp_templates Labeled includes The sub tag is modified to my_header_payload_demux.h The absolute path of ( It's easy ). Other details are easy to distinguish , All need to be revised one by one .
Then execute the following command python And Binding of header file . Be careful !! This is a necessary step , Just change it include Header file in folder ( These are all public header files ) You need to re execute this command to bind , And modify lib This step can be omitted when the header file in the folder . This step is also related to GR3.8 One obvious difference between .
gr_modtool bind [blockname]
In particular , Here because of the creation block be known as my_header_payload_demux, So the command is as follows :
gr_modtool bind my_header_payload_demux
3、 Compilation and installation
Then back gr-myDemux File and create build Folder , Then compile .
mkdir build
cd build
cmake ../
make -j10
sudo make install
sudo ldconfig
That's all . The effect is as follows :
================== Important BUG modify ====================
If all the compilers pass , The errors reported when using are as follows
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, // Don't add
gr::block,
gr::basic_block,
The effect after adding :
================== Important BUG END ====================
Last , If you want to create a new module Add a new block, You need to get there first build Remove the original installation from the folder :
cd build
sudo make uninstall
And then put build Delete folder
rm -rf build
Then build another build Folder , Wait for new block After the code is written, compile and install it with the original ~
4、 of bug The solution of the
Process related bug And solutions can refer to :
边栏推荐
- Ag9310 design USB type C to hdmi+u2+5v slow charging scheme design | ag9310 expansion dock scheme circuit | type-C dongle design data
- Complete model training routine
- 2. Nonlinear regression
- 利用GPU训练网络模型
- Understanding of sidelobe cancellation
- 7. Regularization application
- Y59. Chapter III kubernetes from entry to proficiency - continuous integration and deployment (III, II)
- Getting started STM32 -- how to learn stm32
- How to use education discounts to open Apple Music members for 5 yuan / month and realize member sharing
- 2021 tea master (primary) examination materials and tea master (primary) simulation test questions
猜你喜欢
随机推荐
2、TD+Learning
The examination contents of the third batch of Guangdong Provincial Safety Officer a certificate (main person in charge) in 2021 and the free examination questions of the third batch of Guangdong Prov
4. Cross entropy
5. Over fitting, dropout, regularization
1. Linear regression
Ag9311maq design 100W USB type C docking station data | ag9311maq is used for 100W USB type C to HDMI with PD fast charging +u3+sd/cf docking station scheme description
2022 refrigeration and air conditioning equipment operation examination questions and refrigeration and air conditioning equipment operation examination skills
Redis master-slave replication
50Mhz产生时间
Get started quickly using the local testing tool postman
2022 tea master (intermediate) examination questions and tea master (intermediate) examination skills
2021 Shanghai safety officer C certificate examination registration and analysis of Shanghai safety officer C certificate search
2022 high altitude installation, maintenance and demolition examination materials and high altitude installation, maintenance and demolition operation certificate examination
Chapter 7 Bayesian classifier
Guojingxin center "friendship and righteousness" - the meta universe based on friendship and friendship, and the parallel of "honguniverse"
Complete model verification (test, demo) routine
Use "recombined netlist" to automatically activate eco "APR netlist"
Arm bare metal
Codeforces Round #804 (Div. 2)
Talk about smart Park