%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PLOT_JOINT_DATA(robot) Plots the position, velocity and acceleration of each joint. The movement in joint coordinates must be stored in the variables robot.q_vector: joint position robot.qd_vector: joint speeds robot.qdd_vector: joint accelerations. The variables are plotted in the figures specified by configuration.figure.q, configuration.figure.qd and configuration.figure.qdd, for position, speed and acceleration respectively. Author: Arturo Gil. Universidad Miguel Hernández de Elche. email: arturo.gil@umh.es date: 25/02/2012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0002 % PLOT_JOINT_DATA(robot) 0003 % 0004 % Plots the position, velocity and acceleration of each joint. 0005 % The movement in joint coordinates must be stored in the variables 0006 % robot.q_vector: joint position 0007 % robot.qd_vector: joint speeds 0008 % robot.qdd_vector: joint accelerations. 0009 % 0010 % The variables are plotted in the figures specified by configuration.figure.q, 0011 % configuration.figure.qd and configuration.figure.qdd, for position, 0012 % speed and acceleration respectively. 0013 % 0014 % Author: Arturo Gil. Universidad Miguel Hernández de Elche. 0015 % email: arturo.gil@umh.es date: 25/02/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 plot_joint_data(robot) 0035 global configuration 0036 0037 t = robot.time; 0038 q = robot.q_vector; 0039 qd = robot.qd_vector; 0040 qdd = robot.qdd_vector; 0041 0042 figure(configuration.figure.q) 0043 0044 plot(t, q), grid, title('Position vs. time') 0045 xlabel('time (s)'), ylabel('Position (rad, m)') 0046 legend(make_legend('q', robot.DOF)); 0047 0048 figure(configuration.figure.qd) 0049 plot(t,qd), grid, title('Velocity vs. time') 0050 xlabel('time (s)'), ylabel('Velocity (rad/s, m/s)') 0051 legend(make_legend('qd', robot.DOF)); 0052 0053 figure(configuration.figure.qdd) 0054 plot(t,qdd), grid, title('Acceleration vs. time') 0055 xlabel('time (s)'), ylabel('Acceleration (rad/s^2, m/s^2)') 0056 legend(make_legend('qdd', robot.DOF)); 0057 0058 0059 %make a matrix legend of joint coordinates 0060 function leg=make_legend(tag, DOF) 0061 0062 leg =[]; 0063 for i=1:DOF, 0064 leg=[leg; [tag sprintf('_%d',i)]]; 0065 end