# avery320/ros_docker_gui architecture

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

- Interactive diagram: https://gitdiagram.com/avery320/ros_docker_gui
- Repository: https://github.com/avery320/ros_docker_gui

## Overview

##### Project Type & Purpose
- This is a container-based ROS Noetic desktop environment with VNC and noVNC support.
- It provides one or more Docker Compose profiles (founROS, hiwin_dev) for different robotics development scenarios.
- Key use cases: GUI access to ROS workspace via browser or VNC client; development inside VSCode devcontainer.

##### File Structure
- Dockerfile & entrypoint.sh at project root define the base image (Ubuntu 20.04 + ROS Noetic + system tools + ROS packages).
- docker_compose/founROS and docker_compose/hiwin_dev each contain a docker-compose.yml and .devcontainer config, defining container services, ports, volumes, and devcontainer settings.
- README outlines ports (5901 VNC, 8080 noVNC), default credentials, workspace mount, and core packages.

##### README Insights
- The built image installs: tigervnc-server, supervisor, ROS desktop, industrial robot simulators, rviz, gazebo.
- Workspace is pre-configured at /home/ROS/workspace and mapped from local ./workspace.
- Provides browser-based noVNC client and supports VSCode “Reopen in Container.”

##### Main Components & Their Relationships
a. Host Machine
– Runs Docker Engine / Docker Compose
– Hosts local workspace directory (./workspace)
– Provides network endpoints (localhost:5901, localhost:8080)
b. Docker Image (“ros-desktop”)
– Base OS: Ubuntu 20.04
– System tools (supervisor, tini, git, curl, etc.)
– ROS Noetic desktop + industrial robot packages (Gazebo, RViz, MoveIt, etc.)
– VNC server (tigervnc) + noVNC web client
– Entrypoint script configures user, starts supervisor
c. Containers (per docker-compose profile)
– Service definitions for founROS or hiwin_dev
– Volume mount: host ./workspace → /home/ROS/workspace
– Port mappings: 5901/tcp (VNC), 8080/tcp (noVNC)
– Environment variables: ROS_DISTRO, USER, PASSWORD, VNC_PORT, NOVNC_PORT, etc.
d. In-Container Services (managed by supervisor)
– X11 desktop session
– VNC server process
– noVNC web server (HTTP)
– ROS core (roscore) and secondary ROS nodes (simulators, controllers)
e. External Clients
– VNC client (connects to host:5901)
– Web browser (HTTP to host:8080/vnc.html)
– VSCode remote container extension (connects via devcontainer.json)

##### Architectural Patterns & Design Principles
- “Single-container multi-service” pattern using supervisor to run VNC, ROS, and simulators in one container.
- Docker Compose for environment profiles—isolates founROS vs hiwin_dev setups.
- Volume mapping for persistent development workspace.
- Devcontainer integration for seamless IDE experience.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Host Machine Boundary
    subgraph "Host Machine" 
        direction TB
        DockerEngine((Docker Engine)):::host
        Workspace["Local Workspace\n./workspace"]:::host
        README["README.md"]:::host
        Gitignore[".gitignore"]:::host
    end

    %% Build and Image
    DockerEngine -->|build: Dockerfile| Image["ros-desktop Image"]:::image
    click Dockerfile "https://github.com/avery320/ros_docker_gui/tree/main/Dockerfile"
    click entrypoint "https://github.com/avery320/ros_docker_gui/blob/main/entrypoint.sh"

    %% Compose Profiles Root
    ComposeRoot["docker_compose/"]:::host
    click ComposeRoot "https://github.com/avery320/ros_docker_gui/tree/main/docker_compose/"

    %% Containers via Compose
    Image -->|deploy via docker-compose| founROS["founROS Container"]:::container
    Image -->|deploy via docker-compose| hiwin_dev["hiwin_dev Container"]:::container
    click founROS "https://github.com/avery320/ros_docker_gui/blob/main/docker_compose/founROS/docker-compose.yml"
    click hiwin_dev "https://github.com/avery320/ros_docker_gui/blob/main/docker_compose/hiwin_dev/docker-compose.yml"
    click dev1 "https://github.com/avery320/ros_docker_gui/blob/main/docker_compose/founROS/.devcontainer/devcontainer.json"
    click dev2 "https://github.com/avery320/ros_docker_gui/blob/main/docker_compose/hiwin_dev/.devcontainer/devcontainer.json"

    %% Volume Mount and Env
    founROS & hiwin_dev -->|mount ./workspace| Workspace
    founROS & hiwin_dev -->|env vars| Supervisor

    %% Container Services Subgraph
    subgraph "ROS Docker Container Services"
        direction TB
        Supervisor["Supervisor"]:::service
        VNC["VNC Server\nTCP 5901"]:::service
        noVNC["noVNC Web\nHTTP 8080"]:::service
        ROSCore["ROS Core"]:::service
        Gazebo["Gazebo"]:::service
        RViz["RViz"]:::service
        MoveIt["MoveIt"]:::service
    end

    founROS & hiwin_dev -->|runs| Supervisor
    Supervisor --> VNC
    Supervisor --> noVNC
    Supervisor --> ROSCore
    Supervisor --> Gazebo
    Supervisor --> RViz
    Supervisor --> MoveIt

    %% External Clients
    ClientVNC["VNC Client"]:::client
    Browser["Web Browser"]:::client
    VSCode["VSCode Remote"]:::client

    ClientVNC -->|TCP 5901| VNC
    Browser -->|HTTP 8080| noVNC
    VSCode -.->|DevContainer| founROS
    VSCode -.->|DevContainer| hiwin_dev

    %% Documentation Clicks
    click README "https://github.com/avery320/ros_docker_gui/blob/main/README.md"
    click Gitignore "https://github.com/avery320/ros_docker_gui/blob/main/.gitignore"

    %% Styles
    classDef host fill:#f0f0f0,stroke:#333,stroke-width:1px;
    classDef image fill:#bbdefb,stroke:#1e88e5,stroke-width:1px;
    classDef container fill:#90caf9,stroke:#1565c0,stroke-width:1px,stroke-dasharray: 5 5;
    classDef service fill:#e3f2fd,stroke:#42a5f5,stroke-width:1px;
    classDef client fill:#c8e6c9,stroke:#2e7d32,stroke-width:1px;
```
