# sam-garg/neodrive architecture

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

- Interactive diagram: https://gitdiagram.com/sam-garg/neodrive
- Repository: https://github.com/sam-garg/neodrive

## Overview

NeoDrive translates live hand and foot movements into keyboard input for driving simulations. The documented primary workflow runs `main.py`: it reads separate camera feeds, detects hand gestures for steering and gears and foot movement for braking and acceleration, then sends key presses through `keyinput.py` to the game. `steering.py` is a second, distinct runtime implementation that delegates pedal recognition to `pedals.py`. The excerpts show both implementations, but do not establish whether one supersedes the other; the graph keeps them separate.

Main entry points: [`steering.py`](https://github.com/sam-garg/neodrive/blob/main/steering.py) (Alternate controller), [`keyinput.py`](https://github.com/sam-garg/neodrive/blob/main/keyinput.py) (Key simulation), [`main.py`](https://github.com/sam-garg/neodrive/blob/main/main.py) (Primary controller), [`pedals.py`](https://github.com/sam-garg/neodrive/blob/main/pedals.py) (Foot detector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Control runtimes"]
  node_main_runtime["Primary controller<br/>[main.py]"]
  node_steering_runtime["Alternate controller<br/>[steering.py]"]
end

subgraph group_perception["Gesture perception"]
  node_pedal_detection["Foot detector<br/>[pedals.py]"]
end

subgraph group_output["Keyboard output"]
  node_keyboard_input["Key simulation<br/>[keyinput.py]"]
end

node_driver(("Driver"))
node_cameras(("Dual cameras"))
node_game(("Driving game"))

node_driver -->|"moves before"| node_cameras
node_cameras -->|"video frames"| node_main_runtime
node_main_runtime -->|"sends key events"| node_keyboard_input
node_cameras -->|"video frames"| node_steering_runtime
node_steering_runtime -->|"detects gestures"| node_pedal_detection
node_pedal_detection -->|"returns gesture"| node_steering_runtime
node_steering_runtime -->|"sends key events"| node_keyboard_input
node_keyboard_input -->|"simulates keys"| node_game

click node_main_runtime "https://github.com/sam-garg/neodrive/blob/main/main.py"
click node_steering_runtime "https://github.com/sam-garg/neodrive/blob/main/steering.py"
click node_pedal_detection "https://github.com/sam-garg/neodrive/blob/main/pedals.py"
click node_keyboard_input "https://github.com/sam-garg/neodrive/blob/main/keyinput.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_main_runtime,node_steering_runtime toneBlue
class node_pedal_detection toneAmber
class node_keyboard_input toneMint
class node_driver,node_cameras,node_game toneIndigo
```

## Components

### Control runtimes

- [Primary controller](https://github.com/sam-garg/neodrive/blob/main/main.py): `main.py`
- [Alternate controller](https://github.com/sam-garg/neodrive/blob/main/steering.py): `steering.py`

### Gesture perception

- [Foot detector](https://github.com/sam-garg/neodrive/blob/main/pedals.py): `pedals.py`

### Keyboard output

- [Key simulation](https://github.com/sam-garg/neodrive/blob/main/keyinput.py): `keyinput.py`

### Other components

- **Driver**
- **Dual cameras**
- **Driving game**

## Connections

- Driver → Dual cameras: moves before (evidence: `README.md`)
- Dual cameras → Primary controller: video frames (evidence: `main.py`)
- Primary controller → Key simulation: sends key events (evidence: `main.py`)
- Dual cameras → Alternate controller: video frames (evidence: `steering.py`)
- Alternate controller → Foot detector: detects gestures (evidence: `steering.py`)
- Foot detector → Alternate controller: returns gesture (evidence: `steering.py`)
- Alternate controller → Key simulation: sends key events (evidence: `steering.py`)
- Key simulation → Driving game: simulates keys (evidence: `keyinput.py`)
