Launch GNU Radio script at boot

GNU Radio Auto Start

With a GNU Radio application (3.7) running on a Raspberry PI or an Orange PI, it may be interesting to run the Python script generated by GNU Radio Companion at boot. If you put the python program launch in a crontab task or the /etc/rc.local file, the program will start and stop immediately. You’ll waste hours figuring out why …

Structure of the Python file

Edit the script generated by GNU Radio companion. It includes a ‘class’ bearing the name of the file and at the end the main function of launching ‘main ()’. Example for the file ‘remote_rx_ssb_v1.py’.

The source of the issue is that the program once started waits for an ‘Enter’ to stop. This appears at launch in a Crontab.
See the message ‘Press Enter to Quit’.

In order to overcome it, there are two solutions:

modify the option block by replacing ‘Prompt for Exit’ with ‘Run to Completion’.

  • do not modify the file generated by GNU Radio Companion in order to be able to modify it if you want to improve the processing. We will create a python launch script that will take the “class”. In the same folder where is the python file of gnu radio create the file “gnu_radio_launcher.py”. which will matter.
import remote_rx_ssb_v1

def my_main(top_block_cls=remote_rx_ssb_v1.remote_rx_ssb_v1, options=None):
    tb = top_block_cls()
    tb.start()
    tb.wait()
if __name__ == '__main__':
    my_main()

Call this file in a crontab at launch and GNU-Radio will be launched at boot.

Posts about GNU Radio

Leave a Reply

Your email address will not be published. Required fields are marked *