v0.3.11
xacro-parser
Javascript-based parser for Xacro robot description files, the macro language used to build modular URDF robot definitions enabling integration with commonly used ROS formats.
roboticsnasaparsing
import { HemisphereLight } from 'three';
import { XacroLoader } from 'xacro-parser';
import URDFLoader from 'urdf-loader';
// scene, camera and renderer are initialized here
const URL = 'https://raw.githubusercontent.com/gkjohnson/xacro-parser/master/test/data/r2_description/robots/r2b.xacro';
const MESHES_URL = 'https://raw.githubusercontent.com/gkjohnson/nasa-urdf-robots/master/r2_description';
scene.add( new HemisphereLight( 0xffffff, 0x444444, 3 ) );
camera.position.set( 2, 1.2, 2.8 );
// these files use older xacro conventions
const xacroLoader = new XacroLoader();
xacroLoader.inOrder = false;
xacroLoader.requirePrefix = false;
xacroLoader.localProperties = false;
xacroLoader.load( URL, xml => {
// the expanded xacro is plain URDF
const urdfLoader = new URDFLoader();
urdfLoader.packages = { r2_description: MESHES_URL };
const robot = urdfLoader.parse( xml );
robot.rotation.x = - Math.PI / 2;
robot.position.y = 0.2;
scene.add( robot );
} );Install
npm install xacro-parserChangelog
0.3.11
Fixed
- Switch to use "expr-eval-fork" from "expr-eval" for security fixes.
0.3.10
Added
- Support for "tau" in expressions.
0.3.9
Added
- Exposed the expression parser so functions can be added and extended.
- Support for dictionary reading in expressions.
- New arguments to the cli.