waterloo-rocketry / cansw_processor_canards

Firmware for the 2024-2025 processor board project, performing state estimation and control for the canards system
GNU General Public License v3.0
1 stars 0 forks source link

logger module design #11

Open celery6 opened 1 month ago

celery6 commented 1 month ago

see #5

this module is very software and may be quite rtos heavy. Which is cool! But also it's mostly complete from last year, though there is definitely room for improvement and optimization which looks like an interesting problem. Not too many ppl needed for this one

Responsible for processing log messages from all modules and outputting those to SD card. The design follows similar to CAN Logger board, which holds messages in rotating buffers and outputs full buffers to SD card. The challenge with processor is our logging rate is like 50x faster - we write a LOT of logs, and write in string format, and it includes floating point numbers which are slow to process. This module needs to be optimized for speed and reliability! Last year’s went through a few designs for handling the buffers; early designs made logInfo() calls wait in line to write to the buffer, so each message was snprintf’d into the buffer back to back. We noticed that snprintf() was bottlenecking speed, so the latest design mitigates that by dividing each buffer into equal sections. Then, each logInfo() claims a section to own it, allowing logInfos to concurrently write to their own section.

Components:

Interface:

Things to figure out: