Adding a pick bitrate calculation for new tx/rx modulators with arbitrary samples...
[debian/gnuradio] / gnuradio-examples / python / digital / usrp_transmit_path.py
index ad9f741a6309dec1b82106513525ebcb2a324c2f..4244c33f278478d8648ccdf4300074747cee0f51 100644 (file)
@@ -22,7 +22,7 @@
 from gnuradio import gr
 from gnuradio import usrp_options
 import transmit_path
-from pick_bitrate import pick_tx_bitrate
+from pick_bitrate2 import pick_tx_bitrate
 from gnuradio import eng_notation
 
 def add_freq_option(parser):
@@ -62,12 +62,18 @@ class usrp_transmit_path(gr.hier_block2):
         for attr in dir(tx_path): #forward the methods
             if not attr.startswith('_') and not hasattr(self, attr):
                 setattr(self, attr, getattr(tx_path, attr))
+
         #setup usrp
         self._modulator_class = modulator_class
         self._setup_usrp_sink(options)
-        #connect
-        self.connect(tx_path, self.u)
 
+        # Set up resampler based on rate determined by _setup_usrp_sink
+        rs_taps = gr.firdes.low_pass_2(32, 32, 0.45, 0.1, 60)
+        self.resampler = gr.pfb_arb_resampler_ccf(self.rs_rate, rs_taps)
+
+        #connect
+        self.connect(tx_path, self.resampler, self.u)
+        
     def _setup_usrp_sink(self, options):
         """
         Creates a USRP sink, determines the settings for best bitrate,
@@ -75,13 +81,20 @@ class usrp_transmit_path(gr.hier_block2):
         """
         self.u = usrp_options.create_usrp_sink(options)
         dac_rate = self.u.dac_rate()
+        self.rs_rate = options.bitrate    # Store requested bit rate
         if options.verbose:
             print 'USRP Sink:', self.u
+        #(self._bitrate, self._samples_per_symbol, self._interp) = \
+        #                pick_tx_bitrate(options.bitrate, self._modulator_class.bits_per_symbol(), \
+        #                                options.samples_per_symbol, options.interp, dac_rate, \
+        #                                self.u.get_interp_rates())
         (self._bitrate, self._samples_per_symbol, self._interp) = \
                         pick_tx_bitrate(options.bitrate, self._modulator_class.bits_per_symbol(), \
-                                        options.samples_per_symbol, options.interp, dac_rate, \
-                                        self.u.get_interp_rates())
+                                        dac_rate, self.u.get_interp_rates())
 
+        print "USRP Interpolation: ", self._interp
+        print "Samples Per Symbol: ", self._samples_per_symbol
+        
         self.u.set_interp(self._interp)
         self.u.set_auto_tr(True)