discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Minimal grc python block


From: MJS
Subject: [Discuss-gnuradio] Minimal grc python block
Date: Fri, 4 Jan 2013 10:30:03 -0800 (PST)

Evening all. I only recently (yesterday) started working with gnuradio and am
having some trouble getting a minimal grc python block going. I've found a
number of references in this mailing list and elsewhere (and lots of broken
links) but just can't seem to piece it all together. Some guidance would be
greatly appreciated.

My current goal is just to create a block in grc, it doesn't even have to do
anything yet. Here's what I've done so far. I've added these to .bashrc:

export PYTHONPATH=$PYTHONPATH:/home/user/mygnuradioblocks
export GRC_BLOCKS_PATH=$GRC_BLOCKS_PATH:/home/user/mygnuradioblocks

As suggested by (I've tried the other two methods for specifying the .xml
path as well):

gnuradio.org/redmine/projects/gnuradio/wiki/GNURadioCompanion#Adding-Custom-Blocks

And added the following two files to this folder (based on
https://github.com/guruofquality/grextras/wiki/Blocks-Coding-Guide):

mytestblock.py
-------------------

#!/usr/bin/env python

from gnuradio import gr
import block_gateway

class my_first_block(gr.block):
  def __init__(self):
    gr.block.__init__(self, name = "my first block", in_sig=None,
out_sig=None)

  def work(self, input_items, output_items):
    return 0

mytestblock.xml
---------------------

<?xml version="1.0"?>
<block>
    <name>MY: FIRST BLOCK</name>
    <category>MY</category>
    <key>my_first_block</key>
    <import>import mytestblock as mtb</import>
    <make>mtb.my_first_block()</make>
    
        <name>my param1</name>
        <key>my_param_1</key>
        <value>False</value>
        <type>bool</type>
        <option><name>val_false</name><key>False</key></option>
        <option><name>val_true</name><key>True</key></option>
    
    <doc>
MY TEST BLOCK: Bleh, hope this works!
    </doc>
</block>

I however can't get grc to recognize this block, In addition I've tried
moving these two files to the system xml and py directories respectively:

/usr/local/share/gnuradio/grc/blocks/
/usr/local/lib/python2.7/dist-packages/gnuradio/extras/

And even modifying files in those two folders to a minimal form. In short,
I'm having a fairly hard time to get my first python grc block going, if
anyone could point me in the right direction for creating a minimal grc
python block it would be much appreciated.




--
View this message in context: 
http://gnuradio.4.n7.nabble.com/Minimal-grc-python-block-tp38838.html
Sent from the GnuRadio mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]