# Error on "Assertion \`imu \>= 0' failed" when using gr.udp\_source/sink

**URL:** <https://www.ruby-forum.com/t/error-on-assertion-imu-0-failed-when-using-gr-udp-source-sink/208830>\
**Category:** GNU Radio\
**Created:** [June 28, 2011, 8:38am UTC](https://www.ruby-forum.com/t/error-on-assertion-imu-0-failed-when-using-gr-udp-source-sink/208830 "2011-06-28T08:38:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [June 28, 2011, 8:38am UTC](https://www.ruby-forum.com/t/error-on-assertion-imu-0-failed-when-using-gr-udp-source-sink/208830/1 "2011-06-28T08:38:59Z")

</div>

Hello,

I modified “benchmark\_tx.py and benchmark\_rx.py” by replacing the  
usrp\_source/sink with gr.udp\_source/sink and gr.file\_source/sink, to see  
if the generated IQ data from tx side can be correctly captured and  
processed at rx side via UDP socket or trace file instead of USRP. If it  
does, then I can analyze the signal off-line or transmit the captured  
data to others via socket.

The modified program with gr.file\_source/sink works correctly and the  
results are exactly the same when using usrp\_source/sink.

But when using udp\_source/sink, the tx side can send packets to udp\_sink  
well, but the rx side program is aborted with error  
“python: gri\_mmse\_fir\_interpolator.cc:71: float  
gri\_mmse\_fir\_interpolator::interpolate(const float\*, float) const:  
Assertion `imu \>= 0’ failed.”

My python codes are configured like the following:  
rx side:

* * *

## self.u = gr.udp\_source(gr.sizeof\_gr\_complex, options.host, options.port, options.packet\_size, not options.no\_eof, not options.no\_wait) rx\_path = receive\_path.receive\_path(demod\_class, rx\_callback, options) self.connect(self.u, rx\_path)

## tx side:

## self.u = gr.udp\_sink(gr.sizeof\_gr\_complex, options.host, options.port, options.packet\_size, options.no\_eof); tx\_path = transmit\_path.transmit\_path(modulator\_class, options) self.connect(tx\_path, self.u)

Then I added a printf in “gri\_mmse\_fir\_interpolator.cc”, and found imu  
is −2147483648, .i.e, -0x80000000;

But in normal situation when using usrp\_source/sink or  
file\_source/sink, it is between 63–67.

I searched the mailing list and knew that the imu value is used to tell  
the interpolating filter where in the filter to takethe output from,  
but got few clues to solve this problem.

I wonder if udp\_source/sink modifies the complex data stream it  
transmits then the gnuradio can’t process it correctly?  
Or is there any suggestion to solve it?

Thanks in advance!

Zhen

---

<div class="post-metadata">

**Author:** ![Zhen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/a88e57/32.png) [@Zhen](https://www.ruby-forum.com/u/Zhen)\
**Post date:** [June 29, 2011, 8:01pm UTC](https://www.ruby-forum.com/t/error-on-assertion-imu-0-failed-when-using-gr-udp-source-sink/208830/2 "2011-06-29T20:01:04Z")

</div>

I just solved this problem!

The reason is that in gnuradio-examples, UDP default payload size is set  
to 1471. In gr\_udp\_source.cc, all received data will be round down to a  
multiple of d\_itemsize. Since sizeof\_gr\_complex is 8, so only 1464 Bytes  
are received correctly, while the left 7 byte are abandoned. This will  
in turn disturb the position of the following data stream, and also  
affect the mmse\_fir\_interpolator and make imu negative.

Actually, the default UDP payload size in gr\_udp\_source.h is set to  
1472, but in  
examples, it is set to 1471. I am not sure if this is a bug. A simple  
way to bypass this problem is to set MTU  
size as a multiple of itemsize, such as 1464 or 1472, then everything  
works as expected.

* * *

发件人： Zhen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
收件人： “[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
发送日期： 2011年6月28日, 星期二, 上午 2:34  
主题: [Discuss-gnuradio] Error on “Assertion `imu \>= 0’ failed” when using  
gr.udp\_source/sink

Hello,

I modified “benchmark\_tx.py and benchmark\_rx.py” by replacing the  
usrp\_source/sink with gr.udp\_source/sink and gr.file\_source/sink, to see  
if the generated IQ data from tx side can be correctly captured and  
processed at rx side via UDP socket or trace file instead of USRP. If it  
does, then I can analyze the signal off-line or transmit the captured  
data to others via socket.

The modified program with gr.file\_source/sink works correctly and the  
results are exactly the same when using usrp\_source/sink.

But when using  
udp\_source/sink, the tx side can send packets to udp\_sink well, but the  
rx side program is aborted with error  
“python: gri\_mmse\_fir\_interpolator.cc:71: float  
gri\_mmse\_fir\_interpolator::interpolate(const float\*, float) const:  
Assertion `imu \>= 0’ failed.”

My python codes are configured like the following:  
rx side:

* * *

## self.u = gr.udp\_source(gr.sizeof\_gr\_complex, options.host, options.port, options.packet\_size, not options.no\_eof, not options.no\_wait) rx\_path = receive\_path.receive\_path(demod\_class, rx\_callback, options) self.connect(self.u, rx\_path)

## tx side:

## self.u = gr.udp\_sink(gr.sizeof\_gr\_complex, options.host, options.port, options.packet\_size, options.no\_eof); tx\_path = transmit\_path.transmit\_path(modulator\_class, options) self.connect(tx\_path, self.u)

Then I added a printf in “gri\_mmse\_fir\_interpolator.cc”, and found imu  
is −2147483648, .i.e, -0x80000000;

But in normal situation when using usrp\_source/sink or  
file\_source/sink, it is between 63–67.

I searched the mailing list and knew that the imu value is used to tell  
the interpolating filter where in the filter to takethe output from,  
but got few clues to solve this problem.

I wonder if udp\_source/sink modifies the complex data stream it  
transmits then the gnuradio can’t process it correctly?  
Or is there any suggestion to solve it?

Thanks in advance!

Zhen

---

<div class="post-metadata">

**Author:** ![Zhen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/a88e57/32.png) [@Zhen](https://www.ruby-forum.com/u/Zhen)\
**Post date:** [June 29, 2011, 10:22pm UTC](https://www.ruby-forum.com/t/error-on-assertion-imu-0-failed-when-using-gr-udp-source-sink/208830/3 "2011-06-29T22:22:46Z")

</div>

On Wed, Jun 29, 2011 at 07:44, Zhen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> simple way to bypass this problem is to set MTU size as a multiple of  
> itemsize, such as 1464 or 1472, then everything works as expected.

Very nice catch. I have yet looked at the code to verify this, but your  
description sounds plausible. Thanks!

Johnathan
