/
KUKA Programming KRL Examples
KUKA Programming KRL Examples
This page contains source code for programs written for the KUKA robots in the KRL language, a proprietary scripting language developed by KUKA.
Basic Program that moves robot in a rectangle
;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 consequtive 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
Basic For Loop
DEF MAIN_PROG()
DECL INT ROW, COL
ROW = 1
COL = 1
PTP HOME
FOR ROW = 1 TO 3
FOR COL = 1 TO 2
PTP P01
PTP P02
TASK01() ;CALLS SUBPROGRAM
ENDFOR
ENDFOR
;---------------------------------------------
;START OF SUBPROGRAM
DEF TASK01()
PTP P03
PTP P04
END
Interrupts
&ACCESS RVO
&REL 9
&PARAM EDITMASK = *
&PARAM TEMPLATE = C:\KRC\Roboter\Template\vorgabe
DEF Interrup_TEST( )
INI
PTP HOME Vel= 100 %
LOOP
PTP OverStartFasatura Vel=100 %
INTERRUPT WITH BRAKE DECL 21 WHEN i1_InterruptOn == TRUE DO OnInterrupt()
INTERRUPT ON 21
LIN StartFasatura Vel=2 m/s
LIN EndFasatura Vel=0.5 m/s
INTERRUPT OFF
HALT
ENDLOOP
OnInterrupt()
PTP HOME Vel= 100 %
END
DEF OnInterrupt()
INTERRUPT OFF
HALT
LIN StartFasatura Vel=2 m/s
WAIT SEC 1
INTERRUPT WITH BRAKE DECL 21 WHEN i1_InterruptOn == TRUE DO OnInterrupt()
INTERRUPT ON 21
RESUME
END
Related content
Running A Basic KUKA Program
Running A Basic KUKA Program
More like this
Resources for Learning More
Resources for Learning More
More like this
Understanding World and TCP Coordinates
Understanding World and TCP Coordinates
More like this
3. Kinematic Analysis and MATLAB Logical Functions
3. Kinematic Analysis and MATLAB Logical Functions
More like this
Dabbing Algorithm
Dabbing Algorithm
More like this
7 APPENDIX
7 APPENDIX
More like this