TypeError for gr_vector_float arg

Trying to get my OOT block to accept a vector of floats for filter taps.
I used a couple in-tree blocks (mostly ofdm_carier_allocator and
fir_interpolator) for a quick reference. And I have fir interp/decim in
my flowgraph and they have no issues at runtime. The flowgraph ran fine
with my OOT block before I decided to try adding support for modifying
the filter taps from GRC.

Now I am getting the following runtime error when starting the flowgraph
in GRC:

Traceback (most recent call last):
File “/usr/local/share/gnuradio-InTree-modules/ofdm_tx_rx.py”, line
518, in
tb = ofdm_tx_rx()
File “/usr/local/share/gnuradio-InTree-modules/ofdm_tx_rx.py”, line
314, in init
self.comso_ofdm_rx_0 = comso.ofdm_rx((sync_taps), nfft, ncp, nrp,
nhst, thr, sel)
File “/usr/local/lib64/python2.7/site-packages/comso/comso_swig.py”,
line 398, in make
return _comso_swig.ofdm_rx_make(*args, **kwargs)
TypeError: in method ‘ofdm_rx_make’, argument 1 of type ‘gr_vector_float
const &’

It is really hard to find similar errors on the web, but there are a
couple. None exact and not many where a solution is indicated. However,
it seems likely that SWIG has a problem of some sort converting a tuple
of floats in python (which is typically what the taps for filters look
like that I have seen so far) to a vector in C++. Or, rather, it
has a problem unless you take the required steps. I think there is the
the equivalent of an include missing in SWIG? Something dot i with some
syntax? I am brand new to SWIG and python.

I tried to add this capability to an existing OOT block of mine with a
ton of existing code and did not want to start over with gr_modtool
which perhaps would have built the SWIG interfaces properly if it had
known there would be a vector parameter involved. But that is probably
what I will try next, just have to save off and paste stuff back in. I
don’t know, I am guessing that may be the case and the reason why this
is such a rarely found error.

But does anyone know what I need to do in order to make this run?

On Tue, 5 Aug 2014 17:08:31 -0400
John M. [email protected] wrote:

Trying to get my OOT block to accept a vector of floats for filter taps.
Traceback (most recent call last):
File “/usr/local/share/gnuradio-InTree-modules/ofdm_tx_rx.py”, line 518, in

tb = ofdm_tx_rx()
File “/usr/local/share/gnuradio-InTree-modules/ofdm_tx_rx.py”, line 314, in
init
self.comso_ofdm_rx_0 = comso.ofdm_rx((sync_taps), nfft, ncp, nrp, nhst, thr,
sel)
File “/usr/local/lib64/python2.7/site-packages/comso/comso_swig.py”, line 398,
in make
return _comso_swig.ofdm_rx_make(*args, **kwargs)
TypeError: in method ‘ofdm_rx_make’, argument 1 of type ‘gr_vector_float const
&’

Heh… well… I tried again changing gr_vector_float to
std::vector and that fixed this problem.
Now, I did that a couple times before, but apparently it must have been
when I still had some other issues.
Still… seems odd that a typedef prevents SWIG from making this
connection.
And maybe I am still missing some header in the SWIG for gr_vector_* but
it works for a normal C++ vector.

But for now this is resolved and moving on.

On Wed, Aug 6, 2014 at 1:54 PM, John M. [email protected]
wrote:

nhst, thr, sel)
Still… seems odd that a typedef prevents SWIG from making this
connection.
And maybe I am still missing some header in the SWIG for gr_vector_* but
it works for a normal C++ vector.

But for now this is resolved and moving on.

Yes, it can be tricky properly exporting some typedefs through swig.
Also,
though, we try not to use more typedefs than we really have to. Most of
them, in fact, are slated for removal in version 3.8 and we’ll only be
keeping the oft-used ones (like gr_complex and the ones used in work
functions).

Tom