# kalacademynp/sunfounder_picar-v architecture

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

- Interactive diagram: https://gitdiagram.com/kalacademynp/sunfounder_picar-v
- Repository: https://github.com/kalacademynp/sunfounder_picar-v

## Overview

The product is a Raspberry Pi video car controlled either by a PyQt desktop client or a browser. The main workflow is user login/connection, issuing movement or camera commands to the Django server, and viewing the camera stream; calibration is a separate control stage. The server dispatches car and camera actions and starts MJPG-streamer. The tree also contains a ball-tracking script and I²C helper, but their relationship to the control workflow is not shown. Unsampled routes and templates are represented only where the README or shown source supports them.

Main entry points: [`remote_control/remote_control/views.py`](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/views.py) (Control Views), [`client/client.py`](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/client/client.py) (Client UI), [`remote_control/remote_control/driver/camera.py`](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/driver/camera.py) (Camera Control), [`mjpg-streamer/mjpg_streamer.c`](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/mjpg-streamer/mjpg_streamer.c) (MJPG Streamer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop Client"]
  node_client_ui["Client UI<br/>[client.py]"]
  node_client_assets["Client Assets<br/>[icons_rc.py]"]
end

subgraph group_server["Web Server"]
  node_django_routes["HTTP Routes<br/>[urls.py]"]
  node_web_views["Control Views<br/>[views.py]"]
  node_web_pages["Browser Pages"]
  node_django_settings["Server Settings<br/>[settings.py]"]
end

subgraph group_hardware["Car Hardware"]
  node_camera_control["Camera Control<br/>[camera.py]"]
  node_car_motors["Wheel Control<br/>[views.py]"]
  node_camera_offsets[("Camera Offsets")]
end

subgraph group_video["Video Streaming"]
  node_stream_driver["Stream Driver<br/>[stream.py]"]
  node_mjpg_core["MJPG Streamer<br/>[mjpg_streamer.c]"]
  node_mjpg_header["Plugin Interface<br/>[mjpg_streamer.h]"]
  node_stream_web["Stream Web UI<br/>[index.html]"]
end

subgraph group_utilities["Additional Runtime"]
  node_ball_tracker["Ball Tracker<br/>[ball_tracker.py]"]
  node_i2c_helper["I²C Helper<br/>[i2cHelper.py]"]
end

node_operator(("Operator"))
node_camera(("Camera Device"))
node_car(("Car Hardware"))

node_operator -->|"uses"| node_client_ui
node_client_ui -->|"loads assets"| node_client_assets
node_client_ui -.->|"sends commands"| node_web_views
node_operator -->|"uses browser"| node_web_pages
node_django_routes -->|"routes requests"| node_web_views
node_web_views -->|"renders pages"| node_web_pages
node_django_settings -->|"configures routing"| node_django_routes
node_web_views -->|"dispatches camera"| node_camera_control
node_web_views -->|"dispatches movement"| node_car_motors
node_camera_control -->|"reads and writes"| node_camera_offsets
node_camera_control -.->|"drives servos"| node_car
node_car_motors -.->|"drives wheels"| node_car
node_web_views -->|"starts stream"| node_stream_driver
node_stream_driver -->|"launches streamer"| node_mjpg_core
node_mjpg_core -->|"uses interface"| node_mjpg_header
node_mjpg_core -.->|"captures video"| node_camera
node_stream_web -.->|"presents stream"| node_camera

click node_client_ui "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/client/client.py"
click node_client_assets "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/client/icons_rc.py"
click node_django_routes "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/urls.py"
click node_web_views "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/views.py"
click node_web_pages "https://github.com/kalacademynp/sunfounder_picar-v/tree/master/remote_control/remote_control/templates/templates"
click node_django_settings "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/settings.py"
click node_camera_control "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/driver/camera.py"
click node_car_motors "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/views.py"
click node_camera_offsets "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/driver/config"
click node_stream_driver "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/driver/stream.py"
click node_mjpg_core "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/mjpg-streamer/mjpg_streamer.c"
click node_mjpg_header "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/mjpg-streamer/mjpg_streamer.h"
click node_stream_web "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/mjpg-streamer/www/index.html"
click node_ball_tracker "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/ball_track/ball_tracker.py"
click node_i2c_helper "https://github.com/kalacademynp/sunfounder_picar-v/blob/master/i2cHelper.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_client_ui,node_client_assets toneBlue
class node_django_routes,node_web_views,node_web_pages,node_django_settings toneAmber
class node_camera_control,node_car_motors,node_camera_offsets toneMint
class node_stream_driver,node_mjpg_core,node_mjpg_header,node_stream_web toneRose
class node_ball_tracker,node_i2c_helper,node_operator,node_camera,node_car toneIndigo
```

## Components

### Desktop Client

- [Client UI](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/client/client.py): `client/client.py`
- [Client Assets](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/client/icons_rc.py): `client/icons_rc.py`

### Web Server

- [HTTP Routes](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/urls.py): `remote_control/remote_control/urls.py`
- [Control Views](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/views.py): `remote_control/remote_control/views.py`
- [Browser Pages](https://github.com/kalacademynp/sunfounder_picar-v/tree/master/remote_control/remote_control/templates/templates): `remote_control/remote_control/templates/templates`
- [Server Settings](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/settings.py): `remote_control/remote_control/settings.py`

### Car Hardware

- [Camera Control](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/driver/camera.py): `remote_control/remote_control/driver/camera.py`
- [Wheel Control](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/views.py): `remote_control/remote_control/views.py`
- [Camera Offsets](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/driver/config): `remote_control/remote_control/driver/config`

### Video Streaming

- [Stream Driver](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/remote_control/remote_control/driver/stream.py): `remote_control/remote_control/driver/stream.py`
- [MJPG Streamer](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/mjpg-streamer/mjpg_streamer.c): `mjpg-streamer/mjpg_streamer.c`
- [Plugin Interface](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/mjpg-streamer/mjpg_streamer.h): `mjpg-streamer/mjpg_streamer.h`
- [Stream Web UI](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/mjpg-streamer/www/index.html): `mjpg-streamer/www/index.html`

### Additional Runtime

- [Ball Tracker](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/ball_track/ball_tracker.py): `ball_track/ball_tracker.py`
- [I²C Helper](https://github.com/kalacademynp/sunfounder_picar-v/blob/master/i2cHelper.py): `i2cHelper.py`

### Other components

- **Operator**
- **Camera Device**
- **Car Hardware**

## Connections

- Operator → Client UI: uses (evidence: `README.md`)
- Client UI → Client Assets: loads assets (evidence: `client/client.py`)
- Client UI → Control Views: sends commands (evidence: `README.md`)
- Operator → Browser Pages: uses browser (evidence: `README.md`)
- HTTP Routes → Control Views: routes requests (evidence: `remote_control/remote_control/urls.py`)
- Control Views → Browser Pages: renders pages (evidence: `remote_control/remote_control/views.py`)
- Server Settings → HTTP Routes: configures routing (evidence: `remote_control/remote_control/settings.py`)
- Control Views → Camera Control: dispatches camera (evidence: `remote_control/remote_control/views.py`)
- Control Views → Wheel Control: dispatches movement (evidence: `remote_control/remote_control/views.py`)
- Camera Control → Camera Offsets: reads and writes (evidence: `remote_control/remote_control/driver/camera.py`)
- Camera Control → Car Hardware: drives servos
- Wheel Control → Car Hardware: drives wheels
- Control Views → Stream Driver: starts stream (evidence: `remote_control/remote_control/views.py`)
- Stream Driver → MJPG Streamer: launches streamer (evidence: `remote_control/remote_control/driver/stream.py`)
- MJPG Streamer → Plugin Interface: uses interface (evidence: `mjpg-streamer/mjpg_streamer.c`)
- MJPG Streamer → Camera Device: captures video
- Stream Web UI → Camera Device: presents stream
