Robotics Toolbox for Matlab
1 Transformations% In the field of robotics there are many possible ways of representing
% positions and orientations, but the homogeneous transformation is well
% matched to MATLAB’s powerful tools for matrix manipulation.
% Homogeneous transformations describe the relationships between Cartesian
% coordinate frames in terms of translation and orientation.
% A pure translation of 0.5m in the X direction is represented by
transl(0.5, 0.0, 0.0)
ans =
1.0000 0 0 0.5000
0 1.0000 0 0
0 0 1.0000 0
0 0 0 1.0000
% a rotation of 90degrees about the Y axis by
roty(pi/2)
ans =
0.0000 0 1.0000 0
0 1.0000 0 0
-1.0000 0 0.0000 0
0 0 0 1.0000
% and a rotation of -90degrees about the Z axis by
rotz(-pi/2)
ans =
0.0000 1.0000 0 0
-1.0000 0.0000 0 0
0 0 1.0000 0
0 0 0 1.0000
% these may be concatenated by multiplication
t = transl(0.5, 0.0, 0.0) * roty(pi/2) * rotz(-pi/2)
t =
0.0000 0.0000 1.0000 0.5000
-1.0000 0.0000 0 0
-0.0000 -1.0000 0.0000 0
0 0 0 1.0000
% If this transformation represented the origin of a new coordinate frame with respect
% to the world frame origin (0, 0, 0), that new origin would be given by
t * [0 0 0 1]'
ans =
0.5000
0
0
1.0000
% the orientation of the new coordinate frame may be expressed in terms of