GRAVLOAD Compute the gravity loading on manipulator joints TAUG = GRAVLOAD(ROBOT, Q) TAUG = GRAVLOAD(ROBOT, Q, GRAV) Compute the joint gravity loading for the manipulator ROBOT in the configuration Q. If Q is a row vector, the result is a row vector of joint torques. If Q is a matrix, each row is interpretted as a joint state vector, and the result is a matrix each row being the corresponding joint torques. Gravity vector can be given explicitly using the GRAV argument, otherwise it defaults to the value of the ROBOT object. See also: ROBOT, RNE, ITORQUE, CORIOLIS.
0001 %GRAVLOAD Compute the gravity loading on manipulator joints 0002 % 0003 % TAUG = GRAVLOAD(ROBOT, Q) 0004 % TAUG = GRAVLOAD(ROBOT, Q, GRAV) 0005 % 0006 % Compute the joint gravity loading for the manipulator ROBOT in the 0007 % configuration Q. 0008 % 0009 % If Q is a row vector, the result is a row vector of joint torques. 0010 % If Q is a matrix, each row is interpretted as a joint state vector, and 0011 % the result is a matrix each row being the corresponding joint torques. 0012 % 0013 % Gravity vector can be given explicitly using the GRAV argument, otherwise 0014 % it defaults to the value of the ROBOT object. 0015 % 0016 % See also: ROBOT, RNE, ITORQUE, CORIOLIS. 0017 0018 % Copyright (C) 1993-2008, by Peter I. Corke 0019 % 0020 % This file is part of The Robotics Toolbox for Matlab (RTB). 0021 % 0022 % RTB is free software: you can redistribute it and/or modify 0023 % it under the terms of the GNU Lesser General Public License as published by 0024 % the Free Software Foundation, either version 3 of the License, or 0025 % (at your option) any later version. 0026 % 0027 % RTB is distributed in the hope that it will be useful, 0028 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0029 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0030 % GNU Lesser General Public License for more details. 0031 % 0032 % You should have received a copy of the GNU Leser General Public License 0033 % along with RTB. If not, see <http://www.gnu.org/licenses/>. 0034 0035 function tg = gravload(robot, q, grav) 0036 if numcols(q) ~= robot.n 0037 error('Insufficient columns in q') 0038 end 0039 if nargin == 2, 0040 tg = rne(robot, q, zeros(size(q)), zeros(size(q))); 0041 elseif nargin == 3, 0042 tg = rne(robot, q, zeros(size(q)), zeros(size(q)), grav); 0043 end 0044