Running A Basic KUKA Program

KUKA robots follow instructions that are written in a proprietary, KUKA-specific language called KRL. Programs written in KRL are usually followed by a .src or .dat. While this code is relatively simple, it can also be time consuming to write manually. Because of this, most of the work in the School of Architecture is done via Grasshopper (which exports a human-readable KUKA script like the one below) or programs like PowerMill or RoboDK.

In this section we will introduce a simple KUKA program that moves the arm in a rectangle. This script illustrates the main elements of a KUKA program.

The following video briefly shows what this program will look like when the robot executes it.


This is the program we will be executing. You can download this file here.

;Any line that has a semicolon in front of it is a comment and isn't read by the machine

;Define the name of the program
DEF ExampleProgramName()

;these are some set  up variables you don't have to worry about right now
GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )
$APO.CDIS = 0.5000
BAS (#INITMOV,0)
BAS (#VEL_PTP,20)
BAS (#ACC_PTP,20)
$advance=5

;Defines the coordinates of the tool attached to the robot, relative to the flange
$TOOL={X 0, Y 0, Z 0, A 0, B 0, C 0}

;Defines the Origin of the base, where all the consecutive commands are relative to
$BASE={X -75, Y -1638, Z 492, A 0, B 0, C 0}

;Set speed in meters/second
$VEL.CP=0.3

;First we must tell the program what the initial axis position should be
PTP {A1 90, A2 -75, A3 100, A4 169, A5 -60, A6 -150, E1 0, E2 180, E3 0, E4 0, E5 0, E6 0}

;Finally, we give it a series of LIN commands to trace out a square in space
;E1 and E2 are the external axis
LIN {X 0, Y 0, Z 400, A 0, B 0, C 180, E1 0, E2 180} C_DIS
LIN {X 0, Y 300, Z 400, A 0, B 0, C 180, E1 0, E2 180} C_DIS
LIN {X 300, Y 300, Z 400, A 0, B 0, C 180, E1 0, E2 180} C_DIS
LIN {X 300, Y 0, Z 400, A 0, B 0, C 180, E1 0, E2 180} C_DIS
LIN {X 0, Y 0, Z 400, A 90, B 0, C 180, E1 0, E2 180} C_DIS
END



To run this program, download the file linked above and follow the instructions on this page.



Related pages