|
From: | Pranav Padalkar |
Subject: | Re: [Discuss-gnuradio] Using GRC generated python code inside a C++ code |
Date: | Tue, 30 Aug 2016 08:30:41 +0000 |
Hi, thanks for your help.
I managed to do it by creating an OOT module. I implemented my client C++ code in the block impl.cc file and also added my other source files. I had some problems in that area, but then I managed to solve it, as I discussed in another thread. I implemented messaging passing, created a message output port in my block and used the control port of the UHD:USRP sink block. It works like a charm. With just a couple of commands from my server, I can now control the USRP which is at the client side, using TCP.
Thanks a lot again.
Regards,
Pranav Padalkar
Fraunhofer-Institut für Eingebettete Systeme und Kommunikationstechnik ESK
From: Discuss-gnuradio <discuss-gnuradio-bounces+address@hidden> on behalf of Pranav Padalkar <address@hidden>
Sent: Monday, August 22, 2016 9:48 AM To: Marcus Müller; address@hidden Subject: Re: [Discuss-gnuradio] Using GRC generated python code inside a C++ code Thanks a lot Marcus,
Thanks for pointing me towards feval and message passing. We have decided to implement an OOT module, which will then control some of the blocks from the flowgraph. Message passing will definitely come handy. I will let you know how it works.
Regards, Pranav. From: Discuss-gnuradio <discuss-gnuradio-bounces+address@hidden> on behalf of Marcus Müller <address@hidden>
Sent: Friday, August 19, 2016 3:21 PM To: address@hidden Subject: Re: [Discuss-gnuradio] Using GRC generated python code inside a C++ code have a look at the feval class [1]; it's a way to call python code from C++ land, and vice versa.
Be very careful about multithreading – all the GNU Radio blocks run in their own thread, so does the GNU Radio scheduler, and just executing python while python is executing might have interesting effects!
My approach would probably be to write a Python sync block with 0 in and 0 stream outputs, and connect that to the blocks you want to control with message passing as far as possible (UHD source has a command message interface, so this would work nicely),
and call the python top_block's set_variable() methods only when impossible to avoid. In fact, things can be pretty easy: The ZeroMQ message sources can accept zeromq messages, and you could directly connect them to the message control ports of the blocks,
so no need to write your own GNU Radio blocks at all; just use #include <pmt/pmt.h>/pmt::pmt_t and ZeroMQ in your C++ code to send messages directly across network/IPC/intra-process queues to your Flow graph.
Best regards, Marcus
[1]
http://gnuradio.org/doc/doxygen/classgr_1_1feval.html On 19.08.2016 14:07, Pranav Padalkar wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |