discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] max_streams problem in own module


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] max_streams problem in own module
Date: Wed, 2 Mar 2005 11:27:33 -0800
User-agent: Mutt/1.5.6i

On Wed, Mar 02, 2005 at 10:23:22AM -0500, Charles Clancy wrote:
> I'm trying to write a gnuradio 2.4 module that computes the phase of a 
> complex baseband signal, mostly as a learning excercise in developing a 
> 4-FSK receiver.  (Is there an existing module that could do this for me?)

Yes:  gr.complex_to_arg ()

FYI, there's also:
     gr.complex_to_mag(),
     gr.complex_to_real(),
     gr.complex_to_imag(),
     gr.complex_to_float()

These are all in gnuradio-core/src/lib/general/gr_complex_to_xxx.{h,cc,i}


> I know my installation works, because I've used it for lots of other fun 
> stuff so far.
> 
> I have mypkg.i that defines the package and the mypkg_phase_cf class. 
> Then there are the associated mypkg_phase_cf.[cc|h] files defining the 
> class.  It all compiles properly using the following:
> 
>   CXXFLAGS = -I$(GNURADIO) -I$(GNURADIO)/swig -I$(PYTHON)
>   LDFLAGS = -lgnuradio-core -lcppunit -lm -lrt -lpthread
> 
>   swig -c++ -python $(CXXFLAGS) -module mypkg -o mypkg.cc mypkg.i
>   g++ $(CXXFLAGS) -c mypkg.cc -o mypkg.o
>   g++ $(CXXFLAGS) -c mypkg_phase_cf.cc -o mypkg_phase_cf.o
> 
>   ar rv _mypkg.la mypkg.o mypkg_phase_cf.o
>   ld -shared $(LDFLAGS) -o _mypkg.so -lc mypkg.o mypkg_phase_cf.o
> 
> The constructor for mypkg_phase_cf is:
> 
>   mypkg_phase_cf::mypkg_phase_cf ()
>     : gr_block ( "phase_cf",
>                  gr_make_io_signature (1,1,sizeof(gr_complex)),
>                  gr_make_io_signature (1,1,sizeof(float)) ) {}
> 
> In my script I have:
> 
>   from gnuradio import gr
>   from gnuradio import mypkg
>   ...
>   arctan = mypkg.phase_cf ()
>   fg.connect (baseband, arctan)
>   fg.connect (arctan, sink)
> 
> When I run the script, everything links happily, and I am able to import 
> the package.  However, when I get to "fg.connect (baseband, arctan)", I 
> get the following error:
> 
>   File 
>   "/usr/local/lib/python2.3/site-packages/gnuradio/gr/basic_flow_graph.py",
>   line 180, in _check_port
>     if signature.max_streams () == -1: # infinite
>   AttributeError: 'str' object has no attribute 'max_streams'

The fact that the AttributeError is complaining that a string object ('str')
doesn't have a 'max_streams' attribute is highly suspicious.

Did you follow the examples in gr-howto-write-a-block? 
  http://www.gnu.org/software/gnuradio/doc/howto-write-a-block.html
  ftp://ftp.gnu.org/gnu/gnuradio/gr-howto-write-a-block-0.2.tar.gz

Does the public constructor return a boost shared_ptr version of the pointer?
Does your .i file use GR_SWIG_BLOCK_MAGIC(...)?

Eric




reply via email to

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