An object representing a robot joint.
import { MathUtils } from 'three';
import URDFLoader from 'urdf-loader';
const URL = 'https://raw.githubusercontent.com/gkjohnson/urdf-loaders/master/urdf/T12/urdf/T12_flipped.URDF';
const robot = await new URDFLoader().loadAsync( URL );
const joint = robot.joints[ 'HP1' ];
joint.setJointValue( MathUtils.degToRad( 30 ) );
robot.setJointValue( 'KP1', MathUtils.degToRad( 120 ) );
console.log( joint.jointType, joint.angle, joint.limit.lower, joint.limit.upper );Properties
jointType: string
The type of joint. Can only be the URDF types of joints.
The current position or angle for joint.
name: string
The name of the joint.
The axis described for the joint.
limit: {
lower: number = 0,
upper: number = 0,
effort: number = 0,
velocity: number = 0
}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: boolean
Whether 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.
Methods
setJointValue(
// The joint value components to set, optionally null for no-op
...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.