Using MATLAB to Create a Drill Cycle Pattern for a FANUC Industrial Robot

https://youtu.be/ouTcBKGFJ34

In this video it is demonstrated how MATLAB can be used to create a drill cycle pattern which can be imported into IRBCAM as a CSV file. The MATLAB script generates a CSV file according to the Documentation

MATLAB is a very powerful platform with a large collection of different toolboxes. Only the imagination limits the toolpaths which can be generated in MATLAB for use in IRBCAM.

The MATLAB script used in this example is made available below:

clear;

% X range of drill pattern
xmin = 0; xmax = 1000; dx = 100;
% Y range of drill pattern
ymin = -1000; ymax = 1000; dy = 100;

% Constant variables
z = 50;
z_drill = 50;
rz1 = 0;
ry = pi;
rz2 = 0;
velocity = 100;  % Float (mm/s)
motion_type = 0; % Integer (Linear move)
tool_number = 1; % Integer
spindle = 1000;  % Float (extra data associated with tool)

data = [];
for(x = xmin:dx:xmax)
    for(y = ymin:dy:ymax)
        data = [data; x y z rz1 ry rz2 motion_type velocity tool_number spindle];
        data = [data; x y z-z_drill rz1 ry rz2 motion_type velocity tool_number spindle];
        data = [data; x y z rz1 ry rz2 motion_type velocity tool_number spindle];
    end
end

strHeader = 'x,y,z,rz1,ry,rz2,motion_type,velocity,tool_number,spindle_speed';
fid=fopen('data.csv','w');
fprintf(fid,'%s\n',strHeader);
fclose(fid);
writematrix(data,'data.csv','WriteMode','append');

plot3(data(:,1), data(:,2), data(:,3),'bo');
grid on;
title('Drill Pattern for IRBCAM Demo');
xlabel('X axis (mm)');
ylabel('Y axis (mm)');