INERTIA Compute the manipulator inertia matrix INERTIA(ROBOT, Q) Returns the n x n symmetric inertia matrix which relates joint torque to joint acceleration. ROBOT describes the manipulator dynamics and kinematics, and Q is an n element vector of joint state. See also: RNE, CINERTIA, ITORQUE, CORIOLIS, GRAVLOAD.
0001 %INERTIA Compute the manipulator inertia matrix 0002 % 0003 % INERTIA(ROBOT, Q) 0004 % 0005 % Returns the n x n symmetric inertia matrix which relates joint torque 0006 % to joint acceleration. 0007 % ROBOT describes the manipulator dynamics and kinematics, and Q is 0008 % an n element vector of joint state. 0009 % 0010 % See also: RNE, CINERTIA, ITORQUE, CORIOLIS, GRAVLOAD. 0011 0012 % Copyright (C) 1993-2008, by Peter I. Corke 0013 % 0014 % This file is part of The Robotics Toolbox for Matlab (RTB). 0015 % 0016 % RTB is free software: you can redistribute it and/or modify 0017 % it under the terms of the GNU Lesser General Public License as published by 0018 % the Free Software Foundation, either version 3 of the License, or 0019 % (at your option) any later version. 0020 % 0021 % RTB is distributed in the hope that it will be useful, 0022 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0023 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0024 % GNU Lesser General Public License for more details. 0025 % 0026 % You should have received a copy of the GNU Leser General Public License 0027 % along with RTB. If not, see <http://www.gnu.org/licenses/>. 0028 0029 function M = inertia(robot, q) 0030 n = robot.n; 0031 0032 if numel(q) == robot.n, 0033 q = q(:)'; 0034 end 0035 0036 M = zeros(n,n,0); 0037 for Q = q', 0038 m = rne(robot, ones(n,1)*Q', zeros(n,n), eye(n), [0;0;0]); 0039 M = cat(3, M, m); 0040 end