# lgadiego001/rock-climbing-robot architecture

> Architecture diagram of the GitHub repository lgadiego001/rock-climbing-robot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lgadiego001/rock-climbing-robot
- Repository: https://github.com/lgadiego001/rock-climbing-robot

## Overview

1. **Overall shape**
   - This repository is split into a browser-based visualization app and an offline robotics/simulation asset pipeline.
   - The main product is a Three.js + Vite front end that renders climbing-related robots and wall/route geometry in the browser.

2. **Frontend runtime boundary**
   - The browser app lives under `src/` and is bootstrapped from `src/main.ts` with `index.html` and Vite config.
   - TypeScript is the application language; the codebase is intentionally function-oriented rather than class-heavy.

3. **Rendering subsystem**
   - `src/core/renderer.ts`, `camera.ts`, and `orbit-control.ts` provide the scene, camera, and interaction plumbing around Three.js.
   - `src/shaders/vertex.glsl` and `fragment.glsl` indicate custom GPU shading for parts of the visualization, bundled through Vite’s GLSL support.

4. **Interaction and UI**
   - `src/core/gui.ts` wires Tweakpane controls into the app.
   - This is the main runtime control surface for changing scene parameters, robot configuration, or visualization options without editing code.

5. **Domain logic: wall, routes, and robot kinematics**
   - `src/wall.ts` is the likely center for climbing-wall setup and route geometry.
   - `src/kinematics.ts`, `src/taiwanbear_kinematics.ts`, and `src/fwd_kinematics.py` represent the robot pose/transform logic, with a dedicated path for the “TaiwanBear” model.
   - `src/taiwanbear_matrices.txt` suggests precomputed transformation data is consumed by the visualization layer.

6. **Runtime assets used by the browser**
   - `public/` contains the assets actually served at runtime: GLB models, route text files, and fonts.
   - `public/route1.txt`, `route2.txt`, and `route3.txt` are important data inputs for wall/route rendering or path selection.
   - `public/climbing holds*.glb` and `public/taiwan bear*.glb` are the browser-friendly meshes loaded by the app.

7. **Authoring assets vs runtime assets**
   - `models/` and `assets/` contain source geometry in Blender/OBJ/MTL formats.
   - These are authoring assets, not the primary browser runtime format; they likely feed export steps that produce the GLB files in `public/`.

8. **MuJoCo simulation boundary**
   - The `mujoco/` directory is a separate robotics simulation world with XML scene definitions like `op3.xml`, `taiwanbear.xml`, `wall.xml`, and combined scenes such as `bear_on_wall.xml`.
   - `mujoco/assets/` contains STL meshes for the OP3 robot, the TaiwanBear robot, and wall/jug geometry used by MuJoCo.
   - This part of the repo is for physics simulation, collision checking, and scene composition rather than browser rendering.

9. **Offline simulation scripts**
   - `simulations/` contains Python scripts such as `bear_walking.py`, `bear_on_wall.py`, and `bear_head.py`.
   - These scripts appear to drive or validate robot motion in MuJoCo and may generate logs or model merges, as hinted by `simulations/merged_model.xml` and `MUJOCO_LOG.TXT`.

10. **Data flow between subsystems**
   - The typical flow is: author meshes and scenes in Blender/OBJ/STL → export runtime GLB assets and MuJoCo meshes → run Python/MuJoCo simulations to validate motion and kinematics → feed route text files and precomputed matrices into the browser app → render and interact with the result in Three.js.
   - The browser app is the presentation layer; MuJoCo/Python is the physics and verification layer.

11. **Tooling and build system**
   - Vite is the app bundler/dev server, with TypeScript compilation and GLSL asset handling.
   - ESLint is configured for code quality.
   - GitHub Actions (`.github/workflows/main.yml`) likely runs CI checks or builds.

12. **What an architecture diagram should show**
   - A clear split between the **interactive web viewer** and the **offline robotics/simulation assets/scripts**.
   - Within the web viewer, show separate boxes for **rendering**, **UI/controls**, and **kinematics/domain logic**.
   - Show static asset inputs flowing from `public/` into the renderer, and show MuJoCo/Python as an upstream producer/validator of those assets and motion parameters.

Main entry points: [`src/main.ts`](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/main.ts) (App entry), [`src/core/renderer.ts`](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/core/renderer.ts) (Renderer), [`vite.config.ts`](https://github.com/lgadiego001/rock-climbing-robot/blob/main/vite.config.ts) (Vite config), [`public`](https://github.com/lgadiego001/rock-climbing-robot/tree/main/public) (Runtime assets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser viewer"]
  node_main["App entry<br/>TypeScript boot<br/>[main.ts]"]
  node_renderer["Renderer<br/>Three.js scene<br/>[renderer.ts]"]
  node_camera["Camera<br/>view control<br/>[camera.ts]"]
  node_orbit["Orbit control<br/>interaction<br/>[orbit-control.ts]"]
  node_gui["Control panel<br/>Tweakpane UI<br/>[gui.ts]"]
  node_wall["Wall model<br/>domain geometry<br/>[wall.ts]"]
  node_kin["Kinematics<br/>robot pose math<br/>[kinematics.ts]"]
  node_tbkin["TaiwanBear kin<br/>robot model math"]
  node_fwdpy["Fwd kinematics<br/>Python helper<br/>[fwd_kinematics.py]"]
  node_shaderv["Vertex shader<br/>GLSL<br/>[vertex.glsl]"]
  node_shaderf["Fragment shader<br/>GLSL<br/>[fragment.glsl]"]
end

subgraph group_sim["Simulation pipeline"]
  node_mujoco[("MuJoCo worlds<br/>XML scenes")]
  node_mujocoassets[("MuJoCo assets<br/>STL meshes")]
  node_simscripts["Sim scripts<br/>Python runs"]
end

subgraph group_assets["Asset sources"]
  node_public[("Runtime assets<br/>served assets")]
  node_authoring[("Source assets<br/>blender/mesh sources")]
  node_models[("Mesh sources<br/>blender/obj sources")]
end

subgraph group_tooling["Tooling"]
  node_vite["Vite config<br/>build config<br/>[vite.config.ts]"]
  node_eslint["ESLint<br/>lint config<br/>[eslint.config.js]"]
  node_ci["CI workflow<br/>GitHub Actions<br/>[main.yml]"]
end

node_main -->|"starts"| node_renderer
node_main -->|"sets up"| node_camera
node_main -->|"enables"| node_orbit
node_main -->|"mounts"| node_gui
node_main -->|"loads"| node_wall
node_main -->|"uses"| node_kin
node_main -->|"uses"| node_tbkin
node_renderer -->|"compiles"| node_shaderv
node_renderer -->|"compiles"| node_shaderf
node_renderer -->|"loads"| node_public
node_wall -->|"reads routes"| node_public
node_kin -.->|"matches"| node_fwdpy
node_tbkin -.->|"aligns with"| node_fwdpy
node_fwdpy -.->|"validates against"| node_mujoco
node_authoring -.->|"exports to"| node_public
node_models -.->|"exports to"| node_public
node_authoring -.->|"exports to"| node_mujocoassets
node_mujocoassets -->|"used by"| node_mujoco
node_simscripts -->|"drives"| node_mujoco
node_simscripts -->|"uses"| node_mujocoassets
node_vite -->|"bundles"| node_main
node_vite -->|"handles GLSL"| node_shaderv
node_vite -->|"handles GLSL"| node_shaderf
node_eslint -->|"checks"| node_main
node_ci -->|"runs"| node_vite
node_ci -->|"runs"| node_eslint

click node_main "https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/main.ts"
click node_renderer "https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/core/renderer.ts"
click node_camera "https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/core/camera.ts"
click node_orbit "https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/core/orbit-control.ts"
click node_gui "https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/core/gui.ts"
click node_wall "https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/wall.ts"
click node_kin "https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/kinematics.ts"
click node_tbkin "https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/taiwanbear_kinematics.ts"
click node_fwdpy "https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/fwd_kinematics.py"
click node_shaderv "https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/shaders/vertex.glsl"
click node_shaderf "https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/shaders/fragment.glsl"
click node_public "https://github.com/lgadiego001/rock-climbing-robot/tree/main/public"
click node_authoring "https://github.com/lgadiego001/rock-climbing-robot/tree/main/assets"
click node_models "https://github.com/lgadiego001/rock-climbing-robot/tree/main/models"
click node_mujoco "https://github.com/lgadiego001/rock-climbing-robot/tree/main/mujoco"
click node_mujocoassets "https://github.com/lgadiego001/rock-climbing-robot/tree/main/mujoco/assets"
click node_simscripts "https://github.com/lgadiego001/rock-climbing-robot/tree/main/simulations"
click node_vite "https://github.com/lgadiego001/rock-climbing-robot/blob/main/vite.config.ts"
click node_eslint "https://github.com/lgadiego001/rock-climbing-robot/blob/main/eslint.config.js"
click node_ci "https://github.com/lgadiego001/rock-climbing-robot/blob/main/.github/workflows/main.yml"

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_main,node_renderer,node_camera,node_orbit,node_gui,node_wall,node_kin,node_tbkin,node_fwdpy,node_shaderv,node_shaderf toneBlue
class node_mujoco,node_mujocoassets,node_simscripts toneAmber
class node_public,node_authoring,node_models toneMint
class node_vite,node_eslint,node_ci toneRose
```

## Components

### Browser viewer

Three.js/Vite application for interactive climbing-robot visualization.

- [App entry](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/main.ts): TypeScript boot · Bootstraps the browser app and wires top-level scene setup. · `src/main.ts`
- [Renderer](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/core/renderer.ts): Three.js scene · Creates and manages the core WebGL scene and render loop. · `src/core/renderer.ts`
- [Camera](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/core/camera.ts): view control · Configures the viewport camera used for scene inspection. · `src/core/camera.ts`
- [Orbit control](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/core/orbit-control.ts): interaction · Mouse/touch scene navigation for inspecting models and routes. · `src/core/orbit-control.ts`
- [Control panel](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/core/gui.ts): Tweakpane UI · Runtime controls for visualization parameters and robot/scene options. · `src/core/gui.ts`
- [Wall model](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/wall.ts): domain geometry · Climbing wall and route geometry used by the browser viewer. · `src/wall.ts`
- [Kinematics](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/kinematics.ts): robot pose math · General pose and transform logic for the climbing robot. · `src/kinematics.ts`
- [TaiwanBear kin](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/taiwanbear_kinematics.ts): robot model math · Dedicated kinematics path for the TaiwanBear robot model. · `src/taiwanbear_kinematics.ts`
- [Fwd kinematics](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/fwd_kinematics.py): Python helper · Offline forward-kinematics support used alongside the TypeScript model. · `src/fwd_kinematics.py`
- [Vertex shader](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/shaders/vertex.glsl): GLSL · Custom vertex shading for the visualization pipeline. · `src/shaders/vertex.glsl`
- [Fragment shader](https://github.com/lgadiego001/rock-climbing-robot/blob/main/src/shaders/fragment.glsl): GLSL · Custom fragment shading for the visualization pipeline. · `src/shaders/fragment.glsl`

### Simulation pipeline

Offline MuJoCo scenes and Python scripts for physics validation and motion work.

- [MuJoCo worlds](https://github.com/lgadiego001/rock-climbing-robot/tree/main/mujoco): XML scenes · Physics simulation scenes and robot/wall compositions. · `mujoco`
- [MuJoCo assets](https://github.com/lgadiego001/rock-climbing-robot/tree/main/mujoco/assets): STL meshes · Collision and visual meshes used by MuJoCo scenes. · `mujoco/assets`
- [Sim scripts](https://github.com/lgadiego001/rock-climbing-robot/tree/main/simulations): Python runs · Offline scripts that drive, validate, or log MuJoCo robot motion. · `simulations`

### Asset sources

Authoring geometry and runtime files consumed by the viewer and simulation.

- [Runtime assets](https://github.com/lgadiego001/rock-climbing-robot/tree/main/public): served assets · Browser-facing meshes, fonts, and route text loaded at runtime. · `public`
- [Source assets](https://github.com/lgadiego001/rock-climbing-robot/tree/main/assets): blender/mesh sources · Authoring geometry used to generate runtime meshes and simulation meshes. · `assets`
- [Mesh sources](https://github.com/lgadiego001/rock-climbing-robot/tree/main/models): blender/obj sources · Additional source models and intermediate geometry formats. · `models`

### Tooling

Build, lint, and CI configuration.

- [Vite config](https://github.com/lgadiego001/rock-climbing-robot/blob/main/vite.config.ts): build config · Development server and bundling configuration for the browser app. · `vite.config.ts`
- [ESLint](https://github.com/lgadiego001/rock-climbing-robot/blob/main/eslint.config.js): lint config · Code-quality and style rules for the TypeScript codebase. · `eslint.config.js`
- [CI workflow](https://github.com/lgadiego001/rock-climbing-robot/blob/main/.github/workflows/main.yml): GitHub Actions · Automated checks and build workflow. · `.github/workflows/main.yml`

## Connections

- App entry → Renderer: starts · App entry initializes rendering and scene composition.
- App entry → Camera: sets up · Bootstrapping wires the viewer camera.
- App entry → Orbit control: enables · Navigation control is attached to the scene.
- App entry → Control panel: mounts · Runtime controls are created during app startup.
- App entry → Wall model: loads · Viewer pulls wall and route geometry into the scene.
- App entry → Kinematics: uses · App relies on core kinematics for robot placement.
- App entry → TaiwanBear kin: uses · TaiwanBear-specific kinematics feed the viewer.
- Renderer → Vertex shader: compiles · Renderer consumes custom vertex shading.
- Renderer → Fragment shader: compiles · Renderer consumes custom fragment shading.
- Renderer → Runtime assets: loads · Scene assets are read from the served public directory.
- Wall model → Runtime assets: reads routes · Route text and wall meshes are loaded at runtime.
- Kinematics → Fwd kinematics: matches · TypeScript and Python kinematics mirror each other.
- TaiwanBear kin → Fwd kinematics: aligns with · TaiwanBear-specific pose math is validated offline.
- Fwd kinematics → MuJoCo worlds: validates against · Forward-kinematics work is checked against simulation scenes.
- Source assets → Runtime assets: exports to · Blender/source geometry is exported into browser-ready meshes.
- Mesh sources → Runtime assets: exports to · Intermediate model formats feed the runtime assets.
- Source assets → MuJoCo assets: exports to · Authoring geometry is also converted for MuJoCo use.
- MuJoCo assets → MuJoCo worlds: used by · Simulation scenes reference robot and wall meshes.
- Sim scripts → MuJoCo worlds: drives · Python scripts execute or inspect MuJoCo scenes.
- Sim scripts → MuJoCo assets: uses · Scripts depend on the simulation asset set.
- Vite config → App entry: bundles · Vite serves and bundles the browser entry point.
- Vite config → Vertex shader: handles GLSL · Build config enables shader imports.
- Vite config → Fragment shader: handles GLSL · Build config enables shader imports.
- ESLint → App entry: checks · Linting covers the TypeScript app code.
- CI workflow → Vite config: runs · CI likely validates builds through the Vite toolchain.
- CI workflow → ESLint: runs · CI includes lint checks.
