Thanks, Marcus: re-built with debug symbols. v3.7.11.1 Attached is the flowgraph causing the problem - both the GRC and the resultant top_block.py
It uses an OOT module that talks to OpenHPSDR hardware over Ethernet - should have one thread running to receive Ethernet frames. from: https://github.com/Tom-McDermott/gr-hpsdr Results from gdb: (gdb) start Temporary breakpoint 1 at 0x4934c0: file ../Modules/python.c, line 20. Starting program: /usr/bin/python2 top_block.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Temporary breakpoint 1, main (argc=2, argv=0x7fffffffdfb8) at ../Modules/python.c:20 20 ../Modules/python.c: No such file or directory. (gdb) break std::bad_alloc::what() Function "std::bad_alloc::what()" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 2 (std::bad_alloc::what()) pending. (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /usr/bin/python2 top_block.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7fffdb463700 (LWP 29362)] [New Thread 0x7fffdac62700 (LWP 29363)] [New Thread 0x7fffd6461700 (LWP 29364)] [New Thread 0x7fffd5c60700 (LWP 29365)] [New Thread 0x7fffd145f700 (LWP 29366)] [New Thread 0x7fffcec5e700 (LWP 29367)] [New Thread 0x7fffce45d700 (LWP 29368)] [New Thread 0x7fffbbf5b700 (LWP 29369)] [New Thread 0x7fffbb75a700 (LWP 29370)] [New Thread 0x7fffbaf59700 (LWP 29371)] [New Thread 0x7fffabfff700 (LWP 29372)] [New Thread 0x7fffab7fe700 (LWP 29373)] [Thread 0x7fffabfff700 (LWP 29372) exited] --- this is output from the OOT module, not using docker -- Looking for Metis/Hermes card on interface eth0 Interface[0]:lo Interface[1]:eth0 Interface[2]:docker0 eth0 IP Address: 192.168.0.2 eth0 MAC Address: 90:b1:1c:6d:00:a7 [New Thread 0x7fffabfff700 (LWP 29375)] Metis MAC address 00:04:A3:63:F9:8E Metis IP address 192.168.0.7 gr::log :INFO: audio source - Audio sink arch: alsa [New Thread 0x7fffa9518700 (LWP 29376)] [New Thread 0x7fffa8d17700 (LWP 29377)] [New Thread 0x7fff93ffd700 (LWP 29378)] [New Thread 0x7fff937fc700 (LWP 29379)] [New Thread 0x7fff92ffb700 (LWP 29380)] [New Thread 0x7fff927fa700 (LWP 29381)] [New Thread 0x7fff91ff9700 (LWP 29382)] [New Thread 0x7fff917f8700 (LWP 29383)] [New Thread 0x7fff90ff7700 (LWP 29384)] [New Thread 0x7fff73fff700 (LWP 29385)] [New Thread 0x7fff737fe700 (LWP 29386)] [New Thread 0x7fff72ffd700 (LWP 29387)] aUQt has caught an exception thrown from an event handler. Throwing exceptions from an event handler is not supported in Qt. You must reimplement QApplication::notify() and catch all exceptions there. terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Thread 1 "python2" received signal SIGABRT, Aborted. 0x00007ffff7825428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 54 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) info threads Id Target Id Frame * 1 Thread 0x7ffff7fb9700 (LWP 29361) "python2" 0x00007ffff7825428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 2 Thread 0x7fffdb463700 (LWP 29362) "python2" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 3 Thread 0x7fffdac62700 (LWP 29363) "python2" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 4 Thread 0x7fffd6461700 (LWP 29364) "python2" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 5 Thread 0x7fffd5c60700 (LWP 29365) "python2" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 6 Thread 0x7fffd145f700 (LWP 29366) "python2" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 7 Thread 0x7fffcec5e700 (LWP 29367) "python2" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 8 Thread 0x7fffce45d700 (LWP 29368) "python2" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 9 Thread 0x7fffbbf5b700 (LWP 29369) "dconf worker" 0x00007ffff78eb74d in poll () at ../sysdeps/unix/syscall-template.S:84 10 Thread 0x7fffbb75a700 (LWP 29370) "gmain" 0x00007ffff78eb74d in poll () at ../sysdeps/unix/syscall-template.S:84 11 Thread 0x7fffbaf59700 (LWP 29371) "gdbus" 0x00007ffff78eb74d in poll () at ../sysdeps/unix/syscall-template.S:84 13 Thread 0x7fffab7fe700 (LWP 29373) "pool" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38 14 Thread 0x7fffabfff700 (LWP 29375) "python2" 0x00007ffff7bca8f3 in recvfrom () at ../sysdeps/unix/syscall-template.S:84 15 Thread 0x7fffa9518700 (LWP 29376) "threaded-ml" 0x00007ffff78eb74d in poll () at ../sysdeps/unix/syscall-template.S:84 16 Thread 0x7fffa8d17700 (LWP 29377) "sig_source_c9" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 17 Thread 0x7fff93ffd700 (LWP 29378) "sig_source_c8" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 18 Thread 0x7fff937fc700 (LWP 29379) "hermesNB3" 0x00007fffe048d2db in gr::propagate_tags (block_id=3, rtags=std::vector of length 0, capacity 0, rrate=1, start_nitems_read=std::vector of length 1, capacity 1 = {...}, d=0x1f58ef0, policy=<optimized out>) at /home/tom/gnuradio/gnuradio-runtime/lib/block_executor.cc:110 19 Thread 0x7fff92ffb700 (LWP 29380) "fir_filter_ccf2" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225 20 Thread 0x7fff927fa700 (LWP 29381) "keep_one_in_n5" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225 21 Thread 0x7fff91ff9700 (LWP 29382) "multiply_cc4" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225 22 Thread 0x7fff917f8700 (LWP 29383) "pwr_squelch_cc1" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225 23 Thread 0x7fff90ff7700 (LWP 29384) "agc3_cc11" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225 24 Thread 0x7fff73fff700 (LWP 29385) "complex_to_floa" pthread_cond_timedwait@@GLIBC_2.3.2 () ---Type <return> to continue, or q <return> to quit--- at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225 25 Thread 0x7fff737fe700 (LWP 29386) "audio_alsa_sink" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225 26 Thread 0x7fff72ffd700 (LWP 29387) "freq_sink_c1" pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225 (gdb) bt #0 0x00007ffff7825428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 #1 0x00007ffff782702a in __GI_abort () at abort.c:89 #2 0x00007ffff4f1884d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x00007ffff4f166b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #4 0x00007ffff4f16701 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #5 0x00007ffff4f16969 in __cxa_rethrow () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #6 0x00007ffff53946ee in QEventLoop::exec (this=this@entry=0x7fffffffd860, flags=...) at kernel/qeventloop.cpp:218 #7 0x00007ffff539a4b9 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1227 #8 0x00007ffff2d5522c in QApplication::exec () at kernel/qapplication.cpp:3828 #9 0x00007ffff3df2aeb in meth_QApplication_exec_ (sipArgs=<optimized out>) at sipQtGuipart9.cpp:38155 #10 0x00000000004bc3fa in call_function (oparg=<optimized out>, pp_stack=0x7fffffffd970) at ../Python/ceval.c:4350 #11 PyEval_EvalFrameEx () at ../Python/ceval.c:2987 #12 0x00000000004b9ab6 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582 #13 0x00000000004c16e7 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffffdb70, func=<function at remote 0x7fffc2d2c0c8>) at ../Python/ceval.c:4445 #14 call_function (oparg=<optimized out>, pp_stack=0x7fffffffdb70) at ../Python/ceval.c:4370 #15 PyEval_EvalFrameEx () at ../Python/ceval.c:2987 #16 0x00000000004b9ab6 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582 #17 0x00000000004eb30f in PyEval_EvalCode (locals= {'gr': <module at remote 0x7fffdeabc398>, 'QObject': <PyQt4.QtCore.pyqtWrapperType at remote 0xa8f050>, 'analog': <module at remote 0x7fffed62b910>, 'sip': <module at remote 0x7ffff6b53408>, '__package__': None, 'firdes': <type at remote 0x16f3c10>, 'top_block': <PyQt4.QtCore.pyqtWrapperType at remote 0x18fa910>, 'main': <function at remote 0x7fffc2d2c0c8>, '__doc__': None, 'OptionParser': <classobj at remote 0x7fffc2d754c8>, 'eng_option': <classobj at remote 0x7fffc2d75530>, 'blocks': <module at remote 0x7fffc84cd0c0>, 'Qt': <module at remote 0x7ffff7eb7da8>, '__builtins__': <module at remote 0x7ffff7f78b08>, '__file__': 'top_block.py', 'sys': <module at remote 0x7ffff7f78bb0>, 'Range': <type at remote 0x18cf810>, 'ctypes': <module at remote 0x7ffff7eb7b40>, 'hpsdr': <module at remote 0x7fffc2da22f0>, '__name__': '__main__', 'qtgui': <module at remote 0x7fffc416bd38>, 'eng_notation': <module at remote 0x7fffc41539b8>, 'filter': <module at remote 0x7fffc5db3de0>, 'pyqtSlot': <built-in function pyqtSlot>, 'x11...(truncated), globals={'gr': <module at remote 0x7fffdeabc398>, 'QObject': <PyQt4.QtCore.pyqtWrapperType at remote 0xa8f050>, 'analog': <module at remote 0x7fffed62b910>, 'sip': <module at remote 0x7ffff6b53408>, '__package__': None, 'firdes': <type at remote 0x16f3c10>, 'top_block': <PyQt4.QtCore.pyqtWrapperType at remote 0x18fa910>, 'main': <function at remote 0x7fffc2d2c0c8>, '__doc__': None, 'OptionParser': <classobj at remote 0x7fffc2d754c8>, 'eng_option': <classobj at remote 0x7fffc2d75530>, 'blocks': <module at remote 0x7fffc84cd0c0>, 'Qt': <module at remote 0x7ffff7eb7da8>, '__builtins__': <module at remote 0x7ffff7f78b08>, '__file__': 'top_block.py', 'sys': <module at remote 0x7ffff7f78bb0>, 'Range': <type at remote 0x18cf810>, 'ctypes': <module at remote 0x7ffff7eb7b40>, 'hpsdr': <module at remote 0x7fffc2da22f0>, '__name__': '__main__', 'qtgui': <module at remote 0x7fffc416bd38>, 'eng_notation': <module at remote 0x7fffc41539b8>, 'filter': <modul---Type <return> to continue, or q <return> to quit---Quit (gdb) Quit (gdb) -- Tom, N5EG On Tue, Jun 26, 2018 at 3:55 AM, Müller, Marcus (CEL) <muel...@kit.edu> wrote: > Ah, I said: > > >(gdb)break std::bad_alloc::what()⏎ > > > > (it should NOT complain that this symbol isn't already loaded. If it > > does, we might need to install the libststc++ debug symbols; haven't > > used Ubuntu in a while, but probably `apt install libstdc++-dbg` or > > `-dbgsym` > > I was wrong, at that point it's totally OK to complain about missing > symbol. Just say it's OK to set the breakpoint on future library load. > > > On Tue, 2018-06-26 at 10:47 +0000, Müller, Marcus (CEL) wrote: > > Hi Tom! > > > > Hm, no, I wouldn't be aware of any limitations, and even if such > > exist, > > things shouldn't die with a std::bad_alloc! > > > > Ok, so I'm wondering how we can move forward with this. Let us try > > this: > > > > * Can you share a proof of failure flow graph with us? That way, > > everyone's definitely talking about the same thing. > > * I assume you've got GNU Radio built with debug symbols (cmake > > -DCMAKE_BUILD_TYPE=RelWithDebInfo). This might even work if it > > wasn't, > > but the backtraces below might be less exciting. > > * you'll need gdb > > > > gdb --args python2 /path/to/your/flowgraph.py⏎ > > > > (things flutter by) > > > > (gdb)start⏎ > > > > (things flutter by) > > > > (gdb)break std::bad_alloc::what()⏎ > > > > (it should NOT complain that this symbol isn't already loaded. If it > > does, we might need to install the libststc++ debug symbols; haven't > > used Ubuntu in a while, but probably `apt install libstdc++-dbg` or > > `- > > dbgsym`) > > > > (gdb)run⏎ > > > > (wait for the breakpoint defined above to trigger) > > > > (gdb)info threads⏎ > > > > (this is the list of currently existing threads. Copy and save.) > > > > (gdb)bt⏎ > > > > (short for `backtrace`. Now we should be getting a list that's > > basically like "walking an onion from the middle to the peel", if > > you're onion layers are defined by who called a function which called > > a > > function...) > > > > Share the output; if you look through it, the frame with the lowest > > number that already happens somewhere inside libgnuradio-qtgui > > probably > > contains info on where exactly that allocation happens that fails. > > > > You can "jump" into that frame with `frame <number>`, replacing > > <number> with the index given by #<number> in the backtrace. If these > > variables/symbols weren't optimized away during compilation, you can > > even use `print <variablename>` to print the values of local and > > global > > variables, or use `list` to print the source code of what you're > > looking at (that definitely requires debug info to be included with > > GNU > > Radio's build). > > > > Best regards, > > Marcus > > > > On Mon, 2018-06-25 at 16:52 -0700, Tom McDermott wrote: > > > Ubuntu 16.04.3 > > > GRC 3.7.11.1 (from git) > > > I was on 3.7.13 couple of weeks ago, completely removed all of > > > gnuradio > > > and rebuilt trying to debug this. 3.7.11.1 had same problem. > > > > > > > > > Got back to the problem of several weeks ago. > > > > > > 1. When I try to use a QT GUI sink (such as frequency) the > > > invocation > > > of > > > the QT Gui Frequency sink in this example throws a memory > > > allocation > > > error. > > > > > > Qt has caught an exception thrown from an event handler. Throwing > > > exceptions from an event handler is not supported in Qt. You must > > > reimplement QApplication::notify() and catch all exceptions there. > > > > > > terminate called after throwing an instance of 'std::bad_alloc' > > > what(): std::bad_alloc > > > > > > 2. If I remove the Row, Column GUI hints from just that one QT GUI > > > item, then it > > > comes up and runs OK. The other 9 of the QT controls (sliders, > > > choosers, entry, > > > ranges) still have their R,C hints. > > > > > > 3. Went back to the GRC file in step 1 that still has the R,C hints > > > in it > > > and it still fails with the error as shown in step 1. It did come > > > up > > > and run > > > one time showing 'unable to set locale' error, but still > > > ran. Never > > > seen that before. > > > > > > > > > Is there some limitation against using R,C hints on the QT displays > > > (time, > > > frequency, etc.)? > > > > > > -- Tom, N5EG > > > > > > > > > > > > > > > _______________________________________________ > > > Discuss-gnuradio mailing list > > > Discuss-gnuradio@gnu.org > > > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > > > _______________________________________________ > > Discuss-gnuradio mailing list > > Discuss-gnuradio@gnu.org > > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > >
Alexiares_Test-Full.grc
Description: application/gnuradio-grc
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: Top Block # Generated: Tue Jun 26 13:45:40 2018 ################################################## if __name__ == '__main__': import ctypes import sys if sys.platform.startswith('linux'): try: x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() except: print "Warning: failed to XInitThreads()" from PyQt4 import Qt from PyQt4.QtCore import QObject, pyqtSlot from gnuradio import analog from gnuradio import audio from gnuradio import blocks from gnuradio import eng_notation from gnuradio import filter from gnuradio import gr from gnuradio import qtgui from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from gnuradio.qtgui import Range, RangeWidget from optparse import OptionParser import hpsdr import sip import sys from gnuradio import qtgui class top_block(gr.top_block, Qt.QWidget): def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.squelch = squelch = -150 self.samp_rate = samp_rate = 48000 self.drive = drive = 0 self.TxF = TxF = 7000000 self.Sideband = Sideband = -1 self.RxPre = RxPre = 0 self.RxF0 = RxF0 = 7000000 self.PTT = PTT = 0 self.FreqFine = FreqFine = 00000 ################################################## # Blocks ################################################## self._squelch_range = Range(-200, 0, 5, -150, 500) self._squelch_win = RangeWidget(self._squelch_range, self.set_squelch, "squelch", "counter_slider", float) self.top_grid_layout.addWidget(self._squelch_win, 1, 5, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.setColumnStretch(c, 1) self._samp_rate_options = (48000, 96000, 192000, 384000, ) self._samp_rate_labels = ('48 ks/s', '96 ks/s', '192 ks/s', '384 ks/s', ) self._samp_rate_group_box = Qt.QGroupBox('Rx Sample Rate') self._samp_rate_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._samp_rate_button_group = variable_chooser_button_group() self._samp_rate_group_box.setLayout(self._samp_rate_box) for i, label in enumerate(self._samp_rate_labels): radio_button = Qt.QRadioButton(label) self._samp_rate_box.addWidget(radio_button) self._samp_rate_button_group.addButton(radio_button, i) self._samp_rate_callback = lambda i: Qt.QMetaObject.invokeMethod(self._samp_rate_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._samp_rate_options.index(i))) self._samp_rate_callback(self.samp_rate) self._samp_rate_button_group.buttonClicked[int].connect( lambda i: self.set_samp_rate(self._samp_rate_options[i])) self.top_grid_layout.addWidget(self._samp_rate_group_box, 1, 3, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 4): self.top_grid_layout.setColumnStretch(c, 1) self._drive_tool_bar = Qt.QToolBar(self) self._drive_tool_bar.addWidget(Qt.QLabel("drive"+": ")) self._drive_line_edit = Qt.QLineEdit(str(self.drive)) self._drive_tool_bar.addWidget(self._drive_line_edit) self._drive_line_edit.returnPressed.connect( lambda: self.set_drive(eval(str(self._drive_line_edit.text().toAscii())))) self.top_grid_layout.addWidget(self._drive_tool_bar, 1, 4, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self._TxF_range = Range(1000000, 54000000, 500000, 7000000, 500) self._TxF_win = RangeWidget(self._TxF_range, self.set_TxF, "TxF", "counter_slider", float) self.top_grid_layout.addWidget(self._TxF_win, 2, 1, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 3): self.top_grid_layout.setColumnStretch(c, 1) self._Sideband_options = (-1, 1, ) self._Sideband_labels = ('Lower', 'Upper', ) self._Sideband_group_box = Qt.QGroupBox("Sideband") self._Sideband_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._Sideband_button_group = variable_chooser_button_group() self._Sideband_group_box.setLayout(self._Sideband_box) for i, label in enumerate(self._Sideband_labels): radio_button = Qt.QRadioButton(label) self._Sideband_box.addWidget(radio_button) self._Sideband_button_group.addButton(radio_button, i) self._Sideband_callback = lambda i: Qt.QMetaObject.invokeMethod(self._Sideband_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._Sideband_options.index(i))) self._Sideband_callback(self.Sideband) self._Sideband_button_group.buttonClicked[int].connect( lambda i: self.set_Sideband(self._Sideband_options[i])) self.top_grid_layout.addWidget(self._Sideband_group_box, 1, 2, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self._RxPre_options = (0, 1, ) self._RxPre_labels = ('Off', 'On', ) self._RxPre_tool_bar = Qt.QToolBar(self) self._RxPre_tool_bar.addWidget(Qt.QLabel("RxPre"+": ")) self._RxPre_combo_box = Qt.QComboBox() self._RxPre_tool_bar.addWidget(self._RxPre_combo_box) for label in self._RxPre_labels: self._RxPre_combo_box.addItem(label) self._RxPre_callback = lambda i: Qt.QMetaObject.invokeMethod(self._RxPre_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._RxPre_options.index(i))) self._RxPre_callback(self.RxPre) self._RxPre_combo_box.currentIndexChanged.connect( lambda i: self.set_RxPre(self._RxPre_options[i])) self.top_grid_layout.addWidget(self._RxPre_tool_bar, 2, 5, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.setColumnStretch(c, 1) self._RxF0_range = Range(0, 54000000, 500000, 7000000, 500) self._RxF0_win = RangeWidget(self._RxF0_range, self.set_RxF0, "RxF0", "counter_slider", float) self.top_grid_layout.addWidget(self._RxF0_win, 2, 3, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 5): self.top_grid_layout.setColumnStretch(c, 1) self._PTT_options = (0, 1, 2, ) self._PTT_labels = ('Off', 'Vox', 'On', ) self._PTT_group_box = Qt.QGroupBox("PTT") self._PTT_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._PTT_button_group = variable_chooser_button_group() self._PTT_group_box.setLayout(self._PTT_box) for i, label in enumerate(self._PTT_labels): radio_button = Qt.QRadioButton(label) self._PTT_box.addWidget(radio_button) self._PTT_button_group.addButton(radio_button, i) self._PTT_callback = lambda i: Qt.QMetaObject.invokeMethod(self._PTT_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._PTT_options.index(i))) self._PTT_callback(self.PTT) self._PTT_button_group.buttonClicked[int].connect( lambda i: self.set_PTT(self._PTT_options[i])) self.top_grid_layout.addWidget(self._PTT_group_box, 1, 1, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self._FreqFine_range = Range(000000, 500000, 500, 00000, 500) self._FreqFine_win = RangeWidget(self._FreqFine_range, self.set_FreqFine, "FreqFine", "counter_slider", float) self.top_grid_layout.addWidget(self._FreqFine_win, 3, 1, 1, 5) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 6): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype RxF0+FreqFine+(Sideband*1500), #fc samp_rate, #bw "", #name 2 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(True) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(True) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 4, 1, 5, 5) for r in range(4, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 6): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass( 100, samp_rate, 1500, 200, firdes.WIN_BLACKMAN, 6.76)) self.hpsdr_hermesNB_0 = hpsdr.hermesNB(RxF0+Sideband*1500+FreqFine, 200000, 7200000, 7200000, 7200000, 7200000, 7200000, 7200000, TxF+FreqFine, RxPre, PTT, 1, 1, drive, samp_rate, "eth0", "0xF8", 0, 0, 0x00, 0x00, 0, 1, "*") self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*1, samp_rate/48000) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.audio_sink_0 = audio.sink(48000, '', False) self.analog_sig_source_x_1 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, Sideband*1000, 0.95, 0) self.analog_sig_source_x_0 = analog.sig_source_c(48000, analog.GR_COS_WAVE, Sideband*1500, 1, 0) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(squelch, .00001, 1, False) self.analog_agc3_xx_0 = analog.agc3_cc(1, 1e-5, 0.5, 1.0, 1) self.analog_agc3_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.analog_pwr_squelch_xx_0, 0), (self.analog_agc3_xx_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_1, 0), (self.hpsdr_hermesNB_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.hpsdr_hermesNB_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.hpsdr_hermesNB_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_0, 1)) def closeEvent(self, event): self.settings = Qt.QSettings("GNU Radio", "top_block") self.settings.setValue("geometry", self.saveGeometry()) event.accept() def get_squelch(self): return self.squelch def set_squelch(self, squelch): self.squelch = squelch self.analog_pwr_squelch_xx_0.set_threshold(self.squelch) def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self._samp_rate_callback(self.samp_rate) self.qtgui_freq_sink_x_0.set_frequency_range(self.RxF0+self.FreqFine+(self.Sideband*1500), self.samp_rate) self.low_pass_filter_0.set_taps(firdes.low_pass(100, self.samp_rate, 1500, 200, firdes.WIN_BLACKMAN, 6.76)) self.hpsdr_hermesNB_0.set_RxSampRate(self.samp_rate) self.blocks_keep_one_in_n_0.set_n(self.samp_rate/48000) self.analog_sig_source_x_1.set_sampling_freq(self.samp_rate) def get_drive(self): return self.drive def set_drive(self, drive): self.drive = drive Qt.QMetaObject.invokeMethod(self._drive_line_edit, "setText", Qt.Q_ARG("QString", repr(self.drive))) self.hpsdr_hermesNB_0.set_TxDrive(self.drive) def get_TxF(self): return self.TxF def set_TxF(self, TxF): self.TxF = TxF self.hpsdr_hermesNB_0.set_TransmitFrequency(self.TxF+self.FreqFine) def get_Sideband(self): return self.Sideband def set_Sideband(self, Sideband): self.Sideband = Sideband self._Sideband_callback(self.Sideband) self.qtgui_freq_sink_x_0.set_frequency_range(self.RxF0+self.FreqFine+(self.Sideband*1500), self.samp_rate) self.hpsdr_hermesNB_0.set_Receive0Frequency(self.RxF0+self.Sideband*1500+self.FreqFine) self.analog_sig_source_x_1.set_frequency(self.Sideband*1000) self.analog_sig_source_x_0.set_frequency(self.Sideband*1500) def get_RxPre(self): return self.RxPre def set_RxPre(self, RxPre): self.RxPre = RxPre self._RxPre_callback(self.RxPre) self.hpsdr_hermesNB_0.set_RxPreamp(self.RxPre) def get_RxF0(self): return self.RxF0 def set_RxF0(self, RxF0): self.RxF0 = RxF0 self.qtgui_freq_sink_x_0.set_frequency_range(self.RxF0+self.FreqFine+(self.Sideband*1500), self.samp_rate) self.hpsdr_hermesNB_0.set_Receive0Frequency(self.RxF0+self.Sideband*1500+self.FreqFine) def get_PTT(self): return self.PTT def set_PTT(self, PTT): self.PTT = PTT self._PTT_callback(self.PTT) self.hpsdr_hermesNB_0.set_PTTMode(self.PTT) def get_FreqFine(self): return self.FreqFine def set_FreqFine(self, FreqFine): self.FreqFine = FreqFine self.qtgui_freq_sink_x_0.set_frequency_range(self.RxF0+self.FreqFine+(self.Sideband*1500), self.samp_rate) self.hpsdr_hermesNB_0.set_Receive0Frequency(self.RxF0+self.Sideband*1500+self.FreqFine) self.hpsdr_hermesNB_0.set_TransmitFrequency(self.TxF+self.FreqFine) def main(top_block_cls=top_block, options=None): from distutils.version import StrictVersion if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): style = gr.prefs().get_string('qtgui', 'style', 'raster') Qt.QApplication.setGraphicsSystem(style) qapp = Qt.QApplication(sys.argv) tb = top_block_cls() tb.start() tb.show() def quitting(): tb.stop() tb.wait() qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) qapp.exec_() if __name__ == '__main__': main()
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio