gnuradio模块与模块相连接,进行调制之后由usrp 发送。但如果想看到某一个模块之后输出的数据,方便的方法是加一个file sink模块。但我有很多时候都想自己用python处理数据,不要专门写出一个模块。然后再输入gnuradio进行处理。如果输入输出都要经过file source 的话,感觉很麻烦啊,要一次处理完之后才能进行下一步,还要手动多次。
然后看到benchmark_tx.py(gnuradio/gr-digital/examples/narrowband/..)里面有个数据传输过程:变量data
# build the graph
tb = my_top_block(mods[options.modulation], options)
r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
print ("Warning: failed to enable realtime scheduling")
tb.start() # start flow graph
# generate and send packets
nbytes = int(1e6 * options.megabytes)
n = 0
pktno = 0
pkt_size = int(options.size)
while n < nbytes:
if options.from_file is None:
data = (pkt_size - 2) * chr(pktno & 0xff)
else:
data = source_file.