%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PLOT_RESULTS_line Represents the error at each joint when performing an independent PID control for each joint. Planned represents the joint references for the control, whereas followed are the actual joint positions simulated. See also INVERSEDYNAMIC, FORWARDDYNAMIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0002 % PLOT_RESULTS_line 0003 % Represents the error at each joint when performing an independent PID 0004 % control for each joint. Planned represents the joint references for the 0005 % control, whereas followed are the actual joint positions simulated. 0006 % 0007 % See also INVERSEDYNAMIC, FORWARDDYNAMIC 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 close all 0027 figure, plot(reference), title('Joint references to follow a line in space(rad). ') 0028 legend('q_1', 'q_2', 'q_3', 'q_4', 'q_5', 'q_6') 0029 0030 figure, plot(joint_positions), title('Joint positions (controlled) to follow a line in space(rad). ') 0031 legend('q_1', 'q_2', 'q_3', 'q_4', 'q_5', 'q_6') 0032 0033 figure, plot(reference-joint_positions), title('Error during control (reference-joint_positions)(rad). ') 0034 legend('error q_1', 'error q_2', 'error q_3', 'error q_4', 'error q_5', 'error q_6') 0035 0036 drawrobot3d(robot, reference(end,:)), 0037 %figure, 0038 pp=[]; 0039 for i=1:length(reference), 0040 0041 T=directkinematic(robot,reference(i,:)'); 0042 0043 pp=[pp T(1:3,4)]; 0044 0045 end 0046 0047 plot3(pp(1,:),pp(2,:),pp(3,:), 'k', 'LineWidth', 4), %hold 0048 0049 pp=[]; 0050 for i=1:length(joint_positions), 0051 0052 T=directkinematic(robot,joint_positions(i,:)'); 0053 0054 pp=[pp T(1:3,4)]; 0055 0056 end 0057 0058 plot3(pp(1,:),pp(2,:),pp(3,:), 'r', 'LineWidth', 4), 0059