# smallsatgasteam/cubeworks architecture

> Architecture diagram of the GitHub repository smallsatgasteam/cubeworks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/smallsatgasteam/cubeworks
- Repository: https://github.com/smallsatgasteam/cubeworks

## Overview

CubeWorks is GASPACS flight software for a Raspberry Pi Zero W. Its main workflow is mission-mode control: collect and persist telemetry, apply deployment and safe-mode logic, and service scheduled transmissions and ground commands. Hardware access is abstracted through interchangeable real and dummy drivers; transmission includes preparation, queuing, command processing, and a C radio service. The graph uses documented capabilities and indexed references; several mission-mode and controller implementations were not sampled, so those connections are omitted or marked unverified.

Main entry points: [`TXISR/packetProcessing.py`](https://github.com/smallsatgasteam/cubeworks/blob/master/TXISR/packetProcessing.py) (Packet processing), [`flightLogic/missionModes`](https://github.com/smallsatgasteam/cubeworks/tree/master/flightLogic/missionModes) (Mission modes), [`flightLogic/getDriverData.py`](https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/getDriverData.py) (Telemetry collection), [`flightLogic/missionModes/transmitting.py`](https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/missionModes/transmitting.py) (TX scheduling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flight["Flight control"]
  node_controller["Flight controller<br/>[mainFlightLogic.py]"]
  node_modes["Mission modes"]
  node_deploy["Boom deployment<br/>[boomDeploy.py]"]
  node_safe["Safe mode<br/>[preBoomDeploy.py]"]
end

subgraph group_telemetry["Telemetry and devices"]
  node_acquisition["Telemetry collection<br/>[getDriverData.py]"]
  node_drivers["Hardware drivers"]
  node_dummy["Dummy drivers"]
  node_persistence["Telemetry files<br/>[saveTofiles.py]"]
  node_camera["Camera and images<br/>[Camera.py]"]
end

subgraph group_comms["Communications"]
  node_interrupt["UART interrupt<br/>[pythonInterrupt.py]"]
  node_packet["Packet processing"]
  node_queue["TX window queue"]
  node_transmitting["TX scheduling<br/>[transmitting.py]"]
  node_prepare["File preparation<br/>[prepareFiles.py]"]
  node_radio["Radio service<br/>[TXServiceCode.c]"]
end

subgraph group_reliability["Data protection"]
  node_protection["File protection<br/>[fileProtection.py]"]
end

node_operator(("Mission operator"))
node_ground(("Ground station"))
node_satellite["Satellite hardware"]

node_operator -.->|"starts flight"| node_controller
node_controller -.->|"selects modes"| node_modes
node_modes -.->|"collects telemetry"| node_acquisition
node_modes -.->|"runs deployment"| node_deploy
node_modes -.->|"runs safeguards"| node_safe
node_acquisition -->|"reads devices"| node_drivers
node_acquisition -->|"writes records"| node_persistence
node_drivers -.->|"reads and actuates"| node_satellite
node_dummy -.->|"simulates devices"| node_satellite
node_acquisition -.->|"supports simulation"| node_dummy
node_camera -.->|"captures images"| node_satellite
node_ground -->|"sends commands"| node_interrupt
node_interrupt -->|"dispatches packets"| node_packet
node_packet -->|"enqueues windows"| node_queue
node_packet -->|"uses camera"| node_camera
node_packet -->|"checks files"| node_protection
node_packet -->|"checks TX state"| node_transmitting
node_packet -->|"commands deployer"| node_drivers
node_transmitting -->|"reads windows"| node_queue
node_transmitting -->|"prepares data"| node_prepare
node_transmitting -.->|"starts radio service"| node_radio
node_prepare -->|"packages images"| node_camera
node_prepare -->|"checks files"| node_protection
node_queue -->|"validates windows"| node_protection
node_radio -.->|"transmits data"| node_ground

click node_controller "https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/mainFlightLogic.py"
click node_modes "https://github.com/smallsatgasteam/cubeworks/tree/master/flightLogic/missionModes"
click node_deploy "https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/missionModes/boomDeploy.py"
click node_safe "https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/missionModes/preBoomDeploy.py"
click node_acquisition "https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/getDriverData.py"
click node_drivers "https://github.com/smallsatgasteam/cubeworks/tree/master/Drivers"
click node_dummy "https://github.com/smallsatgasteam/cubeworks/tree/master/DummyDrivers"
click node_persistence "https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/saveTofiles.py"
click node_camera "https://github.com/smallsatgasteam/cubeworks/blob/master/Drivers/camera/Camera.py"
click node_interrupt "https://github.com/smallsatgasteam/cubeworks/blob/master/TXISR/pythonInterrupt.py"
click node_packet "https://github.com/smallsatgasteam/cubeworks/blob/master/TXISR/packetProcessing.py"
click node_queue "https://github.com/smallsatgasteam/cubeworks/blob/master/TXISR/transmitionQueue.py"
click node_transmitting "https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/missionModes/transmitting.py"
click node_prepare "https://github.com/smallsatgasteam/cubeworks/blob/master/TXISR/prepareFiles.py"
click node_radio "https://github.com/smallsatgasteam/cubeworks/blob/master/TXISR/TXServiceCode/TXServiceCode.c"
click node_protection "https://github.com/smallsatgasteam/cubeworks/blob/master/protectionProticol/fileProtection.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_controller,node_modes,node_deploy,node_safe toneBlue
class node_acquisition,node_drivers,node_dummy,node_persistence,node_camera toneAmber
class node_interrupt,node_packet,node_queue,node_transmitting,node_prepare,node_radio toneMint
class node_protection toneRose
class node_operator,node_ground,node_satellite toneIndigo
```

## Components

### Flight control

- [Flight controller](https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/mainFlightLogic.py): `flightLogic/mainFlightLogic.py`
- [Mission modes](https://github.com/smallsatgasteam/cubeworks/tree/master/flightLogic/missionModes): `flightLogic/missionModes`
- [Boom deployment](https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/missionModes/boomDeploy.py): `flightLogic/missionModes/boomDeploy.py`
- [Safe mode](https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/missionModes/preBoomDeploy.py): `flightLogic/missionModes/preBoomDeploy.py`

### Telemetry and devices

- [Telemetry collection](https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/getDriverData.py): `flightLogic/getDriverData.py`
- [Hardware drivers](https://github.com/smallsatgasteam/cubeworks/tree/master/Drivers): `Drivers`
- [Dummy drivers](https://github.com/smallsatgasteam/cubeworks/tree/master/DummyDrivers): `DummyDrivers`
- [Telemetry files](https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/saveTofiles.py): `flightLogic/saveTofiles.py`
- [Camera and images](https://github.com/smallsatgasteam/cubeworks/blob/master/Drivers/camera/Camera.py): `Drivers/camera/Camera.py`

### Communications

- [UART interrupt](https://github.com/smallsatgasteam/cubeworks/blob/master/TXISR/pythonInterrupt.py): `TXISR/pythonInterrupt.py`
- [Packet processing](https://github.com/smallsatgasteam/cubeworks/blob/master/TXISR/packetProcessing.py): `TXISR/packetProcessing.py`
- [TX window queue](https://github.com/smallsatgasteam/cubeworks/blob/master/TXISR/transmitionQueue.py): `TXISR/transmitionQueue.py`
- [TX scheduling](https://github.com/smallsatgasteam/cubeworks/blob/master/flightLogic/missionModes/transmitting.py): `flightLogic/missionModes/transmitting.py`
- [File preparation](https://github.com/smallsatgasteam/cubeworks/blob/master/TXISR/prepareFiles.py): `TXISR/prepareFiles.py`
- [Radio service](https://github.com/smallsatgasteam/cubeworks/blob/master/TXISR/TXServiceCode/TXServiceCode.c): `TXISR/TXServiceCode/TXServiceCode.c`

### Data protection

- [File protection](https://github.com/smallsatgasteam/cubeworks/blob/master/protectionProticol/fileProtection.py): `protectionProticol/fileProtection.py`

### Other components

- **Mission operator**
- **Ground station**
- **Satellite hardware**

## Connections

- Mission operator → Flight controller: starts flight
- Flight controller → Mission modes: selects modes
- Mission modes → Telemetry collection: collects telemetry
- Mission modes → Boom deployment: runs deployment
- Mission modes → Safe mode: runs safeguards
- Telemetry collection → Hardware drivers: reads devices (evidence: `flightLogic/getDriverData.py`)
- Telemetry collection → Telemetry files: writes records (evidence: `flightLogic/getDriverData.py`)
- Hardware drivers → Satellite hardware: reads and actuates
- Dummy drivers → Satellite hardware: simulates devices
- Telemetry collection → Dummy drivers: supports simulation
- Camera and images → Satellite hardware: captures images
- Ground station → UART interrupt: sends commands
- UART interrupt → Packet processing: dispatches packets (evidence: `TXISR/pythonInterrupt.py`)
- Packet processing → TX window queue: enqueues windows (evidence: `TXISR/packetProcessing.py`)
- Packet processing → Camera and images: uses camera (evidence: `TXISR/packetProcessing.py`)
- Packet processing → File protection: checks files (evidence: `TXISR/packetProcessing.py`)
- Packet processing → TX scheduling: checks TX state (evidence: `TXISR/packetProcessing.py`)
- Packet processing → Hardware drivers: commands deployer (evidence: `TXISR/packetProcessing.py`)
- TX scheduling → TX window queue: reads windows (evidence: `flightLogic/missionModes/transmitting.py`)
- TX scheduling → File preparation: prepares data (evidence: `flightLogic/missionModes/transmitting.py`)
- TX scheduling → Radio service: starts radio service
- File preparation → Camera and images: packages images (evidence: `TXISR/prepareFiles.py`)
- File preparation → File protection: checks files (evidence: `TXISR/prepareFiles.py`)
- TX window queue → File protection: validates windows (evidence: `TXISR/transmitionQueue.py`)
- Radio service → Ground station: transmits data
