As usual, I have a simple question for you guys. I have a custom block
for which I specify set_output_multiple(N) in the constructor. Then, for
each call to its work(), I print the parameter noutput_items. As
expected, noutput_items = N most of the times, but occasionally it comes
out as 2N. My concern is that I always want noutput_items = N. I know
noutput_items are assigned by the scheduler and I have a some control
over it by means of set_output_multiple but I want to have more/full
control on it. Is that possible? Any suggestions?
Set the in/out ratio while setting the output multiple, then you can
control the output items number by setting the required input items in
the
forecast() of your block.
You don’t always have to consume everything that’s handed to you. So if
you
get kN items, just process N of them, return N, then the scheduler will
pass you the next N items in the buffer next time.
What you have suggested is absolutely fine but it does not solve my
problem. Actually, my custom block sends a burst of N samples whenever a
condition in its code is met. Since that conditon is met pretty much
regularly, I can say that the custom block sends a burst after every ~30
mS. Now, whenever noutput_items=2N are assigned to work() of my custom
block, I observe that particular (to be transmitted) burst somehow does
not get sent asap, rather it is sent after ~200mS. I have verified this
by two ways:
i) I receive the transmitted bursts at another node and measure the
delay between successive bursts.
ii) On the other hand, I time each bursts by means of tx_time_tag. Then,
I do see that whenever noutput_items=2N, I see “L” printed in the
console (which means packet is late and is discarded by the FPGA).
So, in summary, I would like to send my bursts asap no matter what value
noutput_items takes. Or, I want the scheduler to assign me exactly
noutput_items=N items everytime. What do you suggest?
Thanks,
Yu.
p.s.
Alex,
Could you explain a bit more how to accomplish what you have said?
Thanks.
You don’t always have to consume everything that’s handed to you. So if
you get kN items, just process N of them, return N, then the scheduler
will pass you the next N items in the buffer next time.
I have now split the above flowgraph into two separate flowgraphs as following:
uhd usrp source -> LPF -> my custom block_1
my custom block 2 -> uhd usrp sink
where I have divided the functionality of my original custom block into custom
block 1 and custom block 2.
Now, when I relay the information from custom block 1 to custom block 2 by means
of function probe,
I get the error message AttributeError: ‘gr_top_block_sptr’ object has no
attribute ‘my_custom_block_1_0’
which is expected (because the two flowgraphs are separate and independent).
How can I pass the info from custom block 1 to custom block 2 in this case?
Ok. below is what I have observed. When I run the above mentioned GRC
file (containing two flowgraphs), I get below error:
AttributeError: ‘gr_top_block_sptr’ object has no attribute
‘my_custom_block_1_0’
When I open the corresponding top_block.py file, I can see that the
definition of function probe comes before the definition of
'my_custom_block_1. So, when I put the definition/instantiation of
'my_custom_block_1 before the definition of function probe, I don’t get
any error. Why GRC is generating the code in this manner? It should
rather instantiate the DSP blocks first and then the variables/function
probes etc.
to be fair, this problem is not what you asked for in your initial post.
You are right. I realized it only during my second post. Apologies for
not being clear during the first time.
A couple of notes:
The output buffer does not have to be “full” in order for the scheduler
to call the following downstream block.
Good to know.
Undeterministic latency is one inherent problem of GNU Radio
200 ms seems a bit much, though. Have you tried decreasing the buffer
sizes between blocks? (Try set_max_output_buffer()).
So far, I have added the following line in the constructor of my custom
block:
std::cout << max_output_buffer(0) << std::endl;
which returns -1. Does it mean some default value? If so, what is that
value? Also, what is the range of value for ‘size’
inset_max_output_buffer(size)?
How many blocks are between your custom block and the UHD sink? Lots
of blocks == lots of latency.
So essentially, there is no other block between my custom block and uhd
usrp sink.
I have another question for you. I have now split the above flowgraph
into two separate flowgraphs as following:
uhd usrp source -> LPF -> my custom block_1
my custom block 2 -> uhd usrp sink
where I have divided the functionality of my original custom block into
custom block 1 and custom block 2. Now, when I relay the information
from custom block 1 to custom block 2 by means of function probe, I get
the error message AttributeError: ‘gr_top_block_sptr’ object has no
attribute ‘my_custom_block_1_0’ which is expected (because the two
flowgraphs are separate and independent). How can I pass the info from
custom block 1 to custom block 2 in this case?
Thanks,
Yu.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.