%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Torque = FRICTION(ROBOT, QD, j) Computes torque based on viscous friction and Coulomb friction for the joint j. The torque is computed as: tau = G^2*B*qd + abs(Tc)*abs(G); The viscous friction parameter for each joint j must be stored in the variable robot.motors.Viscous, whereas the vector robot.motors.Coulomb positive or negative parameters of the Coulomb friction Author: Arturo Gil. Universidad Miguel Hern�ndez de Elche. email: arturo.gil@umh.es date: 26/06/2012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0002 % Torque = FRICTION(ROBOT, QD, j) 0003 % 0004 % Computes torque based on viscous friction and Coulomb friction for the 0005 % joint j. 0006 % 0007 % The torque is computed as: 0008 % tau = G^2*B*qd + abs(Tc)*abs(G); 0009 % 0010 % The viscous friction parameter for each joint j must be stored in the 0011 % variable robot.motors.Viscous, whereas the vector robot.motors.Coulomb 0012 % positive or negative parameters of the Coulomb friction 0013 % 0014 % Author: Arturo Gil. Universidad Miguel Hern�ndez de Elche. 0015 % email: arturo.gil@umh.es date: 26/06/2012 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 % Copyright (C) 2012, by Arturo Gil Aparicio 0019 % 0020 % This file is part of ARTE (A Robotics Toolbox for Education). 0021 % 0022 % ARTE 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 % ARTE 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 ARTE. If not, see <http://www.gnu.org/licenses/>. 0034 function torque = friction(robot, qd, j) 0035 0036 %torque due to viscous friction 0037 torque = robot.motors.G(j)^2*robot.motors.Viscous(j)*qd(j); 0038 0039 %Add torque due to Coulomb friction 0040 if qd(j) > 0 0041 torque = torque + abs(robot.motors.G(j))*robot.motors.Coulomb(j,1); 0042 elseif qd(j) < 0 0043 torque = torque + abs(robot.motors.G(j))*robot.motors.Coulomb(j,2); 0044 end 0045 0046 0047 0048 0049 0050