% NOTE: if have reliable method of centering the orgin, max X,Y,Z are cut in half !!!! % 12 10nov2013 - rolling thru x,y,z havin ustep resuled in same delR2 mean std % variance % 09,08,07nov2013,06nov2013, 05nov2013 % 29nov 2013 % 28,29,31 oct 2013 % 25 oct2013 % 3D Printer Error Analysis Project % 17 October 2013 % Robert E. Nee % m2html('mfiles','matlab', 'htmldir','doc', 'global','on'); % REMEMBER THIS --- PARTS TOLERANCES ARE +- 3*SIGMA !! % REMEMBER THIS --- PARTS TOLERANCES ARE +- 3*SIGMA !! % REMEMBER THIS --- PARTS TOLERANCES ARE +- 3*SIGMA !!A2err = 0; clear; opengl autoselect ; global numberPoints numberIterations currentNumberPoints currentNumberIterations global Da1 Da2 Da3 Dd1 Dd2 Dd3 DA1 DA2 DA3 Dt1 Dt2 Dt3 DRz DRy global del_X del_Y del_Z delR2 global fidHtml t1err t2err t3err a1err a2err a3err global TT X2 Y2 Z2 theta_angle_error alpha_angle_error ustep base_Dd global RzRxAngleError global estimatedIterations randn('state',0); t1=0;t2=0;t3=0; x= 0.0; y = 0.0; z = 0.0; % common stuff % baseTestFileName = '3D_' ; testDirectoryPath = '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/'; c = clock; % c = [year month day hour minute seconds] %testDate = strcat(int2str(c(1)),int2str(c(2)),int2str(c(3)) ); testDate = strcat(int2str(c(3)),'_',int2str(c(2)),'_',int2str(c(1)) ); testTime = strcat(int2str(c(4)),':',int2str(c(5)),':',int2str(c(6)) ); fid1 = 1; L3DP = 0; testNumber = 31; % <=========== % a1max = 203.2; a2max = 203.2; a3max = 203.2; % a1max = 100; a2max = 100; a3max = 100; % a1max = 200; a2max = 200; a3max = 200; % %%%%%%%%%%%%%%%%%%%%%% baseTestFileName = strcat('3D_Test-',int2str(testNumber), '_') ; testDirectoryPath = '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/'; extensionless_fullFileName = strcat(baseTestFileName, ... testDate); fullFileName = strcat( extensionless_fullFileName,'.m'); fullPathFileName = strcat(testDirectoryPath,fullFileName); [fid1,message]= ... fopen(fullPathFileName,'w'); fullHtmlName = strcat( extensionless_fullFileName,'.html'); fullPathHtmlName = strcat(testDirectoryPath,fullHtmlName); [fidHtml,message]= ... fopen(fullPathHtmlName,'w'); % %%%%%%%%%%%%%%%%%%%% need HTML heading fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,' '); % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% fprintf(fidHtml,'

3D Printer Error Analysis Using Monte Carlo Simulations

'); fprintf(fidHtml,''); fprintf(fidHtml,' '); fprintf(fidHtml,' ') fprintf(fidHtml,''); fprintf(fidHtml,' ',testDate ); fprintf(fidHtml,' ',testTime ); fprintf(fidHtml,' ',fullHtmlName ); fprintf(fidHtml,' '); fprintf(fidHtml,'
'); fprintf(fidHtml,' Robert E. Nee Date = %s Time = %s Test File = %s
'); % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% mm Cube if testNumber == 24 %testSummary = 'Test-23: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err = 0, Rzerr, Ryerr'; testSummary = 'Test-23: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err = 0 errors : add A1err,A2err,A3err = 0 d: d1err,d2err,d3err = 0, Rzerr <> 0, Ryerr <> 0'; numberIterations = 30; % a1max = 914; a2max = 914; a3max = 914; a1max = 10; a2max = 10; a3max = 10; a1max = 609; a2max = 609; a3max = 609; end %%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Modify for each test: numberPoints = 1; if testNumber == 1 testSummary = 'Test-1: a1err, a2err, a3err link errors '; numberIterations = 50; a1max = 100; a2max = 100; a3max = 100; end if testNumber == 2 testSummary = 'Test-2: add to Test-1: theta t1err errors '; numberIterations = 500; a1max = 100; a2max = 100; a3max = 100; end if testNumber == 3 testSummary = 'Test-3: add to Test-2: theta t2err errors '; numberIterations = 500; a1max = 100; a2max = 100; a3max = 100; end if testNumber == 4 testSummary = 'Test-4: a1err,a2err,a3err theta: t1err t2err t3err errors '; numberIterations = 500; end if testNumber == 5 testSummary = 'Test-5: a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err'; numberIterations = 500; a1max = 100; a2max = 100; a3max = 100; end if testNumber == 6 testSummary = 'Test-6 100mm Cube: a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err'; numberIterations = 500; a1max = 100; a2max = 100; a3max = 100; end if testNumber == 7 testSummary = 'Test-7 200mm Cube : a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err'; numberIterations = 500; a1max = 200; a2max = 200; a3max = 200; end if testNumber == 8 testSummary = 'Test-8 300mm Cube : a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err'; numberIterations = 500; a1max = 300; a2max = 300; a3max = 300; end if testNumber == 9 testSummary = 'Test-9 400mm Cube : a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err'; numberIterations = 500; a1max = 400; a2max = 400; a3max = 400; end if testNumber == 10 testSummary = 'Test-10 500mm Cube : a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err'; numberIterations = 500; a1max = 500; a2max = 500; a3max = 500; end % 4' x 4' x 4' if testNumber == 11 testSummary = 'Test-11 1218mm Cube : a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err'; numberIterations = 500; a1max = 1218; a2max = 1218; a3max = 1218; end % 3' x 3' x 3' if testNumber == 12 testSummary = 'Test-12 914mm Cube : a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err'; numberIterations = 500; a1max = 914; a2max = 914; a3max = 914; end % 3' x 3' x 3' % 8" x 8" x 8" % 100mm Cube if testNumber == 13 testSummary = 'Test-13 100mm Cube : a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err, Rzerr, Ryerr'; numberIterations = 500; % a1max = 914; a2max = 914; a3max = 914; a1max = 100; a2max = 100; a3max = 100; end % 203mm Cube if testNumber == 14 testSummary = 'Test-14 203mm Cube : a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err, Rzerr, Ryerr'; numberIterations = 500; % a1max = 914; a2max = 914; a3max = 914; a1max = 203; a2max = 203; a3max = 203; end % 400mm Cube if testNumber == 15 testSummary = 'Test-15 400mm Cube : a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err, Rzerr, Ryerr'; numberIterations = 500; % a1max = 914; a2max = 914; a3max = 914; a1max = 400; a2max = 400; a3max = 400; end % 914mm Cube if testNumber == 16 testSummary = 'Test-16 914mm Cube : a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err, Rzerr, Ryerr'; numberIterations = 500; %a1max = 914; a2max = 914; a3max = 914; a1max = 1218; a2max = 1218; a3max = 1218; end % 1218mm Cube if testNumber == 17 testSummary = 'Test-17 1218mm Cube : a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err, Rzerr, Ryerr'; numberIterations = 500; %a1max = 914; a2max = 914; a3max = 914; a1max = 1218; a2max = 1218; a3max = 1218; end % % 100mm Cube if testNumber == 18 testSummary = 'Test-18 Cube X: a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err, Rzerr, Ryerr'; numberIterations = 500; % a1max = 914; a2max = 914; a3max = 914; a1max = 100; a2max = 100; a3max = 100; end % % 200mm Cube if testNumber == 19 testSummary = 'Test-19 200 mm Cube X: a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err, Rzerr, Ryerr'; numberIterations = 500; % a1max = 914; a2max = 914; a3max = 914; a1max = 200; a2max = 200; a3max = 200; end % % 609 mm Cube if testNumber == 20 testSummary = 'Test-20 609mm (2ft) Cube: a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err, Rzerr, Ryerr'; numberIterations = 500; % a1max = 914; a2max = 914; a3max = 914; base_Dd = 0.0005*25.4; % sigma a1max = 609; a2max = 609; a3max = 609; end % % mm Cube if testNumber == 21 testSummary = 'Test-21 914mm (3ft) Cube: a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err, Rzerr, Ryerr'; numberIterations = 500; % a1max = 914; a2max = 914; a3max = 914; base_Dd = 0.0005*25.4; % sigma a1max = 914; a2max = 914; a3max = 914; end % mm Cube if testNumber == 22 testSummary = 'Test-21 X-100mm: a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err, Rzerr, Ryerr'; numberIterations = 500; % a1max = 914; a2max = 914; a3max = 914; a1max = 100; a2max = 0; a3max = 0; end %% mm Cube if testNumber == 23 %testSummary = 'Test-23: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err = 0, Rzerr, Ryerr'; testSummary = 'Test-23: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err = 0 errors : add A1err,A2err,A3err = 0 d: d1err,d2err,d3err = 0, Rzerr, Ryerr = 0'; numberIterations = 30; % a1max = 914; a2max = 914; a3max = 914; a1max = 10; a2max = 10; a3max = 10; a1max = 609; a2max = 609; a3max = 609; end %% mm Cube if testNumber == 24 %testSummary = 'Test-23: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err = 0, Rzerr, Ryerr'; testSummary = 'Test-23: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err = 0 errors : add A1err,A2err,A3err = 0 d: d1err,d2err,d3err = 0, Rzerr <> 0, Ryerr <> 0'; numberIterations = 30; % a1max = 914; a2max = 914; a3max = 914; a1max = 10; a2max = 10; a3max = 10; a1max = 609; a2max = 609; a3max = 609; end %% mm Cube if testNumber == 25 %testSummary = 'Test-23: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err = 0, Rzerr, Ryerr'; testSummary = 'Test-23: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err = 0 errors : add A1err,A2err,A3err = 0 d: d1err,d2err,d3err = 0, Rzerr <> 0, Ryerr <> 0'; numberIterations = 30; % a1max = 914; a2max = 914; a3max = 914; a1max = 10; a2max = 10; a3max = 10; a1max = 609; a2max = 609; a3max = 609; end %% mm Cube if testNumber == 26 %testSummary = 'Test-23: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err = 0, Rzerr, Ryerr'; strTestNumber = int2str(testNumber) testSummary_1 = strcat('Test-',strTestNumber, ':609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err = 0 errors : add A1err,A2err,A3err = 0 d: d1err,d2err,d3err = 0, Rzerr <> 0, Ryerr <> 0'); % testSummary = 'Test-26: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err = 0 errors : add A1err,A2err,A3err = 0 d: d1err,d2err,d3err = 0, Rzerr <> 0, Ryerr <> 0'; numberIterations = 30; % a1max = 914; a2max = 914; a3max = 914; a1max = 10; a2max = 10; a3max = 10; a1max = 609; a2max = 609; a3max = 609; end %% mm Cube if testNumber == 27 %testSummary = 'Test-23: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err = 0, Rzerr, Ryerr'; strTestNumber = int2str(testNumber) testSummary_1 = strcat('Test-',strTestNumber, ':609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err = 0 errors : add A1err,A2err,A3err = 0 d: d1err,d2err,d3err <> 0, Rzerr <> 0, Ryerr <> 0'); % testSummary = 'Test-26: 609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err = 0 errors : add A1err,A2err,A3err = 0 d: d1err,d2err,d3err = 0, Rzerr <> 0, Ryerr <> 0'; numberIterations = 30; % a1max = 914; a2max = 914; a3max = 914; a1max = 10; a2max = 10; a3max = 10; a1max = 609; a2max = 609; a3max = 609; end %% mm Cube if testNumber == 28 strTestNumber = int2str(testNumber) testSummary_1 = strcat('Test-',strTestNumber, ':609 mm cube :a1err,a2err,a3err theta: t1err t2err t3err <> 0 errors : add A1err,A2err,A3err = 0 d: d1err,d2err,d3err <> 0, Rzerr <> 0, Ryerr <> 0'); numberIterations = 30; a1max = 609; a2max = 609; a3max = 609; end %% mm Cube if testNumber == 29 strTestNumber = int2str(testNumber) testSummary_1 = strcat('Test-',strTestNumber, ':609 mm cube :all errors:a1err,a2err,a3err theta: t1err t2err t3err <> 0 errors : add A1err,A2err,A3err = <> d: d1err,d2err,d3err <> 0, Rzerr <> 0, Ryerr <> 0'); numberIterations = 30; a1max = 609; a2max = 609; a3max = 609; end %% mm Cube 3 ft cube if testNumber == 30 numberPoints = 1; strnumberPoints = int2str(numberPoints) strTestNumber = int2str(testNumber) testSummary_1 = strcat('Test-',strTestNumber, ': 914mm (3ft) Cube: ', strnumberPoints,' volume points all errors:a1err,a2err,a3err theta: t1err t2err t3err <> 0 errors : add A1err,A2err,A3err = <> d: d1err,d2err,d3err <> 0, Rzerr <> 0, Ryerr <> 0'); numberIterations = 30; a1max = 914; a2max = 914; a3max = 914; end %% mm Cube 4 ft cube if testNumber == 31 strTestNumber = int2str(testNumber) testSummary_1 = strcat('Test-',strTestNumber, ':1218 mm (4ft) cube :all errors:a1err,a2err,a3err theta: t1err t2err t3err <> 0 errors : add A1err,A2err,A3err = <> d: d1err,d2err,d3err <> 0, Rzerr <> 0, Ryerr <> 0'); numberIterations = 30; a1max = 1218; a2max = 1218; a3max = 1218; end % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Modify to control amount of output to file - comment one out: logging_fid = fid1; % full output to file %logging_fid = 1 % write to screen only % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The way the tests are setup, TRUTH is the TCP predicted % by the ForwardKinematicsCalculations with NO NOISE. % For each random point commanded, many Taylor predicted points % are computed. It is desired to obtain the STD of R2-R1 which will % yield tolerances as (+- STD). This is all that is needed for a variety % of points within the 3D Pinter's working volume. % %% %%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% fprintf(fidHtml,'

%s

',testSummary_1); fprintf(fidHtml,'

D-H Fixed Link Parameters

'); t1 = 0.0; d1 = 0.0; a1 = a1max; A1 = 0.0; Rz = 0.0; Ry = 0.0; t2 = 0.0; d2 = 0.0; a2 = a2max; A2 = 0.0; t3 = 0.0; d3 = 0.0; a3 = a3max; A3 = 0.0; fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,'', t1, d1, a1, A1, Rz,Ry ) fprintf(fidHtml,'', t2, d2, a2, A2, Rz,Ry ) fprintf(fidHtml,'', t3, d3, a3, A3, Rz,Ry ) fprintf(fidHtml,'
Link &theta d a &alpha Rz Ry
1 %3.6f %3.6f %3.6f %3.6f %3.6f %3.6f
2 %3.6f %3.6f %3.6f %3.6f %3.6f %3.6f
3 %3.6f %3.6f %3.6f %3.6f %3.6f %3.6f
'); % % base_Dd = 0.0005*25.4; % sigma % P0 = []; P = []; R2var = []; R2std = []; R2Time = []; % The following loop performs MonteCarlo simulations at "numberPoints" % randomly computed within the workspace of the Puma 560 Robot Arm for currentNumberPoints = 1:numberPoints % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%% regression baseline check %%%%% % %%%% results should match test-A %%%%% % % uncomment for test 1 regression test only % numberIterations = 10000; % for baseline % OBE % t1 = pi/2; t2 = 0.0; t3 = pi/2; t4 = 0.0; t5 = 0.0; t6 = 0.0; % a1err = 0; A2STD = 0; A3STD = 0; A4STD = 0; A5STD = 0; A6STD = 0; % a1err = 0; a2err = 0; a3err = 0; a4STD = 0; a5STD = 0; a6STD = 0; % d1err = 0; d2err = all0; d3err = 0; d4STD = 0; d5STD = 0; d6STD = 0; % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% beginTime = cputime; % This function does a Monte Carlo simulation of "numberIterations" % runs about the input link parameters. The resulting R1 and R2 % results refer to straight forward Forward Kinematics computations % for R1 and a first order Taylor expandsion for R2. % a1 = a1max*rand; % a2 = a2max*rand; % a3 = a3max*rand; % %tolerance would be +- 3sigma % 1 std == 1 sigma, 68.3% between +- 1 sigma ; 95.4% +- 2 sigma ; % 99.75 between +-3sigma % ----> must account for all +- of errors % lets estimate A1err & t1err as arc/radius: arc = .001 in and radius % of 1000mm % test with lazer pointer ustep = 11*pi/3200; theta_angle_error = (.001*25.4/1000); % radians alpha_angle_error = (.001*25.4/1000); % radians % alpha_angle_error = 0.0; % radians base_Dd = 0.0005*25.4; % sigma % base_Dd = 0.0; % sigma RzRxAngleError = 0.001*25.4/1000; Rzerr = RzRxAngleError; Ryerr = RzRxAngleError; fprintf(fidHtml,'

Error Estimation Basis

'); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,'', theta_angle_error, alpha_angle_error,Rzerr,Ryerr); fprintf(fidHtml,'', ustep, base_Dd); fprintf(fidHtml,'
Error Types &theta &alpha XYZ travel- a1,a2,a3 Link travel - d Rzerr Ryerr
Fixed Link Angle play %3.6f %3.6f %3.6f %3.6f
Link Distances %3.6f %3.6f
'); t1err = theta_angle_error; t2err = theta_angle_error; t3err = theta_angle_error; d1err = base_Dd ; d2err = base_Dd ; d3err = base_Dd ; a1err = ustep; a2err = ustep; a3err = ustep; A1err = alpha_angle_error; % assume sigma A2err = alpha_angle_error; % assume sigma A3err = alpha_angle_error; % assume sigma Rzerr = RzRxAngleError; Ryerr = RzRxAngleError; Da1 = a1err * randn ; Dd1 = d1err * randn; DA1 = A1err * randn; Dt1 = t1err * randn; DRz = Rzerr * randn; Da2 = a2err * randn ; Dd2 = d2err * randn; DA2 = A2err * randn; Dt2 = t2err * randn; DRy = Ryerr * randn; Da3 = a3err * randn ; Dd3 = d3err * randn; DA3 = A3err * randn; Dt3 = t3err * randn; fprintf(fidHtml,'

Nominal 1&sigma errors

'); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,'', t1err, d1err, a1err, A1err, Rzerr) fprintf(fidHtml,'', t2err, d2err, a2err, A2err, Ryerr) fprintf(fidHtml,'', t3err, d3err, a3err, A3err) fprintf(fidHtml,'
Link &theta d a &alpha &Delta Rz &Delta Ry
1 %3.6f %3.6f %3.6f %3.6f %3.6f
2 %3.6f %3.6f %3.6f %3.6f %3.6f
3 %3.6f %3.6f %3.6f %3.6f
'); fprintf(fidHtml,'

Sample 1&sigma * randn errors

'); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,'', Dt1, Dd1, Da1, DA1, DRz); fprintf(fidHtml,'', Dt2, Dd2, Da2, DA2, DRy); fprintf(fidHtml,'', Dt3, Dd3, Da3, DA3); fprintf(fidHtml,'
Link &Delta&theta &Delta d &Delta a &Delta&alpha &Delta Rz &Delta Ry
1 %1.8f %1.8f %1.8f %1.8f %1.8f
2 %1.8f %1.8f %1.8f %1.8f %1.8f
3 %1.8f %1.8f %1.8f %1.8f
'); % fprintf(fidHtml,'\n TCP points in 3D Printer workspace = %d ',numberPoints); % fprintf(fidHtml,'\n Monte Carlo iterations about a specific TCP = %d ',numberIterations); [del_X, del_Y, del_Z, delR2,P0,delXYZ_variance,delXYZ_std,estimatedIterations] = MonteCarloForwardKinematics_3DP(numberIterations, ... fid1, ... x,y,z, ... a1,a2,a3, ... d1,d2,d3, ... A1,A2,A3, ... t1,t2,t3, ... t1err,t2err,t3err, ... a1err,a2err,a3err, ... A1err,A2err,A3err, ... d1err,d2err,d3err, ... L3DP,estimatedIterations ); P = [P ; P0]; fprintf('\n Point number = %d \n', currentNumberPoints); fprintf('\n P0 = %6.2f \n', P0); endTime = cputime; fprintf(fid1,'\n total time for %d iterations = %8.15f ',numberIterations,(endTime-beginTime)); fprintf(fid1,'\n Point number = %d \n', currentNumberPoints); end % numberPoints: this is the end of the for loop for random truth points in the work volume fprintf('-djpeg','-r600', '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/MY_3D_delR2') figure; %t= linspace(1,numberIterations,numberIterations); t= linspace(1,estimatedIterations , estimatedIterations ); plot(t,del_X , 'rd',t, 3*std(del_X), 'r+', t, -3*std(del_X), 'r+', t, mean(del_X), 'ks'); title('\DeltaX ,i.e. (P0(1)-TT(1) versus Points') xlabel('Number of Randomized Points about Current TCP') ylabel('\DeltaX (mm)') axis([0,estimatedIterations ,-0.25,0.25]) grid on print('-djpeg','-r600', '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/MY_3D_del_X') fprintf(fidHtml,'') fprintf(fid1, '\n P0 = %6.2f \n', P0); figure; plot(t,del_Y , 'gd', t, 3*std(del_Y), 'g+', t, -3*std(del_Y), 'g+', t, mean(del_Y), 'ks'); title('\DeltaY ,i.e. (P0(2)-TT(2) versus Points ') xlabel('Number of Randomized Points about Current TCP') ylabel('\DeltaY (mm)') axis([0, estimatedIterations ,-0.25,0.25]) testSummary = 'Test-7 200mm Cube 3: a1err,a2err,a3err theta: t1err t2err t3err errors : add A1err,A2err,A3err d: d1err,d2err,d3err'; grid on print('-djpeg', '-r600', '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/MY_3D_del_Y') fprintf(fidHtml,'') figure; plot(t,del_Z , 'bd',t, 3*std(del_Z), 'b*', t, -3*std(del_Z), 'b*', t, mean(del_Z), 'ks'); title('\DeltaZ ,i.e. (P0(3)-TT(3) versus Points ') xlabel('Number of Randomized Points about Current TCP') ylabel('\DeltaZ (mm)') grid on axis([0, estimatedIterations ,-0.25,0.25]) print('-djpeg','-r600', '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/MY_3D_del_Z') %imwrite(gcf,'my_test_doc','append'); print('-djpeg', '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/MY_3D_del_Z') % fprintf(fidHtml,'') figure; plot(t, delR2, 'md',t, mean(delR2)+ 3*std(delR2), 'm*', t, mean(delR2)-3*std(delR2), 'm*',t, mean(delR2), 'ks'); title('\DeltaR2 versus Points ') xlabel('Number of Randomized Points about Current TCP') ylabel('\DeltaR2 (mm)') grid on axis([0, estimatedIterations ,-0.25,0.25]) print('-djpeg','-r600', '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/MY_3D_delR2') fprintf(fidHtml,'') figure scatter3(X2 , Y2, Z2 ) title('Scatter Graph of Taylor Generated Points with 3\sigma sphere') xlabel('X') ylabel('Y') zlabel('Z') grid on hold on [x y z] = sphere(10); h = surfl(3*std(delR2)*x+P0(1),3*std(delR2)*y+P0(2),3*std(delR2)*z+P0(3) ) % sphere centered at (3,-2,0) set(h, 'FaceAlpha', 0.05) daspect([1 1 1]) print('-djpeg','-r600', '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/MY_3D_scatter') fprintf(fidHtml,'') % ========================================================================= % figure scatter(X2 , Y2 ) title('\DeltaY vs \DeltaX ') xlabel('\DeltaX (mm)') ylabel('\DeltaY (mm)') grid on % [x y z] = sphere(10); % h = surfl(3*std(delR2)*x+P0(1),3*std(delR2)*y+P0(2),3*std(delR2)*z+P0(3) ) % sphere centered at (3,-2,0) % set(h, 'FaceAlpha', 0.05) % daspect([1 1 1]) print('-djpeg','-r600', '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/MY_2D_scatter_Y2_vs_X2') fprintf(fidHtml,'') figure scatter(X2 , Z2 ) title('\DeltaZ vs \DeltaX ') xlabel('\DeltaX (mm)') ylabel('\DeltaZ (mm)') grid on % [x y z] = sphere(10); % h = surfl(3*std(delR2)*x+P0(1),3*std(delR2)*y+P0(2),3*std(delR2)*z+P0(3) ) % sphere centered at (3,-2,0) % set(h, 'FaceAlpha', 0.05) % daspect([1 1 1]) print('-djpeg','-r600', '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/MY_2D_scatter_Z2_vs_X2') fprintf(fidHtml,'') figure scatter(Y2 , Z2 ) title('\DeltaZ vs \DeltaY ') xlabel('\DeltaY (mm)') ylabel('\DeltaZ (mm)') grid on % [x y z] = sphere(10); % h = surfl(3*std(delR2)*x+P0(1),3*std(delR2)*y+P0(2),3*std(delR2)*z+P0(3) ) % sphere centered at (3,-2,0) % set(h, 'FaceAlpha', 0.05) % daspect([1 1 1]) print('-djpeg','-r600', '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/MY_2D_scatter_Z2_vs_Y2') fprintf(fidHtml,'') % % ========================================================================= % t= linspace(1,numberIterations,numberIterations); % plot(t,del_X , 'rd',t, 3*std(del_X), 'r+', t, -3*std(del_X), 'r+', t, mean(del_X), 'ks'); % title('Delta X ,i.e. (P0(1)-TT(1) versus Points') % xlabel('Number of Randomized Points about Current TCP') % ylabel('del X (mm)') % axis([0,numberIterations,-0.25,0.25]) % grid on % print('-djpeg','-r600', '/home/robert/A_3D_PRINTER_ERROR_ANALYSIS/RobotMatlabs/MY_3D_del_X') % fprintf(fidHtml,'') fprintf(fidHtml,'

Sample Point Calculations Comparison

'); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,''); fprintf(fidHtml,'', a1, a2, a3 ) fprintf(fidHtml,'', P0(1), P0(2), P0(3)) fprintf(fidHtml,'', TT(1), TT(2), TT(3) ) fprintf(fidHtml,'
Point Origin X Y Z
Commanded %3.6f %3.6f %3.6f
No Noise Forward Kinetic %3.6f %3.6f %3.6f
Noise Taylor Expansion %3.6f %3.6f %3.6f
'); %fprintf(fidHtml, '
  • ', P0); fprintf(fidHtml, '' , mean(delR2) ); fprintf(fidHtml, '', std(delR2) ); fprintf(fidHtml, '', 3*std(delR2) ); fprintf(fidHtml, '', 3*std(delR2) ); fprintf(fidHtml, '', -3*std(delR2)+mean(delR2), mean(delR2)+ 3*std(delR2) ); fprintf(fidHtml, '