How to access UHD from within my own OOT block?

Dear all,

In the Companion GUI I use the UHD source- and sink-blocks, together
with my own OOT blocks. Now I want to control the UHD blocks from within
my own blocks, for example changing the center frequency. So in my own
block I would like to write something like:

usrp->set_center_freq(whatever);

I there an easy interface/API available to do this? Or do I have to
download the gr-uhd, modify it (maybe add a method to get a pointer to
the USRP out of it?) and rebuild? Unfortunately I just could not find a
starting point yet.

Regards,

  Jeroen

Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u
niet de geadresseerde bent of dit bericht abusievelijk aan u is
toegezonden, wordt u verzocht dat aan de afzender te melden en het
bericht te verwijderen. TNO aanvaardt geen aansprakelijkheid voor de
inhoud van deze e-mail, de wijze waarop u deze gebruikt en voor schade,
van welke aard ook, die verband houdt met risico’s verbonden aan het
elektronisch verzenden van berichten.

This message may contain information that is not intended for you. If
you are not the addressee or if this message was sent to you by mistake,
you are requested to inform the sender and delete the message. TNO
accepts no liability for the content of this e-mail, for the manner in
which you use it and for damage of any kind resulting from the risks
inherent to the electronic transmission of messages.

Hi Jeroen,

the usrp blocks have public methods to do exactly that. It really looks
like what you’ve proposed :slight_smile:

Not so long ago, Martin added support for doing things like that by
sending messages or stream tags to the block, too.

As you haven’t found a starting point yet: Here’s GNU Radio’s official
API documentation:
http://gnuradio.org/doc/doxygen/
and the gr-uhd blocks are here:
http://gnuradio.org/doc/doxygen/group__uhd__blk.html
http://gnuradio.org/doc/doxygen/namespacegr_1_1uhd.html

Quite straightforward :slight_smile:

Greetings,
Marcus

Regardless of the application, UHD or otherwise, this is not what you
should be doing. Use the message interface for this, it is described on
the
gr-uhd manual page.

M

Two things:

  1. Martin was right, doing this using messages is cleaner!
  2. GRC generates python files when you click the generate button. You
    can change these files to your heart’s delight; most C++ public
    functions are even exported to the encapsulating python class.
    Furthermore, you can write blocks in C++ and python, and you can write
    hierarchical and top_blocks also in C++ and python, so calling public
    functions of blocks is really the easiest thing you will concern
    yourself with when doing GNU Radio development.

The GNU Radio website has new, exciting tutorials, and I encourage you
to go through them. As it seems, the first few tutorials will can be
done quickly with your experience!

Greetings,
Marcus

Hi Jeroen,
here a link where there is an example about how to use UHD class.
http://files.ettus.com/manual/classuhd_1_1usrp_1_1multi__usrp.html
go in section “Detailed description”.
Give me a feedback if you are able to use this class in our own block.
Bests,
Simone

On Wed, 8 Oct 2014 14:01:39 +0000, “Boschma, J.J. (Jeroen)”
[email protected] wrote:

Dear all,

In the Companion GUI I use the UHD source- and sink-blocks, together with
my own OOT blocks. Now I want to control the UHD blocks from within my
own
blocks, for example changing the center frequency. So in my own block I
would like to write something like:

usrp->set_center_freq(whatever);

I there an easy interface/API available to do this? Or do I have to
download the gr-uhd, modify it (maybe add a method to get a pointer to
the
niet de geadresseerde bent of dit bericht abusievelijk aan u is
toegezonden, wordt u verzocht dat aan de afzender te melden en het
bericht