How lgadiego001/rock-climbing-robot works
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: main.ts App entry · renderer.ts Renderer · vite.config.ts Vite config · public Runtime assets
Components 20
Browser viewer
Three.js/Vite application for interactive climbing-robot visualization.
- App entry · Bootstraps the browser app and wires top-level scene setup.
src/main.ts - Renderer · Creates and manages the core WebGL scene and render loop.
src/core/renderer.ts - Camera · Configures the viewport camera used for scene inspection.
src/core/camera.ts - Orbit control · Mouse/touch scene navigation for inspecting models and routes.
src/core/orbit-control.ts - Control panel · Runtime controls for visualization parameters and robot/scene options.
src/core/gui.ts - Wall model · Climbing wall and route geometry used by the browser viewer.
src/wall.ts - Kinematics · General pose and transform logic for the climbing robot.
src/kinematics.ts - TaiwanBear kin · Dedicated kinematics path for the TaiwanBear robot model.
src/taiwanbear_kinematics.ts - Fwd kinematics · Offline forward-kinematics support used alongside the TypeScript model.
src/fwd_kinematics.py - Vertex shader · Custom vertex shading for the visualization pipeline.
src/shaders/vertex.glsl - Fragment shader · 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 · Physics simulation scenes and robot/wall compositions.
mujoco - MuJoCo assets · Collision and visual meshes used by MuJoCo scenes.
mujoco/assets - Sim scripts · 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 · Browser-facing meshes, fonts, and route text loaded at runtime.
public - Source assets · Authoring geometry used to generate runtime meshes and simulation meshes.
assets - Mesh sources · Additional source models and intermediate geometry formats.
models
Tooling
Build, lint, and CI configuration.
- Vite config · Development server and bundling configuration for the browser app.
vite.config.ts - ESLint · Code-quality and style rules for the TypeScript codebase.
eslint.config.js - CI workflow · Automated checks and build workflow.
.github/workflows/main.yml
Connections 26
- 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.