Wednesday, October 27, 2021

Re: Python embedded block stops working after consume()

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