Creating a UHD Sink block

I am having trouble with the GNU Radio block that I have created to use
as
an alternative to the regular UHD USRP Sink block provided by GNU Radio.
The file compiles, but there are errors when I run it in a python file.
The
Python file works fine if I use the GNU Radio UHD Sink, but not when I
use
mine. I have included the errors below. Thanks!

File “sink_test_gui.py”, line 84, in
main ()
File “sink_test_gui.py”, line 80, in main
app = stdgui2.stdapp(tx_sink, “Transmitted Signal”, nstatus=1)
File
“/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/stdgui2.py”,
line 38, in init
wx.App.init (self, redirect=False)
File
“/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py”,
line 7981, in init
self._BootstrapApp()
File
“/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py”,
line 7555, in _BootstrapApp
return core.PyApp__BootstrapApp(*args, **kwargs)
File
“/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/stdgui2.py”,
line 42, in OnInit
self._max_noutput_items)
File
“/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/stdgui2.py”,
line 64, in init
self.panel = stdpanel (self, self, top_block_maker, max_nouts)
File
“/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/stdgui2.py”,
line 86, in init
self.top_block = top_block_maker (frame, self, vbox, sys.argv)
File “sink_test_gui.py”, line 45, in init
self.u = radar2.uhd_lfm_sink(device_addr=options.args,
stream_args=uhd.stream_args(‘fc32’))
AttributeError: ‘module’ object has no attribute ‘uhd_lfm_sink’

On Fri, Mar 22, 2013 at 10:43 AM, Brooke H. [email protected]
wrote:

File “/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/stdgui2.py”,
self._max_noutput_items)
File “/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/stdgui2.py”,
line 64, in init
self.panel = stdpanel (self, self, top_block_maker, max_nouts)
File “/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/stdgui2.py”,
line 86, in init
self.top_block = top_block_maker (frame, self, vbox, sys.argv)
File “sink_test_gui.py”, line 45, in init
self.u = radar2.uhd_lfm_sink(device_addr=options.args,
stream_args=uhd.stream_args(‘fc32’))
AttributeError: ‘module’ object has no attribute ‘uhd_lfm_sink’

Brooke,

Make sure everything looks good in your SWIG files. If you’re using
the new style (3.7) of creating the blocks, you should have something
like this in in your lfm_swig.i file (I’m just using the component
name ‘lfm’ from your block’s name above; replace it with whatever you
actually use):

%{
#include “lfm/uhd_lfm_sink.h”
%}

%include “lfm/uhd_lfm_sink.h”

GR_SWIG_BLOCK_MAGIC2(lfm, uhd_lfm_sink);

Remember that the order of these statements is important.

Tom