# binh705-engineer/camera-obstacle-avoidance-robot architecture

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

- Interactive diagram: https://gitdiagram.com/binh705-engineer/camera-obstacle-avoidance-robot
- Repository: https://github.com/binh705-engineer/camera-obstacle-avoidance-robot

## Overview

This repository is a camera-guided obstacle-avoidance robot: the desktop app displays a camera feed, lets the operator select an obstacle color, estimates obstacle density across three image regions, chooses a movement state, and sends motor commands. The Python excerpt documents the ESP32-CAM and motor-controller firmware roles and their connection. The firmware files are present in the tree but were not excerpted, so their internal behavior is not expanded here; the empty README provides no additional evidence.

Main entry points: [`algo_v7_v3.py`](https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py) (Obstacle vision), [`code_camv2/code_camv2.ino`](https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/code_camv2/code_camv2.ino) (ESP32-CAM firmware), [`dk_dong_co_wifi_v3/dk_dong_co_wifi_v3.ino`](https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/dk_dong_co_wifi_v3/dk_dong_co_wifi_v3.ino) (Motor Wi-Fi firmware)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop controller"]
  node_app["Controller UI<br/>[algo_v7_v3.py]"]
  node_link["Robot link<br/>[algo_v7_v3.py]"]
  node_logs["Run logging<br/>[algo_v7_v3.py]"]
end

subgraph group_vision["Vision and navigation"]
  node_stream["Camera stream<br/>[algo_v7_v3.py]"]
  node_vision_process["Obstacle vision<br/>[algo_v7_v3.py]"]
  node_avoidance["Avoidance states<br/>[algo_v7_v3.py]"]
end

subgraph group_robot["Robot firmware"]
  node_camera_fw["ESP32-CAM firmware<br/>[code_camv2.ino]"]
  node_motor_fw["Motor Wi-Fi firmware"]
end

node_operator(("Operator"))

node_operator -->|"selects obstacle"| node_app
node_camera_fw -->|"provides video"| node_stream
node_stream -->|"supplies frames"| node_vision_process
node_app -->|"processes frames"| node_vision_process
node_vision_process -->|"passes densities"| node_avoidance
node_vision_process -->|"sends motor commands"| node_link
node_link -->|"HTTP drive commands"| node_motor_fw
node_vision_process -->|"updates display"| node_app
node_app -->|"writes run data"| node_logs

click node_app "https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py"
click node_stream "https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py"
click node_vision_process "https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py"
click node_avoidance "https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py"
click node_link "https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py"
click node_logs "https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py"
click node_camera_fw "https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/code_camv2/code_camv2.ino"
click node_motor_fw "https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/dk_dong_co_wifi_v3/dk_dong_co_wifi_v3.ino"

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_app,node_link,node_logs toneBlue
class node_stream,node_vision_process,node_avoidance toneAmber
class node_camera_fw,node_motor_fw toneMint
class node_operator toneIndigo
```

## Components

### Desktop controller

- [Controller UI](https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py): `algo_v7_v3.py`
- [Robot link](https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py): `algo_v7_v3.py`
- [Run logging](https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py): `algo_v7_v3.py`

### Vision and navigation

- [Camera stream](https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py): `algo_v7_v3.py`
- [Obstacle vision](https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py): `algo_v7_v3.py`
- [Avoidance states](https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/algo_v7_v3.py): `algo_v7_v3.py`

### Robot firmware

- [ESP32-CAM firmware](https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/code_camv2/code_camv2.ino): `code_camv2/code_camv2.ino`
- [Motor Wi-Fi firmware](https://github.com/binh705-engineer/camera-obstacle-avoidance-robot/blob/main/dk_dong_co_wifi_v3/dk_dong_co_wifi_v3.ino): `dk_dong_co_wifi_v3/dk_dong_co_wifi_v3.ino`

### Other components

- **Operator**

## Connections

- Operator → Controller UI: selects obstacle (evidence: `algo_v7_v3.py`)
- ESP32-CAM firmware → Camera stream: provides video (evidence: `algo_v7_v3.py`)
- Camera stream → Obstacle vision: supplies frames (evidence: `algo_v7_v3.py`)
- Controller UI → Obstacle vision: processes frames (evidence: `algo_v7_v3.py`)
- Obstacle vision → Avoidance states: passes densities (evidence: `algo_v7_v3.py`)
- Obstacle vision → Robot link: sends motor commands (evidence: `algo_v7_v3.py`)
- Robot link → Motor Wi-Fi firmware: HTTP drive commands (evidence: `algo_v7_v3.py`)
- Obstacle vision → Controller UI: updates display (evidence: `algo_v7_v3.py`)
- Controller UI → Run logging: writes run data (evidence: `algo_v7_v3.py`)
