Hello,
We found two errors in the file:
1. samp_rate parameter is not defined.
2. There is an indention error. The lines with "self.$(id).set_arg("spp",
$spp)" should not have leading spaces.
Thanks,
John
On Thu, Oct 5, 2017 at 11:38 AM, Avila, Jose A via USRP-users <
[email protected]> wrote:
> Thanks for the response and attached is the XML file, also the last commit
> is
>
>
>
>
>
> *commit 23508458f31e8b50264045ee0a34d07c7abc807d Author: Derek Kozel
> <[email protected] <[email protected]>> Date: Thu Jun 29 08:37:14
> 2017 -0700 *
>
> ------------------------------
> *From:* Nicolas Cuervo <[email protected]>
> *Sent:* Wednesday, October 4, 2017 10:39:43 PM
> *To:* Avila, Jose A
> *Cc:* [email protected]
> *Subject:* Re: [USRP-users] Error in RFNoC grc with OOT module
>
> Hello Jose,
>
> this might be an indentation problem at the XML that is located at
> your_oot/grc/your_block.xml. Do you mind sharing with us that file?
>
> Also, I remember seeing this error in earlier versions of the tool, so it
> would be interesting to know if it still happens, and under what
> conditions. Could you please tell us which is the last commit that you are
> pointing to at "gr-ettus"? To check, please go to your gr-ettus repository
> and run:
>
> $ git log
>
> If it is not updated, it is always recommended to update.
>
> Regards,
> -N
>
> On Wed, Oct 4, 2017 at 11:02 PM, Avila, Jose A via USRP-users <
> [email protected]> wrote:
>
>> Hello we are developing an OOT module following the tutorial, but similar
>> to siggen, but are currently encountering an error that comes up with
>>
>>
>> *./testtwochannel.py*
>>
>> The error that comes up is the following
>>
>>
>>
>>
>> * File "./testtwochannel.py", line 97
>> self.siggen2ch_twochannelsiggen_0 = Template error:
>> siggen2ch.twochannelsiggen(
>> ^ SyntaxError: invalid
>> syntax*
>>
>> The file in question is the following:
>>
>>
>> #!/usr/bin/env python2
>> # -*- coding: utf-8 -*-
>> ##################################################
>> # GNU Radio Python Flow Graph
>> # Title: Testtwochannel
>> # Generated: Wed Oct 4 14:35:59 2017
>> ##################################################
>>
>> 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 gnuradio import eng_notation
>> from gnuradio import gr
>> from gnuradio import qtgui
>> from gnuradio import uhd
>> from gnuradio.eng_option import eng_option
>> from gnuradio.filter import firdes
>> from optparse import OptionParser
>> import SimpleXMLRPCServer
>> import ettus
>> import siggen2ch
>> import sip
>> import sys
>> import threading
>> from gnuradio import qtgui
>>
>>
>> class testtwochannel(gr.top_block, Qt.QWidget):
>>
>> def __init__(self):
>> gr.top_block.__init__(self, "Testtwochannel")
>> Qt.QWidget.__init__(self)
>> self.setWindowTitle("Testtwochannel")
>> 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", "testtwochannel")
>> self.restoreGeometry(self.settings.value("geometry").toByteA
>> rray())
>>
>> ##################################################
>> # Variables
>> ##################################################
>> self.samp_rate = samp_rate = 10e6
>> self.waveform = waveform = "SINE_WAVE"
>> self.ip_addr = ip_addr = "192.168.10.100"
>> self.gain = gain = 1.0
>> self.freq = freq = samp_rate/10
>> self.enable = enable = False
>> self.device3 = device3 = ettus.device3(uhd.device_addr_t(
>> ",".join(('type=e3x0', "")) ))
>> self.ampl_q = ampl_q = 1
>> self.ampl_i = ampl_i = 1
>>
>> ##################################################
>> # Blocks
>> ##################################################
>> self.xmlrpc_server_0 =
>> SimpleXMLRPCServer.SimpleXMLRPCServer(('0.0.0.0',
>> 8080), allow_none=True)
>> self.xmlrpc_server_0.register_instance(self)
>> self.xmlrpc_server_0_thread = threading.Thread(target=self.x
>> mlrpc_server_0.serve_forever)
>> self.xmlrpc_server_0_thread.daemon = True
>> self.xmlrpc_server_0_thread.start()
>> self.uhd_rfnoc_streamer_fifo_0 = ettus.rfnoc_generic(
>> self.device3,
>> uhd.stream_args( # TX Stream Args
>> cpu_format="fc32",
>> otw_format="sc16",
>> args="gr_vlen={0},{1}".format(1, "" if 1 == 1 else
>> "spp={0}".format(1)),
>> ),
>> uhd.stream_args( # RX Stream Args
>> cpu_format="fc32",
>> otw_format="sc16",
>> args="gr_vlen={0},{1}".format(1, "" if 1 == 1 else
>> "spp={0}".format(1)),
>> ),
>> "FIFO", -1, -1,
>> )
>> self.siggen2ch_twochannelsiggen_0 = Template error:
>> siggen2ch.twochannelsiggen(
>> self.device3,
>> uhd.stream_args( # TX Stream Args
>> cpu_format="fc32",
>> otw_format="sc16",
>> args="gr_vlen={0},{1}".format(${grvlen}, "" if
>> $grvlen == 1 else "spp={0}".format($grvlen)),
>> ),
>> uhd.stream_args( # RX Stream Args
>> cpu_format="fc32",
>> otw_format="sc16",
>> args="gr_vlen={0},{1}".format(${grvlen}, "" if
>> $grvlen == 1 else "spp={0}".format($grvlen)),
>> ),
>> $block_index,
>> $device_index
>> )
>> self.$(id).set_arg("spp", $spp)
>> self.$(id).set_arg("frequency1", ((2*$frequency1)/$samp_rate))
>> self.$(id).set_arg("cartesian1", $cartesian1)
>> self.$(id).set_arg("frequency2", ((2*$frequency2)/$samp_rate))
>> self.$(id).set_arg("cartesian2", $cartesian2)
>> self.$(id).set_arg("gain", $gain)
>> self.$(id).set_arg("enable", $enable)
>>
>> cannot find 'samp_rate'
>> self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
>> 1024, #size
>> firdes.WIN_BLACKMAN_hARRIS, #wintype
>> 0, #fc
>> samp_rate, #bw
>> "", #name
>> 1 #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(False)
>> 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(False)
>>
>> 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(1):
>> 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_layout.addWidget(self._qtgui_freq_sink_x_0_win)
>>
>> ##################################################
>> # Connections
>> ##################################################
>> self.connect((self.uhd_rfnoc_streamer_fifo_0, 0),
>> (self.qtgui_freq_sink_x_0, 0))
>>
>> self.device3.connect(self.siggen2ch_twochannelsiggen_0.get_block_id(),
>> 0, self.uhd_rfnoc_streamer_fifo_0.get_block_id(), 0)
>>
>> def closeEvent(self, event):
>> self.settings = Qt.QSettings("GNU Radio", "testtwochannel")
>> self.settings.setValue("geometry", self.saveGeometry())
>> event.accept()
>>
>> def get_samp_rate(self):
>> return self.samp_rate
>>
>> def set_samp_rate(self, samp_rate):
>> self.samp_rate = samp_rate
>> self.siggen2ch_twochannelsiggen_0.Template error:
>> set_arg("frequency1", ((2*$frequency1)/$self.samp_rate))
>> cannot find 'samp_rate'
>> self.siggen2ch_twochannelsiggen_0.Template error:
>> set_arg("frequency2", ((2*$frequency2)/$self.samp_rate))
>> cannot find 'samp_rate'
>> self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate)
>> self.set_freq(self.samp_rate/10)
>>
>> def get_waveform(self):
>> return self.waveform
>>
>> def set_waveform(self, waveform):
>> self.waveform = waveform
>>
>> def get_ip_addr(self):
>> return self.ip_addr
>>
>> def set_ip_addr(self, ip_addr):
>> self.ip_addr = ip_addr
>>
>> def get_gain(self):
>> return self.gain
>>
>> def set_gain(self, gain):
>> self.gain = gain
>>
>> def get_freq(self):
>> return self.freq
>>
>> def set_freq(self, freq):
>> self.freq = freq
>>
>> def get_enable(self):
>> return self.enable
>>
>> def set_enable(self, enable):
>> self.enable = enable
>>
>> def get_device3(self):
>> return self.device3
>>
>> def set_device3(self, device3):
>> self.device3 = device3
>>
>> def get_ampl_q(self):
>> return self.ampl_q
>>
>> def set_ampl_q(self, ampl_q):
>> self.ampl_q = ampl_q
>>
>> def get_ampl_i(self):
>> return self.ampl_i
>>
>> def set_ampl_i(self, ampl_i):
>> self.ampl_i = ampl_i
>>
>>
>> def main(top_block_cls=testtwochannel, 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()
>>
>>
>> Thank you
>>
>>
>>
>> _______________________________________________
>> USRP-users mailing list
>> [email protected]
>> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>>
>>
>
> _______________________________________________
> USRP-users mailing list
> [email protected]
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>
>
_______________________________________________
USRP-users mailing list
[email protected]
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com