JavaKUKA is an open-source project for creating KRL (KUKA Robot Language) codes in Java. The first program drives the robot to cut polystyrene foam.
Step 1: create the tool path in java:
float[][] spline = new float[num_pts][];
for (int i = 0; i < num_pts; i++) {
float theta = (float) (i * 7 * Math.PI) / (num_pts – 1);
float x = -margin * X + i * (1 + 2 * margin) * X / (num_pts – 1);
float y = Y0 + Y1 * (float) Math.cos(theta – Math.PI / 2);
float z = -Y0 – Y1 * (float) Math.cos(theta + Math.PI);
float[] point = { x, y, z };
spline[i] = point;
}
A hot knife will follow the spline to cut the foam.
Step 2: Java writes the spline into KRL as a .src file. Finally, copy the first_program.src from the computer to KUKA (KRC:/R1/Program/) and run it. The correspondence between Java, KUKA, and KRL is as follows:
FirstProgram.java includes header(), PTP(), SPL() and other methods. It produces the runnable .src file.
The image above shows that the trajectories of TCP (Tool Center Point) during the two cuts are identical, however, the knife has opposite orientations during the two cuts.
FirstProgram1_visual (dependencies: Processing and Peasycam) visualizes the foam and the tool path.