discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()


From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()
Date: Tue, 14 Feb 2012 10:00:41 -0500

On Tue, Feb 14, 2012 at 4:00 AM, Wu Ting <address@hidden> 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


reply via email to

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