I am transmitting a signal from my USRP N210, but I would like to also
see
that signal on screen in a gui. I'm currently getting an error that I
don't
understand. I have a simple class, tx_test(gr.heir_block2), that simply
transmits a sine wave.
The second class, tx_sink(stdgui2.std_to_block), has the following
things:
def __init__(self, frame, panel, vbox, argv):
stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
parser = OptionParser(option_class=eng_option)
parser.add_option .....adds some options....
(options, args) = parser.parse_args ()
self.u = uhd.usrp_sink(device_addr=options.args,
stream_args=uhd.stream_args('fc32'))
It goes on to set sample rates and such. Lastly I have:
sig0 = tx_test(options.samp_rate)
self.connect(sig0, self.u)
gui = fftsink2.fft_sink_c(panel, title="Tx FFT Plot",
fft_size=1024,
sample_rate=self.usrp_rate)
self.connect (sig0, gui)
vbox.Add (gui.win, 1, wx.EXPAND)
def main ():
app = stdgui2.stdapp(tx_sink, "Transmitted Signal", nstatus=1)
app.MainLoop ()
if __name__ == '__main__':
main ()
I get the following error:
File "tx_test_gui.py", line 47, in tx_sink
self.u = uhd.usrp_sink(device_addr=options.args,
stream_args=uhd.stream_args('fc32'))
NameError: name 'self' is not defined
on 2013-02-20 19:40
on 2013-02-20 19:48
On Wed, Feb 20, 2013 at 1:39 PM, Brooke Hayden <sdratonu@gmail.com> wrote: > parser.add_option .....adds some options.... > sample_rate=self.usrp_rate) > I get the following error: > File "tx_test_gui.py", line 47, in tx_sink > self.u = uhd.usrp_sink(device_addr=options.args, > stream_args=uhd.stream_args('fc32')) > NameError: name 'self' is not defined > My first guess to this is incorrect whitespace. Make sure your "def __init__" function is properly set under the class name and there's no odd spacing anywhere else (or that you have both tabs and spaces that are confusing the parser). Tom
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.