Change a block parameter using a python script

Hi all!

I have a simple flowgraph: a signal source, a throttle and a waterfall
plot. I’d like to change the frequency of the signal source during
runtime using the output of a python script. The output of the python
script is time-varying, then I should see some variations in the plot
during runtime. How can be this done? Is there a ‘simple’ way?

Thanks

Marco

On 01/27/2014 11:19 PM, Marco B. wrote:

Hi all!

I have a simple flowgraph: a signal source, a throttle and a
waterfall plot. I’d like to change the frequency of the signal source
during runtime using the output of a python script. The output of the
python script is time-varying, then I should see some variations in
the plot during runtime. How can be this done? Is there a ‘simple’
way?

Take a look at the XML RPC blocks in GRC.

If you are not using GRC, its still pretty simple to create an xml rpc
server in python, and register the signal source’s .set_frequency()
parameter into the server. Then your python script that is performing
the control can talk to the xml rpc client (it was a separate file from
the flow graph, right?).

http://docs.python.org/2/library/simplexmlrpcserver.html
Its a pretty small number of lines to get working, and xmlrpc generally
comes packaged with python. Good luck!

-josh

It works! Thank you very much!

Marco.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs