Home > arte3.2.0 > tools > animate.m

animate

PURPOSE ^

ANIMATE(ROBOT, Q)

SYNOPSIS ^

function animate(robot, q, line)

DESCRIPTION ^

   ANIMATE(ROBOT, Q) 
   Animate the robot in 3D when performing a trajectory.
   The current robot parameters are stored in ROBOT and Q is a matrix
   where each column stores the robot's joint coordinates.
   Q = [q1, q2, q3,... qn]

   ANIMATE iterates through the vector and draws the robot at each joint
   coordinates.

    See also DRAWROBOT3D.

   Author: Arturo Gil. Universidad Miguel Hernández de Elche.
   email: arturo.gil@umh.es date:   05/01/2012

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %   ANIMATE(ROBOT, Q)
0002 %   Animate the robot in 3D when performing a trajectory.
0003 %   The current robot parameters are stored in ROBOT and Q is a matrix
0004 %   where each column stores the robot's joint coordinates.
0005 %   Q = [q1, q2, q3,... qn]
0006 %
0007 %   ANIMATE iterates through the vector and draws the robot at each joint
0008 %   coordinates.
0009 %
0010 %    See also DRAWROBOT3D.
0011 %
0012 %   Author: Arturo Gil. Universidad Miguel Hernández de Elche.
0013 %   email: arturo.gil@umh.es date:   05/01/2012
0014 
0015 % Copyright (C) 2012, by Arturo Gil Aparicio
0016 %
0017 % This file is part of ARTE (A Robotics Toolbox for Education).
0018 %
0019 % ARTE is free software: you can redistribute it and/or modify
0020 % it under the terms of the GNU Lesser General Public License as published by
0021 % the Free Software Foundation, either version 3 of the License, or
0022 % (at your option) any later version.
0023 %
0024 % ARTE is distributed in the hope that it will be useful,
0025 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0026 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0027 % GNU Lesser General Public License for more details.
0028 %
0029 % You should have received a copy of the GNU Leser General Public License
0030 % along with ARTE.  If not, see <http://www.gnu.org/licenses/>.
0031 function animate(robot, q, line)
0032 global configuration 
0033 
0034 h=figure(configuration.figure.robot);, hold on,
0035 %adjust 3D view as desired
0036 %adjust_view(robot)
0037 v=zeros(3,3);
0038 if exist('line', 'var')
0039     T1=directkinematic(robot, q(:,1));
0040     T2=directkinematic(robot, q(:,end));
0041 
0042     v=[T1(1:3,4) T2(1:3,4)];
0043 end
0044 
0045 %get adjusted view
0046 [az,el] = view;
0047 for j=1:size(q, 2);
0048     clf(h);
0049     qj=q(:,j);  
0050     view(az,el);
0051     %draw robot in 3D
0052     %robot=drawrobot3d_simulation(robot, qj);
0053 
0054     %robot=
0055     drawrobot3d(robot, qj);  
0056 
0057     
0058     %plot3(path(1,:),path(2,:),path(3,:),'k', 'LineWidth', 3);
0059     plot3(v(1,:),v(2,:),v(3,:),'k', 'LineWidth', 3);
0060     
0061     %pause to get a nice view
0062     pause(configuration.time_delay);   
0063 end

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