Nevermind now, I figured it out!
output_items[0][:] = input_items[0]
self.produce(0, len(output_items[0]))
return -2
It turns out that using produce() instead of consume() does the trick, but I couldn't say why. So, the last three lines should be
output_items[0][:] = input_items[0]
self.produce(0, len(output_items[0]))
return -2
Although, in the following block, I just returned len(output_items[0]) without using consume() or produce() and it works fine. So, apparently, my code is a bit random, but I'm happy it works now. :)
Thanks for your help, Jeff!
Best regards,
Verónica
Verónica
On Thu, Oct 28, 2021 at 8:47 AM Verónica Toro Betancur <vetorobe@gmail.com> wrote:
I see but no, I'm not processing a finite number of samples. I'm generating a message periodically with a Message Strobe, then the message is encoded and modulated as a WiFi signal using the modules in: https://github.com/bastibl/gr-ieee802-11. Now, I'm trying to detect the signals myself and then decode them with the blocks from the same gr-ieee802-11 repository. The block I'm implementing in python looks like this:class short_sync_blk(gr.sync_block):
def __init__(self):
gr.sync_block.__init__(self,name='Custom short preamble detection', in_sig=[np.complex64], out_sig=[np.complex64])<+define some variables+>
def work(self, input_items, output_items):
print(input_items[0]) # Here is where I see that, after one iteration, input_items[0] is filled with zeros
<+some processing+><+insert a tag+>
output_items[0][:] = input_items[0]
self.consume_each(len(output_items[0]))
return len(output_items[0])Is this enough? Or should I put all the actual code in here with all the connected blocks?Thanks in advance.Best regards,
Verónica
No comments:
Post a Comment