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.
Kieran B. (Guest)
on 2009-04-03 08: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
Josh B. (Guest)
on 2009-04-03 09:06
(Received via mailing list)
Kieran B. 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
Johnathan C. (Guest)
on 2009-04-03 09:13
(Received via mailing list)
On Thu, 2009-04-02 at 22:05 -0700, Josh B. 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
Eric B. (Guest)
on 2009-04-03 09:17
(Received via mailing list)
On Thu, Apr 02, 2009 at 10:11:38PM -0700, Johnathan C. wrote:
> On Thu, 2009-04-02 at 22:05 -0700, Josh B. 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.