Forum: GNU Radio How to call another blocks in custom out-of-tree module

417587a56ea098bd9642f91178e2091b?d=identicon&s=25 ykoh@solid.co.kr (Guest)
on 2013-11-05 13:58
(Received via mailing list)
Hi,

Can you help me to call gnu-blocks from my own out-of-tree code written
in python?

For example, from this code
(http://gnuradio.org/redmine/projects/gnuradio/wiki...)
1 import numpy
2 from gnuradio import gr
3
 4 class square3_ff(gr.sync_block):
5     " Squaring block "
 6     def __init__(self):
7         gr.sync_block.__init__(
8             self,
9             name = "square3_ff",
10             in_sig = [numpy.float32], # Input signature: 1 float at a
time
11             out_sig = [numpy.float32], # Output signature: 1 float at
a time
12         )
           Self.my_block = (another block / or hier-block)
13
14     def work(self, input_items, output_items):
15         #output_items[0][:] = input_items[0] * input_items[0] # Only
works because numpy.array
# I want to call self.my_block here
16         return len(output_items[0])



I want to call another gnu-blocks (or another hier-block) in work
function.(Line 14~16)

1)     How to connect input item to another blocks input

2)     How to connect local array to another blocks output

Please help me.
Actually I need to make my own sub block.
But I need gnuradio blocks during processing my own block.

Bye.
Ad80d352eb445a3d7dccd5a779db0e43?d=identicon&s=25 Martin Braun (CEL) (Guest)
on 2013-11-05 14:12
(Received via mailing list)
On Tue, Nov 05, 2013 at 12:56:24PM +0000, ykoh@solid.co.kr wrote:
> I want to call another gnu-blocks (or another hier-block) in work function.
> (Line 14~16)
>
> 1)     How to connect input item to another block’s input
>
> 2)     How to connect local array to another block’s output

In GNU Radio's 'block' terminology, you will *never* call another block
from within one block's work function. You always connect the output of
one block the input of the next.

What exactly are you trying to do? Are you simply trying to outsource
some signal processing code out of your block?
We do this quite a lot, but then the object we call from the work
function is not a GNU Radio block, but rather a generic object. Of
course, you can include any Python module or object into your own Python
blocks.

Or are you trying to call another, existing GNU Radio block? In this
case, you might want to think about splitting your block up such that
you can connect your block and existing blocks through the regular
mechanism (i.e. top_block.connect()).

> Please help me.
>
> Actually I need to make my own sub block.
>
> But I need gnuradio blocks during processing my own block.

Perhaps a hier block will solve your problem?

MB

--
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association
417587a56ea098bd9642f91178e2091b?d=identicon&s=25 ykoh@solid.co.kr (Guest)
on 2013-11-06 12:56
(Received via mailing list)
Attachment: image001.png (10 KB)
Attachment: image002.jpg (10 KB)
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Ad80d352eb445a3d7dccd5a779db0e43?d=identicon&s=25 Martin Braun (CEL) (Guest)
on 2013-11-10 19:34
(Received via mailing list)
On Wed, Nov 06, 2013 at 11:55:00AM +0000, ykoh@solid.co.kr wrote:
> Thank you for your concern.
>
> I will tell you more detail about my problem.
>
>
> I'm trying to make frequency hopping system.
>
> [...]

You don't need to call other blocks from your blocks to do this.
Perhaps this can help you:
https://github.com/jmalsbury/pre-cog

MB

--
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association
417587a56ea098bd9642f91178e2091b?d=identicon&s=25 ykoh@solid.co.kr (Guest)
on 2014-01-14 23:12
(Received via mailing list)

  
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.