discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] hier block inside a hier block


From: Kieran Brownlees
Subject: [Discuss-gnuradio] hier block inside a hier block
Date: Fri, 3 Apr 2009 17:47:02 +1300

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:

address@hidden:~/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)
address@hidden:~/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

reply via email to

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