[Discuss-gnuradio] Convert Float to PMT in a Gnuradio flowgraph

2017-06-27 Thread Cristian Rodríguez
Hi all.

I'm implementing this flowgraph.

[image: Imágenes integradas 1]

I want to calculate the power in the antenna, which is set as float and
later convert it to a PMT type. I don't know if it is possible.

I tried to build the above flowgraph, My idea was to convert the float type
to a tagged stream and later it in PMT type. Though the flowgraph can do
that, it is not working as I expected.

What blocks could you recommend me to do this conversion?

In C++ word i want to:

float x=output_of_Moving average.
pmt::cons(pmt::PMT_NIL, pmt::from_float(x))


Thanks a lot.

Best regards,

Cristian
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Problem with Gnuradio git?

2017-06-27 Thread John Ackermann N8UR
Marcus, I'm sorry but I can't find the git for build-gnuradio -- can you 
give a URL?  The links at the top of the script point to repos that 
don't seem to contain the script (and haven't been updated in a long while).


Thanks!
John


On 06/23/2017 05:34 PM, Marcus D. Leech wrote:

That change has been made to the build-gnuradio git repo

Sent from my iPhone


On Jun 23, 2017, at 5:29 PM, John Ackermann N8UR  wrote:

For at least the last couple of days, the build-gnuradio script has been failing almost 
immediately after it starts fetching, claiming that it "could not find 
gnuradio/gnuradio-[core,runtime] after GIT checkout."

I changed the URL in the script from git.gnuradio.org to github.org and that 
worked fine.

Has something in the gnuradio git changed that requires build-gnuradio to be 
patched, or is this a temporary problem?

Thanks,
John

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] Interpolating FIR filter with runtime adjustable interpolation value

2017-06-27 Thread Joe K
Hi all,

How can I adjust the interpolation of an interpolating FIR filter in real
time (e.g., interp_fir_filter_fff)?  I'm not a C++ guru but it appears to
me that the base class, sync_interpolator, does define a function
set_interpolation().  It seems that I should be able to call that, then
call set_taps(), which would regenerate everything with the new
interpolation value.

I've tried to call set_interpolation() via Python but it is not supported,
or at least is not exposed through the SWIG interface.

I noticed that the GRC wrappers for the filters don't include callbacks on
the interpolation value.  Is there some reason to NOT being able to change
the interpolation on the fly?  It seems that most blocks actually don't
support it, e.g., the pfb_interpolator_ccf does not either, as far as I can
tell.

In reality my interpolating filter is part of a Python-based hierarchical
block, which is based off of the gmsk_mod in gr-digital.  I'm essentially
trying to decouple my symbol rate from the hardware sample rate by
adjusting the modulator's samples/symbol factor in real time.  I tried
using lock/disconnect/create new filter/connect/unlock but I randomly get
hangs on the unlock step.  When it does get past unlocking the output is as
expected.

I remembered a bug report about unlock hanging, which was supposedly
fixed.  Is it legit to lock/etc/unlock within a hierarchical block?  Is it
a known problem for it to hang on unlock() within a hierarchical block?
This is GR 3.7.11.

Thanks,
Joe
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Rational Resampler no output.

2017-06-27 Thread Cor Legemaat
Hi Marcus:

Not working, don't have time to debug now, will look at it this
weekend.

But the bug got triggered at i == ntaps - 1 and not i == 0?

Regards:
Cor

On Tue, 2017-06-27 at 12:03 +0200, Marcus Müller wrote:
> 
> Hi Cor,
> hopefully, I have a fix: Could you try
> git pull https://github.com/marcusmueller/gnuradio
>   window_fix_floating_point_math 
> 
> 
> (or, alternatively, attached patch, cd gnuradio; git apply
> /path/to/patchfile.patch )
> 
> 
> 
> Thank you!!
> 
> 
> 
> Marcus
> 
> 
> 
>   On 27.06.2017 07:09, Cor Legemaat wrote:
> 
> 
> 
> >   
> >   https://github.com/gnuradio/gnuradio/issues/1348
> > 
> >   
> > 
> >   
> > 
> >   Regards:
> > 
> >   Cor
> > 
> >   
> > 
> >   
> > 
> >   On Mon, 2017-06-26 at 14:11 +0200, Marcus Müller wrote:
> > 
> > > > > > That's mightily interesting! I feel like we should be
doing
> > >   bug reports, but I'm not sure where.
> > > 
> > > 
> > > 
> > > 
> > > On 26.06.2017 06:42, Cor Legemaat
> > >   wrote:
> > > 
> > > 
> > > 
> > > >   Found it:
> > > > 
> > > >   
> > > > 
> > > >   
> > > > 
> > > >   Created an C++ app that called that function with the
> > > > > > > > same parameter values as with python for this flow
graph.
> > > > Witch I was able to debug normally.
> > > > 
> > > >   
> > > > 
> > > >   
> > > > 
> > > >   In window.cc line 265, with i = ntaps - 1, temp =
> > > > > > > > 1.002 that cause sqrt (0) witch
return
> > > > > > > > "-nan" on the next line and screw all the rest of
the
> > > > calculations.
> > > > 
> > > >   
> > > > 
> > > >   
> > > > 
> > > >   This only happens when compiled with
> > > > > > > > "CFLAGS=-march=native -O2", if I don't specify the
march
> > > > > > > > it's working correctly. The function is called on
my system
> > > > with taps=787 and beta = 7.
> > > > 
> > > >   
> > > > 
> > > >   
> > > > 
> > > >   Regards:
> > > > 
> > > >   Cor
> > > > 
> > > >   
> > > > 
> > > >   
> > > > 
> > > > > > > >   On Wed, 2017-06-21 at 15:13 +0200, Cor Legemaat
wrote:
> > > > 
> > > > > Hi:
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Sorry for the late replay... The intel pc call
> > > > > > > > > >   filter.firdes.low_pass with the same values 
> > > > > > > > > > but
return 768
> > > > > > > > > >   proper float values, not like the 's on
the AMD
> > > > >   pc.
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > > > > > > Tried to debug with "nemiver /usr/bin/python2.7
-u
> > > > >   /fm_receiver.py" and the breakpoint at
> > > > > > > > > >   firdes.cc line 100 witch get triggered and I
can read the
> > > > > > > > > >   function parameters but when I try to step 
> > > > > > > > > > true
the
> > > > > > > > > >   function it jumps to the assembly of pthread.
If I put
> > > > > > > > > >   more breakpoints in firdes.cc I get back to 
> > > > > > > > > > the
function
> > > > > > > > > >   but cant read any variables any more. Also
tried exporting
> > > > > > > > > >   "export GR_SCHEDULER=STS" but the same
symptoms.
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > > > > > > Don't know if Ubuntu will trigger the bug it's
probably
> > > > >   compiled more generic...
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Regards:
> > > > > 
> > > > > Cor
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > > > > > > On Wed, 2017-06-07 at 04:26 -0400, Anon Lister
wrote:
> > > > > 
> > > > > >   
> > > > > > > > > > > > I have an AMD system with the same chip
running
> > > > > > > > > > > >   Ubuntu 16.xx. I can probably try to
duplicate this
> > > > > > > > > > > >   weekend, if Cor doesn't get to it, as
another data
> > > > > >   point. 
> > > > > > 
> > > > > > 
> > > > > >   
> > > > > > 
> > > > > > On Jun 5, 2017 3:14 PM,
> > > > > > > > > > > >   "Marcus Müller" 
> > > > > > > > > > > > 
> > > > > >   wrote:
> > > > > > 
> > > > > >   
> > > > > > 
> > > > > >   Hi Cor,
> > > > > > 
> > > > > >   
> > > > > > > > > > > >  

Re: [Discuss-gnuradio] Tracking Number of Input Items

2017-06-27 Thread Marcus Müller
Hm, to my knowledge, no there's no block like that yet.

However: Should be easy! Just use ninput_items_read(0) to query how many
items have been consumed so far by the block. I'd recommend writing a
sink and putting it parallel to the end of the processing chain of
interest. That way, you can avoid having to "pass through" samples by
copying.

Best regards,

Marcus


On 27.06.2017 14:33, Tellrell White wrote:
> Hello
> I want to know is there a way or even a block that already exists that
> will allow you to send a message(pdu) after receiving a certain amount
> of input items?? Any info would be great.
>
> Thanks
> Tellrell
>
>
> ___
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] Tracking Number of Input Items

2017-06-27 Thread Tellrell White
Hello
I want to know is there a way or even a block that already exists that will
allow you to send a message(pdu) after receiving a certain amount of input
items?? Any info would be great.

Thanks
Tellrell
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Read and Write a PMT input/output GNURadio C++

2017-06-27 Thread Marcus Müller
Hi Cristian,

>How can I take just the real number of that pair?

pmt::car and pmt::cdr give you the first and second element of a pmt::cons.

> do you have a reference page of the command?

https://gnuradio.org/doc/doxygen/namespacepmt.html#a7ab95721db5cbda1852f13a92eee5362

I must admit that I find PMT not the best-documented piece of software
myself.

> I understood that I need to send the pair. Is it possible to send just
> the real number?
As said, you can send /any/ PMT – it's just customary to follow a few
common patterns. But sure, you can just as well just send
pmt::from_double(your_double).

Best regards,
Marcus


On 27.06.2017 14:16, Cristian Rodríguez wrote:
> Hi Marcus.
>
> Thanks for your message.
>
> How can I take just the real number of that pair? do you have a
> reference page of the command?
> I was reading a lot yesterday and my search wasn't well.
>
> I understood that I need to send the pair. Is it possible to send just
> the real number?
>
> Again, thanks a lot for your time.
>
> Best regards,
>
> Cristian
>
> On Jun 27, 2017 3:48 AM, "Marcus Müller"  > wrote:
>
> You're explicitly sending a pair (pmt::cons), not a real or
> integer number!
>
>
> On 27.06.2017 04:57, Cristian Rodríguez wrote:
>> Hi.
>>
>> Thanks a lot for your time to read.
>>
>> I read the two links that you shared to me, Marcus. Thanks a lot
>> for your help. But i still have a problem.
>>
>> I've implemented as follows:
>>
>>   * I create, the output, input and the handler:
>>
>> message_port_register_out(pmt::mp("out_threshold"));
>>
>> message_port_register_in(pmt::mp("in_threshold"));
>> set_msg_handler(pmt::mp("in_threshold"),
>> boost::bind(_short_impl::set_msg, this, _1));
>>
>>   * I create, the next function to handle the inputs
>>
>> void set_msg(pmt::pmt_t msg) { d_msg= msg;
>> dout << "Nueva lectura : " << d_msg << " ninput: " <<
>> std::endl;
>> if (pmt::is_integer(d_msg)) {
>> d_threshold = (double) pmt::to_long(d_msg);
>> } else if (pmt::is_real(d_msg)) {
>> d_threshold = pmt::to_double(d_msg);
>> } else {
>>  // We really expected an integer or a double here, so we don't
>> know what to do
>> throw std::runtime_error("expected an integer!");
>> }
>>
>>  }
>>
>>   * In the block i linked the input and the output, just to check
>> that the function set_msg(), works.
>>
>>
>> Imágenes integradas 3
>>
>>   * I compile the c++ codes, etc... all that is necessary.
>>   * I write the output as follows (that's working, i checked that
>> with a message debug):
>>
>> message_port_pub(pmt::mp("out_threshold"),
>> pmt::cons(pmt::PMT_NIL, pmt::from_double(d_threshold)));
>>
>>   * When i start the flowgraph, the block put in the output a PMT
>> message, after that, as it is linked with the input, the
>> message go to the input port. When it is recevied, the
>> function set_msg is launched, but the type of the number in
>> the PMT is not recognized as double. *Here is my problem, I
>> don't understand why it is happening, because the PMT that I
>> put in the output is build from a double, then it is
>> supposed, the one that i received is too a double. What do
>> you think?*
>>
>> Imágenes integradas 2
>>
>>
>> Thanks in advance.
>>
>>
>> Best regards,
>>
>>
>> Cristian
>>
>> 2017-06-26 12:45 GMT-05:00 Marcus Müller
>> >:
>>
>> Hi Cristian,
>>
>> you need to subscribe a /handler/ to the message port. See:
>>
>> 
>> https://wiki.gnuradio.org/index.php/Guided_Tutorial_Programming_Topics#5.3.2_Adding_Message_Passing_to_the_Code
>> 
>> 
>>
>> It's absolutely up to you what kind of PMT you're publishing
>> over a message port, but it's canonical to have a PMT dict
>> that maps
>>
>> pmt::mp("propertyname") -> pmt::whateversuitsyourproperty.
>>
>> As an example, see what the gr-uhd blocks accept [1]
>>
>> Best regards,
>>
>> Marcus
>>
>> [1]
>> https://gnuradio.org/doc/doxygen/page_uhd.html#uhd_command_syntax
>> 
>>
>> On 06/26/2017 07:35 PM, Cristian Rodríguez wrote:
>>> Hi all,
>>>
>>> I'm not sure about how to read and write PMT ports from and
>>> to local variables. I'm going to expose what i'm doing, and
>>> if someone can help me i would be very greatful.
>>>
>>> I've created an input and an output of PMT type.
>>>
>>> message_port_register_in(pmt::pmt_t in_threshold)
>>> 

Re: [Discuss-gnuradio] Read and Write a PMT input/output GNURadio C++

2017-06-27 Thread Cristian Rodríguez
Hi Marcus.

Thanks for your message.

How can I take just the real number of that pair? do you have a reference
page of the command?
I was reading a lot yesterday and my search wasn't well.

I understood that I need to send the pair. Is it possible to send just the
real number?

Again, thanks a lot for your time.

Best regards,

Cristian

On Jun 27, 2017 3:48 AM, "Marcus Müller"  wrote:

You're explicitly sending a pair (pmt::cons), not a real or integer number!

On 27.06.2017 04:57, Cristian Rodríguez wrote:

Hi.

Thanks a lot for your time to read.

I read the two links that you shared to me, Marcus. Thanks a lot for your
help. But i still have a problem.

I've implemented as follows:

   - I create, the output, input and the handler:

message_port_register_out(pmt::mp("out_threshold"));

message_port_register_in(pmt::mp("in_threshold"));
set_msg_handler(pmt::mp("in_threshold"),
boost::bind(_short_impl::set_msg,
this, _1));

   - I create, the next function to handle the inputs

void set_msg(pmt::pmt_t msg) { d_msg= msg;
dout << "Nueva lectura : " << d_msg << " ninput: " << std::endl;
if (pmt::is_integer(d_msg)) {
d_threshold = (double) pmt::to_long(d_msg);
} else if (pmt::is_real(d_msg)) {
d_threshold = pmt::to_double(d_msg);
} else {
 // We really expected an integer or a double here, so we don't know what
to do
throw std::runtime_error("expected an integer!");
}

 }

   - In the block i linked the input and the output, just to check that the
   function set_msg(), works.


[image: Imágenes integradas 3]

   - I compile the c++ codes, etc... all that is necessary.
   - I write the output as follows (that's working, i checked that with a
   message debug):

message_port_pub(pmt::mp("out_threshold"), pmt::cons(pmt::PMT_NIL,
pmt::from_double(d_threshold)));

   - When i start the flowgraph, the block put in the output a PMT message,
   after that, as it is linked with the input, the message go to the input
   port. When it is recevied, the function set_msg is launched, but the type
   of the number in the PMT is not recognized as double. *Here is my
   problem, I don't understand why it is happening, because the PMT that I put
   in the output is build from a double, then it is supposed, the one that i
   received is too a double. What do you think?*

[image: Imágenes integradas 2]


Thanks in advance.


Best regards,


Cristian
2017-06-26 12:45 GMT-05:00 Marcus Müller :

> Hi Cristian,
>
> you need to subscribe a *handler* to the message port. See:
>
> https://wiki.gnuradio.org/index.php/Guided_Tutorial_Programm
> ing_Topics#5.3.2_Adding_Message_Passing_to_the_Code
>
> It's absolutely up to you what kind of PMT you're publishing over a
> message port, but it's canonical to have a PMT dict that maps
>
> pmt::mp("propertyname") -> pmt::whateversuitsyourproperty.
>
> As an example, see what the gr-uhd blocks accept [1]
>
> Best regards,
>
> Marcus
>
> [1] https://gnuradio.org/doc/doxygen/page_uhd.html#uhd_command_syntax
> On 06/26/2017 07:35 PM, Cristian Rodríguez wrote:
>
> Hi all,
>
> I'm not sure about how to read and write PMT ports from and to local
> variables. I'm going to expose what i'm doing, and if someone can help me i
> would be very greatful.
>
> I've created an input and an output of PMT type.
>
> message_port_register_in(pmt::pmt_t in_threshold)
> message_port_register_out(pmt::pmt_t out_threshold)
>
> Now i want to read the port, and save the data in a local variable, do
> operations with that variable, and later write it in the output,
>
> I create the variables,
>
> double d_threshold;
> pmt::pmt_t target;
>
>
>
> *I read it, I don't know how to do it. But I suppose: *
> message_port_sub(pmt::pmt_t
> 
> in_threshold,pmt::pmt_t
> 
> target);
> d_threshold= pmt::to_double
> 
> (target);
>
> And, I think i can write it as follows:
>
> msg=pmt::from_double
> 
> (d_threshold);
> message_port_pub(pmt::pmt_t
> 
> out_threshold,pmt::pmt_t
> 
> msg);
>
> What do you think, i've seen several examples, and they do this,
> message_port_pub(pmt::mp("symbols"), pmt::cons(pmt::make_dict(),
> pmt::init_c32vector(48, symbols)));
>
> But I don't understand why it is necessary to use pmt::make_dict().
>
> Thanks in advance.
>
> Best regards,
>
> Cristian
>
>
>
> ___
> Discuss-gnuradio mailing 
> 

Re: [Discuss-gnuradio] Rational Resampler no output.

2017-06-27 Thread Marcus Müller
Hi Cor,

hopefully, I have a fix: Could you try

git pull https://github.com/marcusmueller/gnuradio
window_fix_floating_point_math

(or, alternatively, attached patch, cd gnuradio; git apply
/path/to/patchfile.patch )

Thank you!!

Marcus

On 27.06.2017 07:09, Cor Legemaat wrote:
> https://github.com/gnuradio/gnuradio/issues/1348
>
> Regards:
> Cor
>
> On Mon, 2017-06-26 at 14:11 +0200, Marcus Müller wrote:
>>
>> That's mightily interesting! I feel like we should be doing bug
>> reports, but I'm not sure where.
>>
>>
>> On 26.06.2017 06:42, Cor Legemaat wrote:
>>> Found it:
>>>
>>> Created an C++ app that called that function with the same parameter
>>> values as with python for this flow graph. Witch I was able to debug
>>> normally.
>>>
>>> In window.cc line 265, with i = ntaps - 1, temp =
>>> 1.002 that cause sqrt (0) witch return "-nan" on the
>>> next line and screw all the rest of the calculations.
>>>
>>> This only happens when compiled with "CFLAGS=-march=native -O2", if
>>> I don't specify the march it's working correctly. The function is
>>> called on my system with taps=787 and beta = 7.
>>>
>>> Regards:
>>> Cor
>>>
>>> On Wed, 2017-06-21 at 15:13 +0200, Cor Legemaat wrote:
 Hi:

 Sorry for the late replay... The intel pc call
 filter.firdes.low_pass with the same values but return 768 proper
 float values, not like the 's on the AMD pc.

 Tried to debug with "nemiver /usr/bin/python2.7 -u
 /fm_receiver.py" and the breakpoint at firdes.cc line 100
 witch get triggered and I can read the function parameters but when
 I try to step true the function it jumps to the assembly of
 pthread. If I put more breakpoints in firdes.cc I get back to the
 function but cant read any variables any more. Also tried exporting
 "export GR_SCHEDULER=STS" but the same symptoms.

 Don't know if Ubuntu will trigger the bug it's probably compiled
 more generic...

 Regards:
 Cor

 On Wed, 2017-06-07 at 04:26 -0400, Anon Lister wrote:
> I have an AMD system with the same chip running Ubuntu 16.xx. I
> can probably try to duplicate this weekend, if Cor doesn't get to
> it, as another data point. 
>
> On Jun 5, 2017 3:14 PM, "Marcus Müller"  > wrote:
>
> Hi Cor,
>
> Excuse the language, but frk. Ok, looks like we have a bug
> in low_pass. Or in GCC. Or SWIG (which does the
> python-wrapping of the code in firdes.cc). yay.
>
> So, let's narrow this down: on intel and amd64, same number of
> taps, right?
>
> Then: If I asked you to use GDB to verify the C++ low_pass
> function in gr::filter::firdes::low_pass actually returned the
> right float values, would you feel that, with a few hints, be
> able to do that?
>
> Best regards,
>
> Marcus
>
>
> On 01.06.2017 07:20, Cor Legemaat wrote:
>> Hi:
>>
>> filter.firdes.low_pass get called with:
>>  * fractional_bw = 0.4
>>  * trans_width = 0.1
>>  * mid_transition_band = 0.45
>>  * interpolation = 24
>>
>> But return: (nan, <788 times nan>)
>>
>> Regards:
>> Cor
>>
>> On Tue, 2017-05-30 at 00:06 +0200, Marcus Müller wrote:
>>> Hi Cor,
  * When using 1 as "taps" there is output.
>>>  Aha!!
>>> So, here's the thing: something might be going wrong in the python
>>> code that sets up the taps automatically if you don't set them
>>> explicitly. 
>>> Maybe you can figure out where things go wrong; the interesting part
>>> (maybe add some `print`s here?) from [1]:
>>>
>>> # If we don't have user-provided taps, reduce the interp and
>>> # decim values by the GCD (if there is one) and then define
>>> # the taps from these new values.
>>> if taps is None:
>>> interpolation = interpolation // d
>>> decimation = decimation // d
>>> taps = design_filter(interpolation, decimation,
>>> fractional_bw)
>>>
>>> and
>>>
>>>
>>> def design_filter(interpolation, decimation, fractional_bw):
>>> """
>>> Given the interpolation rate, decimation rate and a fractional
>>> bandwidth,
>>> design a set of taps.
>>>
>>> Args:
>>> interpolation: interpolation factor (integer > 0)
>>> decimation: decimation factor (integer > 0)
>>> fractional_bw: fractional bandwidth in (0, 0.5)  0.4 works
>>> well. (float)
>>> Returns:
>>> : sequence of numbers
>>> """
>>>
>>> if fractional_bw >= 0.5 or fractional_bw 

Re: [Discuss-gnuradio] Read and Write a PMT input/output GNURadio C++

2017-06-27 Thread Marcus Müller
You're explicitly sending a pair (pmt::cons), not a real or integer number!


On 27.06.2017 04:57, Cristian Rodríguez wrote:
> Hi.
>
> Thanks a lot for your time to read.
>
> I read the two links that you shared to me, Marcus. Thanks a lot for
> your help. But i still have a problem.
>
> I've implemented as follows:
>
>   * I create, the output, input and the handler:
>
> message_port_register_out(pmt::mp("out_threshold"));
>
> message_port_register_in(pmt::mp("in_threshold"));
> set_msg_handler(pmt::mp("in_threshold"),
> boost::bind(_short_impl::set_msg, this, _1));
>
>   * I create, the next function to handle the inputs
>
> void set_msg(pmt::pmt_t msg) { d_msg= msg;
> dout << "Nueva lectura : " << d_msg << " ninput: " << std::endl;
> if (pmt::is_integer(d_msg)) {
> d_threshold = (double) pmt::to_long(d_msg);
> } else if (pmt::is_real(d_msg)) {
> d_threshold = pmt::to_double(d_msg);
> } else {
>  // We really expected an integer or a double here, so we don't know
> what to do
> throw std::runtime_error("expected an integer!");
> }
>
>  }
>
>   * In the block i linked the input and the output, just to check that
> the function set_msg(), works.
>
>
> Imágenes integradas 3
>
>   * I compile the c++ codes, etc... all that is necessary.
>   * I write the output as follows (that's working, i checked that with
> a message debug):
>
> message_port_pub(pmt::mp("out_threshold"), pmt::cons(pmt::PMT_NIL,
> pmt::from_double(d_threshold)));
>
>   * When i start the flowgraph, the block put in the output a PMT
> message, after that, as it is linked with the input, the message
> go to the input port. When it is recevied, the function set_msg is
> launched, but the type of the number in the PMT is not recognized
> as double. *Here is my problem, I don't understand why it is
> happening, because the PMT that I put in the output is build from
> a double, then it is supposed, the one that i received is too a
> double. What do you think?*
>
> Imágenes integradas 2
>
>
> Thanks in advance.
>
>
> Best regards,
>
>
> Cristian
>
> 2017-06-26 12:45 GMT-05:00 Marcus Müller  >:
>
> Hi Cristian,
>
> you need to subscribe a /handler/ to the message port. See:
>
> 
> https://wiki.gnuradio.org/index.php/Guided_Tutorial_Programming_Topics#5.3.2_Adding_Message_Passing_to_the_Code
> 
> 
>
> It's absolutely up to you what kind of PMT you're publishing over
> a message port, but it's canonical to have a PMT dict that maps
>
> pmt::mp("propertyname") -> pmt::whateversuitsyourproperty.
>
> As an example, see what the gr-uhd blocks accept [1]
>
> Best regards,
>
> Marcus
>
> [1]
> https://gnuradio.org/doc/doxygen/page_uhd.html#uhd_command_syntax
> 
>
> On 06/26/2017 07:35 PM, Cristian Rodríguez wrote:
>> Hi all,
>>
>> I'm not sure about how to read and write PMT ports from and to
>> local variables. I'm going to expose what i'm doing, and if
>> someone can help me i would be very greatful.
>>
>> I've created an input and an output of PMT type.
>>
>> message_port_register_in(pmt::pmt_t in_threshold)
>> message_port_register_out(pmt::pmt_t out_threshold)
>>
>> Now i want to read the port, and save the data in a local
>> variable, do operations with that variable, and later write it in
>> the output,
>>
>> I create the variables,
>>
>> double d_threshold;
>> pmt::pmt_t target;
>>
>> *I read it, I don't know how to do it. But I suppose:
>>
>> *
>> message_port_sub(pmt::pmt_t
>> 
>> 
>> in_threshold,pmt::pmt_t
>> 
>> 
>> target);
>> d_threshold= pmt::to_double
>> 
>> (target);
>>
>> And, I think i can write it as follows:
>>
>> msg=pmt::from_double
>> 
>> (d_threshold);
>> message_port_pub(pmt::pmt_t
>> 
>> 
>> out_threshold,pmt::pmt_t
>> 
>> 
>> msg);
>>
>> What do you think, i've seen several examples, and they do this,
>> message_port_pub(pmt::mp("symbols"), pmt::cons(pmt::make_dict(),
>> pmt::init_c32vector(48, symbols)));
>>   
>> But I don't understand why it is necessary to use pmt::make_dict().
>>
>> Thanks in advance.
>>
>> 

Re: [Discuss-gnuradio] Undefined reference gr::blocks::count_bits8

2017-06-27 Thread Antonis Tzougkarakis

Hello Ron,

Thank you very much for your response. The solution you provided 
actually solve my problem.


Thanks
Antonis


On 06/27/2017 01:00 AM, Ron Economos wrote:


You have to add BLOCKS in addition to RUNTIME. That is, change the 
existing line:


set(GR_REQUIRED_COMPONENTS RUNTIME)

to:

set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS)

Ron


On 06/26/2017 02:46 PM, Antonis Tzougkarakis wrote:


Hello Marcus,

I have added this in my main cmake: set(GR_REQUIRED_COMPONENTS 
BLOCKS). Although, when I tried to compile it I got the following 
message:


Swig source
/home/tzugarak/git/gr-ieee802_15_4g_testing/swig/ieee802_15_4g_testing_swig.i:5: 
Error: Unable to find 'gnuradio.i'
swig/CMakeFiles/ieee802_15_4g_testing_swig_swig_2d0df.dir/build.make:114: 
recipe for target 'swig/ieee802_15_4g_testing_swig_swig_2d0df' failed

make[2]: *** [swig/ieee802_15_4g_testing_swig_swig_2d0df] Error 1
make[2]: *** Deleting file 'swig/ieee802_15_4g_testing_swig_swig_2d0df'
CMakeFiles/Makefile2:345: recipe for target 
'swig/CMakeFiles/ieee802_15_4g_testing_swig_swig_2d0df.dir/all' failed
make[1]: *** 
[swig/CMakeFiles/ieee802_15_4g_testing_swig_swig_2d0df.dir/all] Error 2

make[1]: *** Waiting for unfinished jobs
[ 60%] Linking CXX shared library 
libgnuradio-ieee802_15_4g_testing-1.0.0git.so

[ 60%] Built target gnuradio-ieee802_15_4g_testing
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

I would also want to mention that before my addition of the function 
gr::blocks::count_bits8 I had no problem at all with the compile 
process. Do you have any idea on how to fix this?


Thanks again.
Antonis


On 06/26/2017 11:26 PM, Marcus Müller wrote:


Hello Tzougkarakis,

do you also /link/ against gr-blocks? It's probably sufficient to 
add "BLOCKS" to GR_REQUIRED_COMPONENTS in your OOT's main 
CMakeLists.txt.


Best regards,

Marcus


On 26.06.2017 21:21, Tzougkarakis Antonis wrote:

Hello,

I have an OOT module which I have created with gr_modtool and I 
want to use the function count_bits_8  and count_bits_16 from 
gnuradio/blocks/count_bits.h. I have included the library in my c++ 
file but when I try to compile it I get the following message:


[ 80%] Linking CXX executable test-ieee802_15_4g_testing
libgnuradio-ieee802_15_4g_testing-1.0.0git.so.0.0.0: undefined 
reference to `gr::blocks::count_bits8(unsigned int)'
libgnuradio-ieee802_15_4g_testing-1.0.0git.so.0.0.0: undefined 
reference to `gr::blocks::count_bits16(unsigned int)'

collect2: error: ld returned 1 exit status
lib/CMakeFiles/test-ieee802_15_4g_testing.dir/build.make:130: 
recipe for target 'lib/test-ieee802_15_4g_testing' failed

make[2]: *** [lib/test-ieee802_15_4g_testing] Error 1
CMakeFiles/Makefile2:137: recipe for target 
'lib/CMakeFiles/test-ieee802_15_4g_testing.dir/all' failed
make[1]: *** [lib/CMakeFiles/test-ieee802_15_4g_testing.dir/all] 
Error 2

make[1]: *** Waiting for unfinished jobs
[ 80%] Built target ieee802_15_4g_testing_swig_swig_2d0df
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

I know that it is a link error but I don't know what addition I 
should do in order to fix the error. Any help would be appreciated.


Thank you.


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio