|Subject:||Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()|
|Date:||Wed, 15 Feb 2012 00:29:24 -0500|
Thank you very much for your detailed explanation. That really works!
I really want to learn more about GNURadio by myself. But I don’t know how should I go on. How can I find the right function/module/block for some specific purpose? Do you have any suggestion?
On Tue, Feb 14, 2012 at 4:00 AM, Wu Ting <address@hidden> wrote:
I’m trying to read the real-time value of a stream from USRP. I’m considering using gr.probe_signal_f, but it seems to not work. I’m really new to GNURadio, so please forgive me if I ask some stupid question.
My method is like this:
#First generate a source from USRP:
self.source = uhd.usrp_source(device_addr=’’, stream_args=uhd.stream_args(‘fc32’, ‘sc16’), args=’scalar=1024’)
#change from complex to interleaved short:
op1 = gr.complex_to_interleaved_short()
#change from short to float
op2 = gr.short_to_float()
self.probe = gr.probe_signal_f()
self.connect(self.source, op1, op2, self.probe)
And in a true while loop, I print the value of the probe, but the value is always 0.0
Could anyone tell me what is the problem? And is there any better way to realize this function?
A couple of things. First, you're doing one too many operations. You are going from complex float to short to float. You could just go from complex to float. There is gr.complex_to_float that will provide two output streams for I and Q; complex_to_real or complex_to_imag for each stream independently; of you could use complex_to_mag or complex_to_mag_squared for the magnitude of the complex number.
Second, and the main reason for your question, is that you are never running the flow graph. You construct a flow graph using the connect functions, but that doesn't start any samples running through it. So, given the class you've defined here, call it wu_top_block, we need to return an object:
tb = wu_top_block()
Then you need to run the flowgraph:
This will start your system running and collecting data. After this, you should be able to set a while loop to look at the data:
So the value get's printed every second.
Something like that.
Discuss-gnuradio mailing list
|[Prev in Thread]||Current Thread||[Next in Thread]|