v0.13.1
urdf-loader
Loads and displays URDF robot description files in three.js, enabling robot visualization and simulation in web-based interfaces. Used at NASA JPL for rover state visualization in Mars operations tools.
roboticsnasavisualization
import { HemisphereLight } from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import URDFLoader from 'urdf-loader';
// scene, camera and renderer are initialized here
const URL = 'https://raw.githubusercontent.com/gkjohnson/m2020-urdf-models/main/rover/m2020.urdf';
scene.add( new HemisphereLight( 0xffffff, 0x444444, 3 ) );
camera.position.set( 3, 2.2, 3.7 );
const loader = new URDFLoader();
// this robot's meshes are glTF, which the default mesh loader doesn't handle
loader.loadMeshCb = ( path, manager, material, done ) => {
new GLTFLoader( manager ).load( path, gltf => done( gltf.scene ), null, error => done( null, error ) );
};
const robot = await loader.loadAsync( URL );
// URDF is Z up
robot.rotation.x = Math.PI / 2;
robot.position.set( - 0.8, - 1.05, 0 );
scene.add( robot );Install
npm install urdf-loaderChangelog
0.13.1
Fixed
- Typescript types
0.13.0
Added
- JSDoc annotations on all public API surface (URDFLoader, URDFClasses, URDFViewer).
docs:buildscript and generatedAPI.mdreference documentation.
Changed
- URDFLoader: Add "material" argument to "loadMeshCb" as the third parameter (breaking change).
- README: Replaced inline API documentation with a link to
API.md.
0.12.7
Added
- Support for "inertial" data.
Fixed
- Make "function" check more robust for "packages" field
- Add missing error callback for default geometry loaders