Wednesday, August 1, 2018

Re: [Discuss-gnuradio] Calling public C++ function in OOT module using Python --GRC testcase created

Hi Edwin - You're welcome for the compatibility notes. Your changes work for me out of the box now, so: well done & keep it up!

OK so a few things:

(1) when I execute the GRC script you mention (as checked into your repo), I see the following:
{{{
Generating: '/Users/mlk/Desktop/TMP/gr-chaos/chaotic_prefix_generator_template.py'
>>> Warning: This flow graph may not have flow control: no audio or RF hardware blocks found. Add a Misc->Throttle block to your flow graph to avoid CPU congestion.

Executing: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u /Users/mlk/Desktop/TMP/gr-chaos/chaotic_prefix_generator_template.py

Traceback (most recent call last):
  File "/Users/mlk/Desktop/TMP/gr-chaos/chaotic_prefix_generator_template.py", line 218, in <module>
    main()
  File "/Users/mlk/Desktop/TMP/gr-chaos/chaotic_prefix_generator_template.py", line 206, in main
    tb = top_block_cls(Init=options.Init, Map_parameter=options.Map_parameter, spreading_gain=options.spreading_gain, sps=options.sps)
  File "/Users/mlk/Desktop/TMP/gr-chaos/chaotic_prefix_generator_template.py", line 87, in __init__
    self.blocks_vector_source_x_0 = blocks.vector_source_c(chaos.chaotic_prefix_bc(0.8,3.98,50,'len_tag_key'), False, 1, [])
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gnuradio/blocks/blocks_swig1.py", line 1531, in make
    return _blocks_swig1.vector_source_c_make(*args, **kwargs)
TypeError: in method 'vector_source_c_make', argument 1 of type 'std::vector< gr_complex,std::allocator< gr_complex > > const &'
}}}

which doesn't have the issue you're having ... but, this leads to the next item:

(2) The method "chaotic_prefix_bc_impl::Logistic_map" returns as "std::vector<float>", while in your GRC script you've made the vector source and file sink both complex ... correcting that helps but doesn't solve the issue because ...

(3) "chaotic_prefix_bc_impl::Logistic_map" is a method in a class, not a function; it is meant to be called from some instantiation of the class, not directly like a function as you're doing in the GRC script. You can make it a static function inside the class & then what you're doing might work; might take some special SWIG sauce to get working.

Hope this is useful. - MLD

On Wed, Aug 1, 2018, at 3:40 PM, Edwin Li wrote:
Hi Michael,

Wow! Thanks for pointing out the compatibility issue in my DCSK block. I will modify that according to your suggestion. 
I added  chaotic_prefix_generator_template.grc to my repository. I use it to test.
Inside there is a vector source. I tried to set the data as the output of Logistic_map(). You will see an error: 'chaotic_prefix_bc_sptr' object has no attribute 'Logistic_Map'

Regards,
Edwin



On Wed, 1 Aug 2018 at 12:59 Michael Dickens <michael.dickens@ettus.com> wrote:
Hi Edwin - Is there a test or example in your repo that's failing? I have built it successfully; "make test" fails for a couple reasons but not for the specific issue you're having. I don't see any specific use of the method you're having issues with; hence my query. - MLD

On Wed, Aug 1, 2018, at 2:22 PM, edwin wrote:
> Hi Michael,
>
> Thank you so much for your reply.
>
> I did add the method after building SWIG for the first time. And I have
> tried "make clean" in  build/ and make again. I even tried deleting the
> entire build/ folder and CMake. Still the same problem.
>
> I created a repository if you want to have a look.
>
> Or you can tell me where to look to see whether the SWIG has made
> corresponding changes.
>
> Regards,
>
> Edwin
>
>
>

No comments:

Post a Comment