Main Content

setFixedTransform

Set fixed transform properties of joint

Description

setFixedTransform(jointObj,tform) sets the JointToParentTransform property of the rigidBodyJoint object directly with the specified homogenous transformation, tform.

example

setFixedTransform(jointObj,dhparams,"dh") sets the ChildToJointTransform property using Denavit-Hartenberg (DH) parameters. The JointToParentTransform property is set to an identity matrix. DH parameters are given in the order [a alpha d theta].

For revolute joints, the theta input is ignored when specifying the fixed transformation between joints because that angle is dependent on the joint configuration. For prismatic joints, the d input is ignored. For more information, see Rigid Body Tree Robot Model.

setFixedTransform(jointObj,mdhparams,"mdh") sets the JointToParentTransform property using modified DH parameters. The ChildToJointTransform property is set to an identity matrix. Modified DH parameters are given in the order [a alpha d theta].

Examples

collapse all

Use the Denavit-Hartenberg (DH) parameters of the Puma560® robot to build a robot. Each rigid body is added one at a time, with the child-to-parent transform specified by the joint object.

The DH parameters define the geometry of the robot with relation to how each rigid body is attached to its parent. For convenience, setup the parameters for the Puma560 robot in a matrix. The Puma robot is a serial chain manipulator. The DH parameters are relative to the previous line in the matrix, corresponding to the previous joint attachment.

dhparams = [0   	pi/2	0   	0;
            0.4318	0       0       0
            0.0203	-pi/2	0.15005	0;
            0   	pi/2	0.4318	0;
            0       -pi/2	0   	0;
            0       0       0       0];

Create a rigid body tree object to build the robot.

robot = rigidBodyTree;

Create the first rigid body and add it to the robot. To add a rigid body:

  1. Create a rigidBody object and give it a unique name.

  2. Create a rigidBodyJoint object and give it a unique name.

  3. Use setFixedTransform to specify the body-to-body transformation using DH parameters. The last element of the DH parameters, theta, is ignored because the angle is dependent on the joint position.

  4. Call addBody to attach the first body joint to the base frame of the robot.

body1 = rigidBody('body1');
jnt1 = rigidBodyJoint('jnt1','revolute');

setFixedTransform(jnt1,dhparams(1,:),'dh');
body1.Joint = jnt1;

addBody(robot,body1,'base')

Create and add other rigid bodies to the robot. Specify the previous body name when calling addBody to attach it. Each fixed transform is relative to the previous joint coordinate frame.

body2 = rigidBody('body2');
jnt2 = rigidBodyJoint('jnt2','revolute');
body3 = rigidBody('body3');
jnt3 = rigidBodyJoint('jnt3','revolute');
body4 = rigidBody('body4');
jnt4 = rigidBodyJoint('jnt4','revolute');
body5 = rigidBody('body5');
jnt5 = rigidBodyJoint('jnt5','revolute');
body6 = rigidBody('body6');
jnt6 = rigidBodyJoint('jnt6','revolute');

setFixedTransform(jnt2,dhparams(2,:),'dh');
setFixedTransform(jnt3,dhparams(3,:),'dh');
setFixedTransform(jnt4,dhparams(4,:),'dh');
setFixedTransform(jnt5,dhparams(5,:),'dh');
setFixedTransform(jnt6,dhparams(6,:),'dh');

body2.Joint = jnt2;
body3.Joint = jnt3;
body4.Joint = jnt4;
body5.Joint = jnt5;
body6.Joint = jnt6;

addBody(robot,body2,'body1')
addBody(robot,body3,'body2')
addBody(robot,body4,'body3')
addBody(robot,body5,'body4')
addBody(robot,body6,'body5')

Verify that your robot was built properly by using the showdetails or show function. showdetails lists all the bodies in the MATLAB® command window. show displays the robot with a given configuration (home by default). Calls to axis modify the axis limits and hide the axis labels.

showdetails(robot)
--------------------
Robot: (6 bodies)

 Idx    Body Name   Joint Name   Joint Type    Parent Name(Idx)   Children Name(s)
 ---    ---------   ----------   ----------    ----------------   ----------------
   1        body1         jnt1     revolute             base(0)   body2(2)  
   2        body2         jnt2     revolute            body1(1)   body3(3)  
   3        body3         jnt3     revolute            body2(2)   body4(4)  
   4        body4         jnt4     revolute            body3(3)   body5(5)  
   5        body5         jnt5     revolute            body4(4)   body6(6)  
   6        body6         jnt6     revolute            body5(5)   
--------------------
show(robot);
axis([-0.5,0.5,-0.5,0.5,-0.5,0.5])
axis off

Input Arguments

collapse all

rigidBodyJoint object, specified as a handle.

Homogeneous transform, specified as a 4-by-4 matrix. The transform is set to the ChildToJointTransform property. The JointToParentTransform property is set to an identity matrix.

Denavit-Hartenberg (DH) parameters, specified as a four-element vector, [a alpha d theta]. These parameters are used to set the ChildToJointTransform property. The JointToParentTransform property is set to an identity matrix.

The theta input is ignored when specifying the fixed transformation between joints because that angle is dependent on the joint configuration. For more information, see Rigid Body Tree Robot Model.

Modified Denavit-Hartenberg (DH) parameters, specified as a four-element vector, [a alpha d theta]. These parameters are used to set the JointToParentTransform property. The ChildToJointTransform is set to an identity matrix.

The theta input is ignored when specifying the fixed transformation between joints because that angle is dependent on the joint configuration. For more information, see Rigid Body Tree Robot Model.

References

[1] Craig, John J. Introduction to Robotics: Mechanics and Control. Reading, MA: Addison-Wesley, 1989.

[2] Siciliano, Bruno. Robotics: Modelling, Planning and Control. London: Springer, 2009.

Introduced in R2016b