Home > . > eul2r.m

eul2r

PURPOSE ^

EUL2R Convert Euler angles to homogeneous transformation

SYNOPSIS ^

function r = eul2r(phi, theta, psi)

DESCRIPTION ^

EUL2R Convert Euler angles to homogeneous transformation

     TR = EUL2TR([PHI THETA PSI])
     TR = EUL2TR(PHI, THETA, PSI)

 Returns a homogeneous tranformation for the specified Euler angles.  These 
 correspond to rotations about the Z, Y, Z axes respectively.

 See also: TR2EUL, RPY2TR

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

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