LINK create a new LINK object A LINK object holds all information related to a robot link such as kinematics of the joint, rigid-body inertial parameters, motor and transmission parameters. L = LINK L = LINK(link) Create a default link, or a clone of the passed link. A = LINK(q) Compute the link transform matrix for the link, given the joint variable q. L = LINK([alpha A theta D]) L =LINK([alpha A theta D sigma]) L =LINK([alpha A theta D sigma offset]) L =LINK([alpha A theta D], CONVENTION) L =LINK([alpha A theta D sigma], CONVENTION) L =LINK([alpha A theta D sigma offset], CONVENTION) If sigma or offset are not provided they default to zero. Offset is a constant amount added to the joint angle variable before forward kinematics and is useful if you want the robot to adopt a 'sensible' pose for zero joint angle configuration. The optional CONVENTION argument is 'standard' for standard D&H parameters or 'modified' for modified D&H parameters. If not specified the default 'standard'. Handling the different kinematic conventions is now hidden within the LINK object. Conceivably all sorts of stuff could live in the LINK object such as graphical models of links and so on. For robot models prior to Toolbox release 5 (pre Matlab objects) the following object constructors are provided. L = LINK(DYN_ROW) create from row of legacy DYN matrix L = LINK(DYN_ROW, CONVENTION) create from row of legacy DYN matrix SEE ALSO: LINK/SUBSREF, LINK/SUBSASGN, SHOWLINK, ROBOT.
0001 %LINK create a new LINK object 0002 % 0003 % A LINK object holds all information related to a robot link such as 0004 % kinematics of the joint, rigid-body inertial parameters, motor and 0005 % transmission parameters. 0006 % 0007 % L = LINK 0008 % L = LINK(link) 0009 % 0010 % Create a default link, or a clone of the passed link. 0011 % 0012 % A = LINK(q) 0013 % 0014 % Compute the link transform matrix for the link, given the joint 0015 % variable q. 0016 % 0017 % L = LINK([alpha A theta D]) 0018 % L =LINK([alpha A theta D sigma]) 0019 % L =LINK([alpha A theta D sigma offset]) 0020 % L =LINK([alpha A theta D], CONVENTION) 0021 % L =LINK([alpha A theta D sigma], CONVENTION) 0022 % L =LINK([alpha A theta D sigma offset], CONVENTION) 0023 % 0024 % If sigma or offset are not provided they default to zero. Offset is a 0025 % constant amount added to the joint angle variable before forward kinematics 0026 % and is useful if you want the robot to adopt a 'sensible' pose for zero 0027 % joint angle configuration. 0028 % 0029 % The optional CONVENTION argument is 'standard' for standard D&H parameters 0030 % or 'modified' for modified D&H parameters. If not specified the default 0031 % 'standard'. 0032 % Handling the different kinematic conventions is now hidden within the LINK 0033 % object. 0034 % 0035 % Conceivably all sorts of stuff could live in the LINK object such as 0036 % graphical models of links and so on. 0037 % 0038 % For robot models prior to Toolbox release 5 (pre Matlab objects) the 0039 % following object constructors are provided. 0040 % 0041 % L = LINK(DYN_ROW) create from row of legacy DYN matrix 0042 % L = LINK(DYN_ROW, CONVENTION) create from row of legacy DYN matrix 0043 % 0044 % SEE ALSO: LINK/SUBSREF, LINK/SUBSASGN, SHOWLINK, ROBOT. 0045 0046 % Copyright (C) 1999-2008, by Peter I. Corke 0047 % 0048 % This file is part of The Robotics Toolbox for Matlab (RTB). 0049 % 0050 % RTB is free software: you can redistribute it and/or modify 0051 % it under the terms of the GNU Lesser General Public License as published by 0052 % the Free Software Foundation, either version 3 of the License, or 0053 % (at your option) any later version. 0054 % 0055 % RTB is distributed in the hope that it will be useful, 0056 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0057 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0058 % GNU Lesser General Public License for more details. 0059 % 0060 % You should have received a copy of the GNU Leser General Public License 0061 % along with RTB. If not, see <http://www.gnu.org/licenses/>. 0062 0063 function l = link(dh, convention) 0064 0065 0066 if nargin == 0, 0067 % create an 'empty' link 0068 l.alpha = 0; 0069 l.A = 0; 0070 l.theta = 0; 0071 l.D = 0; 0072 l.sigma = 0; 0073 l.mdh = 0; 0074 l.offset = 0; 0075 0076 % it's a legacy DYN matrix 0077 l.m = []; 0078 l.r = []; 0079 v = []; 0080 l.I = []; 0081 l.Jm = []; 0082 l.G = []; 0083 l.B = 0; 0084 l.Tc = [0 0]; 0085 l.qlim = []; 0086 0087 l = class(l, 'link'); 0088 0089 elseif isa(dh, 'link') 0090 % clone passed link 0091 l = dh; 0092 elseif length(dh) <= 6, 0093 % legacy DH matrix 0094 % link([alpha A theta D sigma]) 0095 0096 if length(dh) < 4, 0097 error('must provide <alpha A theta D> params'); 0098 end 0099 l.alpha = dh(1); 0100 l.A = dh(2); 0101 l.theta = dh(3); 0102 l.D = dh(4); 0103 l.sigma = 0; 0104 if length(dh) >= 5, 0105 l.sigma = dh(5); 0106 end 0107 if nargin > 1 0108 if strncmp(convention, 'mod', 3) == 1, 0109 l.mdh = 1; 0110 elseif strncmp(convention, 'sta', 3) == 1, 0111 l.mdh = 0; 0112 else 0113 error('convention must be modified or standard'); 0114 end 0115 else 0116 l.mdh = 0; % default to standard D&H 0117 end 0118 l.offset = 0; 0119 if length(dh) >= 6, 0120 l.offset = dh(6); 0121 end 0122 0123 % we know nothing about the dynamics 0124 l.m = []; 0125 l.r = []; 0126 v = []; 0127 l.I = []; 0128 l.Jm = []; 0129 l.G = []; 0130 l.B = 0; 0131 l.Tc = [0 0]; 0132 l.qlim = []; 0133 0134 l = class(l, 'link'); 0135 else 0136 % legacy DYN matrix 0137 0138 l.alpha = dh(1); 0139 l.A = dh(2); 0140 l.theta = dh(3); 0141 l.D = dh(4); 0142 if length(dh) == 4, 0143 l.sigma = 0; 0144 else 0145 l.sigma = dh(5); 0146 end 0147 l.mdh = 0; % default to standard D&H 0148 l.offset = 0; 0149 0150 % it's a legacy DYN matrix 0151 l.m = dh(6); 0152 l.r = dh(7:9)'; % a column vector 0153 v = dh(10:15); 0154 l.I = [ v(1) v(4) v(6) 0155 v(4) v(2) v(5) 0156 v(6) v(5) v(3)]; 0157 if length(dh) > 15, 0158 l.Jm = dh(16); 0159 end 0160 if length(dh) > 16, 0161 l.G = dh(17); 0162 else 0163 l.G = 1; 0164 end 0165 if length(dh) > 17, 0166 l.B = dh(18); 0167 else 0168 l.B = 0.0; 0169 end 0170 if length(dh) > 18, 0171 l.Tc = dh(19:20); 0172 else 0173 l.Tc = [0 0]; 0174 end 0175 l.qlim = []; 0176 if nargin > 1 0177 if strncmp(convention, 'mod', 3) == 1, 0178 l.mdh = 1; 0179 elseif strncmp(convention, 'sta', 3) == 1, 0180 l.mdh = 0; 0181 else 0182 error('convention must be modified or standard'); 0183 end 0184 else 0185 l.mdh = 0; % default to standard D&H 0186 end 0187 l = class(l, 'link'); 0188 end