Hi, all
I want to plot a figure with the samples from usrp, but I have some
questions. Here is the flowgraph:
usrp.source_c --> gr.streams_to_vector(gr.sizeof_gr_complex1, 1) -->
gr.complex_to_mag(1)
–> gr.message_sink(gr.sizeof_float1, self.msg_sink_msgq_out, True)
Here, self.msg_sink_msgq_out = gr.msg_queue(2)
In main function, I did this:
msg = tb.msg_sink_msgq_out.delete_head()
a = int(msg.arg1())
b = int(msg.arg2())
s = msg.to_string()
float_data = numpy.fromstring(s, numpy.float32)
for bin in float_data:
print bin
Questions are sa follows:
(1) Is my code correct? If it isn’t, how should I modify it?
(2) What is the return value of gr.msg_queue(2)? I mean what’s the
meaning of “a”,“b”,“s” in this code?
(3) Is what stored in “s” the amplitude of the samples? If I plot the
figure with s, can I get the envelop of the signal? (4) How to calculate
the time interval between each sample? Can I set the collecting time for
USRP? For example, I want to collect the signal for 1 second.
Thank you! Any help will be appreciated!