extends Object3D
An object representing a robot joint.
jointType: stringThe type of joint. Can only be the URDF types of joints.
readonly angle: numberThe current position or angle for joint.
name: stringThe name of the joint.
axis: Vector3The axis described for the joint.
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: booleanWhether or not to ignore the joint limits when setting a the joint position.
mimicJoints: Array<URDFMimicJoint>A list of joints which mimic this joint. These joints are updated whenever this joint is.
setJointValue( ...values: number | null ): booleanSets 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.
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: stringThe name of the joint which this joint mimics.
offset: number = 0Specifies the offset to add in the formula above. Defaults to 0 (radians for revolute joints, meters for prismatic joints).
multiplier: number = 1Specifies the multiplicative factor in the formula above. Defaults to 1.0.
extends Object3D
An object representing a robot link.
name: stringThe name of the link.
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.
extends URDFLink
Object that describes the URDF Robot.
robotName: stringThe 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: Object<string, URDFJoint>A dictionary of jointName : URDFJoint with all joints in the robot.
colliders: Object<string, Object3D>A dictionary of colliderName : Object3D with all collision nodes in the robot.
visual: Object<string, Object3D>A dictionary of visualName : Object3D with all visual nodes in the robot.
frames: Object<string, Object3D>A dictionary of all the named frames in the robot including links, joints, colliders, and visual.
setJointValue( name: string, ...angle: number ): booleanSets the joint value of the joint with the given name. Returns true if the joint changed.
setJointValues( jointValueDictionary: Object ): booleanSets the joint values for all the joints in the dictionary indexed by joint name. Returns true if a joint changed.
Loads and builds the specified URDF robot in THREE.js.
constructor( manager: LoadingManager )Constructor. Manager is used for transforming load URLs and tracking downloads.
loadAsync( urdfpath: string ): Promise<URDFRobot>Promise-wrapped version of load.
load(
urdfpath: string,
onComplete: ( robot: URDFRobot ) => void,
onProgress: () => void,
onError: ( error: Error ) => void
): voidLoads 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( urdfContent: string | Document | Element ): URDFRobotParses 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.
A custom HTML element that loads and displays a URDF robot model in a THREE.js scene.
// 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: stringCorresponds to the package parameter in URDFLoader.load.
urdf: stringCorresponds to the urdfpath parameter in URDFLoader.load.
ignoreLimits: booleanWhether or not the display should ignore the joint limits specified in the model when updating angles.
up: stringThe axis to associate with "up" in THREE.js. Values can be [+-][XYZ].
displayShadow: booleanWhether or not to render the shadow under the robot.
ambientColor: stringThe color of the ambient light specified with css colors.
autoRedraw: booleanAutomatically redraw the model every frame instead of waiting to be dirtied.
noAutoRecenter: booleanRecenter the camera only after loading the model.
jointValues: ObjectSets or gets the jointValues of the robot as a dictionary of joint-name to radian pairs.
redraw(): voidDirty the renderer so the element will redraw next frame.
recenter(): voidRecenter the camera to the model and redraw.
setJointValue( jointName: string, ...jointValues: number | null ): voidSets the given joint to the provided value(s). See URDFJoint.setJointValue.
setJointValues( jointValueDictionary: Object ): voidSets all joint names specified as keys to radian angle value.
List of options available on the URDFLoader class.
packages = '': string | Object | ( pkg: string ) => stringThe 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 = null: ( pathToModel: string, manager: LoadingManager, material: Material, onComplete: ( obj: Object3D, err: Error ) => void ) => voidAn 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 = null: ObjectAn optional object with the set of options to pass to the fetch function call used to load the URDF file.
workingPath = '': stringThe path to load geometry relative to. Defaults to the path relative to the loaded URDF file.
parseVisual = true: booleanAn optional value that can be used to enable / disable loading meshes for links from the visual nodes. Defaults to true.
parseCollision = false: booleanAn optional value that can be used to enable / disable loading meshes for links from the collision nodes. Defaults to false.