discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Fw: Fw: Signal Source - frequency control


From: Gavin Jacobs
Subject: [Discuss-gnuradio] Fw: Fw: Signal Source - frequency control
Date: Tue, 6 Sep 2016 14:22:32 +0000

After further checking, here are the steps to reproduce the issue, and a workaround:

1. Create a flow graph with:

Null Source (short) ->

Throttle(short) ->

Embedded Python Block #1 (short in, short out) ->

Embedded Python Block #2 (short in, float out) ->

Null Sink (float)


For the Embedded Python Blocks, use the code editor to set the types for inputs and outputs:

Block #1

class blk(gr.sync_block):
    def __init__(self, factor=1.0):  # only default arguments here
        gr.sync_block.__init__(
            self,
            name='Embedded Python Block',
            in_sig=[np.short],       # edited this line
            out_sig=[np.short]       # edited this line
        )
        self.factor = factor
)

Block #2

class blk(gr.sync_block):
    def __init__(self, factor=1.0):  # only default arguments here
        gr.sync_block.__init__(
            self,
            name='Embedded Python Block',
            in_sig=[np.short],       # edited this line
            out_sig=[np.float32]     # edited this line
        )
        self.factor = factor

If you try to run, you get a size mismatch error. The reason is that the editor gives the same default name "blk" to both class definitions; then top_block.py instantiates the same class twice, instead of two unique classes. So in one of the modules, change "blk" to "blk2" and it works fine. Seems obvious now, but not at first. Perhaps the template code could have a comment to that effect, or better would be to automatically set the class name to match the block ID.


Hopefully this post will save someone some time.









From: Kevin Reid <address@hidden> on behalf of Kevin Reid <address@hidden>
Sent: September 5, 2016 8:37 PM
To: Gavin Jacobs
Cc: address@hidden
Subject: Re: [Discuss-gnuradio] Fw: Signal Source - frequency control
 
On Sep 5, 2016, at 16:04, Gavin Jacobs <address@hidden> wrote:
> Now here's the frustrating part, when I tried to use another embedded python block to implement the bit banger, I got confusing runtime errors indicating that the top block was getting the two blocks mixed up(e.g. size mismatch). Is there a limit of one embedded python block?

Not as far as I know.

I haven't used Python blocks significantly because they pose a risk of thread deadlock together with other things I need to do, so I can't comment in detail. Perhaps someone else can help there.

A good thing to do at this point would be to make a copy of your code and modify it into an example that demonstrates the problem without having unnecessary parts. If you show us this code it will be easier to find out where the problem lies, whether it is with GNU Radio or with your code.

reply via email to

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