daniestevez / gr-satellites

GNU Radio decoder for Amateur satellites
GNU General Public License v3.0
777 stars 161 forks source link

Missing tags in "Fixed Length Packet Tagger" #425

Open notsleep196 opened 1 year ago

notsleep196 commented 1 year ago

Hello! I faced the issue with tags propagation in "Fixed Length Packet Tagger" block. I tried to push to flowgraph some additional info via tags (using PDU) and saw that this tags are mixed or missed after "Fixed Length Packet Tagger". So i made easier flowgraphs to demonstrate this.

My TopBlock looks like this: image gr_satellites_bug_hier looks like this: image As you can see from TopBlock main idea is to decode data with different "syncwords" in one flowgraph.

I swapped PadSource with simple custom MessagePublisher to push messages to flowgraph. The final python file of TopBlock:

TopBlock ```python import os import sys import pmt from gnuradio import blocks from gnuradio import digital from gnuradio import gr from gnuradio.filter import firdes from gnuradio.fft import window import signal from argparse import ArgumentParser from gnuradio.eng_arg import eng_float, intx from gnuradio import eng_notation from gnuradio import gr, pdu from gr_satellites_bug_hier import gr_satellites_bug_hier # grc-generated hier_block class MessagePublisher(gr.sync_block): def __init__(self): gr.sync_block.__init__( self, name="Publisher", in_sig=None, out_sig=None ) self.message_port_register_out(pmt.intern('out')) class gr_satellites_bug(gr.top_block): def __init__(self): gr.top_block.__init__(self, "gr-satellites_bug_TopBlock", catch_exceptions=True) ################################################## # Variables ################################################## self.syncword_small_packet = syncword_small_packet = "0111000110011101100000111100100101010011010000100010110111111010" self.syncword_long_packet = syncword_long_packet = "0010010011001000110101101001110000000110000101110111100010101111" self.mtu_small_packet = mtu_small_packet = 32 self.mtu_long_packet = mtu_long_packet = 64 self.message_publisher = MessagePublisher() self.iter = 1 ################################################## # Blocks ################################################## self.pdu_pdu_to_tagged_stream_0 = pdu.pdu_to_tagged_stream(gr.types.byte_t, 'length') self.gr_satellites_bug_hier_0_0 = gr_satellites_bug_hier( mtu=mtu_small_packet, syncword=syncword_small_packet, ) self.gr_satellites_bug_hier_0 = gr_satellites_bug_hier( mtu=mtu_long_packet, syncword=syncword_long_packet, ) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bf([-1,1], 1) self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST) self.blocks_message_debug_1 = blocks.message_debug(True) self.blocks_message_debug_0_0 = blocks.message_debug(True) self.blocks_message_debug_0 = blocks.message_debug(True) ################################################## # Connections ################################################## self.msg_connect((self.gr_satellites_bug_hier_0, 'out'), (self.blocks_message_debug_1, 'print')) self.msg_connect((self.gr_satellites_bug_hier_0_0, 'out'), (self.blocks_message_debug_0_0, 'print')) self.msg_connect((self.message_publisher, 'out'), (self.blocks_message_debug_0, 'print')) self.msg_connect((self.message_publisher, 'out'), (self.pdu_pdu_to_tagged_stream_0, 'pdus')) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.gr_satellites_bug_hier_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.gr_satellites_bug_hier_0_0, 0)) self.connect((self.pdu_pdu_to_tagged_stream_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) def get_syncword_small_packet(self): return self.syncword_small_packet def set_syncword_small_packet(self, syncword_small_packet): self.syncword_small_packet = syncword_small_packet self.gr_satellites_bug_hier_0_0.set_syncword(self.syncword_small_packet) def get_syncword_long_packet(self): return self.syncword_long_packet def set_syncword_long_packet(self, syncword_long_packet): self.syncword_long_packet = syncword_long_packet self.gr_satellites_bug_hier_0.set_syncword(self.syncword_long_packet) def get_mtu_small_packet(self): return self.mtu_small_packet def set_mtu_small_packet(self, mtu_small_packet): self.mtu_small_packet = mtu_small_packet self.gr_satellites_bug_hier_0_0.set_mtu(self.mtu_small_packet) def get_mtu_long_packet(self): return self.mtu_long_packet def set_mtu_long_packet(self, mtu_long_packet): self.mtu_long_packet = mtu_long_packet self.gr_satellites_bug_hier_0.set_mtu(self.mtu_long_packet) def decode(self, frame_to_decode: bytes): print("Decode method called") packet_content_as_integers = [int(b) for b in frame_to_decode] for i in range(256): packet_content_as_integers.append(0) #Add 256 zero bytes to avoid unfilling of buffers of flowgraph sometimes example_tag_dict = pmt.to_pmt({'example_tag': self.iter}) self.iter+=1 print("Created dictionary for ids") msg_send = pmt.cons(example_tag_dict, pmt.init_u8vector(len(packet_content_as_integers), packet_content_as_integers)) self.message_publisher.message_port_pub(pmt.intern('out'), msg_send) ```

Hier block stays autogenerated by GNURadio. Script to run flowgraph:

Script to run flowgraph ```python import pmt from gnuradio import gr import time from typing import List import threading from gr_satellites_bug import gr_satellites_bug def test_decode(): decoder = gr_satellites_bug() decoder_thread = threading.Thread(target=decoder.start) decoder_thread.start() # time for startup time.sleep(0.5) raw_data_to_decode_small_packet = b'\x71\x9d\x83\xc9\x53\x42\x2d\xfa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' raw_data_to_decode_long_packet = b'\x24\xc8\xd6\x9c\x06\x17\x78\xaf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' decoder.decode(raw_data_to_decode_long_packet) time.sleep(5) decoder.decode(raw_data_to_decode_small_packet) time.sleep(5) decoder.decode(raw_data_to_decode_long_packet) time.sleep(5) decoder.decode(raw_data_to_decode_small_packet) time.sleep(5) decoder_thread.join() if __name__ == "__main__": test_decode() ```

I'm pushing messages with special "example_tag" that increases with every decode() method call. Result:

Result output correlate_access_code_tag_ff :debug: Access code: 719d83c953422dfa correlate_access_code_tag_ff :debug: Mask: ffffffffffffffff correlate_access_code_tag_ff :debug: Access code: 24c8d69c061778af correlate_access_code_tag_ff :debug: Mask: ffffffffffffffff ***** VERBOSE PDU DEBUG PRINT ****** ((example_tag . 1)) pdu length = 774 bytes pdu vector contents = 0000: 24 c8 d6 9c 06 17 78 af 00 00 00 00 00 00 00 00 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0300: 00 00 00 00 00 00 ************************************ ---------------------------------------------------------------------- Tag Debug: Tags at start of the hier block Input Stream: 00 Offset: 0 Source: pdu_to_tagged_stream0 Key: example_tag Value: 1 Offset: 0 Source: n/a Key: length Value: 774 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Tag Debug: Tags at start of the hier block Input Stream: 00 Offset: 0 Source: pdu_to_tagged_stream0 Key: example_tag Value: 1 Offset: 0 Source: n/a Key: length Value: 774 ---------------------------------------------------------------------- correlate_access_code_tag_ff :debug: writing tag at sample 64 ---------------------------------------------------------------------- Tag Debug: Tags after correlate_access_code Input Stream: 00 Offset: 0 Source: pdu_to_tagged_stream0 Key: example_tag Value: 1 Offset: 0 Source: n/a Key: length Value: 774 Offset: 64 Source: correlate_access_code_tag_ff16 Key: syncword_tag Value: 0 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Tag Debug: Tags after correlate_access_code Input Stream: 00 Offset: 0 Source: pdu_to_tagged_stream0 Key: example_tag Value: 1 Offset: 0 Source: n/a Key: length Value: 774 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Tag Debug: Tags after fixedlen_tagger Input Stream: 00 Offset: 0 Source: n/a Key: packet_len Value: 1024 Offset: 0 Source: pdu_to_tagged_stream0 Key: example_tag Value: 1 Offset: 0 Source: n/a Key: length Value: 774 Offset: 64 Source: correlate_access_code_tag_ff16 Key: syncword_tag Value: 0 ---------------------------------------------------------------------- ***** VERBOSE PDU DEBUG PRINT ****** ((example_tag . 2)) pdu length = 464 bytes pdu vector contents = 0000: 71 9d 83 c9 53 42 2d fa 00 00 00 00 00 00 00 00 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ************************************ correlate_access_code_tag_ff :debug: writing tag at sample 6256 ---------------------------------------------------------------------- Tag Debug: Tags at start of the hier block Input Stream: 00 Offset: 6192 Source: pdu_to_tagged_stream0 Key: example_tag Value: 2 Offset: 6192 Source: n/a Key: length Value: 464 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Tag Debug: Tags after correlate_access_code Input Stream: 00 Offset: 6192 Source: pdu_to_tagged_stream0 Key: example_tag Value: 2 Offset: 6192 Source: n/a Key: length Value: 464 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Tag Debug: Tags at start of the hier block Input Stream: 00 Offset: 6192 Source: pdu_to_tagged_stream0 Key: example_tag Value: 2 Offset: 6192 Source: n/a Key: length Value: 464 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Tag Debug: Tags after correlate_access_code Input Stream: 00 Offset: 6192 Source: pdu_to_tagged_stream0 Key: example_tag Value: 2 Offset: 6192 Source: n/a Key: length Value: 464 Offset: 6256 Source: correlate_access_code_tag_ff6 Key: syncword_tag Value: 0 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Tag Debug: Tags after fixedlen_tagger Input Stream: 00 Offset: 0 Source: pdu_to_tagged_stream0 Key: example_tag Value: 1 Offset: 0 Source: n/a Key: length Value: 774 Offset: 0 Source: n/a Key: packet_len Value: 512 ---------------------------------------------------------------------- ***** VERBOSE PDU DEBUG PRINT ****** ((example_tag . 3)) pdu length = 774 bytes pdu vector contents = 0000: 24 c8 d6 9c 06 17 78 af 00 00 00 00 00 00 00 00 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0300: 00 00 00 00 00 00 ************************************ correlate_access_code_tag_ff :debug: writing tag at sample 9968 ---------------------------------------------------------------------- Tag Debug: Tags at start of the hier block Input Stream: 00 Offset: 9904 Source: pdu_to_tagged_stream0 Key: example_tag Value: 3 Offset: 9904 Source: n/a Key: length Value: 774 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Tag Debug: Tags at start of the hier block Input Stream: 00 Offset: 9904 Source: pdu_to_tagged_stream0 Key: example_tag Value: 3 Offset: 9904 Source: n/a Key: length Value: 774 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Tag Debug: Tags after correlate_access_code Input Stream: 00 Offset: 9904 Source: pdu_to_tagged_stream0 Key: example_tag Value: 3 Offset: 9904 Source: n/a Key: length Value: 774 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Tag Debug: Tags after correlate_access_code Input Stream: 00 Offset: 9904 Source: pdu_to_tagged_stream0 Key: example_tag Value: 3 Offset: 9904 Source: n/a Key: length Value: 774 Offset: 9968 Source: correlate_access_code_tag_ff16 Key: syncword_tag Value: 0 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Tag Debug: Tags after fixedlen_tagger Input Stream: 00 Offset: 1024 Source: n/a Key: packet_len Value: 1024 ---------------------------------------------------------------------- ***** VERBOSE PDU DEBUG PRINT ****** ((example_tag . 4)) pdu length = 464 bytes pdu vector contents = 0000: 71 9d 83 c9 53 42 2d fa 00 00 00 00 00 00 00 00 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ************************************ correlate_access_code_tag_ff :debug: writing tag at sample 16160

As i can see from Tag Debug info, tags in "inactive" (e.g. "syncword" not detected) part of flowgraph are buffered in "Fixed Length Packet Tagger" block. When pushing to TopBlock frames with different "syncword" block works unexpectedly, mixing and, sometimes, missing all additional tags.

Environment: GNU Radio: 3.10.1.1 gr-satellites: 5.0.0 python: 3.10.6

daniestevez commented 1 year ago

Hi, thanks for reporting this.

You are right. fixedlen_tagger doesn't propagate tags from the input to the output. The code to do that is simply missing. Additionally, fixedlen_tagger (which is a Python block, and hence not so efficient) was mostly deprecated in May this year in favour of the fixedlen_to_pdu block (which is a C++ block and much more efficient). I see that I forgot to mark the GRC block as deprecated, so maybe I should do that.

fixedlen_to_pdu is somewhat different to fixedlen_tagger. Its output are PDUs rather than a tagged stream. This made more sense, because gr-satellites always converts the tagged stream to PDUs, and so it used Tagged Stream to PDU always after fixedlen_tagger. Since it's more difficult to properly format a tagged stream output, it makes more sense to have a block which outputs PDUs directly.

fixedlen_to_pdu doesn't propagate tags from input to output either. We could add code so that the tags get added to the PDU, but currently there is no need for this in gr-satellites.

I see that the flowgraph you have could likely be achieved by using gr-satellites Sync and Create Packed PDU block. But perhaps this is just an example to demonstrate the problem rather than your final goal.

In any case, if you do need to use fixedlen_tagger in your application and want to implement tag propagation yourself, I'm happy to review the code and get it merged upstream. At the moment, there is not much interest in having tag propagation in these blocks, so it's probably not something that I'll implement myself.

notsleep196 commented 1 year ago

Hello and thank you for reply! I think i can close this issue, because your answer is exhaustive.

daniestevez commented 1 year ago

Thanks. I actually prefer to leave this issue open, since it describes a possible enhancement that someone might want to implement in the future.