DENAVIT Compute an homogeneous transform matrix DH in terms of Denavit-Hartenberg's parameters of the robot A = DH(TETA, D, A, alpha) returns a 4 x 4 homogeneous transformation matrix as a function of the the Denavit-Hartenberg's parameters D, alpha, A and THETA for link i. A = DH(robot, q, i) is an abbreviated call to return a 4x4 homogeneous transformation matrix as a function of the robot parameters robot.DH.theta, d, a, alpha the joint values q and the transformation i. For i = 1, the function returns the transformation matrix T01, for i=2, T02..., etc. See also DIRECTKINEMATIC. Author: Arturo Gil. Universidad Miguel Hernández de Elche. email: arturo.gil@umh.es date: 01/01/2012
0001 % DENAVIT Compute an homogeneous transform matrix DH in terms of 0002 % Denavit-Hartenberg's parameters of the robot 0003 % 0004 % A = DH(TETA, D, A, alpha) returns a 4 x 4 homogeneous 0005 % transformation matrix as a function of the the Denavit-Hartenberg's 0006 % parameters D, alpha, A and THETA for link i. 0007 % 0008 % A = DH(robot, q, i) is an abbreviated call to return a 4x4 0009 % homogeneous transformation matrix as a function of the robot parameters 0010 % robot.DH.theta, d, a, alpha the joint values q and the transformation i. 0011 % For i = 1, the function returns the transformation matrix T01, for i=2, 0012 % T02..., etc. 0013 % 0014 % See also DIRECTKINEMATIC. 0015 % 0016 % Author: Arturo Gil. Universidad Miguel Hernández de Elche. 0017 % email: arturo.gil@umh.es date: 01/01/2012 0018 0019 % Copyright (C) 2012, by Arturo Gil Aparicio 0020 % 0021 % This file is part of ARTE (A Robotics Toolbox for Education). 0022 % 0023 % ARTE is free software: you can redistribute it and/or modify 0024 % it under the terms of the GNU Lesser General Public License as published by 0025 % the Free Software Foundation, either version 3 of the License, or 0026 % (at your option) any later version. 0027 % 0028 % ARTE is distributed in the hope that it will be useful, 0029 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0030 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0031 % GNU Lesser General Public License for more details. 0032 % 0033 % You should have received a copy of the GNU Leser General Public License 0034 % along with ARTE. If not, see <http://www.gnu.org/licenses/>. 0035 function A=dh(theta, d, a, alpha) 0036 switch nargin 0037 case 3 %abbreviated call to denavit 0038 %arrange arguments 0039 robot = theta; 0040 q = d; 0041 i = a; 0042 0043 theta = eval(robot.DH.theta); 0044 d = eval(robot.DH.d); 0045 a = eval(robot.DH.a); 0046 alpha = eval(robot.DH.alpha); 0047 0048 theta = theta(i); 0049 d = d(i); 0050 a = a(i); 0051 alpha = alpha(i); 0052 0053 A=[cos(theta) -cos(alpha)*sin(theta) sin(alpha)*sin(theta) a*cos(theta); 0054 sin(theta) cos(alpha)*cos(theta) -sin(alpha)*cos(theta) a*sin(theta); 0055 0 sin(alpha) cos(alpha) d; 0056 0 0 0 1]; 0057 case 4 %full 4 argumen call to denavit 0058 A=[cos(theta) -cos(alpha)*sin(theta) sin(alpha)*sin(theta) a*cos(theta); 0059 sin(theta) cos(alpha)*cos(theta) -sin(alpha)*cos(theta) a*sin(theta); 0060 0 sin(alpha) cos(alpha) d; 0061 0 0 0 1]; 0062 otherwise 0063 disp('ERROR:denavit: uncorrect number of arguments') 0064 end