[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] looping with work() function
From: |
Martin Braun |
Subject: |
Re: [Discuss-gnuradio] looping with work() function |
Date: |
Tue, 11 Mar 2014 10:04:55 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 03/11/2014 06:10 AM, Sumedha Goyal wrote:
> Hello
>
> I am executing a flowgraph where I pass different parameters to the
> work() function of my block in every iteration.
I'm not sure I'm understanding you correctly, but this is not how you
use GNU Radio blocks.
Have a look at gr-digital/examples/berawgn.py. Is this what you want to do?
> 1. I would like my flowgraph to execute once with a certain set of
> parameters and on satisfying a certain condition, it should stop
> execution (even if the queue/buffer of the block is not empty).
> 2. The control should come back to the main() function and the next
> iteration should start with a new set of parameters and again upon
> satisfying a certain condition the flowgraph should exit.
You shut down a flow graph by returning WORK_DONE (or -1) from the work
function.
M
>
> *The work() function is of the block "test_demo":*
> *############new_test_tx.py#################*
> class test_demo(gras.Block):
> def__init__(self,parameters):
> gras.Block.__init__(self,name="test",
> in_sig = [numpy.uint8,numpy.uint8,numpy.uint8],
> out_sig = [numpy.uint8,numpy.uint8])
>
> def work(self, ins, outs):
> --some process here
>
> *The top_block is as following and has code for all the connections(not
> shown here):*
>
> class top_block(grc_wxgui.top_block_gui):
>
> def __init__(self,options,llr):
> grc_wxgui.top_block_gui.__init__(self, title="Top Block")
> _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
> self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
>
> self.=new_test_tx.test_demo(options.parameters)
> def main():
>
> parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
> parser.add_option("", "--args",default="",
> help="set the address of usrp_device [default='']")
> (options, args) = parser.parse_args ()
> # build the graph
> tb=top_block(options,param)
> tb.Run(True)
> if __name__=="__main__":
> main()
>
> I am able to execute the flowgraph once and then the main() function exits.
> I would like to perform this action for some 1000 iterations. It is a
> kind of for loop that I use during C/Python programming. How can I use
> it with GNURadio and Python.
>
>
> Thanks and Regards,
> Sumedha
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
- [Discuss-gnuradio] looping with work() function, Sumedha Goyal, 2014/03/11
- Re: [Discuss-gnuradio] looping with work() function,
Martin Braun <=
- Re: [Discuss-gnuradio] looping with work() function, Activecat, 2014/03/11
- Re: [Discuss-gnuradio] looping with work() function, Sumedha Goyal, 2014/03/11
- Re: [Discuss-gnuradio] looping with work() function, Activecat, 2014/03/11
- Re: [Discuss-gnuradio] looping with work() function, Sumedha Goyal, 2014/03/13
- Re: [Discuss-gnuradio] looping with work() function, Activecat, 2014/03/13
- Message not available
- Re: [Discuss-gnuradio] looping with work() function, Sumedha Goyal, 2014/03/25