Home > . > rpy2tr.m

rpy2tr

PURPOSE ^

RPY2TR Roll/pitch/yaw to homogenous transform

SYNOPSIS ^

function T = rpy2tr(roll, pitch, yaw)

DESCRIPTION ^

RPY2TR Roll/pitch/yaw to homogenous transform

     TR = RPY2TR([R P Y])
    TR = RPY2TR(R,P,Y)

 Returns a homogeneous tranformation for the specified roll/pitch/yaw angles.
 These correspond to rotations about the X, Y, Z axes respectively, applied
 in the order yaw, pitch, roll.

 NOTE: in previous releases (<8) the angles corresponded to rotations about Z, Y, X.

 See also: TR2RPY, EUL2TR

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %RPY2TR Roll/pitch/yaw to homogenous transform
0002 %
0003 %     TR = RPY2TR([R P Y])
0004 %    TR = RPY2TR(R,P,Y)
0005 %
0006 % Returns a homogeneous tranformation for the specified roll/pitch/yaw angles.
0007 % These correspond to rotations about the X, Y, Z axes respectively, applied
0008 % in the order yaw, pitch, roll.
0009 %
0010 % NOTE: in previous releases (<8) the angles corresponded to rotations about Z, Y, X.
0011 %
0012 % See also: TR2RPY, EUL2TR
0013 
0014 % Copyright (C) 1993-2008, by Peter I. Corke
0015 %
0016 % This file is part of The Robotics Toolbox for Matlab (RTB).
0017 %
0018 % RTB is free software: you can redistribute it and/or modify
0019 % it under the terms of the GNU Lesser General Public License as published by
0020 % the Free Software Foundation, either version 3 of the License, or
0021 % (at your option) any later version.
0022 %
0023 % RTB is distributed in the hope that it will be useful,
0024 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0026 % GNU Lesser General Public License for more details.
0027 %
0028 % You should have received a copy of the GNU Leser General Public License
0029 % along with RTB.  If not, see <http://www.gnu.org/licenses/>.
0030 
0031 function T = rpy2tr(roll, pitch, yaw)
0032     if (nargin == 1),
0033         if numcols(roll) ~= 3,
0034             error('bad arguments')
0035         end
0036         pitch = roll(:,2);
0037         yaw = roll(:,3);
0038         roll = roll(:,1);
0039     end
0040 
0041     if numrows(roll) == 1,
0042         r = rotx(roll) * roty(pitch) * rotz(yaw);
0043         T = r2t(r);
0044     else
0045         for i=1:numrows(roll),
0046             r = rotx(roll(i)) * roty(pitch(i)) * rotz(yaw(i));
0047             T(:,:,i) = r2t(r);
0048         end
0049     end

Generated on Sun 15-Feb-2009 18:09:29 by m2html © 2003