I have a custom C block for which one of the input argument is of a complex
type (real_T, essentially a structure of primitive type). It appears that
the SWIG by default cannot handle any input or output arguments  other than
simple primitive types (int, float, etc.).

I researched a bit and found that the answer is in defining a custom type
for SWIG using %typemap feature.

SWIG offers the %typemap documentation here:
http://www.swig.org/Doc1.3/Typemaps.html but I was wondering if there are
any examples, specifically for GNU-RADIO that I can follow?

For the curious, this is the error I see once the top_block.py is run:

linux; GNU C++ version 5.4.0 20160609; Boost_105800;
UHD_003.010.001.001-79-g7ac01c7f

-- Detected Device: B210
-- Operating over USB 2.
-- Initialize CODEC control...
-- Initialize Radio control...
-- Performing register loopback test... pass
-- Performing register loopback test... pass
-- Performing CODEC loopback test... pass
-- Performing CODEC loopback test... pass
-- Setting master clock rate selection to 'automatic'.
-- Asking for clock rate 16.000000 MHz...
-- Actually got clock rate 16.000000 MHz.
-- Performing timer loopback test... pass
-- Performing timer loopback test... pass
-- Asking for clock rate 50.000000 MHz...
-- Actually got clock rate 50.000000 MHz.
-- Performing timer loopback test... pass
-- Performing timer loopback test... pass
Traceback (most recent call last):
 File "/home/vipin/a1/grc/a1-rfe+mimo/gr-a1System/build/top_block.py",
line 234, in <module>
 main()
 File "/home/vipin/a1/grc/a1-rfe+mimo/gr-a1System/build/top_block.py",
line 222, in main
 tb = top_block_cls()
 File "/home/vipin/a1/grc/a1-rfe+mimo/gr-a1System/build/top_block.py",
line 164, in __init__
 self.a1System_TargetDetector_cf_0 = a1System.TargetDetector_cf(512,
10, 1024, 2, 5, 1, 1, 1, 1)
 File "/usr/local/lib/python2.7/dist-packages/a1System/a1System_swig.py",
line 214, in make
 return _a1System_swig.TargetDetector_cf_make(samps_per_sweep,
num_sweeps, frame_size, rang_max, v_max, rng_nfft, dop_nfft,
num_peaks, num_tgts)
TypeError: in method 'TargetDetector_cf_make', argument 1 of type 'real_T'


Thanks,
Vipin
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to