Home > arte3.2.0 > lib > test_joints.m

test_joints

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

function error=test_joints(robot, q)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  Test whether any of the joint angles exceeds the mechanical
  limits imposed by manufacturer
   
   Author: Arturo Gil. Universidad Miguel Hernández de Elche
   Date: 05/05/2012
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0002 %  Test whether any of the joint angles exceeds the mechanical
0003 %  limits imposed by manufacturer
0004 %
0005 %   Author: Arturo Gil. Universidad Miguel Hernández de Elche
0006 %   Date: 05/05/2012
0007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0008 
0009 
0010 % Copyright (C) 2012, by Arturo Gil Aparicio
0011 %
0012 % This file is part of ARTE (A Robotics Toolbox for Education).
0013 %
0014 % ARTE is free software: you can redistribute it and/or modify
0015 % it under the terms of the GNU Lesser General Public License as published by
0016 % the Free Software Foundation, either version 3 of the License, or
0017 % (at your option) any later version.
0018 %
0019 % ARTE is distributed in the hope that it will be useful,
0020 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0021 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0022 % GNU Lesser General Public License for more details.
0023 %
0024 % You should have received a copy of the GNU Leser General Public License
0025 % along with ARTE.  If not, see <http://www.gnu.org/licenses/>.
0026 function error=test_joints(robot, q)
0027 
0028 
0029 %0--> no error
0030 error = 0;
0031 if ~isempty(robot.maxangle)
0032     for i=1:robot.DOF,
0033         
0034         if q(i) < robot.maxangle(i,1)
0035             fprintf('\nERROR: joint out of range');
0036             fprintf('\nJoint %d, value %f below %f (rad)', i, q(i), robot.maxangle(i,1));
0037             error = 1; % an error has occurred
0038         end
0039         if q(i) > robot.maxangle(i,2)
0040             fprintf('\nERROR: joint out of range');
0041             fprintf('\nJoint %d, value %f over %f (rad)', i, q(i), robot.maxangle(i,2));
0042             error = 1; % an error has occurred
0043         end
0044     end
0045     
0046 else
0047     disp('WARNING: lib/test_joints: robot.maxangle undefined');
0048 end

Generated on Fri 03-Jan-2014 12:20:01 by m2html © 2005