当前位置:网站首页>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 myDemuxGet 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 myDemuxin 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_demux3、 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 ldconfigThat'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 uninstallAnd then put build Delete folder
rm -rf buildThen 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 :
边栏推荐
- How to use education discounts to open Apple Music members for 5 yuan / month and realize member sharing
- Guojingxin center "friendship and righteousness" - the meta universe based on friendship and friendship, and the parallel of "honguniverse"
- 1. Linear regression
- Ag7120 and ag7220 explain the driving scheme of HDMI signal extension amplifier | ag7120 and ag7220 design HDMI signal extension amplifier circuit reference
- FIR filter of IQ signal after AD phase discrimination
- 2022 safety officer-b certificate examination question bank and safety officer-b certificate simulation test questions
- Recommend a document management tool mendely Reference Manager
- Frrouting BGP protocol learning
- Basic realization of line graph
- 2021-03-14 - play with generics
猜你喜欢

Vs code configuration latex environment nanny level configuration tutorial (dual system)

4、策略學習

2022 free test questions of fusion welding and thermal cutting and summary of fusion welding and thermal cutting examination

How to use education discounts to open Apple Music members for 5 yuan / month and realize member sharing

Definition and classification of energy

Cross modal semantic association alignment retrieval - image text matching

Redis 主从复制

On the concept and application of filtering in radar signal processing

Su embedded training - Day9

Vscode reading Notepad Chinese display garbled code
随机推荐
FIR filter of IQ signal after AD phase discrimination
5、離散控制與連續控制
2.非线性回归
跨模态语义关联对齐检索-图像文本匹配(Image-Text Matching)
Multi purpose signal modulation generation system based on environmental optical signal detection and user-defined signal rules
Four digit nixie tube display multi digit timing
14.绘制网络模型结构
2022 R1 fast opening pressure vessel operation test question bank and R1 fast opening pressure vessel operation free test questions
Chapter IV decision tree
USB type-C docking design | design USB type-C docking scheme | USB type-C docking circuit reference
Taiwan Xinchuang sss1700 latest Chinese specification | sss1700 latest Chinese specification | sss1700datasheet Chinese explanation
4. Apprentissage stratégique
Common configurations in rectangular coordinate system
2022 tea master (intermediate) examination questions and tea master (intermediate) examination skills
Ag9310 design USB type C to hdmi+u2+5v slow charging scheme design | ag9310 expansion dock scheme circuit | type-C dongle design data
Kuntai ch7511b scheme design | ch7511b design EDP to LVDS data | pin to pin replaces ch7511b circuit design
C#中string用法
Markdown learning (entry level)
2022 high voltage electrician examination skills and high voltage electrician reexamination examination
Redis master-slave replication