urdf-loaders

urdf-loader

URDFJoint

extends Object3D

An object representing a robot joint.

.jointType

jointType: string

The type of joint. Can only be the URDF types of joints.

.angle

readonly angle: number

The current position or angle for joint.

.name

name: string

The name of the joint.

.axis

axis: Vector3

The axis described for the joint.

.limit

limit: {
	lower = 0: number,
	upper = 0: number,
	effort = 0: number,
	velocity = 0: number
}

An object containing the lower and upper position constraints, as well as the effort and velocity limits for the joint. All fields default to zero if not specified in the URDF.

.ignoreLimits

ignoreLimits: boolean

Whether or not to ignore the joint limits when setting a the joint position.

.mimicJoints

mimicJoints: Array<URDFMimicJoint>

A list of joints which mimic this joint. These joints are updated whenever this joint is.

.setJointValue

setJointValue( ...values: number | null ): boolean

Sets the joint value(s) for the given joint. The interpretation of the value depends on the joint type. If the joint value specifies an angle it must be in radians. If the value specifies a distance, it must be in meters. Passing null for any component of the value will skip updating that particular component.

Returns true if the joint or any of its mimicking joints changed.

URDFMimicJoint

extends URDFJoint

An object representing a robot joint which mimics another existing joint. The value of this joint can be computed as value = multiplier * other_joint_value + offset.

.mimicJoint

mimicJoint: string

The name of the joint which this joint mimics.

.offset

offset: number = 0

Specifies the offset to add in the formula above. Defaults to 0 (radians for revolute joints, meters for prismatic joints).

.multiplier

multiplier: number = 1

Specifies the multiplicative factor in the formula above. Defaults to 1.0.

extends Object3D

An object representing a robot link.

.name

name: string

The name of the link.

.inertial

inertial: {
	mass = 0: number,
	origin: {
		xyz: Array<number>,
		rpy: Array<number>
	},
	inertia: {
		ixx = 0: number,
		ixy = 0: number,
		ixz = 0: number,
		iyy = 0: number,
		iyz = 0: number,
		izz = 0: number
	}
}

The inertial properties of the link parsed from the <inertial> element. All fields default to zero if not specified in the URDF.

URDFRobot

extends URDFLink

Object that describes the URDF Robot.

.robotName

robotName: string

The name of the robot described in the <robot> tag.

links: Object<string, URDFLink>

A dictionary of linkName : URDFLink with all links in the robot.

.joints

joints: Object<string, URDFJoint>

A dictionary of jointName : URDFJoint with all joints in the robot.

.colliders

colliders: Object<string, Object3D>

A dictionary of colliderName : Object3D with all collision nodes in the robot.

.visual

visual: Object<string, Object3D>

A dictionary of visualName : Object3D with all visual nodes in the robot.

.frames

frames: Object<string, Object3D>

A dictionary of all the named frames in the robot including links, joints, colliders, and visual.

.setJointValue

setJointValue( name: string, ...angle: number ): boolean

Sets the joint value of the joint with the given name. Returns true if the joint changed.

.setJointValues

setJointValues( jointValueDictionary: Object ): boolean

Sets the joint values for all the joints in the dictionary indexed by joint name. Returns true if a joint changed.

URDFLoader

Loads and builds the specified URDF robot in THREE.js.

.constructor

constructor( manager: LoadingManager )

Constructor. Manager is used for transforming load URLs and tracking downloads.

.loadAsync

loadAsync( urdfpath: string ): Promise<URDFRobot>

Promise-wrapped version of load.

.load

load(
	urdfpath: string,
	onComplete: ( robot: URDFRobot ) => void,
	onProgress: () => void,
	onError: ( error: Error ) => void
): void

Loads and builds the specified URDF robot in THREE.js. Takes a path to load the urdf file from, a func to call when the robot has loaded, and a set of options.

.parse

parse( urdfContent: string | Document | Element ): URDFRobot

Parses URDF content and returns the robot model. Takes an XML string to parse and a set of options. If the XML document has already been parsed using DOMParser then either the returned Document or root Element can be passed into this function in place of the string, as well.

Note that geometry will not necessarily be loaded when the robot is returned.

URDFViewer

A custom HTML element that loads and displays a URDF robot model in a THREE.js scene.

events

// Fires when the URDF has changed and a new one is starting to load.
{ type: 'urdf-change' }

// Fires when the `ignore-limits` attribute changes.
{ type: 'ignore-limits-change' }

// Fires when the URDF has finished loading and getting processed.
{ type: 'urdf-processed' }

// Fires when all the geometry has been fully loaded.
{ type: 'geometry-loaded' }

.package

package: string

Corresponds to the package parameter in URDFLoader.load.

.urdf

urdf: string

Corresponds to the urdfpath parameter in URDFLoader.load.

.ignoreLimits

ignoreLimits: boolean

Whether or not the display should ignore the joint limits specified in the model when updating angles.

.up

up: string

The axis to associate with “up” in THREE.js. Values can be [+-][XYZ].

.displayShadow

displayShadow: boolean

Whether or not to render the shadow under the robot.

.ambientColor

ambientColor: string

The color of the ambient light specified with css colors.

.autoRedraw

autoRedraw: boolean

Automatically redraw the model every frame instead of waiting to be dirtied.

.noAutoRecenter

noAutoRecenter: boolean

Recenter the camera only after loading the model.

.jointValues

jointValues: Object

Sets or gets the jointValues of the robot as a dictionary of joint-name to radian pairs.

.redraw

redraw(): void

Dirty the renderer so the element will redraw next frame.

.recenter

recenter(): void

Recenter the camera to the model and redraw.

.setJointValue

setJointValue( jointName: string, ...jointValues: number | null ): void

Sets the given joint to the provided value(s). See URDFJoint.setJointValue.

.setJointValues

setJointValues( jointValueDictionary: Object ): void

Sets all joint names specified as keys to radian angle value.

URDFOptions

List of options available on the URDFLoader class.

.packages

packages = '': string | Object | ( pkg: string ) => string

The path representing the package:// directory(s) to load package:// relative files. If the argument is a string it is used to replace the package:// prefix. To specify multiple packages use an object mapping package names to paths. If set to a function it takes the package name and returns the package path.

.loadMeshCb

loadMeshCb = null: ( pathToModel: string, manager: LoadingManager, material: Material, onComplete: ( obj: Object3D, err: Error ) => void ) => void

An optional function that can be used to override the default mesh loading functionality. The default loader is specified at URDFLoader.defaultMeshLoader. pathToModel is the url to load the model from. manager is the THREE.js LoadingManager used by the URDFLoader. material is the material derived from the URDF <material> tag and should be applied to meshes that have no internally declared material. onComplete is called with the mesh once the geometry has been loaded.

.fetchOptions

fetchOptions = null: Object

An optional object with the set of options to pass to the fetch function call used to load the URDF file.

.workingPath

workingPath = '': string

The path to load geometry relative to. Defaults to the path relative to the loaded URDF file.

.parseVisual

parseVisual = true: boolean

An optional value that can be used to enable / disable loading meshes for links from the visual nodes. Defaults to true.

.parseCollision

parseCollision = false: boolean

An optional value that can be used to enable / disable loading meshes for links from the collision nodes. Defaults to false.