update a variable in GNU Radio over the network

一世执手 提交于 2019-12-25 04:10:14

问题


I am using GNU Radio to stream RF data out using a UDP sink. The data is streamed to a controlling program. As part of this process I am frequency shifting (with a multiply block), filtering and down sampling.

I would like to change the values of frequency shift at run time.

Is there a way for me to have values from a UDP source saved directly to a variable? The only solution I can think of now is to forever generate a sine wave and then pipe that into GNU Radio, and then multiply my signal with that. But that seems like a huge waste of resources. I would like to be able to send a single packet, have that value "latch" into a GNU Radio variable, and then use that variable in my blocks.


回答1:


There's multiple approaches for that:

  1. If you want to stick with the GNU Radio Companion "variable" concept, you can use the XMLRPC blocks. Usage is pretty straightforward, and the GNU Radio GRC example (often found under /usr/share/gnuradio/examples/grc cover that.
  2. If you want to write a little code for yourself, you could write a python hier block that really just contains a signal source, but also has a message port, with a message port handler that modifies the frequency of the signal source. That way, you could also the ZeroMQ blocks, which are pretty awesome :)
  3. Hypothetically, you could of course also implement the hier block from 2., but instead of giving it a message port and a message handler, make it asynchronously react to network messages coming from the outside, to change the settings of the signal source. Caveat here is that python multithreading is a bit tricky, and you'd be basically re-implementing the XMLRPC blocks from 1.


来源:https://stackoverflow.com/questions/33090233/update-a-variable-in-gnu-radio-over-the-network

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!