GRC Any Blocks

From SpenchWiki
Revision as of 23:29, 18 July 2011 by Balint (talk | contribs) (Initial version)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Reason

To enable arbitrary Python-wrapped GNU Radio blocks to be created and connected in the flow graph code generated by GNU Radio Companion. This means that you do NOT need to write an XML block definition for GRC to pick up a new block you may have created (although of course it's nicer if you do write one).

Use

There are three types of Any blocks:

  • Any: at least one input and at least one output
  • Any Source: at least one output only
  • Any Sink: at least one input only

You can configure the total number of sinks and sources (constrained by the type). As the blocks' ports are treated as 'virtual sinks' and 'virtual sources' (except for generation of the flow graph code), type inference will be used when connecting an Any block to another concrete block - you will see the port colour change to that of the connected upstream/downstream port (unless it is also an Any or virtual block, but things will still work).

Fill the Maker field with the raw Python to be copied into the generated flow graph code. This will commonly be of the <package>.<block name> maker format, followed by the necessary arguments to create an instance of the block. You can of course use variables that you have represented as the various variable blocks elsewhere in your GRC flow graph.

The 'Desc' field is simply so you can keep track of which Any block does what. The condensed string representation of the Python object is not very informative.

The final important thing to note is you MUST use the GRC Import block to import the relevant Python packages used in your Maker expressions, otherwise you will receive errors when Python attempts to execute the generate flow graph code.

Download

Place the XML block definitions where GRC will pick them up (e.g. /usr/local/share/gnuradio/grc/blocks).

IMPORTANT: The Any blocks will NOT work unless you apply the two patches to the relevant files in grc/python/