当前位置: 首页>>代码示例>>Python>>正文


Python uhd_interface.uhd_transmitter函数代码示例

本文整理汇总了Python中uhd_interface.uhd_transmitter函数的典型用法代码示例。如果您正苦于以下问题:Python uhd_transmitter函数的具体用法?Python uhd_transmitter怎么用?Python uhd_transmitter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了uhd_transmitter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

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

        if options.outfile is not None:
          u = gr.file_sink(gr.sizeof_gr_complex, options.outfile)
        elif (options.tx_freq is not None) or (options.channel is not None):
          if options.channel is not None:
            self.chan_num = options.channel
            options.tx_freq = ieee802_15_4_pkt.chan_802_15_4.chan_map[self.chan_num]

          u = uhd_transmitter(options.tx_args,
                              options.bandwidth,
                              options.tx_freq, options.tx_gain,
                              options.spec, options.antenna,
                              options.verbose, options.external)
        else:
          raise SystemExit("--tx-freq, --channel or --outfile must be specified\n")

        self.samples_per_symbol = 2

        # transmitter
        self.packet_transmitter = ieee802_15_4_pkt.ieee802_15_4_mod_pkts(self,
                spb=self.samples_per_symbol, msgq_limit=2, log=options.log)
        self.amp = gr.multiply_const_cc(1)

        self.u = u
        self.connect(self.packet_transmitter, self.amp, self.u)

        self.connect(self.amp, gr.file_sink(gr.sizeof_gr_complex, 'cc2420-tx-diag.dat'))
开发者ID:UpYou,项目名称:gr-ieee802-15-4,代码行数:29,代码来源:cc2420_txtest_uhd.py

示例2: _setup_sink

	def _setup_sink(self, options):
            self.symbol_rate=2; #for bpsk will edit the code later to set this automaticly based on the selected modulation scheme
	    self.sink = uhd_transmitter(options.args, self.symbol_rate,
                                        options.samples_per_symbol,
                                        options.tx_freq, options.tx_gain,
                                        options.spec, options.antenna,
                                        options.verbose)
开发者ID:nagsrk,项目名称:ofdm_uhd,代码行数:7,代码来源:usrp_transmit_path.py

示例3: __init__

    def __init__(self, options, payload=''):
        gr.top_block.__init__(self)

	if(options.tx_freq is not None):
            self.sink = uhd_transmitter(options.args,
                                        options.bandwidth,
                                        options.tx_freq, options.tx_gain,
                                        options.spec, options.antenna,
                                        options.verbose)
        elif(options.to_file is not None):
            self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
        else:
            self.sink = gr.null_sink(gr.sizeof_gr_complex)

	options.interp	= 100e6/options.bandwidth	# FTW-specific convertion

        # do this after for any adjustments to the options that may
        # occur in the sinks (specifically the UHD sink)
        if(options.from_file is None):
            self.txpath = ftw_transmit_path(options, payload)    
        else:
            self.txpath = gr.file_source(gr.sizeof_gr_complex, options.from_file);
#            options.tx_amplitude = 1

        # static value to make sure we do not exceed +-1 for the floats being sent to the sink
	self._tx_amplitude = options.tx_amplitude        
	self.amp = gr.multiply_const_cc(self._tx_amplitude)

        # self.txpath = ftw_pnc_transmit_path(options, payload)
        self.connect(self.txpath, self.amp, self.sink)

        if options.log:
            self.connect(self.txpath, gr.file_sink(gr.sizeof_gr_complex, 'ftw_benchmark.dat'))
开发者ID:aler86,项目名称:radioplus,代码行数:33,代码来源:ftw_ofdm_tx_uhd.py

示例4: __init__

    def __init__(self, modulator_class, options):
        gr.top_block.__init__(self)
        self.txpath = transmit_path(modulator_class, options)
        self.audio_rx = audio_rx(options.audio_input)

        if(options.tx_freq is not None):
            self.sink = uhd_transmitter(options.address, options.bitrate,
                                        options.samples_per_symbol,
                                        options.tx_freq, options.tx_gain,
                                        options.antenna, options.verbose)
            options.samples_per_symbol = self.sink._sps
            audio_rate = self.audio_rx.sample_rate
            usrp_rate = self.sink.get_sample_rate()
            rrate = usrp_rate / audio_rate
            
        elif(options.to_file is not None):
            self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file)
            rrate = 1
        else:
            self.sink = blocks.null_sink(gr.sizeof_gr_complex)
            rrate = 1

        self.resampler = filter.pfb.arb_resampler_ccf(rrate)
            
	self.connect(self.audio_rx)
	self.connect(self.txpath, self.resampler, self.sink)
开发者ID:bolin-hsu,项目名称:jelli-gnuradio,代码行数:26,代码来源:tx_voice.py

示例5: __init__

    def __init__(self, modulator, options):
        gr.top_block.__init__(self)

        if(options.tx_freq is not None):
            # Work-around to get the modulation's bits_per_symbol
            args = modulator.extract_kwargs_from_options(options)
            symbol_rate = options.bitrate / modulator(**args).bits_per_symbol()

            self.sink = uhd_transmitter(options.args, symbol_rate,
                                        options.samples_per_symbol,
                                        options.tx_freq, options.tx_gain,
                                        options.spec, options.antenna,
                                        options.verbose)
            options.samples_per_symbol = self.sink._sps
            
        elif(options.to_file is not None):
            sys.stderr.write(("Saving samples to '%s'.\n\n" % (options.to_file)))
            self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
        else:
            sys.stderr.write("No sink defined, dumping samples to null sink.\n\n")
            self.sink = gr.null_sink(gr.sizeof_gr_complex)

        # do this after for any adjustments to the options that may
        # occur in the sinks (specifically the UHD sink)
        self.txpath = transmit_path(modulator, options)

        self.connect(self.txpath, self.sink)
开发者ID:randyp1248,项目名称:darpa,代码行数:27,代码来源:benchmark_tx3.py

示例6: __init__

    def __init__(self, callback, options):
        gr.top_block.__init__(self)

        self.source = uhd_receiver(
            options.args,
            options.bandwidth,
            options.rx_freq,
            options.rx_gain,
            options.spec,
            options.antenna,
            options.verbose,
        )

        self.sink = uhd_transmitter(
            options.args,
            options.bandwidth,
            options.tx_freq,
            options.tx_gain,
            options.spec,
            options.antenna,
            options.verbose,
        )

        self.txpath = transmit_path(options)
        self.rxpath = receive_path(callback, options)

        self.connect(self.txpath, self.sink)
        self.connect(self.source, self.rxpath)
开发者ID:Wysaat,项目名称:gnuradio,代码行数:28,代码来源:tunnel.py

示例7: __init__

    def __init__(self, mod_class, demod_class,
                 rx_callback, options):

        gr.top_block.__init__(self)

        # Get the modulation's bits_per_symbol
        args = mod_class.extract_kwargs_from_options(options)
        symbol_rate = options.bitrate / mod_class(**args).bits_per_symbol()

        self.source = uhd_receiver(options.args, symbol_rate,
                                   options.samples_per_symbol,
                                   options.rx_freq, options.rx_gain,
                                   options.spec, options.antenna,
                                   options.verbose)
        
        self.sink = uhd_transmitter(options.args, symbol_rate,
                                    options.samples_per_symbol,
                                    options.tx_freq, options.tx_gain,
                                    options.spec, options.antenna,
                                    options.verbose)
        
        options.samples_per_symbol = self.source._sps

        self.txpath = transmit_path(mod_class, options)
        self.rxpath = receive_path(demod_class, rx_callback, options)
        self.connect(self.txpath, self.sink)
        self.connect(self.source, self.rxpath)
开发者ID:manuts,项目名称:stop-and-wait-arq,代码行数:27,代码来源:tunnel.py

示例8: __init__

    def __init__(self, callback, options):
        gr.top_block.__init__(self)

	### Rx Side ###

        if(options.rx_freq is not None):
            self.source = uhd_receiver(options.args_rx,
                                       options.bandwidth,
                                       options.rx_freq, options.rx_gain,
                                       options.spec, options.antenna,
                                       options.verbose)
        elif(options.from_file is not None):
            self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
        else:
            self.source = gr.null_source(gr.sizeof_gr_complex)


        # Set up receive path
        # do this after for any adjustments to the options that may
        # occur in the sinks (specifically the UHD sink)
        self.rxpath = receive_path(callback, options)

        
	## Tx Side ###
	if(options.tx_freq is not None):
            self.sink = uhd_transmitter(options.args_tx,
                                        options.bandwidth,
                                        options.tx_freq, options.tx_gain,
                                        options.spec, options.antenna,
                                        options.verbose)
        elif(options.to_file is not None):
            self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
        else:
            self.sink = gr.null_sink(gr.sizeof_gr_complex)


        # do this after for any adjustments to the options that may
        # occur in the sinks (specifically the UHD sink)
        self.txpath = transmit_path(options)
        self.connect(self.txpath, self.sink)

#        self.txpath = gr.message_source(gr.sizeof_gr_complex, 3)
#        nco_sensitivity = 2.0/options.fft_length   # correct for fine frequency
#        self.nco = ftw.pnc_frequency_modulator_fc(nco_sensitivity)
#        self.connect(self.txpath, self.sink) # self.nco, 

	# if you use two USRPs and want to synchonized
	# need to change uhd_interface.py
#	self.source.config_mimo()
#	time.sleep(1)	# to make sync stable

	if options.debug:
	    self.connect(self.source, gr.file_sink(gr.sizeof_gr_complex, 'rx.dat'))	# Save reception signal 
	else:
	    self.connect(self.source, self.rxpath)
            #self.connect(self.source, gr.file_sink(gr.sizeof_gr_complex, 'rx.dat'))

	if(options.verbose):
            self._print_verbage()
开发者ID:UpYou,项目名称:ofdm,代码行数:59,代码来源:benchmark_txrx.py

示例9: __init__

    def __init__(self, modulator, demodulator, rx_callback, options):
        gr.top_block.__init__(self)
		#parameters to sense channe
        #options.symbol_rate=2500000
        #options.samples_per_symbol=2
        #options.rx_freq=2500000000
        #options.rx_gain=20
        #options.chbw_factor=1
        sense_symbol_rate=2500000
        sense_samples_per_symbol=2
        sense_rx_freq=2500000000
        sense_rx_gain=20
        options.chbw_factor=1
	#options.samples_per_symbol,

 
        #args = demodulator.extract_kwargs_from_options(options)
        self.sensesource=uhd_receiver(options.args, sense_symbol_rate,
                                       sense_samples_per_symbol,
                                       sense_rx_freq, sense_rx_gain,
                                       options.spec, options.antenna,
                                       options.verbose)

        if(options.tx_freq is not None):
            # Work-around to get the modulation's bits_per_symbol
            args = modulator.extract_kwargs_from_options(options)
            symbol_rate = options.bitrate / modulator(**args).bits_per_symbol()

            self.sink = uhd_transmitter(options.args, symbol_rate,
                                        options.samples_per_symbol,
                                        options.tx_freq, options.tx_gain,
                                        options.spec, options.antenna,
                                        options.verbose)
            options.samples_per_symbol = self.sink._sps
            
        elif(options.to_file is not None):
            sys.stderr.write(("Saving samples to '%s'.\n\n" % (options.to_file)))
            self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
        else:
            sys.stderr.write("No sink defined, dumping samples to null sink.\n\n")
            self.sink = gr.null_sink(gr.sizeof_gr_complex)


        self.txgate = gr.copy(gr.sizeof_gr_complex)
        self.sensegate = gr.copy(gr.sizeof_gr_complex)
        #self.msgq             = gr.msg_queue()

        # do this after for any adjustments to the options that may
        # occur in the sinks (specifically the UHD sink)
        self.txpath = transmit_path(modulator, options)

        self.connect(self.txpath, self.txgate, self.sink)

	# do sense
        self.sensepath = sensing_path(options)

        self.tx_enabled = True
	self.sense_flag=False
	self.connect(self.sensesource, self.sensepath)
开发者ID:tyc85,项目名称:nwsdr-3.6.3-dsc,代码行数:59,代码来源:benchmarksenseFinal_tx.py

示例10: __init__

 def __init__(self, options):
     gr.top_block.__init__(self)
     self.sink = uhd_transmitter(options.args,
                                 options.bandwidth, options.tx_freq,
                                 options.lo_offset, options.tx_gain,
                                 options.spec, options.antenna,
                                 options.clock_source, options.verbose)
     self.txpath = transmit_path(options)
     self.connect(self.txpath, self.sink)
开发者ID:teoyenmao,项目名称:usrp_project,代码行数:9,代码来源:test_uci.py

示例11: __init__

    def __init__(self, rx_callback, options):
        gr.top_block.__init__(self)

        # Setting up 'Transmit Path'
        self.txpath = transmit_path(options, self)

        # Setting up 'Receive Path'
        packet = cnPacket()
        self.rxpath = receive_path(rx_callback, packet, options) 

        # Channel
        samples_per_packet = options.samples_per_symbol * 8 * 36
 
        if options.mode == 'default':
            print 'Operating mode : Default'
            
            mods = digital.modulation_utils.type_1_mods()
            modulator = mods[options.modulation]
            
            args = modulator.extract_kwargs_from_options(options)
            symbol_rate = options.bitrate / modulator(**args).bits_per_symbol()

            self.usrp_sink = uhd_transmitter(options.args, symbol_rate,
                                        options.samples_per_symbol,
                                        options.tx_freq, options.tx_gain,
                                        options.spec, options.antenna,
                                        options.verbose)

            self.usrp_source = uhd_receiver(options.args, symbol_rate,
                                       options.samples_per_symbol,
                                       options.rx_freq, options.rx_gain,
                                       options.spec, options.antenna,
                                       options.verbose)

            options.samples_per_symbol = self.usrp_sink._sps
            
            
            #self.usrp_sink = usrp_sink(options)
            #self.usrp_source = usrp_source(options)
            self.connect(self.txpath, self.usrp_sink)
            self.connect(self.usrp_source, self.rxpath)

            
        elif options.mode == 'loopback':
            print 'Operating mode : Loopback'
      
            self.channel = channel_emulator(options,samples_per_packet)
            self.connect(self.txpath, self.channel, self.rxpath)
开发者ID:ychang,项目名称:gr-gtlib,代码行数:48,代码来源:cnPHY.py

示例12: __init__

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

        
        self.sink = uhd_transmitter(options.args,
                                    options.bandwidth,
                                    options.tx_freq, options.tx_gain,
                                    options.spec, options.antenna,
                                    options.verbose)
  

        # do this after for any adjustments to the options that may
        # occur in the sinks (specifically the UHD sink)
        self.txpath = transmit_path(options)

        self.connect(self.txpath, self.sink)
开发者ID:xiaov58,项目名称:Coolest_Path,代码行数:16,代码来源:benchmark_tx.py

示例13: _setup_usrp_source2

    def _setup_usrp_source2(self,options):
        """
        Creates a USRP sink, determines the settings for best bitrate,
        and attaches to the transmitter's subdevice.
        """
        print "setup_usrp_source2",self._tx_freq

        if(self._tx_freq is not None):
            self.u_sink = uhd_transmitter(options.args,
                                        options.bandwidth,
                                        self._tx_freq, options.tx_gain,
                                        options.spec, options.antenna,
                                        options.verbose)
        print "setup usrp sink " , self.u_sink
        # do this after for any adjustments to the options that may
        # occur in the sinks (specifically the UHD sink)
        self.txpath = transmit_path(options)
        self.connect(self.txpath, self.u_sink)
开发者ID:jbruno,项目名称:gr_papyrus,代码行数:18,代码来源:ssma.py

示例14: __init__

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

        if(options.tx_freq is not None):
            self.sink = uhd_transmitter(options.args,
                                        options.bandwidth, options.tx_freq, 
                                        options.lo_offset, options.tx_gain,
                                        options.spec, options.antenna,
                                        options.clock_source, options.verbose)
        elif(options.to_file is not None):
            self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file)
        else:
            self.sink = blocks.null_sink(gr.sizeof_gr_complex)

        # do this after for any adjustments to the options that may
        # occur in the sinks (specifically the UHD sink)
        self.txpath = transmit_path(options)

        self.connect(self.txpath, self.sink)
开发者ID:phoorichet,项目名称:gnuradio,代码行数:19,代码来源:benchmark_tx.py

示例15: __init__

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

        if(options.tx_freq is not None):
            self.sink = uhd_transmitter(options.args,
                                        options.bandwidth,
                                        options.tx_freq, options.tx_gain,
                                        options.spec, options.antenna,
                                        options.verbose)
        elif(options.to_file is not None):
            self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
        else:
            self.sink = gr.null_sink(gr.sizeof_gr_complex)

        # do this after for any adjustments to the options that may
        # occur in the sinks (specifically the UHD sink)
        self.txpath = gr.message_source(gr.sizeof_gr_complex, 3)
        self.amp = gr.multiply_const_cc(options.amp)
        self.connect(self.txpath, self.amp, self.sink)
开发者ID:UpYou,项目名称:gnuradio-tools,代码行数:19,代码来源:raw_msgqtx.py


注:本文中的uhd_interface.uhd_transmitter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。