# itsacchu/ai-ar-navigation architecture

> Architecture diagram of the GitHub repository itsacchu/ai-ar-navigation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/itsacchu/ai-ar-navigation
- Repository: https://github.com/itsacchu/ai-ar-navigation

## Overview

##### Project type and purpose
- This is a self-contained AR navigation system for visually impaired users that runs on edge devices (mobile/embedded).
- It fuses video, audio, and inertial sensors; performs real-time AI inference; and outputs audio and haptic cues.

##### File structure
- main.py
– Entry point that orchestrates module initialization and the processing loop.
- depth_estimator.py
– Wraps the MiDaS model for per-frame distance estimation.
- object_detector.py
– Hosts YOLOv8/EfficientDet inference and traffic-sign OCR via EasyOCR.
- navigation_system.py
– Implements A* path planning, dynamic recalculation with OSM API, and safety buffering.
- requirements.txt / .gitignore / README.md
– Define dependencies and high-level architecture overview.

##### README for additional insights
- Four core functional modules:
1. Input Processing (video stabilization, ASR, Kalman-based sensor fusion)
2. Perception (object detection, depth estimation, path segmentation)
3. Navigation (A* planning, geospatial processing, dynamic updates)
4. User Interface (TTS via ElevenLabs, haptic feedback)
- Latency and accuracy targets (<150 ms, >90% object detection, <3 m deviation).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Controller
    MainController["Main Controller\n(orchestration loop)"]:::module

    %% Hardware Layer
    subgraph "Hardware Layer"
        direction TB
        Camera["Camera"]:::sensor
        Microphone["Microphone"]:::sensor
        GPS["GPS"]:::sensor
        Accelerometer["Accelerometer"]:::sensor
        Gyroscope["Gyroscope"]:::sensor
    end

    %% Input Processing Module
    subgraph "Input Processing Module"
        direction TB
        VideoStab["Video Stabilization\n(OpenCV)"]:::module
        ASR["ASR (Voice Commands)"]:::module
        SensorFusion["Sensor Fusion\n(Kalman Filter)"]:::module
    end

    %% Perception Module
    subgraph "Perception Module"
        direction TB
        ObjDetect["Object Detection & OCR"]:::module
        DepthEst["Depth Estimation"]:::module
        PathSeg["Path Segmentation"]:::module
    end

    %% Navigation Module
    subgraph "Navigation Module"
        direction TB
        PathPlan["A* Path Planning"]:::module
        OSMInt["OSM API Integration"]:::module
        SafetyBuf["Safety Buffering"]:::module
    end

    %% User Interface Module
    subgraph "User Interface Module"
        direction TB
        TTS["TTS Generation"]:::module
        Haptic["Haptic Feedback"]:::output
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Whisper["Whisper/DeepSpeech ASR"]:::external
        ElevenLabs["ElevenLabs TTS"]:::external
        OSMAPI["OpenStreetMap API"]:::external
    end

    %% Actuators
    subgraph "Actuators"
        direction TB
        Speaker["Speaker"]:::output
        Vibrator["Vibration Motor"]:::output
    end

    %% Data Flows
    Camera -->|raw video| VideoStab
    Microphone -->|audio stream| ASR
    GPS --> SensorFusion
    Accelerometer --> SensorFusion
    Gyroscope --> SensorFusion

    VideoStab -->|stabilized frames| ObjDetect
    VideoStab -->|frames| DepthEst
    SensorFusion -->|pose estimates| ObjDetect
    SensorFusion -->|pose estimates| DepthEst

    ASR -->|text commands| MainController
    ObjDetect -->|object list| MainController
    DepthEst -->|depth maps| MainController
    MainController -->|inputs| PathSeg

    PathSeg -->|path mask| PathPlan
    PathPlan -->|route plan| SafetyBuf
    SafetyBuf -->|safe route| TTS
    SafetyBuf -->|obstacle alerts| Haptic

    TTS -->|audio cues| Speaker
    Haptic -->|vibration signals| Vibrator

    %% Loop orchestration
    MainController --> VideoStab
    SafetyBuf --> MainController

    %% External integrations
    Whisper -->|ASR requests| ASR
    ElevenLabs -->|TTS requests| TTS
    OSMAPI -->|map data| OSMInt
    OSMInt -->|map tiles & routes| PathPlan

    %% Click Events
    click MainController "https://github.com/itsacchu/ai-ar-navigation/blob/main/main.py"
    click DepthEst "https://github.com/itsacchu/ai-ar-navigation/blob/main/depth_estimator.py"
    click ObjDetect "https://github.com/itsacchu/ai-ar-navigation/blob/main/object_detector.py"
    click PathPlan "https://github.com/itsacchu/ai-ar-navigation/blob/main/navigation_system.py"

    %% Styles
    classDef sensor fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef module fill:#90EE90,stroke:#000,stroke-width:1px
    classDef external fill:#FFA500,stroke:#000,stroke-width:1px
    classDef output fill:#DDA0DD,stroke:#000,stroke-width:1px
```
