How gkjohnson/urdf-loaders works
Project type and purpose
• This is an open-source URDF (Universal Robot Description Format) loader library that provides two parallel implementations:
• A C# plugin for Unity (under the unity/Assets/URDFLoader folder)
• A JavaScript/TypeScript module for THREE.js (under the javascript folder)
• It ships with example URDF robot models and demo scenes for both environments.
File structure
• Top-level directories:
• javascript/ – Source code, build scripts, tests, and demo pages for the web loader
• unity/ – Unity package containing C# loader code, editor extensions, example scenes and materials
• urdf/ – Repository of URDF files and associated STL meshes (ATHLETE models)
• Configuration and CI:
• .github/workflows – CI for code scanning, builds, tests
• Various linting, Babel, Rollup, Jest config under javascript
README insights
• Purpose: “URDF loading code in both C# for Unity and JavaScript for THREE.js”
• Provides live demo link and license details
Main components & interactions
A. URDF Model Assets
• .URDF files (robot descriptions)
• .STL meshes (geometry for each link)
B. Parsing Layer
• C# URDFLoader.cs + ColladaLite.cs / DAELoader.cs / StlLoader.cs (Unity)
• JavaScript URDFLoader.js + URDFClasses.js (parsing, in JS or TS)
C. Data Model
• In-memory representation of joints, links, visuals, collisions
D. Rendering Layer
• Unity: GameObjects with MeshFilters/MeshRenderers + Editor tool (URDFRobotEditor)
• Web: Three.js scene graph + custom Web Components (urdf-viewer-element, urdf-manipulator-element)
E. Build & Test (JavaScript only)
• Babel → Rollup → UMD / ES module outputs
• Jest unit tests (URDFLoader.test.js, URDFRobot.test.js)
F. Example Apps
• Unity example scenes (LoadRobot.cs, plane material, etc.)
• Web example pages (simple.html, vr.html, bundled index.bundle.html)
Relationships & data flows
1. Developer drops URDF + mesh assets → Parser loads and validates URDF structure
2. Parser hands off to data model classes → constructs joint/link hierarchy
3. Renderer layer consumes data model → constructs visual scene
4. In Unity: Editor script provides Inspector GUI + runtime loader
5. In JS: Web Components wrap Three.js viewer and interactivity (drag-and-drop, VR support)
6. CI pipeline lints code, runs unit tests, and builds bundles for publishing
Architectural patterns & design principles
• Separation of concerns: parsing, data modeling, rendering
• Plugin architecture: editor extension vs runtime loader in Unity
• Modular JS design: ES modules, Web Components for extensibility
• Shared asset library (URDF + meshes) reused across both implementations
Element recommendations
• Blue for core libraries (Parser, Data Model)
• Green for rendering layers (Three.js, Unity)
• Yellow for examples/demos
• Grey for assets/data