# yeopbuddy/smart-factory-agv architecture

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

- Interactive diagram: https://gitdiagram.com/yeopbuddy/smart-factory-agv
- Repository: https://github.com/yeopbuddy/smart-factory-agv

## Overview

This repository implements a Jetson AGV controller and a separate PySide2 operator dashboard. The principal workflow is camera-driven autonomous steering and color-target detection on the AGV, with Firebase sensor reads and Firestore logging, while MQTT carries telemetry to the dashboard and commands back to the AGV. The dashboard also retrieves logs for GPT analysis and chart generation. Several links are documented by the README; excerpts confirm the sampled calls, but do not expose all controller startup and model details.

Main entry points: [`agv_dashboard.py`](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_dashboard.py) (Dashboard UI), [`agv_controller.py`](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py) (Sensor Collection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agv["AGV Runtime"]
  node_camera["Camera Input<br/>[agv_controller.py]"]
  node_steering["Autonomous Steering<br/>[agv_controller.py]"]
  node_color["Color Detection<br/>[agv_controller.py]"]
  node_manual["Manual Controls<br/>[agv_controller.py]"]
  node_sensing["Sensor Collection<br/>[agv_controller.py]"]
  node_controller_mqtt["MQTT Controller<br/>[agv_controller.py]"]
end

subgraph group_cloud["Cloud Services"]
  node_rtdb[("Firebase RTDB")]
  node_firestore[("Firestore Logs")]
  node_broker["MQTT Broker"]
end

subgraph group_dashboard["Operator Dashboard"]
  node_dashboard["Dashboard UI<br/>[agv_dashboard.py]"]
  node_dashboard_mqtt["MQTT Messaging<br/>[agv_dashboard.py]"]
  node_log_query["Log Retrieval<br/>[agv_dashboard.py]"]
end

subgraph group_ai["Analysis"]
  node_gpt_analysis["GPT Analysis<br/>[agv_dashboard.py]"]
  node_chart_generation["Chart Generation<br/>[agv_dashboard.py]"]
end

node_operator(("Operator"))
node_openai["OpenAI API"]

node_camera -->|"supplies frames"| node_steering
node_camera -->|"supplies frames"| node_color
node_steering -->|"updates controls"| node_manual
node_manual -->|"accepts input"| node_operator
node_operator -->|"uses"| node_dashboard
node_dashboard -->|"issues commands"| node_dashboard_mqtt
node_dashboard_mqtt -->|"publishes commands"| node_broker
node_broker -->|"dispatches commands"| node_controller_mqtt
node_controller_mqtt -->|"controls robot"| node_manual
node_sensing -->|"fetches readings"| node_rtdb
node_sensing -->|"writes logs"| node_firestore
node_sensing -->|"publishes telemetry"| node_broker
node_broker -->|"delivers telemetry"| node_dashboard_mqtt
node_dashboard_mqtt -->|"updates display"| node_dashboard
node_dashboard -->|"requests logs"| node_log_query
node_log_query -->|"queries logs"| node_firestore
node_dashboard -->|"submits prompt"| node_gpt_analysis
node_gpt_analysis -->|"requests analysis"| node_openai
node_dashboard -->|"requests visualization"| node_chart_generation
node_chart_generation -->|"requests chart code"| node_openai
node_chart_generation -->|"shows chart"| node_dashboard
node_log_query -.->|"provides log data"| node_gpt_analysis
node_log_query -.->|"provides log data"| node_chart_generation

click node_camera "https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py"
click node_steering "https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py"
click node_color "https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py"
click node_manual "https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py"
click node_sensing "https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py"
click node_controller_mqtt "https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py"
click node_dashboard "https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_dashboard.py"
click node_dashboard_mqtt "https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_dashboard.py"
click node_log_query "https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_dashboard.py"
click node_gpt_analysis "https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_dashboard.py"
click node_chart_generation "https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_dashboard.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_camera,node_steering,node_color,node_manual,node_sensing,node_controller_mqtt toneBlue
class node_rtdb,node_firestore,node_broker toneAmber
class node_dashboard,node_dashboard_mqtt,node_log_query,node_openai toneMint
class node_gpt_analysis,node_chart_generation toneRose
class node_operator toneIndigo
```

## Components

### AGV Runtime

- [Camera Input](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py): `agv_controller.py`
- [Autonomous Steering](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py): `agv_controller.py`
- [Color Detection](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py): `agv_controller.py`
- [Manual Controls](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py): `agv_controller.py`
- [Sensor Collection](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py): `agv_controller.py`
- [MQTT Controller](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_controller.py): `agv_controller.py`

### Cloud Services

- **Firebase RTDB**
- **Firestore Logs**
- **MQTT Broker**

### Operator Dashboard

- [Dashboard UI](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_dashboard.py): `agv_dashboard.py`
- [MQTT Messaging](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_dashboard.py): `agv_dashboard.py`
- [Log Retrieval](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_dashboard.py): `agv_dashboard.py`

### Analysis

- [GPT Analysis](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_dashboard.py): `agv_dashboard.py`
- [Chart Generation](https://github.com/yeopbuddy/smart-factory-agv/blob/main/agv_dashboard.py): `agv_dashboard.py`

### Other components

- **Operator**
- **OpenAI API**

## Connections

- Camera Input → Autonomous Steering: supplies frames (evidence: `README.md`)
- Camera Input → Color Detection: supplies frames (evidence: `README.md`)
- Autonomous Steering → Manual Controls: updates controls (evidence: `agv_controller.py`)
- Manual Controls → Operator: accepts input (evidence: `README.md`)
- Operator → Dashboard UI: uses (evidence: `README.md`)
- Dashboard UI → MQTT Messaging: issues commands (evidence: `agv_dashboard.py`)
- MQTT Messaging → MQTT Broker: publishes commands (evidence: `agv_dashboard.py`)
- MQTT Broker → MQTT Controller: dispatches commands (evidence: `README.md`)
- MQTT Controller → Manual Controls: controls robot (evidence: `agv_controller.py`)
- Sensor Collection → Firebase RTDB: fetches readings (evidence: `agv_controller.py`)
- Sensor Collection → Firestore Logs: writes logs (evidence: `agv_controller.py`)
- Sensor Collection → MQTT Broker: publishes telemetry (evidence: `README.md`)
- MQTT Broker → MQTT Messaging: delivers telemetry (evidence: `agv_dashboard.py`)
- MQTT Messaging → Dashboard UI: updates display (evidence: `agv_dashboard.py`)
- Dashboard UI → Log Retrieval: requests logs (evidence: `README.md`)
- Log Retrieval → Firestore Logs: queries logs (evidence: `agv_dashboard.py`)
- Dashboard UI → GPT Analysis: submits prompt (evidence: `README.md`)
- GPT Analysis → OpenAI API: requests analysis (evidence: `agv_dashboard.py`)
- Dashboard UI → Chart Generation: requests visualization (evidence: `agv_dashboard.py`)
- Chart Generation → OpenAI API: requests chart code (evidence: `agv_dashboard.py`)
- Chart Generation → Dashboard UI: shows chart (evidence: `agv_dashboard.py`)
- Log Retrieval → GPT Analysis: provides log data (evidence: `agv_dashboard.py`)
- Log Retrieval → Chart Generation: provides log data (evidence: `agv_dashboard.py`)
