Advance Book Robotics
Advance Book Robotics
_________________________
SEMINAR WORKBOOK OF
PROGRAMMER
Copyright
Copyright 2006
This documentation or excerpts therefrom may not be reproduced or disclosed to third parties without the express permission of the
publishers.
Other functions not described in this documentation may be operable in the controller. The user has no claims to these functions,
however, in the case of a replacement or service work.
We have checked the content of this documentation for conformity with the hardware and software described. Nevertheless,
discrepancies cannot be precluded, for which reason we are not able to guarantee total conformity. The information in this
documentation is checked on a regular basis, however, and necessary corrections will be incorporated in subsequent editions.
Subject to technical alterations without an effect on the function.
KUKA Roboter GmbH accepts no liability whatsoever for any errors in technical information communicated orally or in writing in the
training courses or contained in the documentation. Nor will liability be accepted for any resultant damage or consequential damage.
Contents
1. Structured programming 5
1.1. Programming methodology - conceptualization 5
1.2. Program flowchart 13
1.3. Programming methodology - realization 23
2. General information about expert level 37
2.1. Navigator 37
2.2. Fold - concept 41
3. Variables and declarations 45
3.1. Simple data types 45
3.2. Monitoring of variables 51
3.3. Arrays 55
3.4. Structures 61
3.5. Enumeration data types 65
4. Subprograms and functions 68
4.1. Definition of subprograms 68
4.2. Transfer of parameter 71
4.3. Function 75
5. Data lists 79
6. Data manipulation 83
7. Motion programming 89
7.1. Coordinate systems 89
7.2. Axis motion - PTP 93
7.3. Continuous path motion - LIN und CIRC 99
7.4. Orientation control 103
7.5. Advance run 109
7.6. Approximate positioning 113
7.7. Status and Turn 119
8. System variables 123
1. Structured programming
01/2006 1
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Demands on programs
Efficient
Easy to understand
Maintenance-friendly
Clearly structured
Economical
01/2006 2
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Necessity:
01/2006 3
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Tender specification or
requirements specification
01/2006 4
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Definition:
Requirements specification
01/2006 5
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Transparent breakdown
01/2006 6
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
This is because:
01/2006 7
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 8
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
2. Component independence:
01/2006 9
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
START
No No
Yes Yes
No
Yes
END
01/2006 10
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 11
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Program flowchart
START
No No
Yes Yes
No
Yes
END
01/2006 1
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
An algorithm is required for calculating the highest common factor of two numbers a
and b. This is embedded in a function hcf with two transfer parameters (a and b).
while a<>b do
while
If a>b
01/2006 2
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 3
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 4
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
Statement A
01/2006 5
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
Statement A Statement B
01/2006 6
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 7
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
END
01/2006 8
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 9
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
Statement
01/2006 10
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
Yes
01/2006 11
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 12
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 13
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
Boss No
Employee No
present tiered
Program
flowchart Yes Yes
Yes
Go home
END
01/2006 14
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
START
Program
flowchart Set alarm for next
whole hour
example:
day in the
life of an No Read book
employee until alarm Go and eat
rings
Is it Yes
12 o'clock?
No
Is it
5 o'clock?
END
01/2006 15
program_flowchart_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 1
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Program legibility
Transparency:
01/2006 2
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Program legibility
01/2006 3
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
1. Long texts
Outputs
SYS Ausgnge
18 Output
19 Gripper open
20 Gripper close
21 Output
01/2006 4
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
DEF AIR ( )
...
PTP HOME Vel= 100% DEFAULT
01/2006 6
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
3. Using of signal-declaration
DEF PART_1 ( )
; Inputs / Outputs
SIGNAL machine_OK $IN[32]
SIGNAL Programnumber $IN[33] to $IN[40]
SIGNAL cycle_start $OUT[88]
IF machine_OK==TRUE THEN
cycle_start = TRUE
ENDIF
END
01/2006 7
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Program legibility
01/2006 8
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Program legibility
DEF INDENTION ( )
INT part, counter
INI
PTP HOME Vel= 100% DEFAULT
LOOP
FOR counter = 1 TO 20
part = part + 1
; Inlineforms are not able to indent !!!
PTP P3 CONT Vel= 100% Tool[2]:Greifer Base[2]: Tisch
PTP P4 CONT Vel= 100% Tool[2]:Greifer Base[2]: Tisch
PTP xP5
ENDFOR
ENDLOOP
END
01/2006 9
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Program legibility
Use of comments:
01/2006 10
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Program legibility
0 Normal
1 Stamp
01/2006 11
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
; Any text
Text box
Example:
...
INI
PTP HOME Vel= 100% DEFAULT
; Any text
PTP P1 CONT Vel= 100% Tool[2]:Gripper Base[2]: Table
...
The name and a text can be freely entered after selection of the
command STAMP:
...
INI
PTP HOME Vel= 100% DEFAULT
; 01.01.05 10:15 NAME: User CHANGES: Any text
PTP P1 CONT Vel= 100% Tool[2]:Gripper Base[2]: Table
...
With the Softkeys New time, New name and new text the
respective box can be selected or updated.
01/2006 13
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
After switching to Expert mode, the programmer can turn any line into a
comment by writing a ; as the first character (exception: inline forms).
DEF CLEANING ( )
; **************************************
; *** AUTOR Peter PAN ***
; *** Last changing 05/05/05 ***
; **************************************
INI
PTP HOME Vel= 100% DEFAULT
part = part + 1; part-counter increase
; move to purge
PTP P4 CONT Vel= 100% Tool[2]:Gripper Base[2]: Table
PTP xP5 ; Endposition cleaning
It is also possible to tag a comment onto the end of a command line using ;.
01/2006 14
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Program legibility
Use of FOLDs:
01/2006 15
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Program legibility
DEF CLEANING ( )
USER
INI FOLD
IO_SETUP
PTP HOME Vel= 100% DEFAULT
KUKA
PTP P21 CONT Vel= 100% Tool[2]:Gripper Base[2]: Table FOLD
PTP HOME Vel= 100% DEFAULT
END
01/2006 16
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Program legibility
DEF CLEANING ( )
INI
IO_SETUP
PTP HOME Vel= 100% DEFAULT
$BWDSTART = FALSE KUKA
PDAT_ACT=PDEFAULT FOLD
BAS(#PTP_DAT) open
FDAT_ACT=FHOME
BAS(#FRAMES)
BAS(#VEL_PTP,100)
$H_POS=XHOME
PTP XHOME
PTP P21 CONT Vel= 100% Tool[2]:Gripper Base[2]: Table
PTP HOME Vel= 100% DEFAULT
END
01/2006 17
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Program legibility
DEF CLEANING ( )
USER
INI FOLD
IO_SETUP open
$OUT[12]=TRUE ;cell OK
part = 0 ; counter reset
glue = FALSE ; glueing off
position = 0 ; position-counter reset
PTP HOME Vel= 100% DEFAULT
PTP P21 CONT Vel= 100% Tool[2]:Gripper Base[2]: Table
PTP HOME Vel= 100% DEFAULT
END
01/2006 18
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 19
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Syntax: Syntax:
IF ... THEN SWITCH
ELSE CASE
ENDIF ENDSWITCH
01/2006 20
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Syntax:
FOR ENDFOR (counting loop)
WHILE ENDWHILE (rejecting loop)
REPEAT UNTIL (non-rejecting loop)
LOOP ENDLOOP (endless loop)
01/2006 21
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 22
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
Syntax :
SUBPROG ( ) Local or global subprogram
DEFFCT Function
INTERRUPT Process execution parallel to the robot program
TRIGGER Path-related switching actions
01/2006 23
programming_methodology_en.ppt
Copyright by KUKA Roboter GmbH College
2.1. Navigator
01/2006 1
navigator_en.ppt
Copyright by KUKA Roboter GmbH College
SUB file
SRC file
Dat file
01/2006 2
navigator_en.ppt
Copyright by KUKA Roboter GmbH College
Expert
SUB file without a skeleton program
Submit
Function SRC file without a skeleton program
01/2006 3
navigator_en.ppt
Copyright by KUKA Roboter GmbH College
GO GO mode
The program is executed step by step, i.e. with a STOP after each
instruction (including blank lines). The program is executed without
advance processing.
01/2006 4
navigator_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 5
navigator_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 6
navigator_en.ppt
Copyright by KUKA Roboter GmbH College
Color-coding of FOLDS:
Closed FOLD
Open FOLD
Closed sub-FOLD
Open sub-FOLD
Contents of the FOLD
01/2006 1
fold_en.ppt
Copyright by KUKA Roboter GmbH College
;FOLD Name
Program line
Program line
;ENDFOLD
int x int x
INI INI
;fold Home_position Home_position
$out[1]=true
counter=0
advance=35.0
;endfold
01/2006 2
fold_en.ppt
Copyright by KUKA Roboter GmbH College
int x int x
INI INI
Outputs Outputs
$out[1]=true
$out[2]=true
$out[3]=true
01/2006 3
fold_en.ppt
Copyright by KUKA Roboter GmbH College
int x int x
INI INI
Outputs ;fold Outputs
$out[1]=true $out[1]=true
$out[2]=true $out[2]=true
$out[3]=true $out[3]=true
;endfold
01/2006 4
fold_en.ppt
Copyright by KUKA Roboter GmbH College
Definition of variables
Example:
Variable name
...
...
Part_counter
Part_counter==37
37 Content of the
...
... variable
01/2006 1
simple_data_types_en.ppt
Copyright by KUKA Roboter GmbH College
Declaration of variables
Example:
Def
DefMain(
Main())
DECL
DECLINT
INTpart_counter
part_counter
INI
INI
...
...
End
End
01/2006 2
simple_data_types_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 3
simple_data_types_en.ppt
Copyright by KUKA Roboter GmbH College
Floating-point
Meaning Integer
number
Logic state 1 character
-231 +/-1.1E-38
Range of ASCII character
... ... TRUE, FALSE
values 1-255
(231-1) +/-3.4E+38
01/2006 4
simple_data_types_en.ppt
Copyright by KUKA Roboter GmbH College
DEF
DEFNAME(
NAME() )
END
END
01/2006 5
simple_data_types_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 6
simple_data_types_en.ppt
Copyright by KUKA Roboter GmbH College
DEF
DEFMAIN_PROGRAM(
MAIN_PROGRAM() )
;---
;--- Declaration
Declarationsection
section ---
---
DECL
DECLINT
INTPART
PART
;---
;--- Initialization
Initializationsection
section ---
---
INI
INI ;Initialization
;Initializationofofacceleration
accelerationand
andvelocity
velocity
;--- Instruction section
;--- Instruction section ------
PART=58
PART=58 ;Value
;Valueassignment,
assignment,decimal
decimal
PART='B111010'
PART='B111010' Value assignment, binary
Value assignment, binary
PART='H3A'
PART='H3A' ;Value
;Valueassignment,
assignment,hexadecimal
hexadecimal
......
END
END
01/2006 7
simple_data_types_en.ppt
Copyright by KUKA Roboter GmbH College
Lifetime of variables
01/2006 8
simple_data_types_en.ppt
Copyright by KUKA Roboter GmbH College
Declaration of constants
Constant declarations always have the following syntax and they could
only declared in a data list:
Example :
Defdat
Defdat Main(
Main())
Decl
DeclCONST
CONSTREAL
REALPI
PI==3.14159
3.14159
...
...
End
End
01/2006 9
simple_data_types_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 1
monitor_variable_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 3
monitor_variable_en.ppt
Copyright by KUKA Roboter GmbH College
Softkeys Meaning
Display Switch to the display modes
Tab Next group/worksheet
Jump Jump to the group parameters
(e.g. column width)
Insert Open Insert menu (insert
before/after group/line)
Delete Delete a group/line
OK Confirm, save and close
configuration
Cancel Close window without saving
01/2006 4
monitor_variable_en.ppt
Copyright by KUKA Roboter GmbH College
Softkeys Meaning
Configure Switch to the configuration modes
Tab Next group/worksheet
Refresh all Static update
Start info / Activate/deactivate continual update
Cancel info
Edit Change the name or value of the
variable (writing access)
OK Confirm, save and close
configuration
Cancel Close window without saving
01/2006 5
monitor_variable_en.ppt
Copyright by KUKA Roboter GmbH College
3.3. Arrays
Arrays (one-dimensional)
Syntax: Creation:
DECL Data_Type Variable_Name[Number of array elements]
Work:
Variable_Name[Index] = Value_Assignment
Example: DEF
DEFMAIN_PROGRAM(
MAIN_PROGRAM() )
DECL
DECLREAL
REALmeasurement[3]
measurement[3]
INI
INI
measurement
measurement[1]
[1]==17.5
17.5
measurement
measurement[2]==35.7
[2] 35.7
measurement
measurement[3]
[3]==67.2
67.2
......
END
END
01/2006 1
arrays_en.ppt
Copyright by KUKA Roboter GmbH College
Example: DEF
DEFINIT_OUTPUTS
INIT_OUTPUTS(())
DECL
DECLINT
INTCOUNTER
COUNTER
INI
INI
$OUT[X]
FOR
FORCOUNTER=1
COUNTER=1TO TO10
10 no
;Set
;Set output 1-10 toFALSE
output 1-10 to FALSE
X>10 ?
$OUT[counter]=FALSE
$OUT[counter]=FALSE
ENDFOR
ENDFOR yes
...
...
END
END
01/2006 2
arrays_en.ppt
Copyright by KUKA Roboter GmbH College
DEF
DEFMAIN_PROGRAM(
MAIN_PROGRAM() )
DECL
DECLINT
INTCELL[4]
CELL[4]
DECL
DECL INTFI
INT FI ;Array
;Arrayindex
index
INI
INI
FOR
FORFI FI==11TO
TO44
CELL[FI]
CELL[FI] =FI
= FI**55
ENDFOR
ENDFOR
......
END
END
1*5=5
CELL 5
DEF
DEFMAIN_PROGRAM(
MAIN_PROGRAM() )
DECL
DECLINT
INTCELL[4]
CELL[4]
DECL
DECLINT
INTFI
FI ;Array
;Arrayindex
index
INI
INI
FOR
FORFI FI==11TO
TO44
CELL[FI]
CELL[FI] =FI
= FI**55
ENDFOR
ENDFOR
......
END
END
2 * 5 = 10
CELL 5 10
DEF
DEFMAIN_PROGRAM(
MAIN_PROGRAM() )
DECL
DECLINT
INTCELL[4]
CELL[4]
DECL
DECL INTFI
INT FI ;Array
;Arrayindex
index
INI
INI
FOR
FORFI FI==11TO
TO44
CELL[FI]
CELL[FI] =FI
= FI**55
ENDFOR
ENDFOR
......
END
END
3 * 5 = 15
CELL 5 10 15
DEF
DEFMAIN_PROGRAM(
MAIN_PROGRAM() )
DECL
DECLINT
INTCELL[4]
CELL[4]
DECL
DECLINT
INTFI
FI ;Array
;Arrayindex
index
INI
INI
FOR
FORFI FI==11TO
TO44
CELL[FI]
CELL[FI] =FI
= FI**55
ENDFOR
ENDFOR
......
END
END
FI = 5 4 * 5 = 20
CELL 5 10 15 20
Two-dimensional array
DEF
DEFMAIN_PROGRAM(
MAIN_PROGRAM() )
DECL
DECLINT INTMEAS_VALUE
MEAS_VALUE[2,4] [2,4]
DECL INT ROW,COLUMN
DECL INT ROW,COLUMN
INI
INI
; ;---
---Pre-assignment
Pre-assignmentofofan
anarray
array---
---
FOR
FORROW ROW==11TO TO22
FOR
FORCOLUMN COLUMN==11TO TO44
MEAS_VALUE
MEAS_VALUE [ROW,COLUMN]==00
[ROW,COLUMN]
ENDFOR
ENDFOR
ENDFOR
ENDFOR
......
END
END
Column 1 2 3 4
Row 1
0 0 0 0
Row 2
0 0 0 0
01/2006 7
arrays_en.ppt
Copyright by KUKA Roboter GmbH College
Column
Row Level
01/2006 8
arrays_en.ppt
Copyright by KUKA Roboter GmbH College
Three-dimensional array
DEF
DEFMAIN_PROGRAM(
MAIN_PROGRAM() )
BOOL
BOOLMATRIX
MATRIX[3,3,3]
[3,3,3]
INT
INTROW,
ROW,COLUMN,
COLUMN,LEVEL
LEVEL
INI
INI
FOR
FORLEVEL LEVEL==11TO
TO33
FOR
FOR COLUMN==11TO
COLUMN TO33
FOR
FOR ROW = 1 TO33
ROW = 1 TO
MATRIX
MATRIX[ROW,
[ROW,COLUMN,
COLUMN,LEVEL]
LEVEL]==FALSE
FALSE
ENDFOR
ENDFOR
ENDFOR
ENDFOR
ENDFOR
ENDFOR
......
END
END
01/2006 9
arrays_en.ppt
Copyright by KUKA Roboter GmbH College
3.4. Structures
Structures
Color Motor
01/2006 1
structure_en.ppt
Copyright by KUKA Roboter GmbH College
Structures
01/2006 2
structure_en.ppt
Copyright by KUKA Roboter GmbH College
User-defined structure
DEF
DEFWELD
WELD( () )
STRUC
STRUCWELDTYPE
WELDTYPEREAL
REALV_WIRE,
V_WIRE,INT
INTCHARAC,
CHARAC,BOOL
BOOLPULSE
PULSE
DECL
DECLWELDTYPE
WELDTYPESEAM1
SEAM1
INI
INI
SEAM1={V_WIRE
SEAM1={V_WIRE0.7,
0.7,CHARAC
CHARAC5,5,PULSE
PULSEFALSE}
FALSE}
......
SEAM1.PULSE=TRUE
SEAM1.PULSE=TRUE
......
END
END
Modification of a value in an
aggregate using a point separator
01/2006 3
structure_en.ppt
Copyright by KUKA Roboter GmbH College
Predefined structures
01/2006 4
structure_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 1
enum_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 2
enum_en.ppt
Copyright by KUKA Roboter GmbH College
DEF
DEFSEARCH
SEARCH()()
ENUM
ENUMCOUNTRY_TYPE
COUNTRY_TYPE German,
German,English,
English,French
French
DECL
DECLCOUNTRY_TYPE
COUNTRY_TYPE LANGUAGE
LANGUAGE
INI Generate enumerating variable
INI
......
LANGUAGE Declare enumerating variable
LANGUAGE==#German
#German
......
LANGUAGE Value assignment
LANGUAGE==#English
#English
Value assignment
END
END
01/2006 3
enum_en.ppt
Copyright by KUKA Roboter GmbH College
Data types
Simple Complex
data types data types
- INT - BOOL
- REAL - CHAR
Enumeration
Arrays Structures
data type
01/2006 4
enum_en.ppt
Copyright by KUKA Roboter GmbH College
Local subprograms
01/2006 1
subprogram_def_en.ppt
Copyright by KUKA Roboter GmbH College
Local subprograms
DEF
DEFMain_Program
Main_Program( () )
INI
INI
......
Subprogram1
Subprogram1( () )
......
Subprogram2
Subprogram2( () )
......
END
END
DEF
DEFSubprogram1
Subprogram1( () )
......
Subprogram2
Subprogram2( () )
......
END
END
DEF
DEFSubprogram2
Subprogram2( () )
......
END
END
01/2006 2
subprogram_def_en.ppt
Copyright by KUKA Roboter GmbH College
Global subprograms
DEF
DEFMAINPROG
MAINPROG(()) DEF
DEFGLOBAL_SP1
GLOBAL_SP1(())
INI
INI INI
INI
...
...
...
...
GLOBAL_SP1()
GLOBAL_SP1() ...
...
...
...
END
END END
END
01/2006 3
subprogram_def_en.ppt
Copyright by KUKA Roboter GmbH College
RETURN
DEF
DEFMAINPROG
MAINPROG(()) DEF
DEFGLOBAL_SP1
GLOBAL_SP1(())
INI
INI INI
INI
...
...
...
...
GLOBAL_SP1()
GLOBAL_SP1() IF
IFvalue
value>15
>15THEN
THEN
RETURN
RETURN
...
... ENDIF
ENDIF
END
END END
END
01/2006 4
subprogram_def_en.ppt
Copyright by KUKA Roboter GmbH College
Main_program ( )
X=21.0
Y=TRUE
Calc (X,Y) Calc ()
01/2006 1
subprogram_parameter_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 2
subprogram_parameter_en.ppt
Copyright by KUKA Roboter GmbH College
Example: DEF
DEFMAIN
MAIN( () )
REAL
REALAMOUNT
AMOUNT
INI
INI
......
CALC
CALC(AMOUNT)
(AMOUNT)
END
END
DEF
DEFCALC
CALC(SUM:OUT)
(SUM:OUT)
REAL
REALSUMSUM
......
END
END
01/2006 3
subprogram_parameter_en.ppt
Copyright by KUKA Roboter GmbH College
Example: DEF
DEFMAIN
MAIN( () )
REAL
REALAMOUNT
AMOUNT
INI
INI
......
CALC
CALC(AMOUNT)
(AMOUNT)
END
END
DEF
DEFCALC
CALC(SUM:OUT
(SUM:OUT) )
REAL SUM
REAL SUM
INI
INI
......
END
END
01/2006 4
subprogram_parameter_en.ppt
Copyright by KUKA Roboter GmbH College
DEF
DEFPROG_1
PROG_1( () )
INT
INT A,BB
A,
REAL
REALCC
AA==11
BB==22
Two types of parameter list
CC==3.0
3.0
Call by value: IN
Sequence Call by reference: OUT
CALC is important!
CALC(A,
(A,B,
B,C)
C)
HALT;
HALT;AAisisnownow11
11
The use of parameter lists is
; ;BBisisnow
now22 necessary in both
; ;CCisisnow
now3.0
3.0 LOCAL
END
END and
DEF GLOBAL
DEFCALC
CALC(X1:
(X1:OUT,
OUT,X2:X2:IN,
IN,X3:
X3:IN)
IN)
INT X1, X2
INT X1, X2 subprograms.
REAL
REALX3X3
X1
X1==X1+10
X1+10 ; ;X1
X1isisnow
now11
11
X2
X2 = X2+10 ; X2 is now12
= X2+10 ; X2 is now 12
X3
X3==X3+10
X3+10 ; ;X3
X3isisnow
now13.0
13.0
END
END
01/2006 5
subprogram_parameter_en.ppt
Copyright by KUKA Roboter GmbH College
Example: DEF
DEFMAIN
MAIN(())
CHAR
CHARNAME[8]
NAME[8]
INI
INI
...
...
SP1
SP1(NAME[
(NAME[])])
END
END
DEF
DEFSP1
SP1(FIRST_NAME[
(FIRST_NAME[]:OUT)
]:OUT)
CHAR
CHAR FIRST_NAME[]]
FIRST_NAME[
...
...
END
END
01/2006 6
subprogram_parameter_en.ppt
Copyright by KUKA Roboter GmbH College
4.3. Function
Functions
Function
Arithmetical
Input values algorithm Output value
Return
statement
Functions
X=15
Call by value
15 DEFFCT
DEFFCTINTINTSQUARE(NUMBER:IN)
SQUARE(NUMBER:IN)
NUMBER
INT
INTNUMBER
NUMBER
......
225 NUMBER=NUMBER*NUMBER
NUMBER=NUMBER*NUMBER X = 15
DEF
DEFPROG()
PROG() RETURN(NUMBER)
RETURN(NUMBER) Y = 225
INT
INTX,Y,E ......
X,Y,E E = 15
...... ENDFCT
ENDFCT
X=5*3
X=5*3
Y=SQUARE(X)
Y=SQUARE(X) ;Y=225
;Y=225
E=Y/X
E=Y/X
...... Call by reference
END
END DEFFCT
DEFFCTINTINTSQUARE(NUMBER:OUT)
SQUARE(NUMBER:OUT)
15 INT
INTNUMBER
NUMBER
......
X , NUMBER NUMBER=NUMBER*NUMBER
NUMBER=NUMBER*NUMBER X = 225
RETURN(NUMBER)
RETURN(NUMBER) Y = 225
225 ......
E=1
ENDFCT
ENDFCT
5. Data lists
DEF
DEFPROG_1
PROG_1(()) DEFDAT
DEFDATPROG_1
PROG_1
...
... INT
INTOTTO
OTTO==00
HALT
HALT Value assignment ENDDAT
... ENDDAT
...
OTTO
OTTO==25
25
... Declarationand initialization
...
HALT
HALT
END
END
DEFDAT
DEFDATPROG_1
PROG_1
INT
INTOTTO
OTTO==25
25
ENDDAT
ENDDAT
The value remains unchanged
after program execution
01/2006 1
data_files_en.ppt
Copyright by KUKA Roboter GmbH College
Certain system files are global data lists, i.e. variables, signals and
declarations are valid for all programs.
$MACHINE.DAT
DEFDAT $MACHINE
$CONFIG.DAT .. DEFDAT
..
$MACHINE
..
DEFDAT $CONFIG
.. DEFDAT $CONFIG $SOFTP_END[1] ==185.0
. ... . $SOFTP_END[1]
.
185.0
E6AXIS HOME ..
.. E6AXIS
.. HOME{A1
{A10.0,A2
0.0,A2-90.0,...}
-90.0,...} ..
.. $SOFTP_END[6] ==350.0
.. $SOFTP_END[6]
.
350.0
ENDDAT
ENDDAT . ..
ENDDAT
ENDDAT
01/2006 2
data_files_en.ppt
Copyright by KUKA Roboter GmbH College
Importing variables
PROG_1.SRC PROG_1.DAT
DEF
DEFPROG_1
PROG_1( () ) DEFDAT
DEFDATPROG_1
PROG_1PUBLIC
PUBLIC
...... DECL INT OTTO = 0
HALT DECL INT OTTO = 0
...HALT
...
......
OTTO ==25 ENDDAT
ENDDAT
...OTTO
...
25
END
END
PROG_2.SRC
DEF
The contents of the variable
DEFPROG_2
PROG_2( () ) cannot be modified
IMPORT
IMPORTINTINTOTTO_2
OTTO_2IS
IS/R1/PROG_1
/R1/PROG_1....OTTO
OTTO
...... Make sure that the path is
...... spelled correctly
END
END
01/2006 3
data_files_en.ppt
Copyright by KUKA Roboter GmbH College
Global variables
PROG_1.SRC PROG_1.DAT
DEF
DEFPROG_1
PROG_1( () ) DEFDAT
DEFDATPROG_1
PROG_1PUBLIC
PUBLIC
...... DECL
HALT DECL GLOBALINT
GLOBAL INTOTTO
OTTO==00
...HALT
...
......
OTTO ==25 ENDDAT
ENDDAT
...OTTO
...
25
END
END
PROG_2.SRC
DEF
DEFPROG_2
PROG_2( () )
...... The contents of the variable
OTTO
OTTO==100
100
...... can be modified
END
END
01/2006 4
data_files_en.ppt
Copyright by KUKA Roboter GmbH College
6. Data manipulation
Arithmetic operators
Basic arithmetic operations for the data types INTEGER and REAL:
Operator Description
+ Addition or positive sign
- Subtraction or negative sign
* Multiplication
/ Division
01/2006 1
manipulation_en.ppt
Copyright by KUKA Roboter GmbH College
Program example
DEF
DEFARITH()
ARITH()
;-------
;-------Declaration
Declarationsection
section--------
--------
INT
INTA,B,C
A,B,C
REAL
REALK,L,MK,L,M
;--------
;--------Initialization
Initializationsection
section-------
------- ;All
;Allvariables
variablesare
areinvalid
invalidprior
priortotoinitialization!
initialization!
AA== 22 ;A=2
;A=2
BB== 9.89.8 ;B=10
;B=10
CC== 7/47/4 ;C=1
;C=1
KK== 3.53.5 ;K=3.5
;K=3.5
LL == 0.1E01
0.1E01 ;L=1.0
;L=1.0* *EEhave
havetotobebeaacapital
capitalletter
letter
MM== 33 ;M=3.0
;M=3.0
;-------------
;-------------Main
Mainsection------------
section------------
AA== AA* *CC ;A=2
;A=2
BB== BB- -'HB
'HB ;B=-1
;B=-1
CC== CC++KK ;C=5
;C=5
KK== KK* *10 10 ;K=35.0
;K=35.0
LL == 1010/ /44 ;L=2.0
;L=2.0
LL == 1010/ /4.0
4.0 ;L=2.5
;L=2.5
LL == 1010/ /4.4. ;L=2.5
;L=2.5
LL == 10./
10./44 ;L=2.5
;L=2.5
CC== 10./
10./4.4. ;C=3
;C=3
MM== (10/3)
(10/3)* *MM ;M=9.0
;M=9.0
END
END
01/2006 2
manipulation_en.ppt
Copyright by KUKA Roboter GmbH College
Relational operators
01/2006 3
manipulation_en.ppt
Copyright by KUKA Roboter GmbH College
Logic operators
Logic operators are used for logic operations with Boolean variables, constants
and simple logic expressions.
01/2006 4
manipulation_en.ppt
Copyright by KUKA Roboter GmbH College
Truth table
1 & >1 =1
Operation
A=TRUE B=TRUE FALSE TRUE TRUE FALSE
A=TRUE B=FALSE FALSE FALSE TRUE TRUE
A=FALSE B=TRUE TRUE FALSE TRUE TRUE
A=FALSE B=FALSE TRUE FALSE FALSE FALSE
Example: ...
BOOL A,B,C
...
A = TRUE ;A=TRUE
B = NOT A ;B=FALSE
C = (A AND B) OR NOT (B EXOR NOT A) ;C=TRUE
A = NOT NOT C ;A=TRUE
...
01/2006 5
manipulation_en.ppt
Copyright by KUKA Roboter GmbH College
Bit operators
Bit operators are used to perform logic operations on the individual bits of whole
numbers.
As ASCII characters can also be addressed via the integer ASCII code, the data
type of the operands may also be CHAR besides INT. The result is always of type
INT.
01/2006 6
manipulation_en.ppt
Copyright by KUKA Roboter GmbH College
Bit operators
23 22 21 20
Values
8 4 2 1
B_AND 0 1 0 0 =4
B_OR 1 1 0 1 =13
B_EXOR 1 0 0 1 =9
Bit-by-bit inversion does not simply involve all the bits being inverted.
Instead, 1 is added to the operand and the sign is changed, e.g.:
B_NOT 10 = -11 or B_NOT -10 = 9
01/2006 7
manipulation_en.ppt
Copyright by KUKA Roboter GmbH College
Priority of operators
Priority Operator
1 NOT B_NOT
2 * /
3 + -
4 AND B_AND
5 EXOR B_EXOR
6 OR B_OR
7 == <> < > >= <=
01/2006 8
manipulation_en.ppt
Copyright by KUKA Roboter GmbH College
Standard functions
Description Function
Absolute value ABS (X)
Square root SQRT (X)
Sine SIN (X)
Cosine COS (X)
Tangent TAN (X)
Arc cosine ACOS (X)
Arc tangent ATAN2 (Y, X)
X=COS ()
X=SIN ()
01/2006 9
manipulation_en.ppt
Copyright by KUKA Roboter GmbH College
7. Motion programming
Forward transformation
X,Y,Z,A,B,C(,S,T) A1,A2,A3,A4,A5,A6
Z
Y
X
Reverse transformation
01/2006 1
motion_koordinate_systems_en.ppt
Copyright by KUKA Roboter GmbH College
X
Y Tool coordinate
Z system $TOOL
Z
Y
Z X
Y Z
Y Base coordinate
X system $BASE
Robot coordinate X
system World coordinate
$ROBROOT system $WORLD
01/2006 2
motion_koordinate_systems_en.ppt
Copyright by KUKA Roboter GmbH College
$IPO_MODE=#BASE
X
Y $TOOL
Z
$POS_ACT
Z
Y
X
Z
Z
Y
Y $BASE
X X
$ROBROOT $WORLD
01/2006 3
motion_koordinate_systems_en.ppt
Copyright by KUKA Roboter GmbH College
$IPO_MODE=#TCP
X
Y $TOOL
Z
$POS_ACT
Z
X
Z
Z
Y
Y
X X $BASE
$ROBROOT $WORLD
01/2006 4
motion_koordinate_systems_en.ppt
Copyright by KUKA Roboter GmbH College
Quickest motion between The TCP of the currently The TCP of the currently
two points. active tool is moved along active tool is moved along
a straight line from the a defined circular path.
The controller calculates
start point to the end
the required angle
point.
differences.
P2
P2
P1 P2
P1
P1
01/2006 1
motion_ptp_en.ppt
Copyright by KUKA Roboter GmbH College
BCO run
01/2006 2
motion_ptp_en.ppt
Copyright by KUKA Roboter GmbH College
Axis 4
Axis 2
01/2006 3
motion_ptp_en.ppt
Copyright by KUKA Roboter GmbH College
Vmax
Constant phase
velocity because
Constant
Acceleration
Deceleration
torque too high
phase
Reduction in
phase
phase
t
01/2006 4
motion_ptp_en.ppt
Copyright by KUKA Roboter GmbH College
DEF
DEFPTP_AXIS
PTP_AXIS(())
INT
INTXX
INI
INI ;Initialization
;Initialization
...
...
FOR
FORX=1X=1TO
TO66
$ACC_AXIS[X]=70
$ACC_AXIS[X]=70 ;Modification
;Modificationofofthe
theaxis
axisaccelerations
accelerations
$VEL_AXIS[X]=70
$VEL_AXIS[X]=70 ;Modification
;Modification of the axisvelocities
of the axis velocities
ENDFOR
ENDFOR
...
...
PTP
PTP{AXIS:
{AXIS:A1
A10,
0,A2
A290,
90,A3
A390,90,A4
A40,0,A5
A50,0,A6
A60} 0}
...
...
END
END
01/2006 5
motion_ptp_en.ppt
Copyright by KUKA Roboter GmbH College
DEF
DEFPTP_AXIS
PTP_AXIS(())
INT
INT XX
INI
INI
$BASE=BASE_DATA[1]
$BASE=BASE_DATA[1] ;Setting;Settingthe
thebase
basecoordinate
coordinatesystem
system
$TOOL=TOOL_DATA[3]
$TOOL=TOOL_DATA[3] ;Setting the tool coordinatesystem
;Setting the tool coordinate system
FOR
FORX=1 X=1TO
TO66
$ACC_AXIS[X]=70
$ACC_AXIS[X]=70 ;Modification
;Modificationofofthe
theaxis
axisaccelerations
accelerations
$VEL_AXIS[X]=70
$VEL_AXIS[X]=70 ;Modification
;Modificationof
ofthe
theaxis
axisvelocities
velocities
ENDFOR
ENDFOR
...
...
PTP
PTP{POS:X
{POS:X1025,
1025,YY0,
0,ZZ1480,
1480,AA0,0,BB0,
0,CC0}0}
...
...
END
END
01/2006 6
motion_ptp_en.ppt
Copyright by KUKA Roboter GmbH College
Absolute motion
A3 = 90 Actual position
Relative motion
01/2006 7
motion_ptp_en.ppt
Copyright by KUKA Roboter GmbH College
Y in [mm]
200
150
100
50
01/2006 8
motion_ptp_en.ppt
Copyright by KUKA Roboter GmbH College
Quickest motion between The TCP of the currently The TCP of the currently
two points. active tool is moved along active tool is moved along
a straight line from the a defined circular path.
The controller calculates
start point to the end
the required angle
point.
differences.
P2
P2
P1 P2
P1
P1
01/2006 1
motion_lin_circ_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 2
motion_lin_circ_en.ppt
Copyright by KUKA Roboter GmbH College
DEFDAT
DEFDAT$CONFIG
$CONFIG
...
...
; ;CPCP- -MOVEMENTS
MOVEMENTS
;----------------------------------
;----------------------------------
DECL
DECLCIRC_TYPE
CIRC_TYPEDEF_CIRC_TYP=#BASE
DEF_CIRC_TYP=#BASE
REAL DEF_VEL_CP=2.00
REAL DEF_VEL_CP=2.00
REAL
REALDEF_VEL_ORI1=200.0
DEF_VEL_ORI1=200.0
REAL
REALDEF_VEL_ORI2=200.0
DEF_VEL_ORI2=200.0
REAL
REALDEF_ACC_CP=2.3
DEF_ACC_CP=2.3
REAL
REALDEF_ACC_ORI1=100.0
DEF_ACC_ORI1=100.0
REAL
REALDEF_ACC_ORI2=100.0
DEF_ACC_ORI2=100.0
......
ENDDAT
ENDDAT
01/2006 3
motion_lin_circ_en.ppt
Copyright by KUKA Roboter GmbH College
DEF
DEFCPMOTION
CPMOTION( () )
INI
INI
$BASE=BASE_DATA[1]
$BASE=BASE_DATA[1] ;Setting
;Settingthe
thebase
basecoordinate
coordinatesystem
system
$TOOL=TOOL_DATA[3]
$TOOL=TOOL_DATA[3] ;Setting
;Settingthe
thetool
toolcoordinate
coordinatesystem
system
$VEL.CP=1.0
$VEL.CP=1.0 ;Modification
;Modificationofofvelocities
velocities
$VEL.ORI1=150
$VEL.ORI1=150
$VEL.ORI2=100
$VEL.ORI2=100
$ACC.CP=1.7
$ACC.CP=1.7 ;Modification
;Modificationofofaccelerations
accelerations
$ACC.ORI1=80
$ACC.ORI1=80
$ACC.ORI2=80
$ACC.ORI2=80
......
PTP
PTPHOMEHOME
LIN
LIN{X {X1050,
1050,ZZ900}
900} ;Absolute
;Absolutecoordinate
coordinatespecification
specification
LIN_REL {X 100, Y 250, Z 125} ;Relative distancespecification
LIN_REL {X 100, Y 250, Z 125} ;Relative distance specification
......
END
END
01/2006 4
motion_lin_circ_en.ppt
Copyright by KUKA Roboter GmbH College
Circular motion
Argument Explanation
Auxiliary point coordinate specified by means of an aggregate or the point
Aux_Point
name of a point in the data list
01/2006 5
motion_lin_circ_en.ppt
Copyright by KUKA Roboter GmbH College
Circular motion
The orientation angles at the calculated destination point are identical with the
orientation angles at the destination point, that was touched up.
Start point
Start point
01/2006 6
motion_lin_circ_en.ppt
Copyright by KUKA Roboter GmbH College
$ORI_
TYPE
= #CO
NST ANT
01/2006 1
motion_orientation_en.ppt
Copyright by KUKA Roboter GmbH College
$ORI_
TYPE
= #VA
R
01/2006 2
motion_orientation_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 3
motion_orientation_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 4
motion_orientation_en.ppt
Copyright by KUKA Roboter GmbH College
$ORI_TYPE = #CONSTANT
$CIRC_TYPE = #PATH
01/2006 5
motion_orientation_en.ppt
Copyright by KUKA Roboter GmbH College
$ORI_TYPE = #VAR
$CIRC_TYPE = #PATH
01/2006 6
motion_orientation_en.ppt
Copyright by KUKA Roboter GmbH College
$ORI_TYPE = #CONSTANT
$CIRC_TYPE = #BASE
01/2006 7
motion_orientation_en.ppt
Copyright by KUKA Roboter GmbH College
$ORI_TYPE = #VAR
$CIRC_TYPE = #BASE
01/2006 8
motion_orientation_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 1
continue_en.ppt
Copyright by KUKA Roboter GmbH College
The variable $ADVANCE specifies the maximum number of motion blocks the
advance run may process ahead of the program pointer. The actual advance
run is dependent, however, on the capacity of the computer.
Syntax:
$ADVANCE = Value
Value Explanation
0 Approximation not possible, every point is positioned exactly
1 Minimum value permitting approximation
3 Default
5 Maximum value
01/2006 2
continue_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 3
continue_en.ppt
Copyright by KUKA Roboter GmbH College
Instructions and data which affect the peripheral equipment (e.g. I/O
instructions), or which are based on the current state of the robot, trigger an
advance run stop. This is necessary in order to guarantee the correct sequence
of statements and robot motions.
01/2006 4
continue_en.ppt
Copyright by KUKA Roboter GmbH College
CONTINUE
Syntax: CONTINUE
01/2006 5
continue_en.ppt
Copyright by KUKA Roboter GmbH College
Syntax: CONTINUE
DEF EXIT_PRO ( )
...
PTP XP9 C_PTP
CONTINUE
WAIT FOR $IN[14] == TRUE
...
END
01/2006 6
continue_en.ppt
Copyright by KUKA Roboter GmbH College
DEF
DEFPTP_AXIS_CPTP
PTP_AXIS_CPTP(())
...
...
$APO.CPTP
$APO.CPTP==5050
...
...
PTP
PTPXHOME
XHOME
PTP
PTP {AXIS:A1
{AXIS: A180,
80,A2
A240,
40,A3
A30,0,A4
A40,0,A5
A50,
0,A6
A6-90}
-90}C_PTP
C_PTP
PTP XPOINT1 C_PTP
PTP XPOINT1 C_PTP
...
...
END
END
01/2006 1
motion_approximation_en.ppt
Copyright by KUKA Roboter GmbH College
PTP {POS:X 1159.08,Y -232.06,Z 716.38,A 171.85,B 67.32,C 162.65,S 2,T 10}
PTP {POS:X 1246.93,Y -98.86,Z 715,A 125.1,B 56.75,C 111.66,S 2,T 10} C_PTP
PTP {POS:X 1109.41,Y -0.51,Z 715,A 95.44,B 73.45,C 70.95,S 2,T 10}
$APO.CPTP=20
PTP {POS:X 1296.61,Y 133.41,Z 715,A 150.32,B 55.07,C 130.23,S 2,T 11} C_PTP
PTP {POS:X 988.45,Y 238.53,Z 715,A 114.65,B 50.46,C 84.62,S 2,T 11} C_PTP
PTP {POS:X 1209.5,Y 381.09,Z 715,A -141.91,B 82.41,C -159.41,S 2,T 11}
End point M
di otio
re
cti n
on
Start point
$APO.CPTP=20
01/2006 2
motion_approximation_en.ppt
Copyright by KUKA Roboter GmbH College
Unit /
Variable Description Keyword
Data type
01/2006 3
motion_approximation_en.ppt
Copyright by KUKA Roboter GmbH College
The size of the approximate positioning range is set using the variables
$APO.CDIS, $APO.CVEL and $APO.CORI
DEF
DEFLIN_CIRC_CONT
LIN_CIRC_CONT( () )
......
$APO.CVEL
$APO.CVEL==50 50
$APO.CDIS
$APO.CDIS==20 20
$APO.CORI
$APO.CORI==20 20
......
PTP
PTPXHOME
XHOME
LIN_REL
LIN_REL{X {X-500,
-500,ZZ250,
250,AA50,
50,CC90}
90}C_VEL
C_VEL
CIRC XHP, XZP, CA 270 C_ORI
CIRC XHP, XZP, CA 270 C_ORI
LIN
LIN{X {X1050,
1050,YY120,
120,ZZ1000,
1000,AA0,0,BB0,0,CC0}
0}C_DIS
C_DIS
......
END
END
01/2006 4
motion_approximation_en.ppt
Copyright by KUKA Roboter GmbH College
PTP {POS: X 1159.08,Y -232.06,Z 716.38,A 171.85,B 67.32,C 162.65,S 2,T 10}
$APO.CDIS=20
LIN {X 1246.93,Y -98.86,Z 715,A 125.1,B 56.75,C 111.66} C_DIS
LIN {X 1109.41,Y -0.51,Z 715,A 95.44,B 73.45,C 70.95}
LIN {X 1296.61,Y 133.41,Z 714.99,A 150.32,B 55.07,C 130.23} C_ORI
LIN {X 988.45,Y 238.53,Z 714.99,A 114.65,B 50.46,C 84.62} C_VEL
LIN {X 1209.5,Y 381.09,Z 715,A -141.91,B 82.41,C -159.41}
End point M
di otio
re
cti n
on
$APO.CDIS=20
Start point
01/2006 5
motion_approximation_en.ppt
Copyright by KUKA Roboter GmbH College
Program:
Program:
......
LIN
LINP1 P1
LIN
LINP2 P2C_DIS
C_DIS
PTP
PTPP3 P3
......
Table
01/2006 6
motion_approximation_en.ppt
Copyright by KUKA Roboter GmbH College
Program:
Program:
......
P2_AUX LIN
LINP1 P1
LIN
LINP2 P2C_DIS
C_DIS
LIN
LINP2_AUX
P2_AUXC_DIS
C_DIS
PTP
PTPP3 P3
......
Table
01/2006 7
motion_approximation_en.ppt
Copyright by KUKA Roboter GmbH College
PTP {POS: X 980,Y -238,Z 718,A 133,B 66,C 146,S 6,T 50}
$APO.CDIS=20
CIRC {X 925,Y -285,Z 718},{X 867,Y -192,Z 718,A 155,B 75,C 160} C_DIS
$ORI_TYPE=#CONST
CIRC {X 982,Y -221,Z 718,A 50,B 60,C 0},{X 1061,Y -118,Z 718,A -162,B 60,C 177}, CA 150 C_ORI
CIRC {X 963.08,Y -85.39,Z 718},{X 892.05,Y 67.25,Z 718.01,A 97.34,B 57.07,C 151.11} C_ORI
$APO.CVEL=50
CIRC_REL {X -50,Y 50},{X 0,Y 100} C_VEL
$APO.CDIS=40
CIRC_REL {X -50,Y 50},{X 0,Y 100} C_DIS Start point
CIRC_REL {X -50,Y 50},{X 0,Y 100}
End point
01/2006 8
motion_approximation_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 9
motion_approximation_en.ppt
Copyright by KUKA Roboter GmbH College
DEFDAT
DEFDATMAIN_PROGRAM
MAIN_PROGRAM(())
DECL
DECLPOS
POSXPOINT1={X
XPOINT1={X900,
900,YY0,
0,ZZ800,
800,AA0,
0,BB0,
0,CC0,
0,SS6,6,TT27}
27}
DECL FDAT FPOINT1...
DECL FDAT FPOINT1...
...
...
STATUS TURN
ENDDAT
ENDDAT
01/2006 1
motion_s_t_en.ppt
Copyright by KUKA Roboter GmbH College
Status = 1 Status = 2
Turn = 46 Turn = 43
Status = 6 Status = 4
Turn = 59 Turn = 63
01/2006 2
motion_s_t_en.ppt
Copyright by KUKA Roboter GmbH College
Turn
With rotational axes, the individual bits determine the sign before the
axis value in the following way:
Bit x = 0: angle of axis x 0
Bit x = 1: angle of axis x < 0
0 A6 0 A5 0 A4 0 A3 0 A2 0 A1 0
Example:
Specification T 19 TB010011
Axes A1, A2 and A5 negative; axes A3, A4 and A6 positive
01/2006 3
motion_s_t_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 4
motion_s_t_en.ppt
Copyright by KUKA Roboter GmbH College
Axis 5
Axis 3
Axis 2
Offset
Bit 1 specifies the position of the arm. The
setting of the bit is dependent on the robot model
in use. For robots whose axes 3 and 4 intersect,
the following applies:
Bit 1 has the value 0, if axis 3 < 0, otherwise
bit 1 = 1.
For robots with an offset between axis 3 and axis
4 (e.g. KR 30), the angle at which the value of bit KR 30
1 changes depends on the size of this offset.
01/2006 5
motion_s_t_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 6
motion_s_t_en.ppt
Copyright by KUKA Roboter GmbH College
8. System variables
01/2006 1
systemvariables_en.ppt
Copyright by KUKA Roboter GmbH College
Syntax:
$TIMER_STOP[No] = Value
Example:
$TIMER[5] = 0 ;Reset timer 5 by assigning a value
$TIMER_STOP[5] = FALSE ;Start timer 5
...
$TIMER_STOP[5] = TRUE ;Stop timer 5
01/2006 2
systemvariables_en.ppt
Copyright by KUKA Roboter GmbH College
Timer flag
1
$TIMER_STOP[No]
0
1
$TIMER_FLAG[No]
0
10000
$TIMER[No] in ms
0 Time
Zero position
-10000
01/2006 3
systemvariables_en.ppt
Copyright by KUKA Roboter GmbH College
Flags
Flags are 1-bit memories and are used as global markers. Flags are static.
Syntax:
$FLAG[No] = Value
Example:
$FLAG[1] = FALSE ;Reset flag 1
01/2006 4
systemvariables_en.ppt
Copyright by KUKA Roboter GmbH College
Cyclical flags
Cyclical flags are also 1-bit memories, but are cyclically active at the robot level
only.
Syntax:
$CYCFLAG[No] = Value
Example:
$CYCFLAG[1] = $IN[2] AND $IN[13] ;Boolean expression is cyclically
evaluated and updated.
01/2006 5
systemvariables_en.ppt
Copyright by KUKA Roboter GmbH College
01/2006 1
program_control_branches_en.ppt
Copyright by KUKA Roboter GmbH College
Jump instruction
Syntax:
GOTO Marker
DEF
DEFPRG
PRG(())
...
...
GOTO
GOTOMark1
Mark1
...
...
...
...
Mark1:
Mark1:
...
...
END
END
01/2006 2
program_control_branches_en.ppt
Copyright by KUKA Roboter GmbH College
Conditional branch
...
...
Condition
IF
IF$IN[22]==TRUE
$IN[22]==TRUETHEN
THEN
OK ?
PTP HOME
PTP HOME Yes
No
ELSE
ELSE
$OUT[17]=TRUE
$OUT[17]=TRUE Statement A Statement B
$OUT[18]=FALSE
$OUT[18]=FALSE
PTP
PTPHOME
HOME
ENDIF
ENDIF
...
...
01/2006 3
program_control_branches_en.ppt
Copyright by KUKA Roboter GmbH College
Verteiler
...
...
SWITCH
SWITCHPROG_NO
PROG_NO
CASE
CASE11
Part1
Part1(()) ; ;ififProg_No
Prog_No==11
CASE 2
CASE 2
Part2
Part2()() ; ;ififProg_No
Prog_No==22
DEFAULT
DEFAULT
ERROR_SP(
ERROR_SP()); ;all allother
othervalues
values
ENDSWITCH
ENDSWITCH
...
...
01/2006 4
program_control_branches_en.ppt
Copyright by KUKA Roboter GmbH College
9.2. Loops
WHILE
Conditional loops
REPEAT - UNTIL
01/2006 1
program_control_loops_en.ppt
Copyright by KUKA Roboter GmbH College
Loops - general
01/2006 2
program_control_loops_en.ppt
Copyright by KUKA Roboter GmbH College
Counting loop
Syntax:
FOR Counter = Start TO End STEP Increment
Statement
ENDFOR
E6POS
E6POSPOSITION[4,4]
POSITION[4,4]
INT
INTX, X,YY For i = 1 to 4
...
...
FOR
FORX=1 X=1TOTO44STEP
STEP11
FOR
FOR Y=4 TO11STEP
Y=4 TO STEP-1-1 Statement
POSITION[X,Y]=P1
POSITION[X,Y]=P1
POSITION[X,Y].X=P1.X+50
POSITION[X,Y].X=P1.X+50
POSITION[X,Y].Y=P1.Y+50
POSITION[X,Y].Y=P1.Y+50
ENDFOR
ENDFOR
ENDFOR
ENDFOR
01/2006 3
program_control_loops_en.ppt
Copyright by KUKA Roboter GmbH College
Rejecting loop
Statement
ENDWHILE
...
...
WHILE
WHILE$IN[22]==TRUE
$IN[22]==TRUE
WHILE
condition ?
$OUT[17]=TRUE
$OUT[17]=TRUE Yes
$OUT[18]=FALSE
$OUT[18]=FALSE No
PTP
PTPHOME
HOME
Statement
ENDWHILE
ENDWHILE
...
...
01/2006 4
program_control_loops_en.ppt
Copyright by KUKA Roboter GmbH College
Non-rejecting loop
Syntax: REPEAT
Statement
UNTIL Condition
...
...
REPEAT
REPEAT No
Statement
$OUT[17]=TRUE
$OUT[17]=TRUE
$OUT[18]=FALSE
$OUT[18]=FALSE
PTP
PTPHOME
HOME Repeat
condition ?
UNTIL
UNTIL$IN[22]==TRUE
$IN[22]==TRUE Yes
...
...
01/2006 5
program_control_loops_en.ppt
Copyright by KUKA Roboter GmbH College
Endless loop
Syntax: LOOP
Statement 1
...
Statement n
ENDLOOP
Statement A
...
...
PTP
PTPHOME
HOME
LOOP
LOOP Statement B
LIN
LINXP1
XP1
LIN
LINXP2
XP2
LIN
LINXP4
XP4 Statement C
ENDLOOP
ENDLOOP
PTP
PTPHOME
HOME
...
...
01/2006 6
program_control_loops_en.ppt
Copyright by KUKA Roboter GmbH College
Syntax: EXIT
DEF
DEFEXIT_PRO
EXIT_PRO(())
PTP
PTPXHOME
XHOME
LOOP
LOOP ;Start
;Startof
ofendless
endlessloop
loop
LIN XP1
LIN XP1
IF
IF$IN[1]
$IN[1]==
==TRUE
TRUETHEN
THEN ;Terminate
;Terminatewhen when
EXIT
EXIT ;input
;input11set
set
ENDIF
ENDIF
LIN
LINXP2
XP2
ENDLOOP
ENDLOOP ; ;End
Endofofendless
endlessloop
loop
PTP
PTPXHOME
XHOME
END
END
01/2006 7
program_control_loops_en.ppt
Copyright by KUKA Roboter GmbH College
Wait statements
DEF EXIT_PRO ( )
...
WAIT FOR $IN[14] == TRUE ;waits until input 14 is set
...
END
01/2006 1
program_control_add_en.ppt
Copyright by KUKA Roboter GmbH College
Wait statements
DEF EXIT_PRO ( )
...
WAIT SEC 5 ;waits 5 seconds
...
WAIT SEC Time*0.5+0.25 ;waits calculated time
END
01/2006 2
program_control_add_en.ppt
Copyright by KUKA Roboter GmbH College
Syntax: HALT
01/2006 3
program_control_add_en.ppt
Copyright by KUKA Roboter GmbH College
System structure
Control system
PLCs components
(robots and periphery)
Robots
01/2006 1
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
Automatic External:
Operating mode in which a
host computer or PLC
CELL.SRC assumes control of the robot
system.
PLC
Signal exchange
T T
01/2006 2
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
The signals of the Automatic External interface must be assigned physical inputs
and outputs of the robot controller.
01/2006 3
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
Functional
Variable name
description
01/2006 4
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
Functional
Function name
description
Output number
01/2006 5
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
$NEAR_POSRET
The signal $NEAR_POSRET can be used to determine whether or not the robot is
situated within a sphere about the position saved in $POS_RET*). The radius of the
sphere can be set in the file $CUSTOM.DAT using the system variable $NEARPATHTOL.
$NEAR_POSRET=FALSE
$NEAR_POSRET=TRUE
Deviation from
path caused,
th for example, by
Pa dynamic braking
$NEARPATHTOL
01/2006 6
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
INIT
BASISTECH INI
Position check CHECK HOME
PTP HOME Vel= 100 % DEFAULT
AUTOEXT INI
LOOP
Function for program P00 (#EXT_PGNO,#PGNO_GET,DMY[],0 )
number transfer
SWITCH PGNO
CASE 1
Delete semicolon P00 (#EXT_PGNO,#PGNO_ACKN,DMY[],0 )
;EXAMPLE1 ( )
CASE 2
Substitute program P00 (#EXT_PGNO,#PGNO_ACKN,DMY[],0 )
name for ;EXAMPLE2 ( )
EXAMPLEx CASE 3
P00 (#EXT_PGNO,#PGNO_ACKN,DMY[],0 )
;EXAMPLE3 ( )
If program number
invalid, restart program DEFAULT
P00 (#EXT_PGNO,#PGNO_FAULT,DMY[],0 )
with $EXT_START
ENDSWITCH
ENDLOOP
01/2006 7
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
Expanding CELL.SRC
LOOP
P00 (#EXT_PGNO,#PGNO_GET,DMY[],0 )
SWITCH PGNO
CASE 1
Select CASE branch with P00 (#EXT_PGNO,#PGNO_ACKN,DMY[],0 )
SHIFT + cursor key and insert PROG1 ( )
as new copied branch CASE 2
Proceed in the same way for P00 (#EXT_PGNO,#PGNO_ACKN,DMY[],0 )
PROG2 ( )
each subsequent program CASE 3
Modify program number and P00 (#EXT_PGNO,#PGNO_ACKN,DMY[],0 )
corresponding program name PROG3 ( )
CASE 4
P00 (#EXT_PGNO,#PGNO_ACKN,DMY[],0 )
PROG4 ( )
DEFAULT
P00 (#EXT_PGNO,#PGNO_FAULT,DMY[],0 )
ENDSWITCH
ENDLOOP
01/2006 8
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
$STOPMESS
PGNO_REQ
APPL_RUN
$PERI_RDY
INPUTS
OUTPUTS
$ALARM_STOP
$USER_SAF
$I_O_ACTCONF(EXT)
$ON_PATH
$PRO_ACT
$IN_HOME
PGNO / PGNO_PARITY
KRC PGNO_VALID PLC
OUTPUTS
$EXT_START
INPUTS
$MOVE_ENABLE
$CONF_MESS
$DRIVES_ON
$DRIVES_OFF
01/2006 9
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
KRC PLC
OUTPUTS
INPUTS
01/2006 10
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
INPUTS
OUTPUTS
$ALARM_STOP (no E-STOP)
$USER_SAF (safety gate closed)
$I_O_ACTCONF(EXT)
KRC PLC
OUTPUTS
INPUTS
01/2006 11
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
KRC PLC
OUTPUTS
01/2006 12
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
PGNO_REQ (request)
INPUTS
OUTPUTS
$ALARM_STOP (no E-STOP)
$USER_SAF (safety gate closed)
$I_O_ACTCONF(EXT)
$ON_PATH (robot is on path)
$PRO_ACT (program is active)
$IN_HOME (robot in HOME position)
PGNO (number + parity)
KRC PGNO_VALID (read command) PLC
OUTPUTS
INPUTS
01/2006 13
automatic_external_en.ppt
Copyright by KUKA Roboter GmbH College
This value determines the format in which the program number sent by the host
computer is read.
01/2006 1
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
Input: ... E8 E7 E6 E5 E4 E3 E2 E1
Example: 0 1 1 0 0 0 0 1
Prog. no.: 97 =0 + 64 + 32 + 0 + 0 + 0 + 0 + 1
01/2006 2
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
Input: ... E8 E7 E6 E5 E4 E3 E2 E1
Values: 8 4 2 1 8 4 2 1
Example: 0 0 1 0 0 1 1 1
Result: 2 7
Prog. no.: 27
01/2006 3
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
Prog. no. 1 : 0 0 0 0 0 0 0 1
Prog. no. 2 : 0 0 0 0 0 0 1 0
Prog. no. 3 : 0 0 0 0 0 1 0 0
Prog. no. 4 : 0 0 0 0 1 0 0 0
Prog. no. 5 : 0 0 0 1 0 0 0 0
Prog. no. 6 : 0 0 1 0 0 0 0 0
Prog. no. 7 : 0 1 0 0 0 0 0 0
Prog. no. 8 : 1 0 0 0 0 0 0 0
REFLECT_PROG_NR REFLECT_PROG_NR
This option allows you to decide whether or not the program number
should be mirrored in a definable output area.
REFLECT_PROG_NR Function
0 Deactivated
1 Activated
The output of the signal starts with the output defined using
PGNO_FBIT_REFL.
01/2006 5
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
Its value determines the number of bits defining the program number sent by the
host computer.
Example: PGNO_LENGTH = 4
01/2006 6
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
Example: PGNO_FBIT = 5
01/2006 7
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
Input to which the parity bit is transferred from the host computer.
Input Function
0 No evaluation
Positive value Even parity
01/2006 8
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
Input to which the command to read the program number is transferred from the
host computer. If the variable PGNO_TYPE has the value 3, PGNO_VALID is
not evaluated.
Input Function
Number is transferred at the falling edge of the signal
Negative value
01/2006 9
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
If the I/O interface is active, this input can be set to start or continue a program.
01/2006 10
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
This input is used by the host computer to check the robot drives.
Signal Function
TRUE Jogging and program execution are possible
All drives are stopped and all active commands inhibited
FALSE
If the drives have been switched off by the host computer, the message
GENERAL MOTION ENABLE appears in the message window of the
KCP. It is only possible to move the robot again once this message has
been reset and another external start signal has been given.
01/2006 11
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
Signal Function
01/2006 12
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
Setting this input enables the host computer to reset (acknowledge) error
messages automatically.
Acknowledgement of the error messages is only possible once the cause of the
error has been eliminated.
1 1
0 0
Rising edge Falling edge
01/2006 13
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
DRIVES_OFF (inverse)
DRIVES_ON
01/2006 14
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
$I_O_ACT Interface
The I/O interface can be activated by setting this system variable to TRUE
($IN[1025])
01/2006 15
automatic_external_inputs_en.ppt
Copyright by KUKA Roboter GmbH College
Start condition
01/2006 1
automatic_external_outputs_en.ppt
Copyright by KUKA Roboter GmbH College
Start condition
01/2006 2
automatic_external_outputs_en.ppt
Copyright by KUKA Roboter GmbH College
Start condition
01/2006 3
automatic_external_outputs_en.ppt
Copyright by KUKA Roboter GmbH College
Start condition
PGNO_FBIT_REFL
Mirrored output representing the first bit of the program number. If a program
selected by the PLC is deselected by the user, the output area starting with
PGNO_FBIT_REFL is set to FALSE. In this way, the PLC can prevent a
program from being restarted manually.
01/2006 4
automatic_external_outputs_en.ppt
Copyright by KUKA Roboter GmbH College
Program status
01/2006 5
automatic_external_outputs_en.ppt
Copyright by KUKA Roboter GmbH College
Program status
01/2006 6
automatic_external_outputs_en.ppt
Copyright by KUKA Roboter GmbH College
Robot position
01/2006 7
automatic_external_outputs_en.ppt
Copyright by KUKA Roboter GmbH College
Robot position
01/2006 8
automatic_external_outputs_en.ppt
Copyright by KUKA Roboter GmbH College
Operating mode
01/2006 9
automatic_external_outputs_en.ppt
Copyright by KUKA Roboter GmbH College
- Robot interpreter
- Controller interpreter
01/2006 1
submit_en.ppt
Copyright by KUKA Roboter GmbH College
SPS.SUB - Programming
DEF
DEFSPS
SPS(()) Declaration section
for SUBMIT
DECLARATIONS
DECLARATIONS
Initialization section
INI
INI for SUBMIT
LOOP
LOOP
GRIPPERKEYS
GRIPPERKEYS
STATUSKEYS Submit interpreter
STATUSKEYS
programs that run
USER continuously in the
USER
background
ENDLOOP
ENDLOOP
01/2006 2
submit_en.ppt
Copyright by KUKA Roboter GmbH College
SPS.SUB - Programming
Controller Robot
DEF
DEFSPS
SPS(())
...RUN
...RUN/R1/CELL(
/R1/CELL()) DEF
DEFCELL
CELL(())
LOOP
LOOP LOOP
LOOP
GRIPPERKEYS
GRIPPERKEYS CASE1 EXAMPLE1.SRC
CASE1
STATUSKEYS
STATUSKEYS
CASE2
CASE2 EXAMPLE2.SRC
USER
USER CASE3
CASE3 EXAMPLE3.SRC
ENDLOOP
ENDLOOP
ENDLOOP
ENDLOOP
SUBMIT 0 START SELECT
1 STOP
01/2006 3
submit_en.ppt
Copyright by KUKA Roboter GmbH College
SPS.SUB - Features
01/2006 4
submit_en.ppt
Copyright by KUKA Roboter GmbH College
$MODE_OP
Value Explanation
#T1 Robot controller is in T1 mode
01/2006 5
submit_en.ppt
Copyright by KUKA Roboter GmbH College
$OV_PRO = Value
Programming example:
If the programmed velocity cannot be reached, output 2 remains set to
FALSE:
...
...
IF
IF(($MODE_OP
(($MODE_OP====#T1)
#T1)OR
OR($OV_PRO
($OV_PRO<<100))
100))THEN
THEN
$OUT[2] = FALSE
$OUT[2] = FALSE
ENDIF
ENDIF
...
...
01/2006 6
submit_en.ppt
Copyright by KUKA Roboter GmbH College
12. Exercises
Exercise: Creating a program sequence 170
Exercise: Recapitulation of TOOL/BASE calibration 173
Exercise: Navigator (Expert) and endless loop 175
Exercise: Simple data types 177
Exercise: Arrays with simple data types and counting loop 179
Exercise: Creating a structure Box 181
Exercise: Creating an enumeration type - ENUM color 183
Exercise: Subprograms with parameter transfer 184
Exercise: Data manipulation - Position calculation 186
Exercise: Motion programming Palletizing / Depalletizing 189
Exercise: System variable Timer Cycle time measurement 191
Exercise: Use of loops 193
Exercise: Program optimization / Program intelligence 195
Exercise: Automatic External 197
Prerequisites:
Theoretical knowledge of the chapter Programming methodology
Necessary equipment:
Office PC with VISIO
Reading materials:
Training documentation:
Workbook Advanced Robot Programming Release 5.x Chapter Programming methodology
Task:
System description
The robots task is to remove plastic components from an injection molding machine. The components
are gripped using suction cups and stacked up on an indexing conveyor next to the injection molding
machine.
Gate 1
KUKA robot
Cell
Indexing conveyor
Procedure
Once the injection molding machine (IMM) has manufactured a part, gate 1 is opened. After checking
the limit switch, the robot moves to the unloading position and grips the part. The ejector pushes the part
out of the mold. The robot now moves out of the machine and the ejector is retracted. As soon as the
robot has moved safely out of the machine, gate 1 can be closed and a new part can be manufactured.
The finished part is now set down in the free space on the indexing conveyor. The indexing conveyor is
then moved until the setdown position is free again.
Input/output configuration
Tasks
Break the task down into appropriate program modules
Refine your preliminary task break-down
Create a program flowchart
Prerequisites:
Theoretical knowledge of tool calibration
Theoretical knowledge of base calibration
Necessary equipment:
Pen 1 from the pen magazine
Reading materials:
Standard documentation:
Operating Handbook, chapter Start-up
Task:
Calibrating the gripper
Calibrate the TCP of the gripper using numeric input. Assign the tool number 3 and the name
gripper. The calibration data are: X=132.05, Y=171.3, Z=173.0, A=45, B=0, C=0
Payload gripper : M=6,68kg; X=23mm; Y=11mm; Z=41mm; A=25; B=87; C=123; JX=0 kgm;
JY=0,4 kgm; JZ=0,46 kgm
TCP of gripper
y
z x
Calibration of pen 1
Use the uppermost pen from the pen magazine and clamp it manually in the gripper. Calibrate the
pen using the XYZ 4-Point and ABC World 5D methods. Use the tool number 2 and the name
pen 1.
Calibration of the blue BASE
BASE number 2 is calibrated using pen 1 and the 3-point method. The name blue base is used.
Prerequisites:
Theoretical knowledge of the Navigator at Expert level
Theoretical knowledge of the use of global subprograms
Theoretical knowledge of an endless loop
Necessary equipment:
Training cell
Reading materials:
Standard documentation:
Operating Handbook, chapter Start-up
Training documentation:
Workbook, chapter Navigator
Workbook, chapter Subprograms and functions Definition
Workbook, chapter Program execution control Loops
Task:
Procedure
Remove a cube from the cube magazine. The start and end position is the HOME position. Next,
place the cube back into the magazine. Both processes are then to be linked and left to run
continuously. Optimize the HOME position if necessary.
Task
Create two appropriate modules (Setdown_cube/Fetch_cube).
These are to be linked in the module MAGAZINE.
Before commencing programming, create a program flowchart
Test your program in the modes T1, T2 and Automatic. Observe the relevant safety instructions.
Prerequisites:
Theoretical knowledge of simple data types and how they are handled
CHAR A, b, C, X, 8, +
Necessary equipment:
Training cell
Reading materials:
Standard documentation:
Programming Handbook, chapter Expert Programming
Training documentation:
Workbook, chapter Variables and declarations Simple data types
Task:
Description
Expand the programs you have created to include the following:
A variable that counts the number of cubes transported since the last program selection.
A variable that saves the absolute number of all cubes transported so far.
A variable that adds up the combined weight (in kg) of all cubes transported. A cube weighs 0.329
kg.
A variable that is set to TRUE while the cube is being fetched and is otherwise set to FALSE.
A variable that contains the letter O when the gripper is open and the letter C when the gripper is
closed. In the undefined state, the variable is assigned the value X.
Use appropriate variable names and data types. It is also important to declare the variable in the
correct place.
Task
Define where your variables are declared.
Expand your existing program flowchart to include these new variables.
Observe the different initializations of the variables.
Test your program in the modes T1, T2 and Automatic. Observe the relevant safety instructions.
Prerequisites:
Knowledge of simple data types
Theoretical knowledge of arrays
Theoretical knowledge of the FOR loop
Theoretical knowledge of the variable display
Pre-initialization:
1 2 3 4 5 6 7 8 9 10 11 12
O O O O O O O O O O O O
Program execution:
1 2 3 4 5 6 7 8 9 10 11 12
X X X X X X O O O O O O
Reading materials:
Standard documentation:
Programming Handbook, chapter Expert Programming
Operating Handbook, chapter Operator control
Training documentation:
Workbook, chapter Variables and declarations Arrays
Task:
Description
Expand the program you have created to include the following:
Create a one-dimensional array of size 12. The contents of the individual boxes should be the
letters O and X.
Before the program is executed, the pre-defined content for all boxes should be the letter O
Once the first cube has been set down, the first box should receive the letter X. The same
procedure is to apply for each subsequent setdown operation.
Check the current array index and the contents of the array.
Task
Define where your variables are declared.
Expand your existing program flowchart to include this array.
Create a new group to display your required array variables.
Test your program in the modes T1, T2 and Automatic. Observe the relevant safety instructions.
Prerequisites:
Theoretical knowledge of simple data types and structures
Necessary equipment:
Training robot cell
Reading materials:
Standard documentation:
Programming Handbook, chapter Expert Programming
Training documentation:
Workbook, chapter Variables and declarations Structures
Task:
Task
Create a program with the name Structure.
Generate a structure with the name BOX_Type. This structure is to be able to store the following
variables:
o Length
o Width
o Height
o Painted (yes/no)
o Number of bottles
Assign the structure BOX_Type to the variable CRATE and initialize it with the following start values:
o Length 25.2
o Width 18.5
o Height 5.0
o Contents: 4 bottles
o Not painted
In the first operation, a further 8 bottles are added to the crate. In the second step, the CRATE is
painted. Plan a wait time of 3 seconds between steps one and two.
Display the contents of the variable CRATE during program execution.
Prerequisites:
Theoretical knowledge of simple data types and structures
Theoretical knowledge of simple ENUM variables
Necessary equipment:
Training robot cell
Reading materials:
Standard documentation:
Programming Handbook, chapter Expert Programming
Training documentation:
Workbook, chapter Variables and declarations ENUM
Task:
Task
Expand your program Structure to include the following:
Generate an ENUM variable containing the colors red, yellow, green and blue.
Create a variable with the name Lamp and assign it the color blue.
In the second step, assign the lamp the color yellow.
Expand your BOX_Type structure to include the aggregate Color and assign the following colors
to the CRATE: first red, then yellow, and finally green.
Display the contents of the variable CRATE during program execution.
Prerequisites:
Knowledge of working with subprograms
Theoretical knowledge of parameter transfer
Theoretical knowledge of functions
Necessary equipment:
Training robot cell
Reading materials:
Standard documentation:
Programming Handbook, chapter Expert Programming
Training documentation:
Workbook, chapter Subprograms and functions
Task:
Please complete the results following program execution.
Main program:
DEF var_transf( )
INT A, B, C, D, E, F
A=50
B=48
C=200
D=300
E=8
F=5
CALC (C, D, A, F, B, E)
;A = B = C =
;D = E = F =
END
Subprogram:
DEF CALC (X1:OUT, X2:IN, X3:OUT, X4:IN, X6:IN, X5:OUT)
INT X1, X2, X3, X4, X5, X6
; Calculation
X1 = X1+211 ; X1 =
X2 = X2-312 ; X2 =
X3 = X2 +X3 ; X3 =
X4 = X4 * X5 ; X4 =
X5 = X5 * 8 ; X5 =
X6 = X6 40 ; X6 =
END
Prerequisites:
Knowledge of arrays, structures and the FOR loop
Theoretical knowledge of data manipulation
Necessary equipment:
Training robot cell
Reading materials:
Standard documentation:
Programming Handbook, chapter Expert Programming
Training documentation:
Workbook, chapter Variables and subprograms
Workbook, chapter Data manipulation
Task:
80 mm
80 mm START position
Pre-position
Setdown position
b. Tasks
Expand your existing program flowchart to include this new function.
Expand your program CALCULATION to include this pre-position (declaration, initialization,
calculation).
Prerequisites:
Theoretical knowledge of motion programming without inline forms
Necessary equipment:
Training robot cell
Reading materials:
Standard documentation:
Programming Handbook, chapter Expert Programming
Training documentation:
Workbook, chapter Motion programming
Task:
Description
Duplicate your program CALCULATION with the new name Pallet.
Now that you have calculated the 16 setdown positions, it only remains to fetch the cube from the
magazine and set it down in the corresponding position on the table. Once all 16 cubes have been set
down, they should automatically be cleared away from the table. The cube that was set down first is also
to be cleared away first.
1st cube
16th cube
Tasks
Create a program flowchart for palletizing/depalletizing. A block with calculation is sufficient for
calculation of the coordinates.
Create a program for the entire operation.
Pack your calculation in suitable Folds.
Make appropriate use of existing modules.
Check the different variables in the variable display.
Test your program in the modes T1, T2 and Automatic. Observe the relevant safety instructions.
Prerequisites:
Knowledge of the system variable $TIMER[x].
Necessary equipment:
Training cell
Reading materials:
Standard documentation:
Programming Handbook, chapter Expert Programming
Training documentation:
Workbook, chapter System variables
Task:
Description
Duplicate your program Pallet and rename it Time_measurement. You should record three times.
Timer 1 is to time the palletization and timer 2 is to time the clearing operation. Timer 3 calculates the
overall time of the two operations. Make sure that you do not start and stop the timer with the advance
run.
Task
Use $TIMER[1] for timer 1 and also save the final value in $TIMER[4]. Assign the description of
timer 1 the name Current palletization and assign the saved value the name OLD palletization.
$TIMER[2] is used for timer 2 and the value is saved in $TIMER[5]. Here, once again, appropriate
names are to be assigned in the display.
$TIMER[3] is used for timer 3 and the value is saved in $TIMER[6]. Here, once again, appropriate
names are to be assigned in the display.
Try to optimize your program.
Test your program in the modes T1, T2 and Automatic. Observe the relevant safety instructions.
Prerequisites:
Theoretical knowledge of the functionality of the different loop techniques in programming
Necessary equipment:
Training robot cell
Reading materials:
Standard documentation:
Programming Handbook, chapter Expert Programming
Training documentation:
Workbook, chapter Program execution control
Task:
Description
In the program section Palletization, change the double FOR loop into two WHILE loops. During
depalletization, the existing loops are to be converted into REPEAT/UNTIL loops.
Task
Duplicate your program Pallet with the new name Pal_loop.
Update your existing program flowchart for the new loops.
Create new counting variables for your loops. Make sure that your variables are correctly initialized
or suitably reset.
Modify the way the cubes are cleared from the table so that the last cube cleared is the first one to
be picked up and set back down again.
Test your program in the modes T1, T2 and Automatic. Observe the relevant safety instructions.
Prerequisites:
Knowledge of the Navigator at Expert level
Knowledge of subprogram and loop programming
Necessary equipment:
Training robot cell
Reading materials:
Standard documentation:
Programming Handbook, chapter Expert Programming
Training documentation:
Workbook, chapter Variables and declarations
Workbook, chapter Program execution control
Task:
Description
Optimize your program Pal_loop by expanding it so that you can deselect it at any time and resume
program execution on restarting the program from the point at which it was stopped.
Task
Define in your program sequence whether you are palletizing or depalletizing.
Evaluate the state of the gripper (e.g: open $IN[26] / closed with cube $IN[29]) and resume the
program accordingly.
Check during initialization of the basic values whether this is necessary, or whether you wish to
continue working with the saved values.
Update your existing program flowchart for this new function.
Test your program in the modes T1, T2 and Automatic. Observe the relevant safety instructions.
Prerequisites:
Knowledge of how to edit the Cell program
Knowledge of how to configure the Automatic External interface
Theoretical knowledge of the signal sequence in Automatic External
Necessary equipment:
Training robot cell
Reading materials:
Standard documentation:
Programming Handbook, chapter Configuration
Training documentation:
Workbook, chapter Automatic External interface
Task:
Description:
You have individual functioning modules and these are to be made available to the Automatic External
interface.
Task
Configure the Automatic External interface to the requirements of your control panel.
Expand your Cell program by any three modules, the functions of which you have verified
beforehand.
Use buttons to simulate the functionality of the PLC.
Test your program in the modes T1, T2 and Automatic. Observe the relevant safety instructions.
Input 17