diff options
Diffstat (limited to 'gr-wxgui')
-rw-r--r-- | gr-wxgui/CMakeLists.txt | 83 | ||||
-rw-r--r-- | gr-wxgui/grc/CMakeLists.txt | 36 | ||||
-rw-r--r-- | gr-wxgui/grc/wxgui_constellationsink2.xml | 8 | ||||
-rw-r--r-- | gr-wxgui/src/python/CMakeLists.txt | 88 | ||||
-rw-r--r-- | gr-wxgui/src/python/const_window.py | 22 | ||||
-rw-r--r-- | gr-wxgui/src/python/constants.py | 1 | ||||
-rw-r--r-- | gr-wxgui/src/python/constsink_gl.py | 25 |
7 files changed, 236 insertions, 27 deletions
diff --git a/gr-wxgui/CMakeLists.txt b/gr-wxgui/CMakeLists.txt new file mode 100644 index 000000000..5beb39f5e --- /dev/null +++ b/gr-wxgui/CMakeLists.txt @@ -0,0 +1,83 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup dependencies +######################################################################## +include(GrPython) + +GR_PYTHON_CHECK_MODULE("wx >= 2.8" wx "wx.version().split()[0] >= '2.8'" WX_FOUND) +GR_PYTHON_CHECK_MODULE("numpy" numpy True NUMPY_FOUND) + +######################################################################## +# Register component +######################################################################## +include(GrComponent) +GR_REGISTER_COMPONENT("gr-wxgui" ENABLE_GR_WXGUI + ENABLE_GR_CORE + ENABLE_PYTHON + NUMPY_FOUND + WX_FOUND +) + +######################################################################## +# Begin conditional configuration +######################################################################## +if(ENABLE_GR_WXGUI) + +######################################################################## +# Setup CPack components +######################################################################## +include(GrPackage) +CPACK_COMPONENT("wxgui" + DISPLAY_NAME "WxGUI" + DESCRIPTION "Wx GUI plotter widgets and grc wrappers" + DEPENDS "core_python" +) + +######################################################################## +# Create Pkg Config File +######################################################################## +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/gr-wxgui.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gr-wxgui.pc +@ONLY) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gr-wxgui.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "wxgui" +) + +######################################################################## +# Install the conf file +######################################################################## +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr-wxgui.conf + DESTINATION ${GR_PKG_CONF_DIR} + COMPONENT "wxgui" +) + +######################################################################## +# Add subdirectories +######################################################################## +add_subdirectory(grc) +add_subdirectory(src/python) + +endif(ENABLE_GR_WXGUI) diff --git a/gr-wxgui/grc/CMakeLists.txt b/gr-wxgui/grc/CMakeLists.txt new file mode 100644 index 000000000..49e3da3b1 --- /dev/null +++ b/gr-wxgui/grc/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +file(GLOB xml_files "*.xml") +install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "wxgui") + +######################################################################## +#The wxgui module contains a top_block + wxgui frame. +######################################################################## +include(GrPython) + +GR_PYTHON_INSTALL( + FILES + __init__.py + panel.py + top_block_gui.py + DESTINATION ${GR_PYTHON_DIR}/grc_gnuradio/wxgui + COMPONENT "wxgui" +) diff --git a/gr-wxgui/grc/wxgui_constellationsink2.xml b/gr-wxgui/grc/wxgui_constellationsink2.xml index c200790f9..f9df9d4ac 100644 --- a/gr-wxgui/grc/wxgui_constellationsink2.xml +++ b/gr-wxgui/grc/wxgui_constellationsink2.xml @@ -18,7 +18,7 @@ constsink_gl.const_sink_c( const_size=$const_size, M=$M, theta=$theta, - alpha=$alpha, + loop_bw=$loop_bw, fmax=$fmax, mu=$mu, gain_mu=$gain_mu, @@ -71,9 +71,9 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <type>real</type> </param> <param> - <name>Alpha</name> - <key>alpha</key> - <value>0.005</value> + <name>Loop Bandwidth</name> + <key>loop_bw</key> + <value>6.28/100.0</value> <type>real</type> </param> <param> diff --git a/gr-wxgui/src/python/CMakeLists.txt b/gr-wxgui/src/python/CMakeLists.txt new file mode 100644 index 000000000..24e06acd5 --- /dev/null +++ b/gr-wxgui/src/python/CMakeLists.txt @@ -0,0 +1,88 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +include(GrPython) + +######################################################################## +# Install python files into wxgui module +######################################################################## +GR_PYTHON_INSTALL( + FILES + __init__.py + common.py + constants.py + constsink_gl.py + const_window.py + form.py + fftsink2.py + fftsink_nongl.py + fftsink_gl.py + fft_window.py + gui.py + histosink_gl.py + histo_window.py + numbersink2.py + number_window.py + plot.py + powermate.py + pubsub.py + scopesink2.py + scopesink_nongl.py + scopesink_gl.py + scope_window.py + termsink.py + waterfallsink2.py + waterfallsink_nongl.py + waterfallsink_gl.py + waterfall_window.py + slider.py + stdgui2.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/wxgui + COMPONENT "wxgui" +) + +######################################################################## +# Install python files into wxgui forms sub-module +######################################################################## +GR_PYTHON_INSTALL( + FILES + forms/__init__.py + forms/forms.py + forms/converters.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/wxgui/forms + COMPONENT "wxgui" +) + +######################################################################## +# Install python files into wxgui plotter sub-module +######################################################################## +GR_PYTHON_INSTALL( + FILES + plotter/__init__.py + plotter/bar_plotter.py + plotter/channel_plotter.py + plotter/common.py + plotter/gltext.py + plotter/grid_plotter_base.py + plotter/plotter_base.py + plotter/waterfall_plotter.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/wxgui/plotter + COMPONENT "wxgui" +) diff --git a/gr-wxgui/src/python/const_window.py b/gr-wxgui/src/python/const_window.py index f7c7caf07..2ad89b2a3 100644 --- a/gr-wxgui/src/python/const_window.py +++ b/gr-wxgui/src/python/const_window.py @@ -36,7 +36,7 @@ import forms # Constants ################################################## SLIDER_STEPS = 200 -ALPHA_MIN_EXP, ALPHA_MAX_EXP = -6, -0.301 +LOOP_BW_MIN_EXP, LOOP_BW_MAX_EXP = -6, 0.0 GAIN_MU_MIN_EXP, GAIN_MU_MAX_EXP = -6, -0.301 DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'const_rate', 5) DEFAULT_WIN_SIZE = (500, 400) @@ -70,19 +70,19 @@ class control_panel(wx.Panel): parent=self, label='Options', bold=True, orient=wx.VERTICAL, ) - #alpha + #loop_bw control_box.AddStretchSpacer() forms.text_box( - sizer=control_box, parent=self, label='Alpha', + sizer=control_box, parent=self, label='Loop Bandwidth', converter=forms.float_converter(), - ps=parent, key=ALPHA_KEY, + ps=parent, key=LOOP_BW_KEY, ) forms.log_slider( sizer=control_box, parent=self, - min_exp=ALPHA_MIN_EXP, - max_exp=ALPHA_MAX_EXP, + min_exp=LOOP_BW_MIN_EXP, + max_exp=LOOP_BW_MAX_EXP, num_steps=SLIDER_STEPS, - ps=parent, key=ALPHA_KEY, + ps=parent, key=LOOP_BW_KEY, ) #gain_mu control_box.AddStretchSpacer() @@ -127,8 +127,7 @@ class const_window(wx.Panel, pubsub.pubsub): size, title, msg_key, - alpha_key, - beta_key, + loop_bw_key, gain_mu_key, gain_omega_key, omega_key, @@ -137,8 +136,7 @@ class const_window(wx.Panel, pubsub.pubsub): pubsub.pubsub.__init__(self) #proxy the keys self.proxy(MSG_KEY, controller, msg_key) - self.proxy(ALPHA_KEY, controller, alpha_key) - self.proxy(BETA_KEY, controller, beta_key) + self.proxy(LOOP_BW_KEY, controller, loop_bw_key) self.proxy(GAIN_MU_KEY, controller, gain_mu_key) self.proxy(GAIN_OMEGA_KEY, controller, gain_omega_key) self.proxy(OMEGA_KEY, controller, omega_key) @@ -164,8 +162,6 @@ class const_window(wx.Panel, pubsub.pubsub): main_box.Add(self.control_panel, 0, wx.EXPAND) self.SetSizerAndFit(main_box) #alpha and gain mu 2nd orders - def set_beta(alpha): self[BETA_KEY] = .25*alpha**2 - self.subscribe(ALPHA_KEY, set_beta) def set_gain_omega(gain_mu): self[GAIN_OMEGA_KEY] = .25*gain_mu**2 self.subscribe(GAIN_MU_KEY, set_gain_omega) #register events diff --git a/gr-wxgui/src/python/constants.py b/gr-wxgui/src/python/constants.py index 070be0808..08cc6a634 100644 --- a/gr-wxgui/src/python/constants.py +++ b/gr-wxgui/src/python/constants.py @@ -73,3 +73,4 @@ NUM_BINS_KEY = 'num_bins' FRAME_SIZE_KEY = 'frame_size' CHANNEL_OPTIONS_KEY = 'channel_options' SHOW_CONTROL_PANEL_KEY = 'show_control_panel' +LOOP_BW_KEY = 'loop_bw' diff --git a/gr-wxgui/src/python/constsink_gl.py b/gr-wxgui/src/python/constsink_gl.py index 91bc65d9f..51434df68 100644 --- a/gr-wxgui/src/python/constsink_gl.py +++ b/gr-wxgui/src/python/constsink_gl.py @@ -27,6 +27,12 @@ import common from gnuradio import gr, blks2 from pubsub import pubsub from constants import * +import sys +try: + from gnuradio import digital +except ImportError: + sys.stderr.write("Error: could not import gnuradio.digital, please install gr-digitial.\n") + sys.exit(1) ################################################## # Constellation sink block (wrapper for old wxgui) @@ -47,7 +53,7 @@ class const_sink_c(gr.hier_block2, common.wxgui_hb): #mpsk recv params M=4, theta=0, - alpha=0.005, + loop_bw=6.28/100.0, fmax=0.06, mu=0.5, gain_mu=0.005, @@ -68,16 +74,18 @@ class const_sink_c(gr.hier_block2, common.wxgui_hb): vec_rate=frame_rate, vec_len=const_size, ) - beta = .25*alpha**2 #redundant, will be updated fmin = -fmax gain_omega = .25*gain_mu**2 #redundant, will be updated omega = 1 #set_sample_rate will update this # Costas frequency/phase recovery loop # Critically damped 2nd order PLL - self._costas = gr.costas_loop_cc(alpha, beta, fmax, fmin, M) + self._costas = digital.costas_loop_cc(loop_bw, M) # Timing recovery loop # Critically damped 2nd order DLL - self._retime = gr.clock_recovery_mm_cc(omega, gain_omega, mu, gain_mu, omega_limit) + self._retime = digital.clock_recovery_mm_cc(omega, + gain_omega, + mu, gain_mu, + omega_limit) #sync = gr.mpsk_receiver_cc( # M, #psk order # theta, @@ -97,10 +105,8 @@ class const_sink_c(gr.hier_block2, common.wxgui_hb): #controller def setter(p, k, x): p[k] = x self.controller = pubsub() - self.controller.subscribe(ALPHA_KEY, self._costas.set_alpha) - self.controller.publish(ALPHA_KEY, self._costas.alpha) - self.controller.subscribe(BETA_KEY, self._costas.set_beta) - self.controller.publish(BETA_KEY, self._costas.beta) + self.controller.subscribe(LOOP_BW_KEY, self._costas.set_loop_bandwidth) + self.controller.publish(LOOP_BW_KEY, self._costas.get_loop_bandwidth) self.controller.subscribe(GAIN_MU_KEY, self._retime.set_gain_mu) self.controller.publish(GAIN_MU_KEY, self._retime.gain_mu) self.controller.subscribe(OMEGA_KEY, self._retime.set_omega) @@ -121,8 +127,7 @@ class const_sink_c(gr.hier_block2, common.wxgui_hb): size=size, title=title, msg_key=MSG_KEY, - alpha_key=ALPHA_KEY, - beta_key=BETA_KEY, + loop_bw_key=LOOP_BW_KEY, gain_mu_key=GAIN_MU_KEY, gain_omega_key=GAIN_OMEGA_KEY, omega_key=OMEGA_KEY, |