Fixed IMU parse fails using chunking #78
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously we had IMU parse fails due to sunlink unable to keep up with messages coming in. We confirmed this by checking the raw UART stream coming to my comuter's port and noticed that all messages were indeed sent and sunlink could not get all the messages because it was too slow.
To fix this, I implemented a simple chunking method where we read 512 bytes from the stream at a time (variable and can be adjusted. See next steps). Once the chunk is received, it is extracted for the messages inside it which are then sent to the parser.
To verify this algorithm I ran it with a load of 1926 bytes per second (78 imu messages and 3 GPS messages ran in their respect tasks instead of the normal 13 and 1) and it got all the data except the last 13 or so messages which could have still been in the 512 byte chunk (cannot access this until the full amount is read). Quantitatively, 614/623 lines were received where all lines before line 616 matched the SD log.
Downside:
Specific Changes:
process_message
function which takes in the 512 byte chunk and returns a list of all the valid messagessendToParser
function to abstract the functionally of creating a payload, sending to the parser, and expecting a callback.Next Steps: