discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Error: "Assertion `px != 0' failed."


From: Jon L
Subject: [Discuss-gnuradio] Error: "Assertion `px != 0' failed."
Date: Tue, 16 Feb 2010 16:42:51 -0700

Hello,

I need some help with an error I'm getting.

python: /usr/include/boost/shared_ptr.hpp:419: T* boost::shared_ptr< <template-parameter-1-1> >::operator->() const [with T = db_base]: Assertion `px != 0' failed.

What could be causing this?  The entire code is the following:

#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Signal To Raw
# Generated: Fri Feb 12 01:11:49 2010
##################################################

from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from grc_gnuradio import usrp as grc_usrp
from optparse import OptionParser
import datetime
import time

class signal_to_raw(gr.top_block):

    def __init__(self):
        gr.top_block.__init__(self)


        today = datetime.datetime.now()
            print "Starting:  %s" % today.isoformat(' ')

        ##################################################
        # option parser
        ##################################################
            ### usage="%prog: [options] output_filename0 output_filename1 "
            parser = OptionParser(option_class=eng_option)  ###, usage=usage)
            parser.add_option("-R", "--rx_subdev_spec0", type="subdev", default=(0,0),help="first channel select USRP Rx side A or B(default=A)")
            parser.add_option("-r", "--rx_subdev_spec1", type="subdev", default=(1,0),help="second channel select USRP Rx side A or B(default=A)")
            parser.add_option("-d", "--decim", type="int", default=256,help="set fgpa decimation rate to DECIM[default=%default]")
         parser.add_option("-f", "--freq", type="eng_float", default=54.1e6,help="set frequency to FREQ", metavar="FREQ")
            parser.add_option("-g", "--gain", type="eng_float", default=100,help="set gain in dB (default is midpoint)")
            #parser.add_option("-N", "--nsamples", type="eng_float", default=9600000,help="number of samples to collect[default=9600000]")
            parser.add_option("-t", "--time", type="eng_float", default=3540.0,help="length of recording in seconds [default=0]")
            parser.add_option("-F", "--fft", type="int", default=-1,help="display real-time FFT")
        #parser.add_option("-

             (options, args) = parser.parse_args ()
            if len(args) !=0:
               parser.print_help()
               raise SystemExit, 1

       
        ##################################################
        # File name
        ##################################################   
        adc_rate = 64e6
                decim = options.decim
                usrp_rate = adc_rate/decim
        interp = 4 # this is the interpolation interval for the "one in N" function
        outdir = '/home/tamember/radar/gr_jp/'
            #basename = 'grdata_'
            today = datetime.datetime.now()
            datestamp = today.strftime("%y%m%d%H%M%S")
            gain = options.gain
        gainset = '%d_' % (gain)
        freq = options.freq
        in_kHz = freq/1000
            freqn = '%dkHz_' % (in_kHz)
        rate = '%i' % ((usrp_rate * 2)/interp)
            filenamea = outdir + datestamp + "_" + gainset + freqn + rate + '_cha.dat'
            filenameb = outdir + datestamp + "_" + gainset + freqn + rate + '_chb.dat'       
       

        ##################################################
        # Blocks
        ##################################################
        self.gr_file_sink_A = gr.file_sink(gr.sizeof_gr_complex*1, "/gr_jp/filenamea")
        self.gr_file_sink_B = gr.file_sink(gr.sizeof_gr_complex*1, "/gr_jp/filenameb")
        self.usrp_dual_source_x_0 = grc_usrp.dual_source_c(which=0, rx_ant_a='RXA', rx_ant_b="RXB")
        self.usrp_dual_source_x_0.set_decim_rate(decim)
        self.usrp_dual_source_x_0.set_frequency_a(freq, verbose=True)
        self.usrp_dual_source_x_0.set_frequency_b(freq, verbose=True)
        self.usrp_dual_source_x_0.set_gain_a(gain)
        self.usrp_dual_source_x_0.set_gain_b(gain)


        ##################################################
        # Connections
        ##################################################
        self.connect((self.usrp_dual_source_x_0, 0), (self.gr_file_sink_A, 0))
        self.connect((self.usrp_dual_source_x_0, 1), (self.gr_file_sink_B, 0))

        print 'Sample rate is: %ikHz' % (usrp_rate*2/(1000*interp))
        print 'ADC rate is: %iMHz' % (usrp_dual_source_x_0.adc_rate()/1000000)
        print "Gain: %i" % (gain)
            print "Freq is set to: %sMHz" % (freq/float(1000000.0))
        print "Decimation interval is: %i" % (usrp_dual_source_x_0.decim_rate())
        print "Interpolation interval is: %i" % (interp)
       

if __name__ == '__main__':
    if gr.enable_realtime_scheduling() != gr.RT_OK:
        print "Error: failed to enable realtime scheduling."
    tb = signal_to_raw()
    tb.start()
    raw_input('Press Enter to quit: ')
    tb.stop()
    today = datetime.datetime.now()
        print "Ending:  %s" % today.isoformat(' ')
    print ""



reply via email to

[Prev in Thread] Current Thread [Next in Thread]