# robotics-lab-ucsb/webbased-robotics-frontend architecture

> Architecture diagram of the GitHub repository robotics-lab-ucsb/webbased-robotics-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/robotics-lab-ucsb/webbased-robotics-frontend
- Repository: https://github.com/robotics-lab-ucsb/webbased-robotics-frontend

## Overview

##### Main Components

a) Frontend Layer:
- React Application (based on TypeScript/Vite setup)
- 3D Rendering Engine (Three.js/WebGL, indicated by .glb/.gltf files)
- User Interface Components:
- Lab Components (/src/labComponents)
- Landing Page (/src/landingPage)
- Settings Interface (/src/settingsPage)
- Task Bar (/src/taskbar)
- AI Assistant (/src/Assisstant)

b) Communication Layer:
- WebSocket Connection (/src/Websocket)
- Real-time Updates Handler
- Context Providers (/src/contexts)

c) Lab Equipment Integration:
- Equipment Controllers
- Real-time Data Synchronization
- Interactive 3D Models (/public directory structure)

d) AI Integration Layer:
- Chat Interface
- AI Assistant System
- Lab Guide Integration

**[User Browser] → [Frontend Application]**
- ↓
**[WebSocket Layer] ←→ [Backend Services]**
- ↓
**[Physical Lab Equipment]**

##### Key Relationships to Highlight

- Bidirectional data flow between frontend and physical lab equipment
- How the AI assistant integrates with both the UI and lab components
- Demonstrate the WebSocket connection's role in real-time updates
- How the 3D models interact with physical equipment data

##### Implementation Details

- Annotations for critical interactions

##### Technical Stack Indicators

- React/TypeScript
- WebSocket
- 3D Rendering (Three.js/WebGL)
- AI Integration
- Real-time Communication Protocols

For this specific project, emphasize:
##### The multi-lab support structure

This will create a comprehensive visualization that accurately represents the system's architecture while maintaining clarity and usefulness for the development team.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Browser
        UA[User Access]
    end

    subgraph Frontend
        RA["React App"]:::frontend
        UI["User Interface"]:::frontend
        LP["Landing Page"]:::frontend
        SI["Settings Interface"]:::frontend
        TB["Task Bar"]:::frontend
        CI["Chat Interface"]:::frontend
        TDE["3D Engine"]:::frontend
    end

    subgraph Communication
        WS["WebSocket Layer"]:::comm
        RU["Real-time Updates"]:::comm
        CP["Context Providers"]:::comm
    end

    subgraph LabEquipment
        EC["Equipment Controllers"]:::lab
        DS["Data Sync"]:::lab
        CS["Camera System"]:::lab
        UI3D["3D Models"]:::lab
        LC["Lab Controls"]:::lab
        UIS["User Interaction System"]:::lab
    end

    subgraph AILayer
        AIS["AI System"]:::ai
        LG["Lab Guide"]:::ai
    end

    %% Connections
    UA --> RA
    RA --> UI
    UI --> LP
    UI --> SI
    UI --> TB
    TB --> CI
    RA --> TDE
    TDE --> UI3D
    WS --> RU
    RU --> CP
    CP --> UI
    EC --> DS
    DS --> WS
    CS --> TDE
    UIS --> TDE
    LC --> CS
    CI --> AIS
    AIS --> LG
    LG --> UI

    %% Click Events
    click RA "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/blob/main/src/App.tsx"
    click AIS "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/blob/main/src/Assisstant/alltogether.tsx"
    click WS "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/blob/main/src/Websocket/experiments/websocketTest.tsx"
    click CP "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/tree/main/src/contexts/"
    click LP "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/blob/main/src/landingPage/homePage/homepage.tsx"
    click SI "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/blob/main/src/settingsPage/settingsPage.tsx"
    click TB "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/blob/main/src/taskbar/taskbar.tsx"
    click CI "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/tree/main/src/taskbar/chatbox/"
    click EC "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/tree/main/src/labComponents/FrankHertzMainComp/"
    click CS "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/blob/main/src/LABS/cameras/lab1Camera.tsx"
    click UI3D "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/tree/main/public/"
    click UIS "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/blob/main/src/raycasters/lab1Raycaster.tsx"
    click LC "https://github.com/Robotics-Lab-UCSB/webbased-robotics-frontend/blob/main/src/miscellaneous/controls/cameracontrol.tsx"

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef comm fill:#2ecc71,stroke:#27ae60,color:white
    classDef lab fill:#e67e22,stroke:#d35400,color:white
    classDef ai fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        F[Frontend]:::frontend
        C[Communication]:::comm
        L[Lab Equipment]:::lab
        A[AI Components]:::ai
    end
```
