Forum: GNU Radio hier block inside a hier block

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
992d7640b9396bb5e8baf989281b59c0?d=identicon&s=25 Kieran Brownlees (Guest)
on 2009-04-03 06:48
(Received via mailing list)
Hello all,

I am not sure whether this is strange behaviour or I am misunderstanding
what you can do with hier_blocks.

Problem is best described with an example:

from gnuradio import gr
class h_block(gr.hier_block2):
    def __init__(self):
        gr.hier_block2.__init__(self,
            "h_block",
            gr.io_signature(1,1,gr.sizeof_float),
            gr.io_signature(0,0,0))

        hblock2 = h_block2()
        self.connect(self, hblock2)

class h_block2(gr.hier_block2):
    def __init__(self):
        gr.hier_block2.__init__(self,
            "h_block2",
            gr.io_signature(1,1,gr.sizeof_float),
            gr.io_signature(0,0,0))
        self.connect(self, gr.multiply_const_ff(1), gr.null_sink(4))

class temp(gr.top_block):
    def __init__(self):
        gr.top_block.__init__(self)
        source = gr.null_source(4)
        hblock = h_block()
        self.connect(source, hblock)
        self.start()

if __name__ == "__main__":
    app = temp()

When I run the above example I get:

sdrts@sdrts:~/sdrts/test$ python gr3.2_test.py
Traceback (most recent call last):
  File "gr3.2_test.py", line 29, in <module>
    app = temp()
  File "gr3.2_test.py", line 26, in __init__
    self.start()
  File
"/opt/gnuradio/trunk//lib/python2.5/site-packages/gnuradio/gr/top_block.py",
line 95, in start
    self._tb.start()
  File
"/opt/gnuradio/trunk//lib/python2.5/site-packages/gnuradio/gr/gnuradio_swig_py_runtime.py",
line 1411, in start
    return _gnuradio_swig_py_runtime.gr_top_block_sptr_start(*args,
**kwargs)
RuntimeError: multiply_const_ff(4): insufficient connected output ports
(1
needed, 0 connected)
sdrts@sdrts:~/sdrts/test$

There is no error if in h_block2 the connect line is just
self.connect(self,
gr.null_sink(4)).

I am running an ubuntu 8.10 server, same output on 3.1.3, 3.2 and trunk.
Thoughts?

Kieran
4252201ac30d6dd44d8090ce1070e35f?d=identicon&s=25 Josh Blum (Guest)
on 2009-04-03 07:06
(Received via mailing list)
Kieran Brownlees wrote:
>         gr.hier_block2.__init__(self,
>             "h_block",
>             gr.io_signature(1,1,gr.sizeof_float),
>             gr.io_signature(0,0,0))
>
>         hblock2 = h_block2()
>         self.connect(self, hblock2)
>

i would change this last line to:
self.connect(self, gr.kludge_copy(gr.sizeof_float), hblock2)

hier blocks dont like to connect their virtualized inputs and outputs
directly to other hier blocks. They require something substantial
in-between. Thats is why we have kludge_copy, which just takes data from
the h_block and passes it to the h_block2 input, just so long as the two
  h_blocks dont have to communicate directly!

Im not sure if there is a ticket about this, maybe
http://gnuradio.org/trac/ticket/161 is related.

-Josh
D0072e69d706bb3ca211d33a1b536e2c?d=identicon&s=25 Johnathan Corgan (Guest)
on 2009-04-03 07:13
(Received via mailing list)
On Thu, 2009-04-02 at 22:05 -0700, Josh Blum wrote:

> Im not sure if there is a ticket about this, maybe
> http://gnuradio.org/trac/ticket/161 is related.

It is related, and the solution to 161 will fix this issue as well.

Johnathan
745d8202ef5a58c1058d0e5395a78f9c?d=identicon&s=25 Eric Blossom (Guest)
on 2009-04-03 07:17
(Received via mailing list)
On Thu, Apr 02, 2009 at 10:11:38PM -0700, Johnathan Corgan wrote:
> On Thu, 2009-04-02 at 22:05 -0700, Josh Blum wrote:
>
> > Im not sure if there is a ticket about this, maybe
> > http://gnuradio.org/trac/ticket/161 is related.
>
> It is related, and the solution to 161 will fix this issue as well.
>
> Johnathan

I just opened ticket:383 on this.  I'm not sure that these are the
same problem.  We definitely need more QA code for this area of the
code.

Eric
This topic is locked and can not be replied to.