Hi Tom,

 

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?

 

Thanks again.

 

Wu

 

From: trond...@trondeau.com [mailto:trond...@trondeau.com] On Behalf Of Tom
Rondeau
Sent: 2012年2月15日 0:01
To: Wu Ting
Cc: discuss-gnuradio@gnu.org
Subject: Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()

 

On Tue, Feb 14, 2012 at 4:00 AM, Wu Ting <wu.t...@comf5.comm.eng.osaka-u.ac.
jp> wrote:

Hi all,

 

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()

 

#create probe

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?

 

Thanks.

 

Wu

 

Hi Wu,

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:

 

tb.start()

 

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:

 

while(1):

    print tb.probe.value()

    time.sleep(1000)

 

So the value get's printed every second.

 

Something like that.

 

Tom

 

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to