Creating Python OOT with gr-modtool: Difference between revisions
Mattcarrick (talk | contribs) No edit summary |
Mattcarrick (talk | contribs) No edit summary |
||
Line 35: | Line 35: | ||
Select the ''sync'' block, which produces an output for every input: | Select the ''sync'' block, which produces an output for every input: | ||
<pre>Enter block type: sync</pre> | <pre>Enter block type: sync</pre> | ||
Enter ''python'' as the language: | Enter ''python'' as the language: | ||
<pre>Language (python/cpp): python | <pre>Language (python/cpp): python | ||
Language: Python | Language: Python | ||
Line 45: | Line 43: | ||
Enter the name or organization of the copyright holder: | Enter the name or organization of the copyright holder: | ||
<pre>Please specify the copyright holder: YourName</pre> | |||
<pre> | Now enter the argument list: | ||
<pre>Enter valid argument list, including default arguments:</pre> | |||
Enter the argument list as if writing the Python code directly. In this case the ''selector'' will determine whether or not the block performs addition or subtraction. A default argument of ''True'' is given: | |||
<pre>selector=True</pre> |
Revision as of 17:01, 8 March 2022
Beginner Tutorials
Introducing GNU Radio Flowgraph Fundamentals
Creating and Modifying Python Blocks DSP Blocks
SDR Hardware |
TODO: fill out some introductory info TODO: add this tutorial to the nav bar
This tutorial was written using GNU Radio v3.10.1.1.
Open a terminal and navigate to an appropriate directory for writing software, such as the home directory:
$ cd $HOME
GNU Radio comes packaged with gr_modtool, software used to create out-of-tree (OOT) modules. An OOT module can be thought of as a collection of custom GNU Radio blocks. Create an OOT module named customModule using gr_modtool:
$ gr_modtool newmod customModule
The directory gr-customModule is created which contains all of the skeleton code for an OOT module, however it does not yet have any blocks. Move into the gr-customModule directory:
$ cd gr-customModule
List all of the files and directories within the OOT module:
$ ls
The directory listing will be as follows:
apps/ cmake/ CMakeLists.txt docs/ examples/ grc/ include/ lib/ MANIFEST.md python/
Now a block needs to be created within gr-customModule. The custom block will either add or subtract based on an input parameter, so the block is named addSubSelect:
$ gr_modtool add addSubSelect
The command will start a questionnaire about how to the block is to be defined: what block type, language and parameters:
GNU Radio module name identified: customModule ('sink', 'source', 'sync', 'decimator', 'interpolator', 'general', 'tagged_stream', 'hier', 'noblock')
Select the sync block, which produces an output for every input:
Enter block type: sync
Enter python as the language:
Language (python/cpp): python Language: Python Block/code identifier: addSubSelect
Enter the name or organization of the copyright holder:
Please specify the copyright holder: YourName
Now enter the argument list:
Enter valid argument list, including default arguments:
Enter the argument list as if writing the Python code directly. In this case the selector will determine whether or not the block performs addition or subtraction. A default argument of True is given:
selector=True