UBCSailbot / sailbot_workspace

UBC Sailbot's monorepo
https://ubcsailbot.github.io/sailbot_workspace/main/
Apache License 2.0
5 stars 2 forks source link

Account for Satellite Sensor Payload Sizes #273

Open hhenry01 opened 11 months ago

hhenry01 commented 11 months ago

Purpose

Handle situations where we may need to transmit more data than possible at once.

Description

The satellite has a limit for how large of a payload can be sent. The limits are:

To account for this, I recommend a mechanism to split data across multiple payloads when necessary.

Potential Solutions

I have two ideas that split the payload across multiple messages (and recommend option 2):

1. Use the Iridium's MOMSN and MTMSN or MT queued fields (not recommended).

Why I don't recommend these

  • The use of MT queued in Raye assumed that if there are multiple messages queued, all of them must be processed to get the data. This assumed that we would not need to worry about:
    • Partial transmission sequences where only part of the multi-message sequence is sent successfully. So if 2/3 message are sent successfully but message 3 fails and continues to fail, then the first two messages are interpreted as the complete set of data and can lead to failure on the boat.
    • The queue would not get backed up. If another sequence of messages starts transmitting before the last sequence is processed, then the new message would be considered part of the same sequence.
  • MOMSN and MTMSN do not tell us how many messages there are to reconstruct the complete data. This solution would necessitate additional metadata in the data payload to be adequately robust, but we would still need to work with other limitations of these fields. Hence I would recommend 2:

2. Create a Wrapper Packet

I recommend creating a new Payload protobuf type as follows:

uint32 id;  // For our use case, this is always 8 bit
bytes data;

Since data will always be a whole number of bytes, there is no point in making the id field smaller than 8 bits as we are billed per byte. This method allows a maximum sequence length of 128 entries, which is more than sufficient based on Raye only needing a max of 23.

This introduces a fixed overhead of 1B per message. In exchange, we guarantee that up to 127 messages in one sequence can be sent and received out of order without issues. However, we must ensure that new sequences cannot begin before a previous sequence finishes, otherwise invalid data will be sent.

Alternatively, we could reserve an extra bit for something like a reset flag to reset the sequence. If we go down this route, we would have the top 2 bits reserved for indicating special ids. This would give us 4 unique ids in total (end of sequence, reset, and two more available for the future), in exchange for lowering the max length to 68.

To implement this, changes need to be made to both the Local and Remote Transceiver. For the Local Transceiver, this encompasses step 9 and onwards in the Transmit Sensors Sequence: https://ubcsailbot.atlassian.net/wiki/spaces/prjt22/pages/1768882211/Local+Transceiver#Transmit-Sensors-Sequence For the Remote Transceiver, this encompasses step 3 to 9 in the Receive Sensors Sequence: https://ubcsailbot.atlassian.net/wiki/spaces/prjt22/pages/1814954153/Remote+Transciever#Receive-Sensors-Sequence

Resources