# inner-king/elrobot-digital-twin architecture

> Architecture diagram of the GitHub repository inner-king/elrobot-digital-twin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/inner-king/elrobot-digital-twin
- Repository: https://github.com/inner-king/elrobot-digital-twin

## Overview

ElRobot Digital Twin combines a browser robot console with an iPhone-based spatial twin. The main workflow is browser commands through the server to the servo arm, while camera frames stream into live point-cloud display, reconstruction, and object recognition; users can then select objects for planned and simulated pick-and-place execution. The graph preserves the documented calibration, registration, completion, object-model, and virtual-scene capabilities. Relationships involving unsampled code are included only where the README or source index documents them.

Main entry points: [`grasp/manager.py`](https://github.com/inner-king/elrobot-digital-twin/blob/main/grasp/manager.py) (Grasp Manager), [`server.py`](https://github.com/inner-king/elrobot-digital-twin/blob/main/server.py) (Arm Server), [`camera/stream.py`](https://github.com/inner-king/elrobot-digital-twin/blob/main/camera/stream.py) (Camera Stream), [`static/index.html`](https://github.com/inner-king/elrobot-digital-twin/blob/main/static/index.html) (Web Console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Robot Console"]
  node_browser["Web Console<br/>[index.html]"]
  node_backend["Arm Server<br/>[server.py]"]
  node_calibration["Calibration Manager<br/>[server.py]"]
end

subgraph group_camera["Camera And Mapping"]
  node_stream["Camera Stream<br/>[stream.py]"]
  node_reconstruction["TSDF Reconstruction<br/>[recon.py]"]
  node_completion["Mesh Completion<br/>[complete.py]"]
  node_detection["Object Detection<br/>[detect.py]"]
  node_object_model["Object Models<br/>[objmodel.py]"]
end

subgraph group_grasp["Grasp And Motion"]
  node_grasp_manager["Grasp Manager<br/>[manager.py]"]
  node_planner["Grasp Planner<br/>[planner.py]"]
  node_simulator["Physics Prediction<br/>[sim.py]"]
  node_motion["Motion Timeline<br/>[motion.py]"]
end

subgraph group_virtual["Virtual Devices"]
  node_virtual_bus["Virtual Servo Bus<br/>[virtual.py]"]
  node_virtual_camera["Virtual Camera<br/>[virtual.py]"]
  node_kitchen["Kitchen Scene<br/>[virtual_kitchen.py]"]
end

node_operator(("Operator"))
node_servo["ST3215 Bus"]
node_camera_client["iPhone Stream"]

node_operator -->|"uses"| node_browser
node_browser -->|"sends commands"| node_backend
node_backend -->|"streams state"| node_browser
node_backend -->|"polls and commands"| node_servo
node_backend -->|"loads and saves"| node_calibration
node_backend -->|"serves camera"| node_stream
node_camera_client -->|"sends frames"| node_stream
node_stream -->|"streams point cloud"| node_browser
node_stream -->|"submits frames"| node_reconstruction
node_stream -->|"submits frames"| node_detection
node_reconstruction -->|"completes meshes"| node_completion
node_detection -->|"generates models"| node_object_model
node_reconstruction -->|"gets labels"| node_detection
node_backend -->|"routes commands"| node_grasp_manager
node_browser -->|"sends grasp commands"| node_grasp_manager
node_grasp_manager -->|"plans grasp"| node_planner
node_grasp_manager -->|"predicts outcome"| node_simulator
node_grasp_manager -->|"executes timeline"| node_motion
node_grasp_manager -->|"reads scene"| node_reconstruction
node_simulator -->|"uses timeline"| node_motion
node_grasp_manager -->|"executes motion"| node_servo
node_grasp_manager -->|"supports virtual arm"| node_virtual_bus
node_stream -->|"supports virtual feed"| node_virtual_camera
node_kitchen -->|"extends camera"| node_virtual_camera
node_simulator -.->|"updates virtual scene"| node_virtual_camera

click node_browser "https://github.com/inner-king/elrobot-digital-twin/blob/main/static/index.html"
click node_backend "https://github.com/inner-king/elrobot-digital-twin/blob/main/server.py"
click node_calibration "https://github.com/inner-king/elrobot-digital-twin/blob/main/server.py"
click node_stream "https://github.com/inner-king/elrobot-digital-twin/blob/main/camera/stream.py"
click node_reconstruction "https://github.com/inner-king/elrobot-digital-twin/blob/main/camera/recon.py"
click node_completion "https://github.com/inner-king/elrobot-digital-twin/blob/main/camera/complete.py"
click node_detection "https://github.com/inner-king/elrobot-digital-twin/blob/main/camera/detect.py"
click node_object_model "https://github.com/inner-king/elrobot-digital-twin/blob/main/camera/objmodel.py"
click node_grasp_manager "https://github.com/inner-king/elrobot-digital-twin/blob/main/grasp/manager.py"
click node_planner "https://github.com/inner-king/elrobot-digital-twin/blob/main/grasp/planner.py"
click node_simulator "https://github.com/inner-king/elrobot-digital-twin/blob/main/grasp/sim.py"
click node_motion "https://github.com/inner-king/elrobot-digital-twin/blob/main/grasp/motion.py"
click node_virtual_bus "https://github.com/inner-king/elrobot-digital-twin/blob/main/virtual.py"
click node_virtual_camera "https://github.com/inner-king/elrobot-digital-twin/blob/main/virtual.py"
click node_kitchen "https://github.com/inner-king/elrobot-digital-twin/blob/main/virtual_kitchen.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_browser,node_backend,node_calibration toneBlue
class node_stream,node_reconstruction,node_completion,node_detection,node_object_model toneAmber
class node_grasp_manager,node_planner,node_simulator,node_motion toneMint
class node_virtual_bus,node_virtual_camera,node_kitchen toneRose
class node_operator,node_servo,node_camera_client toneIndigo
```

## Components

### Robot Console

- [Web Console](https://github.com/inner-king/elrobot-digital-twin/blob/main/static/index.html): `static/index.html`
- [Arm Server](https://github.com/inner-king/elrobot-digital-twin/blob/main/server.py): `server.py`
- [Calibration Manager](https://github.com/inner-king/elrobot-digital-twin/blob/main/server.py): `server.py`

### Camera And Mapping

- [Camera Stream](https://github.com/inner-king/elrobot-digital-twin/blob/main/camera/stream.py): `camera/stream.py`
- [TSDF Reconstruction](https://github.com/inner-king/elrobot-digital-twin/blob/main/camera/recon.py): `camera/recon.py`
- [Mesh Completion](https://github.com/inner-king/elrobot-digital-twin/blob/main/camera/complete.py): `camera/complete.py`
- [Object Detection](https://github.com/inner-king/elrobot-digital-twin/blob/main/camera/detect.py): `camera/detect.py`
- [Object Models](https://github.com/inner-king/elrobot-digital-twin/blob/main/camera/objmodel.py): `camera/objmodel.py`

### Grasp And Motion

- [Grasp Manager](https://github.com/inner-king/elrobot-digital-twin/blob/main/grasp/manager.py): `grasp/manager.py`
- [Grasp Planner](https://github.com/inner-king/elrobot-digital-twin/blob/main/grasp/planner.py): `grasp/planner.py`
- [Physics Prediction](https://github.com/inner-king/elrobot-digital-twin/blob/main/grasp/sim.py): `grasp/sim.py`
- [Motion Timeline](https://github.com/inner-king/elrobot-digital-twin/blob/main/grasp/motion.py): `grasp/motion.py`

### Virtual Devices

- [Virtual Servo Bus](https://github.com/inner-king/elrobot-digital-twin/blob/main/virtual.py): `virtual.py`
- [Virtual Camera](https://github.com/inner-king/elrobot-digital-twin/blob/main/virtual.py): `virtual.py`
- [Kitchen Scene](https://github.com/inner-king/elrobot-digital-twin/blob/main/virtual_kitchen.py): `virtual_kitchen.py`

### Other components

- **Operator**
- **ST3215 Bus**
- **iPhone Stream**

## Connections

- Operator → Web Console: uses (evidence: `README.md`)
- Web Console → Arm Server: sends commands (evidence: `README.md`)
- Arm Server → Web Console: streams state (evidence: `README.md`)
- Arm Server → ST3215 Bus: polls and commands (evidence: `README.md`)
- Arm Server → Calibration Manager: loads and saves (evidence: `server.py`)
- Arm Server → Camera Stream: serves camera (evidence: `server.py`)
- iPhone Stream → Camera Stream: sends frames (evidence: `README.md`)
- Camera Stream → Web Console: streams point cloud (evidence: `README.md`)
- Camera Stream → TSDF Reconstruction: submits frames (evidence: `camera/stream.py`)
- Camera Stream → Object Detection: submits frames (evidence: `camera/stream.py`)
- TSDF Reconstruction → Mesh Completion: completes meshes (evidence: `camera/recon.py`)
- Object Detection → Object Models: generates models (evidence: `camera/detect.py`)
- TSDF Reconstruction → Object Detection: gets labels (evidence: `camera/recon.py`)
- Arm Server → Grasp Manager: routes commands (evidence: `server.py`)
- Web Console → Grasp Manager: sends grasp commands (evidence: `grasp/manager.py`)
- Grasp Manager → Grasp Planner: plans grasp (evidence: `grasp/manager.py`)
- Grasp Manager → Physics Prediction: predicts outcome (evidence: `grasp/manager.py`)
- Grasp Manager → Motion Timeline: executes timeline (evidence: `grasp/manager.py`)
- Grasp Manager → TSDF Reconstruction: reads scene (evidence: `grasp/manager.py`)
- Physics Prediction → Motion Timeline: uses timeline (evidence: `grasp/sim.py`)
- Grasp Manager → ST3215 Bus: executes motion (evidence: `README.md`)
- Grasp Manager → Virtual Servo Bus: supports virtual arm (evidence: `README.md`)
- Camera Stream → Virtual Camera: supports virtual feed (evidence: `camera/stream.py`)
- Kitchen Scene → Virtual Camera: extends camera (evidence: `virtual_kitchen.py`)
- Physics Prediction → Virtual Camera: updates virtual scene
