Gnuradioの基本

「Gnuradioの基本」の編集履歴(バックアップ)一覧に戻る

Gnuradioの基本 - (2011/04/19 (火) 00:10:42) の編集履歴(バックアップ)


ブロック間の情報は得られない

  • サンプリングレートは各ブロックで指定する必要がある
Gnuradio Tutorialより「GNU Radio cannot guess the correct sampling rate from the context, as it is not part of the information flow between blocks.」
digital_tone.pyより
13         src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl)#ちゃんと各ブロックでsample_rateを指定している
14         src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl)
15         dst = audio.sink (sample_rate, "")
16         self.connect (src0, (dst, 0))
17         self.connect (src1, (dst, 1))

ということはサンプリングレートさえ指定すればブロック間の同期は可能?

ブロックの接尾辞はデータタイプを表す

   * f = float
   * c = complex float
   * i = int
   * s = short int
   * b = bits (actually an integer type)
These suffixes are used for all types of blocks, e.g. gr.fir_filter_ccf() will define an FIR filter with complex input, complex output and float taps, and gr.add_const_ss() will define a block which adds incoming short values with another, constant, short int.

全てのPythonブロックXXXはC++で記述されたgr_make_XXXを呼んでいる。このインターフェースがSwig!

Every block in C++ comes with a creating function, called gr_make_*** (gr_make_sig_source_f() in the example mentioned above). This function is always documented on the same page as the matching class, and this function is what gets exported to Python, so gr.sig_source_f() in Python calls gr_make_sig_source_f() in C++. For the same reason, it takes the same arguments - that's how you know how to initialise a block in Python.