# team4205/projectnitro architecture

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

- Interactive diagram: https://gitdiagram.com/team4205/projectnitro
- Repository: https://github.com/team4205/projectnitro

## Overview

This is a PROS-based VEX robot application with custom match recording and playback. The visible workflow initializes robot services and recording, accepts operator input to drive or start/stop a match recording, and exposes a recording-selection menu; replay support is present in the project. The source excerpts show only parts of that workflow, so links to unsampled control modes and hardware interactions are omitted rather than inferred.

Main entry points: [`include/nitrogen/recordnreplay/recorder.hpp`](https://github.com/team4205/projectnitro/blob/main/include/nitrogen/recordnreplay/recorder.hpp) (Recorder), [`include/nitrogen/Storage.hpp`](https://github.com/team4205/projectnitro/blob/main/include/nitrogen/Storage.hpp) (SD storage), [`src/main.cpp`](https://github.com/team4205/projectnitro/blob/main/src/main.cpp) (Lifecycle hooks), [`include/nitrogen/recordnreplay/replayer.hpp`](https://github.com/team4205/projectnitro/blob/main/include/nitrogen/recordnreplay/replayer.hpp) (Replayer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_robot["Robot control"]
  node_lifecycle["Lifecycle hooks<br/>[main.cpp]"]
  node_opcontrol["Operator control<br/>[main.cpp]"]
  node_autonomous["Autonomous mode<br/>[main.cpp]"]
  node_actions["Robot actions<br/>[actions.cpp]"]
  node_profiles["Robot profiles<br/>[profiles.cpp]"]
  node_hooks["Robot hooks<br/>[hooks.cpp]"]
end

subgraph group_recording["Match recording"]
  node_recording_api["Recorder<br/>[recorder.hpp]"]
  node_replay_api["Replayer<br/>[replayer.hpp]"]
  node_record_format["Record codec<br/>[codec.hpp]"]
  node_storage["SD storage<br/>[Storage.hpp]"]
  node_record_ui["Recording menu<br/>[main.cpp]"]
end

subgraph group_platform["PROS platform"]
  node_motor_api["Motor groups<br/>[motor_group.hpp]"]
  node_pros_api["PROS API<br/>[api.h]"]
end

node_operator(("Operator"))
node_controller(("VEX controller"))
node_sd_card[("SD card")]

node_operator -.->|"controls"| node_opcontrol
node_lifecycle -->|"updates run ID"| node_storage
node_lifecycle -->|"initializes recording"| node_recording_api
node_lifecycle -->|"attaches controller"| node_recording_api
node_record_ui -->|"starts or stops"| node_recording_api
node_recording_api -->|"writes recordings"| node_storage
node_replay_api -.->|"reads recordings"| node_storage
node_recording_api -->|"encodes frames"| node_record_format
node_replay_api -->|"decodes frames"| node_record_format
node_opcontrol -.->|"reads input"| node_controller
node_recording_api -.->|"samples input"| node_controller
node_opcontrol -.->|"commands motors"| node_motor_api
node_motor_api -->|"uses motor API"| node_pros_api
node_storage -->|"reads and writes"| node_sd_card

click node_lifecycle "https://github.com/team4205/projectnitro/blob/main/src/main.cpp"
click node_opcontrol "https://github.com/team4205/projectnitro/blob/main/src/main.cpp"
click node_autonomous "https://github.com/team4205/projectnitro/blob/main/src/main.cpp"
click node_actions "https://github.com/team4205/projectnitro/blob/main/src/actions.cpp"
click node_profiles "https://github.com/team4205/projectnitro/blob/main/src/profiles.cpp"
click node_hooks "https://github.com/team4205/projectnitro/blob/main/src/hooks.cpp"
click node_recording_api "https://github.com/team4205/projectnitro/blob/main/include/nitrogen/recordnreplay/recorder.hpp"
click node_replay_api "https://github.com/team4205/projectnitro/blob/main/include/nitrogen/recordnreplay/replayer.hpp"
click node_record_format "https://github.com/team4205/projectnitro/blob/main/include/nitrogen/recordnreplay/codec.hpp"
click node_storage "https://github.com/team4205/projectnitro/blob/main/include/nitrogen/Storage.hpp"
click node_record_ui "https://github.com/team4205/projectnitro/blob/main/src/main.cpp"
click node_motor_api "https://github.com/team4205/projectnitro/blob/main/include/pros/motor_group.hpp"
click node_pros_api "https://github.com/team4205/projectnitro/blob/main/include/api.h"

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_lifecycle,node_opcontrol,node_autonomous,node_actions,node_profiles,node_hooks toneBlue
class node_recording_api,node_replay_api,node_record_format,node_storage,node_record_ui,node_sd_card toneAmber
class node_motor_api,node_pros_api toneMint
class node_operator,node_controller toneIndigo
```

## Components

### Robot control

- [Lifecycle hooks](https://github.com/team4205/projectnitro/blob/main/src/main.cpp): `src/main.cpp`
- [Operator control](https://github.com/team4205/projectnitro/blob/main/src/main.cpp): `src/main.cpp`
- [Autonomous mode](https://github.com/team4205/projectnitro/blob/main/src/main.cpp): `src/main.cpp`
- [Robot actions](https://github.com/team4205/projectnitro/blob/main/src/actions.cpp): `src/actions.cpp`
- [Robot profiles](https://github.com/team4205/projectnitro/blob/main/src/profiles.cpp): `src/profiles.cpp`
- [Robot hooks](https://github.com/team4205/projectnitro/blob/main/src/hooks.cpp): `src/hooks.cpp`

### Match recording

- [Recorder](https://github.com/team4205/projectnitro/blob/main/include/nitrogen/recordnreplay/recorder.hpp): `include/nitrogen/recordnreplay/recorder.hpp`
- [Replayer](https://github.com/team4205/projectnitro/blob/main/include/nitrogen/recordnreplay/replayer.hpp): `include/nitrogen/recordnreplay/replayer.hpp`
- [Record codec](https://github.com/team4205/projectnitro/blob/main/include/nitrogen/recordnreplay/codec.hpp): `include/nitrogen/recordnreplay/codec.hpp`
- [SD storage](https://github.com/team4205/projectnitro/blob/main/include/nitrogen/Storage.hpp): `include/nitrogen/Storage.hpp`
- [Recording menu](https://github.com/team4205/projectnitro/blob/main/src/main.cpp): `src/main.cpp`

### PROS platform

- [Motor groups](https://github.com/team4205/projectnitro/blob/main/include/pros/motor_group.hpp): `include/pros/motor_group.hpp`
- [PROS API](https://github.com/team4205/projectnitro/blob/main/include/api.h): `include/api.h`

### Other components

- **Operator**
- **VEX controller**
- **SD card**

## Connections

- Operator → Operator control: controls
- Lifecycle hooks → SD storage: updates run ID (evidence: `src/main.cpp`)
- Lifecycle hooks → Recorder: initializes recording (evidence: `src/main.cpp`)
- Lifecycle hooks → Recorder: attaches controller (evidence: `src/main.cpp`)
- Recording menu → Recorder: starts or stops (evidence: `src/main.cpp`)
- Recorder → SD storage: writes recordings (evidence: `include/nitrogen/recordnreplay/recorder.hpp`)
- Replayer → SD storage: reads recordings
- Recorder → Record codec: encodes frames (evidence: `include/nitrogen/recordnreplay/recorder.hpp`)
- Replayer → Record codec: decodes frames (evidence: `include/nitrogen/recordnreplay/replayer.hpp`)
- Operator control → VEX controller: reads input
- Recorder → VEX controller: samples input
- Operator control → Motor groups: commands motors
- Motor groups → PROS API: uses motor API (evidence: `include/pros/motor_group.hpp`)
- SD storage → SD card: reads and writes (evidence: `include/nitrogen/Storage.hpp`)
