S4C-RAPID Reference Manual 3.2 (3HAC 5783-1)
S4C-RAPID Reference Manual 3.2 (3HAC 5783-1)
S4C-RAPID Reference Manual 3.2 (3HAC 5783-1)
Table of Contents
Introduction
RAPID Overview
RAPID Summary
Basic Characteristics
Programming Off-line
Index, Glossary
The information in this document is subject to change without notice and should not be construed as a commitment
by ABB Robotics AB. ABB Robotics AB assumes no responsibility for any errors that may appear in this document.
In no event shall ABB Robotics AB be liable for incidental or consequential damages arising from use of this document or of the software and hardware described in this document.
This document and parts thereof must not be reproduced or copied without ABB Robotics ABs written permission,
and contents thereof must not be imparted to a third party nor be used for any unauthorized purpose. Contravention will be prosecuted.
Additional copies of this document may be obtained from ABB Robotics AB at its then current charge.
ABB Robotics AB
Article number: 3HAC 5774-1
Issue: For BaseWare OS 3.2
ABB Robotics AB
S-721 68 Vsters
Sweden
RAPID Overview
CONTENTS
Page
1-1
RAPID Overview
1-2
RAPID Overview
RAPID Overview
10 System & Time .............................................................................................................. 3-27
10.1 Programming principles ....................................................................................... 3-27
10.2 Using a clock to time an event.............................................................................. 3-27
10.3 Reading current time and date .............................................................................. 3-27
10.4 Retrieve time information from file...................................................................... 3-28
11 Mathematics................................................................................................................... 3-29
11.1 Programming principles........................................................................................ 3-29
11.2 Simple calculations on numeric data .................................................................... 3-29
11.3 More advanced calculations ................................................................................. 3-29
11.4 Arithmetic functions ............................................................................................. 3-30
12 Spot Welding.................................................................................................................. 3-32
12.1 Spot welding features ........................................................................................... 3-32
12.2 Principles of SpotWare ......................................................................................... 3-33
12.3 Programming principles ....................................................................................... 3-34
12.4 Spot welding instructions ..................................................................................... 3-34
12.5 Spot welding data ................................................................................................. 3-34
13 Arc Welding ................................................................................................................... 3-35
13.1 Programming principles ....................................................................................... 3-35
13.2 Arc welding instructions....................................................................................... 3-35
13.3 Arc welding plus instructions ............................................................................... 3-36
13.4 Arc welding data................................................................................................... 3-36
13.5 Arc welding plus data ........................................................................................... 3-36
14 GlueWare ....................................................................................................................... 3-37
14.1 Glueing features.................................................................................................... 3-37
14.2 Programming principles ....................................................................................... 3-37
14.3 Glue instructions................................................................................................... 3-37
14.4 Glue data............................................................................................................... 3-38
14.5 DispenseWare data................................................................................................ 3-38
15 External Computer Communication........................................................................... 3-39
15.1 Programming principles ....................................................................................... 3-39
15.2 Sending a program-controlled message from the robot to a computer................. 3-39
16 RAPID Support Instructions ....................................................................................... 3-41
16.1 Get system data..................................................................................................... 3-41
17 Service Instructions....................................................................................................... 3-43
17.1 Directing a value to the robots test signal ........................................................... 3-43
18 String Functions ............................................................................................................ 3-45
18.1 Basic Operations................................................................................................... 3-45
18.2 Comparison and Searching................................................................................... 3-45
RAPID Overview
1-3
RAPID Overview
18.3 Conversion............................................................................................................ 3-46
19 Multitasking................................................................................................................... 3-47
19.1 Basics.................................................................................................................... 3-47
19.2 Resource access Protection .................................................................................. 3-47
20 Syntax Summary ........................................................................................................... 3-49
20.1 Instructions ........................................................................................................... 3-49
20.2 Functions .............................................................................................................. 3-55
1-4
RAPID Overview
RAPID Overview
5.4 Constant declaration ............................................................................................... 4-23
5.5 Initiating data.......................................................................................................... 4-24
5.6 Storage Class .......................................................................................................... 4-24
5.7 Syntax ..................................................................................................................... 4-25
6 Instructions ...................................................................................................................... 4-27
6.1 Syntax ..................................................................................................................... 4-27
7 Expressions ...................................................................................................................... 4-29
7.1 Arithmetic expressions ........................................................................................... 4-29
7.2 Logical expressions ................................................................................................ 4-30
7.3 String expressions................................................................................................... 4-30
7.4 Using data in expressions ....................................................................................... 4-31
7.5 Using aggregates in expressions............................................................................. 4-32
7.6 Using function calls in expressions ........................................................................ 4-32
7.7 Priority between operators...................................................................................... 4-33
7.8 Syntax ..................................................................................................................... 4-34
8 Error Recovery................................................................................................................ 4-37
8.1 Error handlers ......................................................................................................... 4-37
9 Interrupts ......................................................................................................................... 4-39
9.1 Interrupt manipulation ............................................................................................ 4-39
9.2 Trap routines ........................................................................................................... 4-40
10 Backward execution ...................................................................................................... 4-41
10.1 Backward handlers ............................................................................................... 4-41
10.2 Limitation of move instructions in the backward handler.................................... 4-42
11 Multitasking ................................................................................................................... 4-43
11.1 Synchronising the tasks ........................................................................................ 4-44
11.2 Intertask communication ...................................................................................... 4-45
11.3 Type of task........................................................................................................... 4-46
11.4 Priorities................................................................................................................ 4-47
11.5 Trust Level ............................................................................................................ 4-48
11.6 Task sizes .............................................................................................................. 4-48
11.7 Something to think about...................................................................................... 4-48
11.8 Programming scheme ........................................................................................... 4-49
RAPID Overview
1-5
RAPID Overview
4
5
1-6
RAPID Overview
RAPID Overview
8.5 Actions.................................................................................................................... 5-49
8.6 Minimum size of World Zones. .............................................................................. 5-50
8.7 Maximum number of World Zones ........................................................................ 5-50
8.8 Power failure, restart, and run on ........................................................................... 5-50
8.9 Related information ................................................................................................ 5-51
9 I/O Principles................................................................................................................... 5-53
9.1 Signal characteristics .............................................................................................. 5-53
9.2 Signals connected to interrupt ................................................................................ 5-54
9.3 System signals ........................................................................................................ 5-54
9.4 Cross connections ................................................................................................... 5-55
9.5 Limitations.............................................................................................................. 5-55
9.6 Related information ................................................................................................ 5-56
RAPID Overview
1-7
RAPID Overview
1-8
RAPID Overview
Introduction
1 Introduction
This is a reference manual containing a detailed explanation of the programming
language as well as all data types, instructions and functions. If you are programming off-line, this manual will be particularly useful in this respect.
When you start to program the robot it is normally better to start with the Users
Guide until you are familiar with the system.
2-1
Introduction
To make things easier to locate and understand, RAPID Overview chapter 8 contains an Index, Glossary and System DataTypes and Routines Chapter 4 contains an
index.
Typographic conventions
The commands located under any of the five menu keys at the top of the teach pendant display are written in the form of Menu: Command. For example, to activate
the Print command in the File menu, you choose File: Print.
The names on the function keys and in the entry fields are specified in bold italic
typeface, e.g. Modpos.
Words belonging to the actual programming language, such as instruction names,
are written in italics, e.g. MoveL.
Examples of programs are always displayed in the same way as they are output to a
diskette or printer. This differs from what is displayed on the teach pendant in the
following ways:
- Certain control words that are masked in the teach pendant display are
printed, e.g. words indicating the start and end of a routine.
- Data and routine declarations are printed in the formal form,
e.g. VAR num reg1;.
Syntax rules
Instructions and functions are described using both simplified syntax and formal
syntax. If you use the teach pendant to program, you generally only need to know
the simplified syntax, since the robot automatically makes sure that the correct syntax is used.
Simplified syntax
Example:
TPWrite
Instruction
Optional
argument
Mutually
exclusive
arguments
2-2
RAPID Overview
Introduction
Formal syntax
Example:
TPWrite
[String:=] <expression (IN) of string>
[\Num:= <expression (IN) of num> ] |
[\Bool:= <expression (IN) of bool> ] |
[\Pos:= <expression (IN) of pos> ] |
[\Orient:= <expression (IN) of orient> ];
GOTO <identifier>;
<identifier> ::= <ident>
| <ID>
<ident> ::= <letter> {<letter> | <digit> | _}
RAPID Overview
2-3
Introduction
2-4
RAPID Overview
RAPID Summary
3-1
3-2
RAPID Summary
RAPID Overview
RAPID Summary
Used to:
ProcCall
CallByVar
RETURN
Used to:
Compact IF
IF
FOR
WHILE
TEST
GOTO
Jump to a label
label
RAPID Overview
3-3
RAPID Summary
Used to:
Stop
EXIT
Break
3-4
Instruction
Used to:
Exit cycle
Stop the current cycle and move the program pointer to the first
instruction in the main routine. When the execution mode
CONT is selected, execution will continue with the next
program cycle.
RAPID Overview
RAPID Summary
Various Instructions
3 Various Instructions
Various instructions are used to
- assign values to data
- wait a given amount of time or wait until a condition is satisfied
- insert a comment into the program
- load program modules.
Used to:
:=
3.2 Wait
The robot can be programmed to wait a given amount of time, or to wait until an arbitrary condition is satisfied; for example, to wait until an input is set.
Instruction
Used to:
WaitTime
WaitUntil
WaitDI
WaitDO
3.3 Comments
Comments are only inserted into the program to increase its readability. Program execution is not affected by a comment.
Instruction
Used to:
comment
RAPID Overview
3-5
Various Instructions
RAPID Summary
Used to:
Load
UnLoad
Start Load
Wait Load
Save
Data type
Used to:
loadsession
Used to:
OpMode
RunMode
Dim
Present
IsPers
IsVar
3-6
Data type
Used to define:
bool
num
symnum
string
Character strings
switch
RAPID Overview
RAPID Summary
Various Instructions
Used to:
StrToByte
ByteToStr
RAPID Overview
3-7
Various Instructions
3-8
RAPID Summary
RAPID Overview
RAPID Summary
Motion Settings
4 Motion Settings
Some of the motion characteristics of the robot are determined using logical
instructions that apply to all movements:
- Maximum velocity and velocity override
- Acceleration
- Management of different robot configurations
- Payload
- Behaviour close to singular points
- Program displacement
- Soft servo
- Tuning values
Used to define:
VelSet
RAPID Overview
3-9
Motion Settings
RAPID Summary
Used to define:
AccSet
Used to define:
ConfJ
ConfL
Used to define:
GripLoad
3-10
Instruction
Used to define:
SingArea
RAPID Overview
RAPID Summary
Motion Settings
Used to:
PDispOn
PDispSet
PDispOff
EOffsOn
EOffsSet
EOffsOff
Function
Used to:
DefDFrame
DefFrame
ORobT
Used to:
SoftAct
SoftDeact
Used to:
TuneServo1
TuneReset
PathResol
Data type
Used to:
tunetype
1. Only when the robot is equipped with the option Advanced Motion
RAPID Overview
3-11
Motion Settings
RAPID Summary
Used to:
WZBoxDef
WZCylDef
WZSphDef
WZLimSup1
WZDOSet1
WZDisable1
WZEnable1
WZFree1
Data type
Used to:
wztemporary
wzstationary
shapedata
Used to define:
motsetdata
progdisp
Program displacement
1. Only when the robot is equipped with the option Advanced functions
3-12
RAPID Overview
RAPID Summary
Motion
5 Motion
The robot movements are programmed as pose-to-pose movements, i.e. move from
the current position to a new position. The path between these two positions is then
automatically calculated by the robot.
RAPID Overview
3-13
Motion
RAPID Summary
Type of movement:
MoveC
MoveJ
Joint movement
MoveL
MoveAbsJ
MoveCDO
MoveJDO
MoveLDO
MoveCSync1
MoveJSync
MoveLSync1
5.3 Searching
During the movement, the robot can search for the position of a work object, for example. The searched position (indicated by a sensor signal) is stored and can be used later
to position the robot or to calculate a program displacement.
Instruction
Type of movement:
SearchC
SearchL
Used to:
TriggIO1
TriggInt
3-14
RAPID Overview
RAPID Summary
Motion
TriggEquip1
TriggC1
TriggJ1
TriggL1
Data type
Used to define:
triggdata1
Trigg conditions
aoitrigg
Used to:
StopMove
StartMove
StorePath1
RestoPath1
Used to:
DeactUnit
ActUnit
MechUnit Load
RAPID Overview
3-15
Motion
RAPID Summary
Function
Used to:
2
IndAMove
IndCMove2
IndDMove2
IndRMove2
IndReset2
IndInpos2
IndSpeed
Instruction
Used to:
HollowWristReset2
Used to:
CorrCon2
CorrWrite2
CorrDiscon2
CorrClear2
Function
Used to:
CorrRead2
Data type
Used to:
Corrdescr2
3-16
RAPID Overview
RAPID Summary
Motion
Used to:
WaitWObj3
DropWObj3
Used to:
MotionSup
ParIdPosValid
ParIdRobValid
LoadId
Used to:
Offs
RelTool
CalcRobT
CPos
CRobT
CJointT
ReadMotor
CTool
CWObj
ORobT
MirPos
Mirror a position
CalcJointT
Distance
RAPID Overview
3-17
Motion
RAPID Summary
Used to define:
robtarget
jointtarget
speeddata
The speed
zonedata
tooldata
wobjdata
3-18
Data type
Used to define:
pos
A position (x, y, z)
orient
An orientation
pose
confdata
extjoint
robjoint
o_robtarget
o_jointtarget
loaddata
A load
mecunit
RAPID Overview
RAPID Summary
Used to:
InvertDO
PulseDO
Reset
Set
SetAO
SetDO
SetGO
RAPID Overview
3-19
RAPID Summary
Used to:
WaitDI
WaitDO
Function
Used to:
TestDI
Used to:
IODisable
IOEnable
Used to define:
dionum
signalai
signalao
signaldi
signaldo
signalgi
signalgo
Instruction
Used to:
AliasIO1
3-20
RAPID Overview
RAPID Summary
Communication
7 Communication
There are four possible ways to communicate via serial channels:
- Messages can be output to the teach pendant display and the user can answer
questions, such as about the number of parts to be processed.
- Character-based information can be written to or read from text files in mass
memory. In this way, for example, production statistics can be stored and processed later in a PC. Information can also be printed directly on a printer connected to the robot.
- Binary information can be transferred between the robot and a sensor, for example.
- Binary information can be transferred between the robot and another computer,
for example, with a link protocol.
Used to:
TPErase
TPWrite
ErrWrite
TPReadFK
TPReadNum
TPShow
RAPID Overview
3-21
Communication
RAPID Summary
Used to:
Open1
Write
Close
Function
Used to:
1
ReadNum
ReadStr1
Used to:
Open1
WriteBin1
WriteAnyBin1
WriteStrBin1
Rewind1
Close1
ClearIOBuff1
Function
Used to:
ReadBin1
ReadAnyBin
Used to define:
iodev
3-22
RAPID Overview
RAPID Summary
Interrupts
8 Interrupts
Interrupts are used by the program to enable it to deal directly with an event, regardless
of which instruction is being run at the time.
The program is interrupted, for example, when a specific input is set to one. When this
occurs, the ordinary program is interrupted and a special trap routine is executed.
When this has been fully executed, program execution resumes from where it was
interrupted.
Used to:
CONNECT
RAPID Overview
3-23
Interrupts
RAPID Summary
Used to order:
ISignalDI
SignalDO
ITimer
A timed interrupt
TriggInt1
Used to:
IDelete
Used to:
ISleep
IWatch
IDisable
IEnable
Used to define:
intnum
3-24
RAPID Overview
RAPID Summary
Error Recovery
9 Error Recovery
Many of the errors that occur when a program is being executed can be handled in the
program, which means that program execution does not have to be interrupted. These
errors are either of a type detected by the robot, such as division by zero, or of a type
that is detected by the program, such as errors that occur when an incorrect value is
read by a bar code reader.
Used to:
RAISE
RAPID Overview
3-25
Error Recovery
RAPID Summary
Used to:
EXIT
RAISE
Call the error handler of the routine that called the current routine
RETRY
TRYNEXT
RETURN
3-26
Data type
Used to define:
errnum
RAPID Overview
RAPID Summary
Used to:
ClkReset
ClkStart
ClkStop
Function
Used to:
ClkRead
Data Type
Used for:
clock
Used to:
CDate
CTime
GetTime
RAPID Overview
3-27
RAPID Summary
3-28
Function
Used to:
FileTime
ModTime
RAPID Overview
RAPID Summary
Mathematics
11 Mathematics
Mathematical instructions and functions are used to calculate and change the value of
data.
Used to:
Clear
Add
Incr
Increment by 1
Decr
Decrement by 1
Used to:
:=
RAPID Overview
3-29
Mathematics
RAPID Summary
3-30
Function
Used to:
Abs
Round
Trunc
Sqrt
Exp
Pow
ACos
ASin
ATan
ATan2
Cos
Sin
Tan
EulerZYX
OrientZYX
PoseInv
Invert a pose
PoseMult
Multiply a pose
PoseVect
Vectmagn
DotProd
NOrient
RAPID Overview
RAPID Summary
RAPID Overview
Mathematics
3-31
Spot Welding
RAPID Summary
12 Spot Welding
The SpotWare package provides support for spot welding applications that are
equipped with a weld timer and on/off weld gun.
The SpotWare application provides fast and accurate positioning combined with gun
manipulation, process start and supervision of an external weld timer.
Communication with the welding equipment is carried out by means of digital inputs
and outputs. Some serial weld timer interfaces are also supported: Bosch PSS5000,
NADEX, ABB Timer. See separate documentation.
It should be noted that SpotWare is a package that can be extensively customised. The
intention is that the user adapts some user data and routines to suit the environmental
situation.
3-32
RAPID Summary
Spot Welding
3-33
Spot Welding
RAPID Summary
Used to:
SpotL
SpotJ
SpotML
3-34
Data type
Used to define:
spotdata
gundata
spotmdata
gunmdata
RAPID Summary
Arc Welding
13 Arc Welding
The ArcWare package supports most welding functions. Crater-filling and scraping
starts can, for example, be programmed. Using ArcWare, the whole welding process
can be controlled and monitored by the robot via a number of different digital and analog inputs and outputs.
WELD
START
PREACTION
IGNITION
END
FINISH
HEAT
FILL
POSTACTION
Type of movement:
ArcC
ArcL
RAPID Overview
3-35
Arc Welding
RAPID Summary
Type of movement:
ArcRefresh
ArcKill
SpcWrite
SpcStat
SpcRead
SpcDump
SpcDiscon
SpcCon
Used to define:
welddata
seamdata
weavedata
arcdata
3-36
Data type
Used to define:
spcdescr
spcdata
RAPID Overview
RAPID Summary
GlueWare
14 GlueWare
The GlueWare package provides support for gluing applications that are equipped with
one or two gluing guns.
The GlueWare application provides fast and accurate positioning combined with gun
manipulation, process start and stop.
Communication with the glueing equipment is carried out by means of digital and analog outputs.
Used to:
GlueL
Move the TCP along a linear path and perform gluing with the
given data
GlueC
Move the TCP along a circular path and perform gluing with
the given data
RAPID Overview
3-37
GlueWare
RAPID Summary
Used to define:
ggundata
3-38
Data type
Used to define:
beaddata
equidata
RAPID Overview
RAPID Summary
Used to:
SCWrite1
1. Only if the robot is equipped with the option RAP Serial Link.
RAPID Overview
3-39
3-40
RAPID Summary
RAPID Overview
RAPID Summary
Used to:
GetSysData
Fetch data for and name of current active Tool or Work Object.
RAPID Overview
3-41
3-42
RAPID Summary
RAPID Overview
RAPID Summary
Service Instructions
17 Service Instructions
A number of instructions are available to test the robot system. See the chapter on
Troubleshooting Tools in the Product Manual for more information.
Used to:
TestSign
Data type
Used to define:
testsignal
RAPID Overview
3-43
Service Instructions
3-44
RAPID Summary
RAPID Overview
RAPID Summary
String Functions
18 String Functions
String functions are used for operations with strings such as copying, concatenation,
comparison, searching, conversion, etc.
Used to define:
string
Instruction/Operator
Used to:
:=
String concatenation
Function
Used to:
StrLen
StrPart
Used to:
Test if equal to
<>
Function
Used to:
StrMemb
StrFind
StrMatch
StrOrder
RAPID Overview
3-45
String Functions
RAPID Summary
18.3 Conversion
3-46
Function
Used to:
NumToStr
ValToStr
StrToVal
StrMap
Map a string
StrToByte
ByteToStr
RAPID Overview
RAPID Summary
Multitasking
19 Multitasking
Multitasking RAPID is a way to execute programs in (pseudo) parallel with the
normal execution. One parallel program can be placed in the background or foreground
of another program. It can also be on the same level as another program.
(See Basic Characteristics Multitasking.)
19.1 Basics
To use this function the robot must be configured with one extra TASK for each background program.
Up to 10 different tasks can be run in pseudo parallel. Each task consists of a set of
modules, in the same way as the normal program. All the modules are local in each
task.
Variables and constants are local in each task, but persistents are not. A persistent with
the same name and type is reachable in all tasks. If two persistents have the same name,
but their type or size (array dimension) differ, a runtime error will occur.
A task has its own trap handling and the event routines are triggered only on its own
task system states (e.g. Start/Stop/Restart....).
Used to
TestAndSet
RAPID Overview
3-47
Multitasking
3-48
RAPID Summary
RAPID Overview
RAPID Summary
Syntax Summary
20 Syntax Summary
20.1 Instructions
Data := Value
AccSet
Acc Ramp
ActUnit MecUnit
Add
Name AddValue
ArcRefresh
ArcKill
Break
CallBy Var Name Number
Clear
Name
ClkReset
Clock
ClkStart
Clock
ClkStop
Clock
Close
IODevice
! Comment
ConfJ
[\On] | [\Off]
ConfL
[\On] | [\Off]
RAPID Overview
3-49
Syntax Summary
RAPID Summary
CorrClear
DeactUnit MecUnit
Decr
Name
DropWObj WObj
EOffsSet EAxOffs
ErrWrite [ \W ] Header Reason [ \RL2] [ \RL3] [ \RL4]
Exit
ExitCycle
FOR Loop counter FROM Start value TO End value
[STEP Step value] DO ... ENDFOR
GOTO
Label
GripLoad
Load
GetSysData
IDelete
IF
DestObject [\ ObjectName ]
Interrupt
Condition
...
Name
3-50
RAPID Overview
RAPID Summary
Syntax Summary
InvertDO
Signal
IODisable
UnitName MaxTime
IOEnable
UnitName MaxTime
ISignalDI
Interrupt
ITimer
IVarValue
IWatch
LoadId
MoveCDO
MoveCSync
MoveJ
RAPID Overview
3-51
Syntax Summary
RAPID Summary
MoveLDO
[ \On] | [ \Off]
[\TuneValue]
(ParIdType)
PathResol Value
PDispOn [ \Rot ] [ \ExeP ] ProgPoint Tool [ \WObj ]
PDispSet DispFrame
Procedure
{ Argument }
PulseDO
[ \PLength ] Signal
RAISE
Reset
[ Error no ]
Signal
RETURN
Rewind
Save
[ Return value ]
IODevice
Signal
SetAO
Signal Value
SetDO
SetGO
Signal Value
SingArea
3-52
RAPID Overview
RAPID Summary
Syntax Summary
SpotML
Stop
[ \NoRegain ]
Window
TPWrite
RAPID Overview
3-53
Syntax Summary
RAPID Summary
Override Max
WaitDI
[\InPos] Time
WaitUntil
WaitWObj
WHILE
WObj [ \RelDist ]
Condition DO ... ENDWHILE
WriteStrBin
IODevice Str
3-54
RAPID Overview
RAPID Summary
Syntax Summary
20.2 Functions
Abs (Input)
ACos
(Value)
AOutput
(Signal)
(Parameter)
ArgName
ASin
(Value)
ATan
(Value)
ATan2
(Y
ByteToStr
X)
(ByteData [\Hex] | [\Okt] | [\Bin] | [\Char])
ClkRead
(Clock)
CorrRead
Cos
(Angle)
CPos
([Tool] [\WObj])
CRobT
([Tool] [\WObj])
DefDFrame (OldP1
DefFrame
Dim
(NewP1
OldP2
NewP2
NewP1
NewP2
NewP3)
NewP3 [\Origin])
(ArrPar DimNo)
DOutput
(Signal)
DotProd
(Vector1 Vector2)
EulerZYX
Exp
OldP3
(Exponent)
(Signal)
GetTime
RAPID Overview
3-55
Syntax Summary
RAPID Summary
(DatObj)
IsVar
(DatObj)
MirPos
(Point
MirPlane
[\WObj]
[\MirY])
ModTime ( Object )
NOrient
(Rotation)
NumToStr
Offs
OrientZYX
(Pose1 Pose2)
PoseVect
(Pose Pos)
Pow
(Base Exponent)
Present
(OptPar)
ReadBin
(IODevice [\Time])
(IODevice [\Time])
RelTool
(Point
Round
Sin
Sqrt
Dx
Dy
Dz
[\Rx]
[\Ry]
[\Rz])
( Val [\Dec])
(Angle)
(Value)
StrFind
StrLen
3-56
(IODevice [\Time])
RAPID Overview
RAPID Summary
Syntax Summary
StrMap
StrMatch
StrMemb
StrOrder
StrPart
StrToByte
(Angle)
TestDI
(Signal)
TestAndSet
Trunc
( Val [\Dec] )
ValToStr
VectMagn
RAPID Overview
Object
( Val )
(Vector)
3-57
Syntax Summary
3-58
RAPID Summary
RAPID Overview
Basic Characteristics
Basic Elements
1 Basic Elements
1.1 Identifiers
Identifiers are used to name modules, routines, data and labels;
e.g.
MODULE module_name
PROC routine_name()
VAR pos data_name;
label_name:
The first character in an identifier must be a letter. The other characters can be letters,
digits or underscores _.
The maximum length of any identifier is 16 characters, each of these characters being
significant. Identifiers that are the same except that they are typed in the upper case,
and vice versa, are considered the same.
Reserved words
The words listed below are reserved. They have a special meaning in the RAPID
language and thus must not be used as identifiers.
There are also a number of predefined names for data types, system data, instructions,
and functions, that must not be used as identifiers. See Chapters 7, 8, 9, 10 ,13, 14 and
15 in this manual.
ALIAS
CONNECT
DO
ENDFUNC
ENDRECORD
ERROR
FROM
INOUT
NOSTEPIN
PERS
RECORD
SYSMODULE
TRAP
VIEWONLY
RAPID Overview
AND
CONST
ELSE
ENDIF
ENDTEST
EXIT
FUNC
LOCAL
NOT
PROC
RETRY
TEST
TRUE
WHILE
BACKWARD
DEFAULT
ELSEIF
ENDMODULE
ENDTRAP
FALSE
GOTO
MOD
NOVIEW
RAISE
RETURN
THEN
TRYNEXT
WITH
CASE
DIV
ENDFOR
ENDPROC
ENDWHILE
FOR
IF
MODULE
OR
READONLY
STEP
TO
VAR
XOR
4-1
Basic Elements
Basic Characteristics
"This is a string"
"This string ends with the BEL control character \07"
4-2
RAPID Overview
Basic Characteristics
Basic Elements
1.6 Comments
Comments are used to make the program easier to understand. They do not affect the
meaning of the program in any way.
A comment starts with an exclamation mark ! and ends with a new-line character. It
occupies an entire line and cannot occur between two modules;
e.g.
! comment
IF reg1 > 5 THEN
! comment
reg2 := 0;
ENDIF
1.7 Placeholders
Placeholders can be used to temporarily represent parts of a program that are not yet
defined. A program that contains placeholders is syntactically correct and may be
loaded into the program memory.
Placeholder
Represents:
<TDN>
<DDN>
<RDN>
<PAR>
<ALT>
<DIM>
<SMT>
<VAR>
<EIT>
<CSE>
<EXP>
<ARG>
<ID>
RAPID Overview
4-3
Basic Elements
Basic Characteristics
1.9 Syntax
Identifiers
<identifier> ::=
<ident>
| <ID>
<ident> ::= <letter> {<letter> | <digit> | _}
Numeric values
<num literal> ::=
<integer> [ <exponent> ]
| <integer> . [ <integer> ] [ <exponent> ]
| [ <integer> ] . <integer> [ <exponent> ]
<integer> ::= <digit> {<digit>}
<exponent> ::= (E | e) [+ | -] <integer>
Logical values
<bool literal> ::= TRUE | FALSE
String values
<string literal> ::= " {<character> | <character code> } "
<character code> ::= \ <hex digit> <hex digit>
<hex digit> ::= <digit> | A | B | C | D | E | F | a | b | c | d | e | f
Comments
<comment> ::=
! {<character> | <tab>} <newline>
Characters
<character> ::= -- ISO 8859-1 -<newline> ::= -- newline control character -<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
<letter> ::=
<upper case letter>
| <lower case letter>
4-4
RAPID Overview
Basic Characteristics
Basic Elements
RAPID Overview
4-5
Basic Elements
4-6
Basic Characteristics
RAPID Overview
Basic Characteristics
Modules
2 Modules
The program is divided into program and system modules. The program can also be
divided into modules (see Figure 1).
Program memory
Program
Program data
Main routine
Main module
Routine1
Module1
Module2
Routine2
Routine3
Module3
Module4
Program data
Routine4
Routine5
System module1
Program data
System module2
Routine6
Routine7
RAPID Overview
4-7
Modules
Basic Characteristics
SYSMODULE
NOSTEPIN
VIEWONLY
cannot be modified
READONLY
NOVIEW
e.g.
A module may not have the same name as another module or a global routine or data.
2.4 Syntax
Module declaration
<module declaration> ::=
MODULE <module name> [ <module attribute list> ]
<type definition list>
<data declaration list>
<routine declaration list>
ENDMODULE
4-8
RAPID Overview
Basic Characteristics
Modules
RAPID Overview
4-9
Modules
4-10
Basic Characteristics
RAPID Overview
Basic Characteristics
Routines
3 Routines
There are three types of routines (subprograms): procedures, functions and traps.
- Procedures do not return a value and are used in the context of instructions.
- Functions return a value of a specific type and are used in the context of
expressions.
- Trap routines provide a means of dealing with interrupts. A trap routine can be
associated with a specific interrupt and then, if that particular interrupt occurs
at a later stage, will automatically be executed. A trap routine can never be
explicitly called from the program.
The following scope rules apply to routines (see the example in Figure 2):
- The scope of a global routine may include any module.
- The scope of a local routine comprises the module in which it is contained.
- Within its scope, a local routine hides any global routine or data with the same
name.
- Within its scope, a routine hides instructions and predefined routines and data
with the same name.
Module1
Module2
Local Routine a
Local Routine a
Local Routine b
Local Routine e
Routine c
Routine f
Routine d
Routine g
Routine e
Routine h
A routine may not have the same name as another routine or data in the same module.
A global routine may not have the same name as a module or a global routine or global
data in another module.
RAPID Overview
4-11
Routines
Basic Characteristics
3.2 Parameters
The parameter list of a routine declaration specifies the arguments (actual parameters)
that must/can be supplied when the routine is called.
There are four different types of parameters (in the access mode):
- Normally, a parameter is used only as an input and is treated as a routine
variable. Changing this variable will not change the corresponding argument.
- An INOUT parameter specifies that a corresponding argument must be a
variable (entire, element or component) or an entire persistent which can be
changed by the routine.
- A VAR parameter specifies that a corresponding argument must be a variable
(entire, element or component) which can be changed by the routine.
- A PERS parameter specifies that a corresponding argument must be an entire
persistent which can be changed by the routine.
If an INOUT, VAR or PERS parameter is updated, this means, in actual fact, that the
argument itself is updated, i.e. it makes it possible to use arguments to return values to the
calling routine.
Example:
A parameter can be optional and may be omitted from the argument list of a routine
call. An optional parameter is denoted by a backslash \ before the parameter.
Example:
The value of an optional parameter that is omitted in a routine call may not be
referenced. This means that routine calls must be checked for optional parameters
before an optional parameter is used.
Two or more optional parameters may be mutually exclusive (i.e. declared to exclude
each other), which means that only one of them may be present in a routine call. This
is indicated by a stroke | between the parameters in question.
Example:
The special type, switch, may (only) be assigned to optional parameters and provides a
means to use switch arguments, i.e. arguments that are only specified by names (not
values). A value cannot be transferred to a switch parameter. The only way to use a
switch parameter is to check for its presence using the predefined function, Present.
Example:
4-12
RAPID Overview
Basic Characteristics
Routines
Arrays may be passed as arguments. The degree of an array argument must comply
with the degree of the corresponding formal parameter. The dimension of an array
parameter is conformant (marked with *). The actual dimension thus depends on
the dimension of the corresponding argument in a routine call. A routine can determine
the actual dimension of a parameter using the predefined function, Dim.
Example:
Routine declaration
Data declarations
Routine c
Body (Instructions)
Routine d
Backward handler
Routine e
Error handler
Figure 3 A routine can contain declarations, data, a body, a backward handler and an error
handler.
RAPID Overview
4-13
Routines
Basic Characteristics
Procedure declaration
Example:
Function declaration
A function can return any data type value, but not an array value.
Example:
Trap declaration
Example:
4-14
RAPID Overview
Basic Characteristics
Example:
Routines
! early binding
TEST products_id
CASE 1:
proc1 x, y, z;
CASE 2:
proc2 x, y, z;
CASE 3:
...
! same example using late binding
% proc + NumToStr(product_id, 0) % x, y, z;
...
! same example again using another variant of late binding
VAR string procname {3} :=[proc1, proc2, proc3];
...
% procname{product_id} % x, y, z;
...
Note that the late binding is available for procedure calls only, and not for function
calls. If a reference is made to an unknown procedure using late binding, the system
variable ERRNO is set to ERR_REFUNKPRC. If a reference is made to a procedure
call error (syntax, not procedure) using late binding, the system variable ERRNO is set
to ERR_CALLPROC.
3.6 Syntax
Routine declaration
<routine declaration> ::=
[LOCAL] ( <procedure declaration>
| <function declaration>
| <trap declaration> )
| <comment>
| <RDN>
Parameters
<parameter list> ::=
<first parameter declaration> { <next parameter declaration> }
<first parameter declaration> ::=
<parameter declaration>
| <optional parameter declaration>
| <PAR>
<next parameter declaration> ::=
, <parameter declaration>
| <optional parameter declaration>
| ,<optional parameter declaration>
| , <PAR>
RAPID Overview
4-15
Routines
Basic Characteristics
4-16
RAPID Overview
Basic Characteristics
Routines
Procedure call
<procedure call> ::= <procedure> [ <procedure argument list> ] ;
<procedure> ::=
<identifier>
| % <expression> %
<procedure argument list> ::= <first procedure argument> { <procedure argument> }
<first procedure argument> ::=
<required procedure argument>
| <optional procedure argument>
| <conditional procedure argument>
| <ARG>
<procedure argument> ::=
, <required procedure argument>
| <optional procedure argument>
| , <optional procedure argument>
| <conditional procedure argument>
| , <conditional procedure argument>
| , <ARG>
<required procedure argument> ::= [ <identifier> := ] <expression>
<optional procedure argument> ::= \ <identifier> [ := <expression> ]
<conditional procedure argument> ::= \ <identifier> ? ( <parameter> | <VAR> )
RAPID Overview
4-17
Routines
4-18
Basic Characteristics
RAPID Overview
Basic Characteristics
Data Types
4 Data Types
There are two different kinds of data types:
- An atomic type is atomic in the sense that it is not defined based on any other
type and cannot be divided into parts or components, e.g. num.
- A record data type is a composite type with named, ordered components, e.g.
pos. A component may be of an atomic or record type.
A record value can be expressed using an aggregate representation;
e.g.
A specific component of a record data can be accessed by using the name of that
component;
e.g.
pos1.x := 300;
RAPID Overview
4-19
Data Types
Basic Characteristics
4.3 Syntax
<type definition>::=
[LOCAL] ( <record definition>
| <alias definition> )
| <comment>
| <TDN>
<record definition>::=
RECORD <identifier>
<record component list> ;
ENDRECORD
<record component list> ::=
<record component definition> |
<record component definition> <record component list>
<record component definition> ::=
<data type> <record component name>
<alias definition> ::=
ALIAS <data type> <identifier> ;
<data type> ::= <identifier>
4-20
RAPID Overview
Basic Characteristics
Data
5 Data
There are three kinds of data: variables, persistents and constants.
- A variable can be assigned a new value during program execution.
- A persistent can be described as a persistent variable. This is accomplished
by letting an update of the value of a persistent automatically cause the
initialisation value of the persistent declaration to be updated. (When a program
is saved the initialisation value of any persistent declaration reflects the current
value of the persistent.)
- A constant represents a static value and cannot be assigned a new value.
A data declaration introduces data by associating a name (identifier) with a data type.
Except for predefined data and loop variables, all data used must be declared.
Data declared outside a routine is called program data. The following scope rules
apply to program data:
- The scope of predefined or global program data may include any module.
- The scope of local program data comprises the module in which it is contained.
- Within its scope, local program data hides any global data or routine with the
same name (including instructions and predefined routines and data).
Program data may not have the same name as other data or a routine in the same
module. Global program data may not have the same name as other global data or a
routine in another module. A persistent may not have the same name as another
persistent in the same program.
Data declared inside a routine is called routine data. Note that the parameters of a
routine are also handled as routine data. The following scope rules apply to routine
data:
- The scope of routine data comprises the routine in which it is contained.
- Within its scope, routine data hides any other routine or data with the same
name.
RAPID Overview
4-21
Data
Basic Characteristics
See the example in Figure 4.
Module1
Module2
Local Data a
Local Data a
Local Data b
Local Data f
Data c
Data g
Data d
Local Routine e
Data e1
Data e
Routine h
Data h1
Data c
Figure 4 Example: The following data can be called from routine e:
Module1: Data c, d.
Module2: Data a, f, g, e1.
The following data can be called from routine h:
Module1: Data d.
Module2: Data a, f, g, h1, c.
Routine data may not have the same name as other data or a label in the same routine.
VAR num x;
Variables of any type can be given an array (of degree 1, 2 or 3) format by adding
dimensional information to the declaration. A dimension is an integer value greater
than 0.
Example:
Variables with value types may be initialised (given an initial value). The expression
used to initialise a program variable must be constant. Note that the value of an
uninitialized variable may be used, but it is undefined, i.e. set to zero.
Example:
4-22
RAPID Overview
Basic Characteristics
Data
Persistents of any type can be given an array (of degree 1, 2 or 3) format by adding
dimensional information to the declaration. A dimension is an integer value greater
than 0.
Example:
Note that if the value of a persistent is updated, this automatically causes the
initialisation value of the persistent declaration to be updated.
Example:
It is possible to declare two persistents with the same name in different modules, if they
are local within the module (PERS LOCAL), without any error being generated by the
system (different data scope). But note the limitation that these two persistents always
have the same current value (use the same storage in the memory).
A constant of any type can be given an array (of degree 1, 2 or 3) format by adding
dimensional information to the declaration. A dimension is an integer value greater
than 0.
Example:
RAPID Overview
4-23
Data
Basic Characteristics
Example:
CONST num a := 2;
CONST num b := 3;
! Correct syntax
CONST num ab := a + b;
VAR num a_b := a + b;
PERS num a__b := 5;
! Faulty syntax
PERS num a__b := a + b;
In the table below, you can see what is happening in various activities such as warm
start, new program, program start etc.
Table1
System
event
Affects
Power on
(Warm
start)
Open, Close
or New
program
Start
program
(Move PP to
main)
Start
program
(Move PP to
Routine)
Start
program
(Move PP to
cursor)
Start
program
(Call
Routine)
Start
program
(After
cycle)
Start
program
(After stop)
Constant
Unchanged
Init
Init
Init
Unchanged
Unchanged
Unchanged
Unchanged
Variable
Unchanged
Init
Init
Init
Unchanged
Unchanged
Unchanged
Unchanged
Persistent
Unchanged
Init
Init
Init
Unchanged
Unchanged
Unchanged
Unchanged
Commanded
interrupts
Re-ordered
Disappears
Disappears
Disappears
Unchanged
Unchanged
Unchanged
Unchanged
Start up
routine
SYS_RESET
(with motion
settings)
Not run
Run*
Run
Not run
Not run
Not run
Not run
Not run
Files
Closes
Closes
Closes
Closes
Unchanged
Unchanged
Unchanged
Unchanged
Path
Recreated at
power on
Disappears
Disappears
Disappears
Disappears
Unchanged
Unchanged
Unchanged
* Generates an error when there is a semantic error in the actual task program.
4-24
RAPID Overview
Basic Characteristics
Data
Constants, persistents, and module variables are static, i.e. they have the same storage
during the lifetime of a task. This means that any value assigned to an persistent or a
module variable, always remains unchanged until the next assignment.
Routine variables are volatile. The memory needed to store the value of a volatile
variable is allocated first upon the call of the routine in which the declaration of the
variable is contained. The memory is later de-allocated at the point of the return to the
caller of the routine. This means that the value of a routine variable is always undefined
before the call of the routine and is always lost (becomes undefined) at the end of the
execution of the routine.
In a chain of recursive routine calls (a routine calling itself directly or indirectly) each
instance of the routine receives its own memory location for the same routine
variable - a number of instances of the same variable are created.
5.7 Syntax
Data declaration
<data declaration> ::=
[LOCAL] ( <variable declaration>
| <persistent declaration>
| <constant declaration> )
| <comment>
| <DDN>
Variable declaration
<variable declaration> ::=
VAR <data type> <variable definition> ;
<variable definition> ::=
<identifier> [ { <dim> { , <dim> } } ]
[ := <constant expression> ]
<dim> ::= <constant expression>
Persistent declaration
<persistent declaration> ::=
PERS <data type> <persistent definition> ;
<persistent definition> ::=
<identifier> [ { <dim> { , <dim> } } ]
:= <literal expression>
RAPID Overview
4-25
Data
Basic Characteristics
Constant declaration
<constant declaration> ::=
CONST <data type> <constant definition> ;
<constant definition> ::=
<identifier> [ { <dim> { , <dim> } } ]
:= <constant expression>
<dim> ::= <constant expression>
4-26
RAPID Overview
Basic Characteristics
Instructions
6 Instructions
Instructions are executed in succession unless a program flow instruction or an interrupt or error causes the execution to continue at some other place.
Most instructions are terminated by a semicolon ;. A label is terminated by a colon
:. Some instructions may contain other instructions and are terminated by specific
keywords:
Instruction
Termination word
IF
ENDIF
FOR
ENDFOR
WHILE
ENDWHILE
TEST
ENDTEST
Example:
6.1 Syntax
<instruction list> ::= { <instruction> }
<instruction> ::=
[<instruction according to separate chapter in this manual>
| <SMT>
RAPID Overview
4-27
Instructions
4-28
Basic Characteristics
RAPID Overview
Basic Characteristics
Expressions
7 Expressions
An expression specifies the evaluation of a value. It can be used, for example:
- in an assignment instruction
e.g. a:=3*b/c;
- as a condition in an IF instruction
- as an argument in an instruction
e.g. a:=Abs(3*b);
2*pi*radius
Operation
Operand types
Result type
addition
num + num
num3)
+num or +pos
same1)3)
vector addition
pos + pos
pos
subtraction
num - num
num3)
-num or -pos
same1)3)
vector subtraction
pos - pos
pos
multiplication
num * num
num3)
pos
vector product
pos * pos
pos
linking of rotations
orient * orient
orient
division
num / num
num
integer division
num
num
/
DIV
2)
MOD 2)
1. The result receives the same type as the operand. If the operand has an alias
data type, the result receives the alias "base" type (num or pos).
2. Integer operations, e.g. 14 DIV 4=3, 14 MOD 4=2.
(Non-integer operands are illegal.)
3. Preserves integer (exact) representation as long as operands and result are kept
within the integer subdomain of the num type.
RAPID Overview
4-29
Expressions
Basic Characteristics
Operation
Operand types
<
less than
<=
Result type
bool
1)
bool
equal to
any = any
bool
>=
bool
>
greater than
bool
<>
not equal to
bool
AND
and
bool
XOR
exclusive or
bool
OR
or
bool OR bool
bool
NOT
NOT bool
bool
a XOR b
a True False
b
True False True
False True False
a OR b
a True False
b
True True True
False True False
NOT b
b
True False
False True
4-30
IN + PUT
RAPID Overview
Basic Characteristics
Expressions
Table 4
Operator
+
Operation
string concatenation
Operand types
string + string
Result type
string
2*pi*radius
Arrays
A variable, persistent or constant declared as an array can be referenced to the whole
array or a single element.
An array element is referenced using the index number of the element. The index is an
integer value greater than 0 and may not violate the declared dimension. Index value 1
selects the first element. The number of elements in the index list must fit the declared
degree (1, 2 or 3) of the array.
Example:
Records
A variable, persistent or constant declared as a record can be referenced to the whole
record or a single component.
A record component is referenced using the component name.
Example:
RAPID Overview
4-31
Expressions
Basic Characteristics
It must be possible to determine the data type of an aggregate the context. The data type
of each aggregate member must be equal to the type of the corresponding member of
the determined type.
Example
Sin(angle)
The arguments of a function call are used to transfer data to (and possibly from) the
called function. The data type of an argument must be equal to the type of the corresponding parameter of the function. Optional arguments may be omitted but the order
of the (present) arguments must be the same as the order of the formal parameters. In
addition, two or more optional arguments may be declared to exclude each other, in
which case, only one of them may be present in the argument list.
A required (compulsory) argument is separated from the preceding argument by a
comma ,. The formal parameter name may be included or omitted.
Example:
Polar(3.937, 0.785398)
two required arguments
Polar(Dist:=3.937, Angle:=0.785398)... using names
4-32
Cosine(45)
Cosine(0.785398\Rad)
Dist(p2)
Dist(\distance:=pos1, p2)
RAPID Overview
Basic Characteristics
Expressions
The parameter list of a function assigns an access mode to each parameter. The access
mode can be either in, inout, var or pers:
- An IN parameter (default) allows the argument to be any expression. The called
function views the parameter as a constant.
- An INOUT parameter requires the corresponding argument to be a variable
(entire, array element or record component) or an entire persistent. The called
function gains full (read/write) access to the argument.
- A VAR parameter requires the corresponding argument to be a variable (entire,
array element or record component). The called function gains full (read/write)
access to the argument.
- A PERS parameter requires the corresponding argument to be an entire persistent. The called function gains full (read/update) access to the argument.
- highest
- lowest
An operator with high priority is evaluated prior to an operator with low priority. Operators of the same priority are evaluated from left to right.
RAPID Overview
4-33
Expressions
Basic Characteristics
Example
Expression
Evaluation order
Comment
a+b+c
a+b*c
a OR b OR c
a AND b OR c AND d
(a + b) + c
a + (b * c)
(a OR b) OR c
(a AND b) OR (c AND d)
7.8 Syntax
Expressions
<expression> ::=
<expr>
| <EXP>
<expr> ::= [ NOT ] <logical term> { ( OR | XOR ) <logical term> }
<logical term> ::= <relation> { AND <relation> }
<relation> ::= <simple expr> [ <relop> <simple expr> ]
<simple expr> ::= [ <addop> ] <term> { <addop> <term> }
<term> ::= <primary> { <mulop> <primary> }
<primary> ::=
<literal>
| <variable>
| <persistent>
| <constant>
| <parameter>
| <function call>
| <aggregate>
| ( <expr> )
Operators
<relop> ::= < | <= | = | > | >= | <>
<addop> ::= + | -
<mulop> ::= * | / | DIV | MOD
Constant values
<literal> ::= <num literal>
| <string literal>
| <bool literal>
4-34
RAPID Overview
Basic Characteristics
Expressions
Data
<variable> ::=
<entire variable>
| <variable element>
| <variable component>
<entire variable> ::= <ident>
<variable element> ::= <entire variable> { <index list> }
<index list> ::= <expr> { , <expr> }
<variable component> ::= <variable> . <component name>
<component name> ::= <ident>
<persistent> ::=
<entire persistent>
| <persistent element>
| <persistent component>
<constant> ::=
<entire constant>
| <constant element>
| <constant component>
Aggregates
<aggregate> ::= [ <expr> { , <expr> } ]
Function calls
<function call> ::= <function> ( [ <function argument list> ] )
<function> ::= <ident>
<function argument list> ::= <first function argument> { <function argument> }
<first function argument> ::=
<required function argument>
| <optional function argument>
| <conditional function argument>
<function argument> ::=
, <required function argument>
| <optional function argument>
| , <optional function argument>
| <conditional function argument>
| , <conditional function argument>
<required function argument> ::= [ <ident> := ] <expr>
<optional function argument> ::= \ <ident> [ := <expr> ]
<conditional function argument> ::= \ <ident> ? <parameter>
Special expressions
<constant expression> ::= <expression>
<literal expression> ::= <expression>
RAPID Overview
4-35
Expressions
Basic Characteristics
4-36
RAPID Overview
Basic Characteristics
Error Recovery
8 Error Recovery
An execution error is an abnormal situation, related to the execution of a specific piece
of a program. An error makes further execution impossible (or at least hazardous).
Overflow and division by zero are examples of errors. Errors are identified by their
unique error number and are always recognized by the robot. The occurrence of an
error causes suspension of the normal program execution and the control is passed to
an error handler. The concept of error handlers makes it possible to respond to and,
possibly, recover from errors that arise during program execution. If further execution
is not possible, the error handler can at least assure that the program is given a graceful
abortion.
The system variable ERRNO contains the error number of the (most recent) error and
can be used by the error handler to identify that error. After any necessary actions have
been taken, the error handler can:
- Resume execution, starting with the instruction in which the error occurred.
This is done using the RETRY instruction. If this instruction causes the same
error again, up to four error recoveries will take place; after that execution will
stop.
- Resume execution, starting with the instruction following the instruction in
which the error occurred. This is done using the TRYNEXT instruction.
- Return control to the caller of the routine using the RETURN instruction. If the
routine is a function, the RETURN instruction must specify an appropriate
return value.
- Propagate the error to the caller of the routine using the RAISE instruction.
When an error occurs in a routine that does not contain an error handler or when the
end of the error handler is reached (ENDFUNC, ENDPROC or ENDTRAP), the
system error handler is called. The system error handler just reports the error and stops
the execution.
RAPID Overview
4-37
Error Recovery
Basic Characteristics
In a chain of routine calls, each routine may have its own error handler. If an error
occurs in a routine with an error handler, and the error is explicitly propagated using
the RAISE instruction, the same error is raised again at the point of the call of the
routine - the error is propagated. When the top of the call chain (the entry routine of the
task) is reached without any error handler being found or when the end of any error
handler is reached within the call chain, the system error handler is called. The system
error handler just reports the error and stops the execution. Since a trap routine can only
be called by the system (as a response to an interrupt), any propagation of an error from
a trap routine is made to the system error handler.
Error recovery is not available for instructions in the backward handler. Such errors are
always propagated to the system error handler.
In addition to errors detected and raised by the robot, a program can explicitly raise
errors using the RAISE instruction. This facility can be used to recover from complex
situations. It can, for example, be used to escape from deeply-nested code positions.
Error numbers 1-90 may be used in the raise instruction. Explicitly-raised errors are
treated exactly like errors raised by the system.
Note that it is not possible to recover from or respond to errors that occur within an error
clause. Such errors are always propagated to the system error handler.
4-38
RAPID Overview
Basic Characteristics
Interrupts
9 Interrupts
Interrupts are program-defined events, identified by interrupt numbers. An interrupt
occurs when an interrupt condition is true. Unlike errors, the occurrence of an interrupt
is not directly related to (synchronous with) a specific code position. The occurrence
of an interrupt causes suspension of the normal program execution and control is
passed to a trap routine.
Even though the robot immediately recognizes the occurrence of an interrupt (only
delayed by the speed of the hardware), its response calling the corresponding trap
routine can only take place at specific program positions, namely:
- when the next instruction is entered,
- any time during the execution of a waiting instruction, e.g. WaitUntil,
- any time during the execution of a movement instruction, e.g. MoveL.
This normally results in a delay of 5-120 ms between interrupt recognition and
response, depending on what type of movement is being performed at the time of the
interrupt.
The raising of interrupts may be disabled and enabled. If interrupts are disabled, any
interrupt that occurs is queued and not raised until interrupts are enabled again. Note
that the interrupt queue may contain more than one waiting interrupt. Queued
interrupts are raised in FIFO order. Interrupts are always disabled during the execution
of a trap routine.
When running stepwise and when the program has been stopped, no interrupts will be
handled. Interrupts that are generated under these circumstances are not dealt with.
The maximum number of defined interrupts at any one time is limited to 70 per
program task. The total limitation set by the I/O CPU is 100 interrupts.
RAPID Overview
ISleep sig1int;
.
IWatch sig1int;
deactivate
activate
4-39
Interrupts
Basic Characteristics
IDisable sig1int;
.
IEnable sig1int;
disable
enable
IDelete sig1int;
TRAP etrap
open_valve;
RETURN;
ENDTRAP
responds to feeder
empty interrupt
TRAP ftrap
close_valve;
RETURN;
ENDTRAP
Several interrupts may be connected to the same trap routine. The system variable
INTNO contains the interrupt number and can be used by a trap routine to identify an
interrupt. After the necessary action has been taken, a trap routine can be terminated
using the RETURN instruction or when the end (ENDTRAP or ERROR) of the trap
routine is reached. Execution continues from the place where the interrupt occurred.
4-40
RAPID Overview
Basic Characteristics
Backward execution
10 Backward execution
A program can be executed backwards one instruction at a time. The following general
restrictions are valid for backward execution:
- The instructions IF, FOR, WHILE and TEST cannot be executed backwards.
- It is not possible to step backwards out of a routine when reaching the beginning
of the routine.
PROC MoveTo ()
MoveL p1,v500,z10,tool1;
MoveC p2,p3,v500,z10,tool1;
MoveL p4,v500,z10,tool1;
BACKWARD
MoveL p4,v500,z10,tool1;
MoveC p2,p3,v500,z10,tool1;
MoveL p1,v500,z10,tool1;
ENDPROC
When the procedure is called during forward execution, the following occurs:
..
MoveTo;
..
RAPID Overview
PROC MoveTo ()
MoveL p1,v500,z10,tool1;
MoveC p2,p3,v500,z10,tool1;
MoveL p4,v500,z10,tool1;
BACKWARD
MoveL p4,v500,z10,tool1;
MoveC p2,p3,v500,z10,tool1;
MoveL p1,v500,z10,tool1;
ENDPROC
4-41
Backward execution
Basic Characteristics
When the procedure is called during backwards execution, the following occurs:
..
MoveTo;
..
PROC MoveTo ()
MoveL p1,v500,z10,tool1;
MoveC p2,p3,v500,z10,tool1;
MoveL p4,v500,z10,tool1;
BACKWARD
MoveL p4,v500,z10,tool1;
MoveC p2,p3,v500,z10,tool1;
MoveL p1,v500,z10,tool1;
ENDPROC
PROC MoveTo ()
MoveL p1,v500,z10,tool1;
MoveC p2,p3,v500,z10,tool1;
MoveL p4,v500,z10,tool1;
BACKWARD
MoveL p4,v500,z10,tool1;
MoveC p2,p3,v500,z10,tool1;
MoveL p1,v500,z10,tool1;
ENDPROC
Mirror plane
Note that the order of CirPoint p2 and ToPoint p3 in the MoveC should be the same.
By move instructions is meant all instructions that result in some movement of the
robot or external axes such as MoveL, SearchC, TriggJ, ArcC, PaintL ...
Any departures from this programming limitation in the backward handler can
result in faulty backward movement. Linear movement can result in circular
movement and vice versa, for some part of the backward path.
4-42
RAPID Overview
Basic Characteristics
Multitasking
11 Multitasking
The events in a robot cell are often in parallel, so why are the programs not in parallel?
Multitasking RAPID is a way to execute programs in (pseudo) parallel with the normal execution. The execution is started at power on and will continue for ever, unless
an error occurs in that program. One parallel program can be placed in the background
or foreground of another program. It can also be on the same level as another program.
To use this function the robot must be configured with one extra TASK for each background program.
Up to 10 different tasks can be run in pseudo parallel. Each task consists of a set of
modules, in the same way as the normal program. All the modules are local in each
task.
Variables and constants are local in each task, but persistents are not. A persistent with
the same name and type is reachable in all tasks. If two persistents have the same name,
but their type or size (array dimension) differ, a runtime error will occur.
A task has its own trap handling and the event routines are triggered only on its own
task system states (e.g. Start/Stop/Restart....).
There are a few restrictions on the use of Multitasking RAPID.
- Do not mix up parallel programs with a PLC. The response time is the same as
the interrupt response time for one task. This is true, of course, when the task is
not in the background of another busy program
- There is only one physical Teach Pendent, so be careful that a TPWrite request
is not mixed in the Operator Window for all tasks.
- When running a Wait instruction in manual mode, a simulation box will come
up after 3 seconds. This will only occur in the main task.
- Move instructions can only be executed in the main task (the task bind to program instance 0, see Users guide - System parameters).
- The execution of a task will halt during the time that some other tasks are
accessing the file system, that is if the operator chooses to save or open a program, or if the program in a task uses the load/erase/read/write instructions.
- The Teach Pendent cannot access other tasks than the main task. So, the development of RAPID programs for other tasks can only be done if the code is
loaded into the main task, or off-line.
For all settings, see Users Guide - System parameters.
RAPID Overview
4-43
Multitasking
Basic Characteristics
4-44
RAPID Overview
Basic Characteristics
Multitasking
RAPID Overview
4-45
Multitasking
Basic Characteristics
Example
TASK 0
MODULE module1
PERS bool startsync:=FALSE;
PERS string stringtosend:=;
PROC main()
stringtosend:=this is a test;
startsync:= TRUE
ENDPROC
ENDMODULE
TASK 1
MODULE module2
PERS bool startsync:=FALSE;
PERS string stringtosend:=;
PROC main()
WaitUntil startsync;
!read string
IF stringtosend = this is a test THEN
ENDPROC
ENDMODULE
4-46
RAPID Overview
Basic Characteristics
Multitasking
11.4 Priorities
The way to run the tasks as default is to run all tasks at the same level in a round robbin way (one basic step on each instance). But it is possible to change the priority of
one task by putting the task in the background of another. Then the background will
only execute when the foreground is waiting for some events, or has stopped the execution (idle). A robot program with move instructions will be in an idle state most of
the time.
The example below describes some situations where the system has 10 tasks (see
Figure 5)
Round robbin chain 1:
chain 1
chain 2
task 0
task 1
task 2
task 3
task 4
task 5
task 6
task 7
chain 4
chain 3
task 8
task 9
RAPID Overview
4-47
Multitasking
Basic Characteristics
4-48
RAPID Overview
Basic Characteristics
Multitasking
RAPID Overview
4-49
Multitasking
4-50
Basic Characteristics
RAPID Overview
Coordinate Systems
1 Coordinate Systems
1.1 The robots tool centre point (TCP)
The position of the robot and its movements are always related to the tool centre point.
This point is normally defined as being somewhere on the tool, e.g. in the muzzle of a
glue gun, at the centre of a gripper or at the end of a grading tool.
Several TCPs (tools) may be defined, but only one may be active at any one time.
When a position is recorded, it is the position of the TCP that is recorded. This is also
the point that moves along a given path, at a given velocity.
If the robot is holding a work object and working on a stationary tool, a stationary TCP
is used. If that tool is active, the programmed path and speed are related to the work
object. See Stationary TCPs on page 8.
Z
Y
X
Figure 1 The base coordinate system.
RAPID Overview
5-1
Coordinate Systems
X
Y
Z
Y
X
Base coordinate system robot 1
z
y
World coordinate system
x
Figure 2 Two robots (one of which is suspended) with a common world coordinate system.
5-2
RAPID Overview
Coordinate Systems
Y
X
Z
Y
X
Y
X
Base coordinate system
y
World coordinate system
x
Figure 3 Two user coordinate systems describe the position of two different fixtures.
RAPID Overview
5-3
Coordinate Systems
The object coordinate system is defined based on the user coordinate system (see Figure 4).
z
z
y
User coordinate system
y
x
x
Object coordinate system 2
z
y
World coordinate system
x
Figure 4 Two object coordinate systems describe the position of two different work objects
located in the same fixture.
The programmed positions are always defined relative to an object coordinate system.
If a fixture is moved/turned, this can be compensated for by moving/turning the user
coordinate system. Neither the programmed positions nor the defined object coordinate
systems need to be changed. If the work object is moved/turned, this can be
compensated for by moving/turning the object coordinate system.
If the user coordinate system is movable, that is, coordinated external axes are used,
then the object coordinate system moves with the user coordinate system. This makes
it possible to move the robot in relation to the object even when the workbench is being
manipulated.
5-4
RAPID Overview
Coordinate Systems
New position
y
x
Original position
x
Object coordinate system
y
x
joint 2
joint 3
joint 1
z
y
World coordinate system
x
Figure 6 A user coordinate system, defined to follow the movements of a 3-axis external mechanical unit.
RAPID Overview
5-5
Coordinate Systems
World coordinate
system
Track
Figure 7 Coordinated interpolation with a track moving the base coordinate system of the robot.
To be able to calculate the user and the base coordinate systems when involved units
are moved, the robot must be aware of:
- The calibration positions of the user and the base coordinate systems
- The relations between the angles of the external axes and the translation/rotation
of the user and the base coordinate systems.
These relations are defined in the system parameters.
5-6
RAPID Overview
Coordinate Systems
The wrist coordinate system cannot be changed and is always the same as the mounting
flange of the robot in the following respects:
- The origin is situated at the centre of the mounting flange (on the mounting surface).
- The x-axis points in the opposite direction, towards the control hole of the
mounting flange.
- The z-axis points outwards, at right angles to the mounting flange.
RAPID Overview
5-7
Coordinate Systems
x
x
Top
Top
z
Figure 9 Tool coordinate system, as usually defined for an arc-welding gun (left) and
a spot welding gun (right).
The tool coordinate system is defined based on the wrist coordinate system
(see Figure 10).
y
Figure 10 The tool coordinate system is defined relative to the wrist coordinate system,
here for a gripper.
5-8
RAPID Overview
Coordinate Systems
Z
Object coordinate system
Y
X
Tool coordinate system
Y
X
x
Figure 11 If a stationary TCP is used, the object coordinate system is usually based on the wrist
coordinate system.
In the example in Figure 11, neither the user coordinate system nor program
displacement is used. It is, however, possible to use them and, if they are used, they
will be related to each other as shown in Figure 12.
z
y
z
y
z
x
y
x
y
Displacement coordinate system
x
Figure 12 Program displacement can also be used together with stationary TCPs.
RAPID Overview
5-9
Coordinate Systems
5-10
RAPID Overview
RAPID Overview
5-11
Destination point
Start point
Joint interpolated
path
Figure 13 Joint interpolation is often the fastest way to move between two points as the robot
axes follow the closest path between the start point and the destination point (from the
perspective of the axis angles).
The velocity of the tool centre point is expressed in mm/s (in the object coordinate
system). As interpolation takes place axis-by-axis, the velocity will not be exactly the
programmed value.
During interpolation, the velocity of the limiting axis, i.e. the axis that travels fastest
relative to its maximum velocity in order to carry out the movement, is determined.
Then, the velocities of the remaining axes are calculated so that all axes reach the
destination point at the same time.
All axes are coordinated in order to obtain a path that is independent of the velocity.
Acceleration is automatically optimised to the max performance of the robot.
Start point
Destination point
Figure 14 Linear interpolation without reorientation of the tool.
To obtain a linear path in the object coordinate system, the robot axes must follow a
non-linear path in the axis space. The more non-linear the configuration of the robot is,
the more accelerations and decelerations are required to make the tool move in a
straight line and to obtain the desired tool orientation. If the configuration is extremely
non-linear (e.g. in the proximity of wrist and arm singularities), one or more of the axes
will require more torque than the motors can give. In this case, the velocity of all axes
will automatically be reduced.
5-12
The orientation of the tool remains constant during the entire movement unless a
reorientation has been programmed. If the tool is reorientated, it is rotated at constant
velocity.
RAPID Overview
A maximum rotational velocity (in degrees per second) can be specified when rotating
the tool. If this is set to a low value, reorientation will be smooth, irrespective of the
velocity defined for the tool centre point. If it is a high value, the reorientation velocity
is only limited by the maximum motor speeds. As long as no motor exceeds the limit for
the torque, the defined velocity will be maintained. If, on the other hand, one of the
motors exceeds the current limit, the velocity of the entire movement (with respect to
both the position and the orientation) will be reduced.
All axes are coordinated in order to obtain a path that is independent of the velocity.
Acceleration is optimised automatically.
Destination point
Start point
Figure 15 Circular interpolation with a short twist for part of a circle (circle segment) with a
start point, circle point and destination point.
However, if the orientation at the support point is programmed closer to the orientation
rotated 180, the alternative twist is selected (see Figure 16).
RAPID Overview
5-13
Circle point
Destination point
Start point
Figure 16 Circular interpolation with a long twist for orientation is achieved by defining the
orientation in the circle point in the opposite direction compared to the start point.
As long as all motor torques do not exceed the maximum permitted values, the tool will
move at the programmed velocity along the arc of the circle. If the torque of any of the
motors is insufficient, the velocity will automatically be reduced at those parts of the
circular path where the motor performance is insufficient.
All axes are coordinated in order to obtain a path that is independent of the velocity.
Acceleration is optimised automatically.
2.2.4 SingArea\Wrist
During execution in the proximity of a singular point, linear or circular interpolation
may be problematic. In this case, it is best to use modified interpolation, which means
that the wrist axes are interpolated axis-by-axis, with the TCP following a linear or
circular path. The orientation of the tool, however, will differ somewhat from the
programmed orientation.
In the SingArea\Wrist case the orientation in the circle support point will be the same
as programmed. However, the tool will not have a constant direction relative to the
circle plane as for normal circular interpolation. If the circle path passes a singularity,
the orientation in the programmed positions sometimes must be modified to avoid big
wrist movements, which can occur if a complete wrist reconfiguration is generated
when the circle is executed (joints 4 and 6 moved 180 degrees each).
5-14
RAPID Overview
position, which generally means that the programmed position is never reached. The
beginning and end of this corner path are defined by a zone around the programmed
position (see Figure 17).
Programmed
position
Corner path
Figure 17 A fly-by point generates a corner path to pass the programmed position.
All axes are coordinated in order to obtain a path that is independent of the velocity.
Acceleration is optimised automatically.
Zone
Start point
Destination point
Corner path
Figure 18 During joint interpolation, a corner path is generated in order to pass a fly-by point.
RAPID Overview
5-15
Start point
Zone
Corner path
Destination point
Figure 19 During linear interpolation, a corner path is generated in order to pass a fly-by point.
If different speeds have been programmed before or after the corner position, the
transition will be smooth and take place within the corner path without affecting the
actual path.
If the tool is to carry out a process (such as arc-welding, gluing or water cutting) along
the corner path, the size of the zone can be adjusted to get the desired path. If the shape
of the parabolic corner path does not match the object geometry, the programmed
positions can be placed closer together, making it possible to approximate the desired
path using two or more smaller parabolic paths.
Figure 20a Three positions with different tool orientations are programmed as above.
5-16
RAPID Overview
Figure 20b If all positions were stop points, program execution would look like this.
The orientation zone for the tool movement is normally expressed in mm. In this way,
you can determine directly where on the path the orientation zone begins and ends. If
the tool is not moved, the size of the zone is expressed in angle of rotation degrees
instead of TCP-mm.
If different reorientation velocities are programmed before and after the fly-by point,
and if the reorientation velocities limit the movement, the transition from one velocity
to the other will take place smoothly within the corner path.
RAPID Overview
5-17
p1
Sing Area\Wrist
p4
interpolation
Linear
interpolation
Joint interpolation
p2
p3
Sing Area\Wrist
interpolation
Position zone
Orientation zone
Figure 21 Interpolation when changing from one interpolation method to another. Linear
interpolation has been programmed between p1 and p2; joint interpolation between
p2 and p3; and Sing Area\Wrist interpolation between p3 and p4.
5-18
RAPID Overview
Generated
path
p4
p2
p1
Programmed
position zones
p3
Corner zones as
calculated by the robot
Figure 22 Interpolation with overlapping position zones. The zones around p2 and p3 are larger
than half the distance from p2 to p3. Thus, the robot reduces the size of the zones to
make them equal to half the distance from p2 to p3, thereby generating symmetrical
corner paths within the zones.
Both position and orientation corner path zones can overlap. As soon as one of these
corner path zones overlap, that zone is reduced (see Figure 23).
Programmed
orientation zone
Generated path
Generated
orientation zone
p4
p2
p1
p3
Position zones
Orientation zone
Figure 23 Interpolation with overlapping orientation zones. The orientation zone at p2 is larger
than half the distance from p2 to p3 and is thus reduced to half the distance from p2
to p3. The position zones do not overlap and are consequently not reduced; the
orientation zone at p3 is not reduced either.
RAPID Overview
5-19
5-20
RAPID Overview
WaitTime 10
MoveL
MoveL
10 s
Independent axis
speed
Normal axis speed
Figure 24 Stepwise execution of independent axes.
2.4.3 Jogging
Axes in independent mode cannot be jogged. If an attempt is made to execute the axis
manually, the axis does not move and an error message is displayed. Execute an
IndReset instruction or move the program pointer to main, in order to leave the
independent mode.
RAPID Overview
5-21
The resolution of positions is decreased when moving away from logical position 0.
Low resolution together with stiff tuned controller can result in unacceptable torque,
noise and controller instability. Check the controller tuning and axis performance close
to the working range limit at installation. Also check if the position resolution and path
performance are acceptable.
5-22
RAPID Overview
The axis 6 is also internally active in the path performance calculation. A result of this
is that an internal movement of axis 6 can reduce the speed of the other axes in the
system.
The independent working range for axis 6 is defined with axis 4 and 5 in home
position. If axis 4 or 5 is out of home position the working range for axis 6 is moved
due to the gear coupling. However, the position read from teach pendant for axis 6 is
compensated with the positions of axis 4 and 5 via the gear coupling.
RAPID Overview
5-23
3. For a quick-stop the mechanical brakes are used to achieve a deceleration distance,
which is as short as specified for safety reasons. The path deviation will usually be
bigger for a quick-stop than for a stiff stop.
After a stop (any of the types above) a restart can always be made on the interrupted
path. If the robot has stopped outside the programmed path, the restart will begin with
a return to the position on the path, where the robot should have stopped.
A restart following a power failure is equivalent to a restart after a quick-stop. It should
be noted that the robot will always return to the path before the interrupted program
operation is restarted, even in cases when the power failure occurred while a logical
instruction was running. When restarting, all times are counted from the beginning; for
example, positioning on time or an interruption in the instruction WaitTime.
5-24
Definition of speed
Instructions - MoveJ
Instructions - MoveL
Instructions - MoveC
Instructions - SingArea
Singularity
CPU Optimization
RAPID Overview
Position zone
Orientation zone
Figure 27 A logical instruction following a fly-by point is executed before reaching the largest zone.
RAPID Overview
5-25
Execution
of SetDO
Position zone
DT
p2
p1
Orientation zone
Figure 28 A logical instruction following a fly-by point is executed before reaching the largest zone.
The time at which they are executed (DT) comprises the following time components:
- The time it takes for the robot to plan the next move: approx. 0.1 seconds.
- The robot delay (servo lag) in seconds: 0 - 1.0 seconds depending on the
velocity and the actual deceleration performance of the robot.
5-26
RAPID Overview
When a positioning instruction with the argument \Conc is executed, the following
logical instructions are also executed (in sequence):
- If the robot is not moving, or if the previous positioning instruction ended with a
stop point, the logical instructions are executed as soon as the current positioning
instruction starts (at the same time as the movement). See Figure 29.
- If the previous positioning instruction ends at a fly-by point, the logical
instructions are executed at a given time (DT) before reaching the largest zone
(for position, orientation or external axes). See Figure 30.
Execution of SetDO
p2
p1
MoveL p1, v1000, fine, tool1;
MoveL \Conc, p2, v1000, z30, tool1;
SetDO do1, on;
MoveL p3, v1000, z30, tool1;
Figure 29 In the case of concurrent program execution after a stop point, a positioning
instruction and subsequent logical instructions are started at the same time.
RAPID Overview
5-27
Execution
of SetDO
Largest zone
DT
p2
p1
Instructions which indirectly affect movements, such as ConfL and SingArea, are
executed in the same way as other logical instructions. They do not, however, affect
the movements ordered by previous positioning instructions.
If several positioning instructions with the argument \Conc and several logical
instructions in a long sequence are mixed, the following applies:
- Logical instructions are executed directly, in the order they were programmed.
This takes place at the same time as the movement (see Figure 31) which means
that logical instructions are executed at an earlier stage on the path than they
were programmed.
5-28
RAPID Overview
Execution of
SetDO and SetAO
DT
Largest zone
p2
p1
RAPID Overview
5-29
All the position synchronised signals can be achieved both before (look ahead time)
and after (delay time) the time that the robot passes the predefined position. The
position is defined by a programmed position and can be tuned as a path distance before
the programmed position.
Typical repeat accuracy for a set of digital outputs on the path is +/- 2ms.
In the event of a power failure and restart in a Trigg instruction, all trigg events will be
generated once again on the remaining movement path for the trigg instruction.
5-30
Positioning instructions
RAPID Overview
Robot Configuration
4 Robot Configuration
It is usually possible to attain the same robot tool position and orientation in several
different ways, using different sets of axis angles. We call these different robot
configurations. If, for example, a position is located approximately in the middle of a
work cell, some robots can get to that position from above and from below (see Figure
32). This can also be achieved by turning the front part of the robot upper arm (axis 4)
upside down while rotating axes 5 and 6 to the desired position and orientation (see
Figure 33).
Figure 32 Two different arm configurations used to attain the same position and orientation.
In one of the configurations, the arms point upwards and to attain the other
configuration, axis 1 must be rotated 180 degrees.
axis 6
axis 4
axis 5
Figure 33 Two different wrist configurations used to attain the same position and orientation.
In the configuration in which the front part of the upper arm points upwards (lower),
axis 4 has been rotated 180 degrees, axis 5 through 180 degrees and axis 6 through
180 degrees in order to attain the configuration in which the front part of the upper
arm points downwards (upper).
RAPID Overview
5-31
Robot Configuration
Usually you want the robot to attain the same configuration during program execution as
the one you programmed. To do this, you can make the robot check the configuration
and, if the correct configuration is not attained, program execution will stop. If the
configuration is not checked, the robot may unexpectedly start to move its arms and
wrists which, in turn, may cause it to collide with peripheral equipment.
For a rotational robot axis the robot configuration is specified by defining the
appropriate quarter revolutions of the axis.
Figure 34 Quarter revolution for a positive joint angle: int ( join tan gle 2 ) .
-3
-4
-2
-1
Figure 35 Quarter revolution for a negative joint angle: int ( join tan gle 2 1 ) .
For a linear robot axis the value defines a meter interval for the robot axis. Value 0
means a position between 0 and 1 meters, 1 means a position between 1 and 2 meters.
For negative values, -1 means a position between -1 and 0 meters, etc.
-2
-3
-1
3
x (m)
-3
-2
-1
Configuration value
The configuration data set consists of four components cf1, cf4, cf6, cfx. cf1 specifies
the value for axis 1, cf4, for axis 4, cf6 for axis 6. cfx is an additional component that
is used for robot types with structures that need an extra component.
The configuration check involves comparing the configuration of the programmed
position with that of the robot. The configuration of a specific axis is accepted if the
5-32
RAPID Overview
Robot Configuration
attained axis value is within +/- 45 degrees from the specified quadrant for a rotational
joint or within +/- 0.5 m from the specified meter value of a linear axis.
cf4 = 0
Figure 37 Example: Accepted axis value 135 deg < joint 4 <-45 deg for rotational axis 4 when
cf4 = 0
-3
-2
-1
3
x (m)
-1
Configuration value
Figure 38 Example: Accepted axis value -1.5 m < joint 1 < 0.5 m for linear axis 1 when cf1 = -1
During linear movement, the robot always moves to the closest possible configuration.
If, however, the configuration check is active, program execution stops as soon as:
- The configuration of the programmed position will not be attained.
- The reorientation needed by any one of the wrist axes to get to the programmed
position exceeds a limit (140-180 degrees).
During axis-by-axis or modified linear movement using a configuration check, the
robot always moves to the programmed axis configuration. If the programmed axes
configurations will not be reached, program execution stops before starting the
movement. If the configuration check is not active, the robot moves to the specified
position and orientation with the closest configuration.
When the execution of a programmed position is stopped because of a configuration
error, it may often be caused by one or more of the following reasons:
- The position is programmed off-line with a faulty configuration.
- The robot tool has been changed causing the robot to take another configuration
than was programmed.
- The position is subject to an active frame operation (displacement, user, object,
base).
RAPID Overview
5-33
Robot Configuration
The correct configuration in the destination position can be found by positioning the
robot near it and reading the configuration on the teach pendant.
If the configuration parameters change because of active frame operation, the
configuration check can be deactivated.
5-34
RAPID Overview
length_of_upper_arm
offset_of_joint_3
Z
joint 4
joint 3
length_of_wrist
Z6
joint 5
joint 6
X6
length_of_lower_arm
offset_of_joint_2
height_of_foot
joint 2
joint 1
X
Figure 39 Kinematic structure of an IRB1400 robot
A calibration procedure supports the definition of the base frame of the master robot
relative to the world frame.
RAPID Overview
5-35
Z6
X6
Z
Y
X
World frame
Figure 40 Base frame of master robot
joint 2
joint 1
X2
turn_table
offset_of_joint1_x
attitude_of_joint
height_of_foot
X0
Figure 41 Kinematic structure of an ORBIT 160B robot using predefined model
Calibration procedures to define the base frame relative to the world frame are supplied
for each class of structures.
5-36
RAPID Overview
Z0
Z2
Body C
X2
Body B
Body A
X0
External robot base frame
World frame
Figure 42 Base frame of an ORBIT_160B robot
Y0
Y2
X0
y1
X2
x1
x2
Figure 43 Reference points on turntable for base frame calibration of an ORBIT_160B robot in
the home position using predefined model
RAPID Overview
5-37
Z2
d1
d2
Z0
Y2
X0
a1 = 0
a2 = 0
alfa1 = 0
turn_table
alfa2
Figure 44 Kinematic structure of an ORBIT 160B robot using general kinematics model
A calibration procedure supports the definition of the base frame of the external robot
relative to the world frame.
Z2
Z0
Y2
X0
External robot base frame
World frame
Figure 45 Base frame of an ORBIT_160B robot using general kinematics model
5-38
RAPID Overview
Y0
X0
x1
y1
Y2
x2
X2
Figure 46 Reference points on turntable for base frame calibration of an ORBIT_160B robot in
the home position (joints = 0 degrees)
an external robot
RAPID Overview
5-39
5-40
RAPID Overview
6.1 Introduction
The collision detection will trig if the load is incorrectly defined. If the load data is
not known, the load identification functionality can be used to define it.
When the collision detection is triggered, the motor torques are reversed and the
mechanical brakes applied in order to stop the robot. The robot then backs up a short
distance along the path in order to remove any residual forces which may be present
if a collision or jam occurred. After this, the robot stops again and remains in the
motors on state. A typical collision is illustrated in the figure below.
The motion supervision is only active when at least one axis (including external axes)
is in motion. When all axes are standing still, the function is deactivated. This is to
avoid unnecessary trigging due to external process forces.
RAPID Overview
5-41
time of
collision
collision
detected
robot
stopped
residual forces
removed
motor
speed
time
speed
reversed
motor
torque
time
torque
reversed
5-42
RAPID Overview
6.5 Limitations
The motion supervision is only available for the robot axes. It is not available for
track motions, orbit stations, or any other external manipulators.
In RobotWare 3.1, the motion supervision is only available for the IRB6400
robot family.
The collision detection is deactivated when at least one axis is run in independent
joint mode. This is also the case even when it is an external axis which is run as an
independent joint.
The collision detection may trigger when the robot is used in soft servo mode.
Therefore, it is advisable to turn the collision detection off when the robot is in soft
sevo mode.
If the RAPID instruction MotionSup is used to turn off the collision detection, this
will only take effect once the robot starts to move. As a result, the digital output
MotSupOn may temporarily be high at program start before the robot starts to move.
The distance the robot backs up after a collision is proportional to the speed of the
motion before the collision. If repeated low speed collisions occur, the robot may not
back up sufficiently to relieve the stress of the collision. As a result, it may not be
possible to jog the robot without the supervision triggering. In this case use the jog
menu to turn off the collision detection temporarily and jog the robot away from the
obstacle.
In the event of a stiff collision during program execution, it may take a few seconds
before the robot starts to back up.
RAPID Overview
5-43
5-44
Load Identification
RAPID Overview
Singularities
7 Singularities
Some positions in the robot working space can be attained using an infinite number
of robot configurations to position and orient the tool. These positions, known as
singular points (singularities), constitute a problem when calculating the robot arm
angles based on the position and orientation of the tool.
Generally speaking, a robot has two types of singularities: arm singularities and wrist
singularities. Arm singularities are all configurations where the wrist centre (the
intersection of axes 4, 5 and 6) ends up directly above axis 1 (see Figure 47).
Wrist singularities are configurations where axis 4 and axis 6 are on the same line,
i.e. axis 5 has an angle equal to 0 (see Figure 48).
Singularity at the intersection of the
wrist centre and axis 1
Z base
X base
Figure 47 Arm singularity occurs where the wrist centre and axis 1 intersect.
RAPID Overview
5-45
Singularities
5-46
Instructions - SingArea
RAPID Overview
World Zones
8 World Zones
8.1 Using global zones
When using this function, the robot stops or an output is automatically set if the robot
is inside a special user-defined area. Here are some examples of applications:
- When two robots share a part of their respective work areas. The possibility of
the two robots colliding can be safely eliminated by the supervision of these
signals.
- When external equipment is located inside the robots work area. A forbidden
work area can be created to prevent the robot colliding with this equipment.
- Indication that the robot is at a position where it is permissible to start program
execution from a PLC.
RAPID Overview
5-47
World Zones
X
Y
Sphere
Radius
TCP
Cylinder
Radius
Box
Height
A World Zone can be defined to be inside or outside the shape of the Box, Sphere or
the Cylinder.
5-48
RAPID Overview
World Zones
8.5 Actions
8.5.1 Set a digital output when the tcp is inside a World Zone.
This action sets a digital output when the tcp is inside a World Zone. It is useful to indicate
that the robot has stopped in a specified area.
Time between checks
against World Zones
World Zone
Movement of TCP
8.5.2 Set a digital output before the tcp reaches a World Zone.
This action sets a digital output before the tcp reaches a World Zone. It can be used to
stop the robot just inside a World Zone
Stop Time for Robot
World Zone
Movement of TCP
8.5.3 Stop the robot before the tcp reaches a World Zone.
A World Zone can be defined to be outside the work area. The robot will then stop with
the Tool Centre Point just outside the World Zone, when heading towards the Zone
Stop Time for Robot
Time between checks
against World Zones
Movement of TCP
When the robot has been moved into a World Zone defined as an outside work area,
for example, by releasing the brakes and manually pushing, then the only ways to get
out of the Zone are by jogging or by manual pushing with the brakes released.
RAPID Overview
5-49
World Zones
1000 mm/s
2000 mm/s
25 mm
50 mm
100 mm
50 mm
100 mm
200 mm
75 mm
150 mm
300 mm
Resol.
4000 mm/s
If the same digital output is used for more than one World Zone, the distance between
the Zones must exceed the minimum size, as shown in the table above, to avoid an
incorrect status for the output.
Time between checks
against World Zones
5-50
RAPID Overview
World Zones
Coordinate Systems
Data Types:
wztemporary
wzstationary
shapedata
Instructions:
WZBoxDef
WZSphDef
WZCylDef
WZLimSup
WZDOSet
WZDisable
WZEnable
WZFree
WZTempFree
RAPID Overview
5-51
World Zones
5-52
RAPID Overview
I/O Principles
9 I/O Principles
The robot generally has one or more I/O boards. Each of the boards has several digital and/or analog channels which must be connected to logical signals before they
can be used. This is carried out in the system parameters and has usually already been
done using standard names before the robot is delivered. Logical names must always
be used during programming.
A physical channel can be connected to several logical names, but can also have no
logical connections (see Figure 49).
Physical channel
IN1
IN2
IN16
Logical signal
do1
feeder
.
.
.
.
I/O board
OUT1
OUT2
OUT16
.
.
.
.
gripper
do2
feeder2
do16
Figure 49 To be able to use an I/O board, its channels must be given logical names. In the above
example, the physical output 2 is connected to two different logical names. IN16, on
the other hand, has no logical name and thus cannot be used.
RAPID Overview
5-53
I/O Principles
An output can be set to one or zero from within the program. This can also be done using
a delay or in the form of a pulse. If a pulse or a delayed change is ordered for an output,
program execution continues. The change is then carried out without affecting the rest of
the program execution. If, on the other hand, a new change is ordered for the same output
before the given time elapses, the first change is not carried out (see Figure 50).
0.5
Figure 50 The instruction SetDO is not carried out at all because a new command is given before
the time delay has elapsed.
RAPID Overview
I/O Principles
9.5 Limitations
A maximum of 10 signals can be pulsed at the same time and a maximum of 20 signals can be delayed at the same time.
RAPID Overview
5-55
I/O Principles
5-56
RAPID Overview
Programming Off-line
Programming Off-line
1 Programming Off-line
RAPID programs can easily be created, maintained and stored in an ordinary office
computer. All information can be read and changed directly using a normal text editor.
This chapter explains the working procedure for doing this. In addition to off-line
programming, you can use the computer tool, QuickTeach.
1.2 Editing
When a program is created or changed in a word-processor, all information will be
handled in the form of text. This means that information about data and routines will
differ somewhat from what is displayed on the teach pendant.
Note that the value of a stored position is only displayed as an *on the teach pendant,
whereas the text file will contain the actual position value (x, y, z, etc.).
In order to minimise the risk of errors in the syntax (faulty programs), you should use
a template. A template can take the form of a program that was created previously on
the robot or using QuickTeach. These programs can be read directly to a wordprocessor without having to be converted.
6-1
Programming Off-line
Programming Off-line
1.4 Examples
The following shows examples of what routines look like in text format.
%%%
VERSION: 1
LANGUAGE: ENGLISH
%%%
MODULE main
VAR intnum process_int ;
! Demo of RAPID program
PROC main()
MoveL p1, v200, fine, gun1;
ENDPROC
TRAP InvertDo12
! Trap routine for TriggInt
TEST INTNO
CASE process_int:
InvertDO do12;
DEFAULT:
TPWrite Unknown trap , number=\Num:=INTNO;
ENDTEST
ENDTRAP
LOCAL FUNC num MaxNum(num t1, num t2)
IF t1 > t2 THEN
RETURN t1;
ELSE
RETURN t2;
ENDIF
ENDFUNC
ENDMODULE
6-2
RAPID Overview
Programming Off-line
Programming Off-line
Create a routine in this system module with the name that you want your new
instruction to be called. The arguments of the instruction are defined in the form of
routine parameters. Note that the name of the parameters will be displayed in the
window during programming and should therefore be given names that the user will
understand.
Place the routine in one of the Most Common pick lists.
If the instruction is to behave in a certain way during backward program execution,
this can be done in the form of a backward handler. If there is no such handler, it will
not be possible to get past the instruction during backward program execution (see
Chapter 13 in this manual - Basic Characteristics). A backward handler can be
entered using the command Routine: Add Backward Handler from the Program
Routines window.
Test the routine thoroughly so that it works with different types of input data
(arguments).
Change the module attribute to NOSTEPIN. The complete routine will then be run
during step-by-step execution. This attribute, however, must be entered off-line.
Example: To make the gripper easier to handle, two new instructions are made,
GripOpen and GripClose. The output signals name is given to the instructions
argument, e.g. GripOpen gripper1.
MODULE My_instr (SYSMODULE, NOSTEPIN)
PROC GripOpen (VAR signaldo Gripper)
Set Gripper;
WaitTime 0.2;
ENDPROC
PROC GripClose (VAR signaldo Gripper)
Reset Gripper;
WaitTime 0.2;
ENDPROC
ENDMODULE
RAPID Overview
6-3
Programming Off-line
6-4
Programming Off-line
RAPID Overview
1.1 Contents
User comprises five numerical data (registers), one work object data, one clock and
two symbolic values for digital signals.
Name
Data type
Declaration
reg1
reg2
reg3
reg4
reg5
num
.
.
.
num
wobj1
wobjdata
clock1
clock
high
low
edge
dionum
dionum
dionum
User is a system module, which means that it is always present in the memory of the
robot regardless of which program is loaded.
Change, create data and routines in the normal way (see Programming and Testing).
RAPID Overview
7-1
7-2
RAPID Overview
INDEX
A
aggregate 4-19
alias data type 4-19
AND 4-30
argument
conditional 4-33
arithmetic expression 4-29
array 4-22, 4-23
assigning a value to data 3-5
axis configuration 5-31
B
backward execution 4-41
Backward Handler 6-3
backward handler 4-13, 4-41, 4-44
base coordinate system 5-1
C
calling a subroutine 3-3
circular movement 5-13
comment 3-5, 4-3
communication 3-39
communication instructions 3-21
component of a record 4-19
concurrent execution 5-26, 5-43
conditional argument 4-33
configuration check instructions 3-10
CONST 4-23
constant 4-21
coordinate system 5-1, 5-35
coordinated external axes 5-5
corner path 5-14
cross connections 5-55
D
joint movement 5-11
data 4-21
used in expression 4-31
data type 4-19
declaration
constant 4-23
module 4-8
persistent 4-23
routine 4-13
variable 4-22
displacement frame 5-4
RAPID Overview
L
linear movement 5-12
local
data 4-21
routine 4-11
logical expression 4-30
logical value 4-2
8-1
M
main routine 4-7
mathematical instructions 3-29, 3-45
MOD 4-29
modified linear interpolation 5-14
module 4-7
declaration 4-8
motion instructions 3-14
motion settings instructions 3-9
mulittasking 4-43
Multitasking 3-47
N
non value data type 4-19
NOT 4-30
numeric value 4-2
O
object coordinate system 5-3
offline programming 6-1
operator
priority 4-33
optional parameter 4-12
OR 4-30
output instructions 3-19
P
parameter 4-12
path synchronization 5-29
PERS 4-23
persistent 4-21
placeholder 4-3
position
instruction 3-14
position fix I/O 5-29
procedure 4-11
program 4-7
program data 4-21
program displacement 3-11
program flow instructions 3-3
program module 4-7
programming 6-1
R
record 4-19
reserved words 4-1
8-2
RAPID Overview
Glossary
Glossary
Argument
Automatic mode
Component
Configuration
Constant
Corner path
Declaration
Dialog/Dialog box
Any dialog boxes appearing on the display of the teach pendant must always be terminated (usually by pressing OK or
Cancel) before they can be exited.
Error handler
Expression
Fly-by point
Function
Group of signals
Interrupt
I/O
Main routine
The routine that usually starts when the Start key is pressed.
Manual mode
Mechanical unit
Module
Motors On/Off
The state of the robot, i.e. whether or not the power supply
to the motors is switched on.
Operators panel
Orientation
Parameter
The input data of a routine, sent with the routine call. It corresponds to the argument of an instruction.
Persistent
Procedure
RAPID Overview
8-3
Glossary
Program
The set of instructions and data which define the task of the
robot. Programs do not, however, contain system modules.
Program data
Program module
Record
Routine
A subprogram.
Routine data
Start point
The instruction that will be executed first when starting program execution.
Stop point
System module
System parameters
The settings which define the robot equipment and properties; configuration data in other words.
Tool Centre Point (TCP) The point, generally at the tip of a tool, that moves along the
programmed path at the programmed velocity.
8-4
Trap routine
Variable
Window
The robot is programmed and operated by means of a number of different windows, such as the Program window and
the Service window. A window can always be exited by
choosing another window.
Zone
RAPID Overview
3HAC 5761-1
For BaseWare OS 3.2
Instructions
Functions
Index
The information in this document is subject to change without notice and should not be construed as a commitment by ABB Robotics AB. ABB Robotics AB assumes no responsibility for any errors that may appear in this
document.
In no event shall ABB Robotics AB be liable for incidental or consequential damages arising from use of this document or of the software and hardware described in this document.
This document and parts thereof must not be reproduced or copied without ABB Robotics ABs written permission, and contents thereof must not be imparted to a third party nor be used for any unauthorized purpose. Contravention will be prosecuted.
Additional copies of this document may be obtained from ABB Robotics AB at its then current charge.
ABB Robotics AB
Article number: 3HAC 5761-1
Issue: For BaseWare OS 3.2
ABB Robotics AB
S-721 68 Vsters
Sweden
Data Types
CONTENTS
aiotrigg
bool
byte
clock
confdata
dionum
errnum
extjoint
intnum
iodev
jointtarget
loaddata
loadsession
mecunit
motsetdata
num
orient
o_jointtarget
o_robtarget
pos
pose
progdisp
robjoint
robtarget
shapedata
signalxx
speeddata
string
symnum
System Data
taskid
testsignal
tooldata
tpnum
triggdata
tunetype
Test signal
Tool data
Teach Pendant Window number
Positioning events - trigg
Servo tune type
Task identification
1-1
Data Types
wobjdata
wzstationary
wztemporary
zonedata
1-2
Data Types
aiotrigg
aiotrigg
aiotrigg (Analog I/O Trigger) is used to define the condition to generate an interrupt
for an analog input or output signal.
Description
Data of the type aiotrigg defines the way a low and a high threshold will be used to
determine whether the logical value of an analog signal satisfies a condition to generate
an interrupt.
Example
VAR intnum sig1int;
CONNECT sig1int WITH iroutine1;
ISignalAI \Single, ai1, AIO_BETWEEN, 1.5, 0.5, 0, sig1int;
Orders an interrupt which is to occur the first time the logical value of the analog
input signal ai1 is between 0.5 and 1.5. A call is then made to the iroutine1 trap
routine.
Predefined data
The following symbolic constants of the data type aiotrigg are predefined and can be
used when specifying a condition for the instructions ISignalAI and ISignalAO.
Value
Symbolic constant
Comment
AIO_ABOVE_HIGH
AIO_BELOW_HIGH
AIO_ABOVE_LOW
AIO_BELOW_LOW
AIO_BETWEEN
AIO_OUTSIDE
AIO_ALWAYS
1-aiotrigg-3
aiotrigg
Data Types
Characteristics
aiotrigg is an alias data type for num and consequently inherits its characteristics.
Related information
Described in:
Interrupt from analog input signal
Instructions - ISignalAI
Instructions - ISignalAO
1-aiotrigg-4
Data Types
bool
bool
Logical values
Bool is used for logical values (true/false).
Description
The value of data of the type bool can be either TRUE or FALSE.
Examples
flag1 := TRUE;
flag is assigned the value TRUE.
VAR bool highvalue;
VAR num reg1;
.
highvalue := reg1 > 100;
highvalue is assigned the value TRUE if reg1 is greater than 100; otherwise,
FALSE is assigned.
IF highvalue Set do1;
The do1 signal is set if highvalue is TRUE.
highvalue := reg1 > 100;
mediumvalue := reg1 > 20 AND NOT highvalue;
mediumvalue is assigned the value TRUE if reg1 is between 20 and 100.
Related information
Described in:
Logical expressions
1-bool-5
bool
1-bool-6
Data Types
Data Types
byte
byte
Description
Data of the type byte represents a decimal byte value.
Examples
CONST num parity_bit := 8;
VAR byte data1 := 130;
Definition of a variable data1 with a decimal value 130.
BitClear data1, parity_bit;
Bit number 8 (parity_bit) in the variable data1 will be set to 0, e.g. the content
of the variable data1 will be changed from 130 to 2 (decimal representation).
Error handling
If an argument of the type byte has a value that is not in the range between 0 and 255,
an error is returned on program execution.
Characteristics
Byte is an alias data type for num and consequently inherits its characteristics.
Related information
Described in:
Alias data types
Bit functions
1-byte-7
byte
1-byte-8
Data Types
Data Types
clock
clock
Time measurement
Clock is used for time measurement. A clock functions like a stopwatch used for timing.
Description
Data of the type clock stores a time measurement in seconds and has a resolution of
0.01 seconds.
Example
VAR clock clock1;
ClkReset clock1;
The clock, clock1, is declared and reset. Before using ClkReset, ClkStart, ClkStop and
ClkRead, you must declare a variable of data type clock in your program.
Limitations
The maximum time that can be stored in a clock variable is approximately 49 days
(4,294,967 seconds). The instructions ClkStart, ClkStop and ClkRead report clock
overflows in the very unlikely event that one occurs.
A clock must be declared as a VAR variable type, not as a persistent variable type.
Characteristics
Clock is a non-value data type and cannot be used in value-oriented operations.
Related Information
Described in:
Summary of Time and Date Instructions
1-clock-9
clock
1-clock-10
Data Types
Data Types
confdata
confdata
Description
All positions of the robot are defined and stored using rectangular coordinates. When
calculating the corresponding axis positions, there will often be two or more possible
solutions. This means that the robot is able to achieve the same position, i.e. the tool is
in the same position and with the same orientation, with several different positions or
configurations of the robots axes.
Some robot types use iterative numerical methods to determine the robot axes
positions. In these cases the configuration parameters may be used to define good
starting values for the joints to be used by the iterative procedure.
To unambiguously denote one of these possible configurations, the robot configuration
is specified using four axis values. For a rotating axis, the value defines the current
quadrant of the robot axis. The quadrants are numbered 0, 1, 2, etc. (they can also be
negative). The quadrant number is connected to the current joint angle of the axis. For
each axis, quadrant 0 is the first quarter revolution, 0 to 90, in a positive direction
from the zero position; quadrant 1 is the next revolution, 90 to 180, etc. Quadrant -1
is the revolution 0 to (-90), etc. (see Figure 1).
-4
-3
-1
-2
For a linear axis, the value defines a meter interval for the robot axis. For each axis,
value 0 means a position between 0 and 1 meters, 1 means a position between 1 and 2
meters. For negative values, -1 means a position between -1 and 0 meters, etc. (see
Figure 2).
1-confdata-11
confdata
Data Types
-2
-3
-1
3
x (m)
-3
-2
-1
Configuration value
1-confdata-12
Data Types
confdata
FORWARD,
cf1 = 0
BACKWARD,
cf1 = 1.
Figure 3 Same position and orientation with two different main axes configurations.
The forward configuration is the front part of the robots working area with the arm
directed forward. The backward configuration is the service part of the working area
with the arm directed backwards.
1-confdata-13
confdata
Data Types
Components
cf1
cf4
cf6
1-confdata-14
Data Types
confdata
cfx
Example
VAR confdata conf15 := [1, -1, 0, 0]
A robot configuration conf15 is defined as follows:
- The axis configuration of the robot axis 1 is quadrant 1, i.e. 90-180o.
- The axis configuration of the robot axis 4 is quadrant -1, i.e. 0-(-90o).
- The axis configuration of the robot axis 6 is quadrant 0, i.e. 0 - 90o.
- The axis configuration of the robot axis 5 is quadrant 0, i.e. 0 - 90o.
Structure
< dataobject of confdata >
< cf1 of num >
< cf4 of num >
< cf6 of num >
< cfx of num >
Related information
Described in:
Coordinate systems
1-confdata-15
confdata
1-confdata-16
Data Types
Data Types
dionum
dionum
Digital values 0 - 1
Dionum (digital input output numeric) is used for digital values (0 or 1).
This data type is used in conjunction with instructions and functions that handle digital
input or output signals.
Description
Data of the type dionum represents a digital value 0 or 1.
Examples
CONST dionum close := 1;
Definition of a constant close with a value equal to 1.
SetDO grip1, close;
The signal grip1 is set to close, i.e. 1.
Error handling
If an argument of the type dionum has a value that is neither equal to 0 nor 1, an error
is returned on program execution.
Characteristics
Dionum is an alias data type for num and consequently inherits its characteristics.
Related information
Described in:
Summary input/output instructions
Configuration of I/O
1-dionum-17
dionum
1-dionum-18
Data Types
Data Types
errnum
errnum
Error number
Errnum is used to describe all recoverable (non fatal) errors that occur during program
execution, such as division by zero.
Description
If the robot detects an error during program execution, this can be dealt with in the
error handler of the routine. Examples of such errors are values that are too high and
division by zero. The system variable ERRNO, of type errnum, is thus assigned
different values depending on the nature of an error. The error handler may be able to
correct an error by reading this variable and then program execution can continue in
the correct way.
An error can also be created from within the program using the RAISE instruction.
This particular type of error can be detected in the error handler by specifying an error
number (within the range 1-90 or booked with instruction BookErrNo) as an argument
to RAISE.
Examples
reg1 := reg2 / reg3;
.
ERROR
IF ERRNO = ERR_DIVZERO THEN
reg3 := 1;
RETRY;
ENDIF
If reg3 = 0, the robot detects an error when division is taking place. This error,
however, can be detected and corrected by assigning reg3 the value 1. Following
this, the division can be performed again and program execution can continue.
CONST errnum machine_error := 1;
.
IF di1=0 RAISE machine_error;
.
ERROR
IF ERRNO=machine_error RAISE;
An error occurs in a machine (detected by means of the input signal di1). A jump
is made to the error handler in the routine which, in turn, calls the error handler
of the calling routine where the error may possibly be corrected. The constant,
machine_error, is used to let the error handler know exactly what type of error
has occurred.
1-errnum-19
errnum
Data Types
Predefined data
The system variable ERRNO can be used to read the latest error that occurred. A
number of predefined constants can be used to determine the type of error that has
occurred.
Name
Cause of error
ERR_ALRDYCNT
ERR_CNTNOTVAR
ERR_CNV_NOT_ACT
ERR_CNV_CONNECT
ERR_CNV_DROPPED
ERR_DEV_MAXTIME
ERR_ARGDUPCND
ERR_ARGNAME
ERR_ARGNOTPER
ERR_ARGNOTVAR
ERR_AXIS_ACT
ERR_AXIS_IND
ERR_AXIS_MOVING
ERR_AXIS_PAR
ERR_CALLIO_INTER
ERR_CALLPROC
ERR_DIVZERO
ERR_EXCRTYMAX
ERR_EXECPHR
ERR_FILEACC
ERR_FILEOPEN
ERR_FILNOTFND
ERR_FNCNORET
ERR_FRAME
ERR_ILLDIM
ERR_ILLQUAT
1-errnum-20
Data Types
ERR_ILLRAISE
ERR_INOMAX
ERR_IODISABLE
ERR_IOENABLE
ERR_IOERROR
ERR_LOADED
ERR_LOADID_FATAL
ERR_LOADID_RETRY
ERR_MAXINTVAL
ERR_MODULE
ERR_NAME_INVALID
ERR_NEGARG
ERR_NOTARR
ERR_NOTEQDIM
ERR_NOTINTVAL
ERR_NOTPRES
ERR_OUTOFBND
ERR_PATH
ERR_PATHDIST
ERR_PID_MOVESTOP
ERR_PID_RAISE_PP
ERR_RANYBIN_EOF
ERR_RCVDATA
ERR_REFUNKDAT
ERR_REFUNKFUN
ERR_REFUNKPRC
ERR_REFUNKTRP
ERR_SC_WRITE
ERR_SIGSUPSEARCH
ERR_STEP_PAR
ERR_STRTOOLNG
ERR_SYM_ACCESS
ERR_TP_DIBREAK
ERR_TP_MAXTIME
errnum
Error number in RAISE out of range
No more interrupt numbers available
Timeout when executing IODisable
Timeout when executing IOEnable
I/O Error from instruction Save
The program module is already loaded
Only internal use in LoadId
Only internal use in LoadId
The integer value is too large
Incorrect module name in instruction Save
If the unit name does not exist or if the unit is not
allowed to be disabled
Negative argument is not allowed
Data is not an array
The array dimension used when calling the routine
does not coincide with its parameters
Not an integer value
A parameter is used, despite the fact that the
corresponding argument was not used at the routine
call
The array index is outside the permitted limits
Missing destination path in instruction Save
Too long regain distance for StartMove instruction
Only internal use in LoadId
Error from ParIdRobValid or ParIdPosValid
End of file is detected before all bytes are read in
instruction ReadAnyBin
An attempt was made to read non numeric data with
ReadNum
Reference to unknown entire data object
Reference to unknown function
Reference to unknown procedure at linking time or
at run time (late binding)
Reference to unknown trap
Error when sending to external computer
The signal has already a positive value at the
beginning of the search process
Parameter Step in SetCurrRef is wrong
The string is too long
Symbol read/write access error
A TPRead instruction was interrupted by a digital
input
Timeout when executing a TPRead instruction
1-errnum-21
errnum
Data Types
ERR_UNIT_PAR
ERR_UNKINO
ERR_UNKPROC
ERR_UNLOAD
ERR_WAIT_MAXTIME
ERR_WHLSEARCH
Characteristics
Errnum is an alias data type for num and consequently inherits its characteristics.
Related information
Described in:
Error recovery
1-errnum-22
Data Types
extjoint
extjoint
Extjoint is used to define the axis positions of external axes, positioners or workpiece
manipulators.
Description
The robot can control up to six external axes in addition to its six internal axes, i.e. a
total of twelve axes. The six external axes are logically denoted: a, b, c, d, e, f. Each
such logical axis can be connected to a physical axis and, in this case, the connection
is defined in the system parameters.
Data of the type extjoint is used to hold position values for each of the logical axes a - f.
For each logical axis connected to a physical axis, the position is defined as follows:
- For rotating axes the position is defined as the rotation in degrees from the
calibration position.
- For linear axes the position is defined as the distance in mm from the calibration position.
If a logical axis is not connected to a physical one, the value 9E9 is used as a position
value, indicating that the axis is not connected. At the time of execution, the position
data of each axis is checked and it is checked whether or not the corresponding axis is
connected. If the stored position value does not comply with the actual axis connection,
the following applies:
- If the position is not defined in the position data (value is 9E9), the value will
be ignored if the axis is connected and not activated. But if the axis is activated,
it will result in an error.
- If the position is defined in the position data, although the axis is not connected,
the value will be ignored.
If an external axis offset is used (instruction EOffsOn or EOffsSet), the positions are
specified in the ExtOffs coordinate system.
1-extjoint-23
extjoint
Data Types
Components
eax_a
(external axis a)
(external axis b)
(external axis f)
The position of the external logical axis f, expressed in degrees or mm (depending on the type of axis).
Example
VAR extjoint axpos10 := [ 11, 12.3, 9E9, 9E9, 9E9, 9E9] ;
The position of an external positioner, axpos10, is defined as follows:
- The position of the external logical axis a is set to 11, expressed in degrees or
mm (depending on the type of axis).
- The position of the external logical axis b is set to 12.3, expressed in degrees
or mm (depending on the type of axis).
- Axes c to f are undefined.
Structure
< dataobject of extjoint >
< eax_a of num >
< eax_b of num >
< eax_c of num >
< eax_d of num >
< eax_e of num >
< eax_f of num >
1-extjoint-24
Data Types
extjoint
Related information
Described in:
Position data
Instructions - EOffsOn
1-extjoint-25
extjoint
1-extjoint-26
Data Types
Data Types
intnum
intnum
Interrupt identity
Intnum (interrupt numeric) is used to identify an interrupt.
Description
When a variable of type intnum is connected to a trap routine, it is given a specific
value identifying the interrupt. This variable is then used in all dealings with the interrupt, such as when ordering or disabling an interrupt.
More than one interrupt identity can be connected to the same trap routine. The system
variable INTNO can thus be used in a trap routine to determine the type of interrupt that
occurs.
Examples
VAR intnum feeder_error;
.
CONNECT feeder_error WITH correct_feeder;
ISignalDI di1, 1, feeder_error;
An interrupt is generated when the input di1 is set to 1. When this happens, a call
is made to the correct_feeder trap routine.
1-intnum-27
intnum
Data Types
VAR intnum feeder1_error;
VAR intnum feeder2_error;
.
PROC init_interrupt();
.
CONNECT feeder1_error WITH correct_feeder;
ISignalDI di1, 1, feeder1_error;
CONNECT feeder2_error WITH correct_feeder;
ISignalDI di2, 1, feeder2_error;
.
ENDPROC
.
TRAP correct_feeder
IF INTNO=feeder1_error THEN
.
ELSE
.
ENDIF
.
ENDTRAP
An interrupt is generated when either of the inputs di1 or di2 is set to 1. A call is
then made to the correct_feeder trap routine. The system variable INTNO is used
in the trap routine to find out which type of interrupt has occurred.
Limitations
The maximum number of active variables of type intnum at any one time (between
CONNECT and IDelete) is limited to 40.The maximum number of interrupts, in the
queue for execution of TRAP routine at any one time, is limited to 30.
Characteristics
Intnum is an alias data type for num and thus inherits its properties.
Related information
Described in:
Summary of interrupts
1-intnum-28
Data Types
iodev
iodev
Description
Data of the type iodev contains a reference to a file or serial channel. It can be linked
to the physical unit by means of the instruction Open and then used for reading and
writing.
Example
VAR iodev file;
.
Open "flp1:LOGDIR/INFILE.DOC", file\Read;
input := ReadNum(file);
The file INFILE.DOC is opened for reading. When reading from the file, file is
used as a reference instead of the file name.
Characteristics
Iodev is a non-value data type.
Related information
Described in:
Communication via serial channels
1-iodev-29
iodev
1-iodev-30
Data Types
Data Types
jointtarget
jointtarget
Jointtarget is used to define the position that the robot and the external axes will move
to with the instruction MoveAbsJ.
Description
Jointtarget defines each individual axis position, for both the robot and the external
axes.
Components
robax
(robot axes)
(external axes)
1-jointtarget-31
jointtarget
Data Types
Examples
CONST jointtarget calib_pos := [ [ 0, 0, 0, 0, 0, 0], [ 0, 9E9, 9E9, 9E9, 9E9, 9E9] ];
The normal calibration position for IRB2400 is defined in calib_pos by the data
type jointtarget. The normal calibration position 0 (degrees or mm) is also
defined for the external logical axis a. The external axes b to f are undefined.
Structure
< dataobject of jointtarget >
< robax of robjoint >
< rax_1 of num >
< rax_2 of num >
< rax_3 of num >
< rax_4 of num >
< rax_5 of num >
< rax_6 of num >
< extax of extjoint >
< eax_a of num >
< eax_b of num >
< eax_c of num >
< eax_d of num >
< eax_e of num >
< eax_f of num >
Related information
Described in:
Move to joint position
Instructions - MoveAbsJ
Positioning instructions
1-jointtarget-32
Data Types
loaddata
loaddata
Load data
Loaddata is used to describe loads attached to the mechanical interface of the robot
(the robots mounting flange).
Load data usually defines the payload (grip load is defined by the instruction GripLoad) of the robot, i.e. the load held in the robot gripper. The tool load is specified in
the tool data (tooldata) which includes load data.
Description
Specified loads are used to set up a model of the dynamics of the robot so that the robot
movements can be controlled in the best possible way.
It is important to always define the actual tool load and when used, the payload
of the robot too. Incorrect definitions of load data can result in overloading of the
robot mechanical structure.
When incorrect load data is specified, it can often lead to the following consequences:
- If the value in the specified load data is greater than that of the value of the true
load;
-> The robot will not be used to its maximum capacity
-> Impaired path accuracy including a risk of overshooting
-> Risk of overloading the mechanical structure
- If the value in the specified load data is less than the value of the true load;
-> Impaired path accuracy including a risk of overshooting
-> Risk of overloading the mechanical structure
The payload is connected/disconnected using the instruction GripLoad.
Components
mass
cog
(centre of gravity)
The centre of gravity of a tool load expressed in the wrist coordinate system.
If a stationary tool is used, it means the centre of gravity for the tool holding the
work object.
The centre of gravity of a payload expressed in the tool coordinate system. The
object coordinate system when a stationary tool is used.
1-loaddata-33
loaddata
Data Types
aom
(axes of moment)
IX
TCP
Figure 4 Restriction on the orientation of tool load and payload coordinate system.
1-loaddata-34
Data Types
loaddata
Z
Y
Payload coordinate
Z system Inertial axes of payload
X
Payload
X
ix
(inertia x)
The moment of inertia of the load around the x-axis of the tool load or payload
coordinate system in kgm2.
Correct definition of the inertial moments will allow optimal utilisation of the
path planner and axes control. This may be of special importance when handling
large sheets of metal, etc. All inertial moments of inertia ix, iy and iz equal to
0 kgm2 imply a point mass.
Normally, the inertial moments must only be defined when the distance from the
mounting flange to the centre of gravity is less than the dimension of the load
(see Figure 6).
payload
distance
x
dimension
Figure 6 The moment of inertia must normally be defined when the distance
is less than the load dimension.
iy
(inertia y)
The inertial moment of the load around the y-axis, expressed in kgm2.
1-loaddata-35
loaddata
Data Types
For more information, see ix.
iz
(inertia z)
The inertial moment of the load around the z-axis, expressed in kgm2.
For more information, see ix.
Examples
PERS loaddata piece1 := [ 5, [50, 0, 50], [1, 0, 0, 0], 0, 0, 0];
The payload in Figure 4 is described using the following values:
- Weight 5 kg.
- The centre of gravity is x = 50, y = 0 and z = 50 mm in the tool coordinate system.
- The payload is a point mass.
Set gripper;
WaitTime 0.3;
GripLoad piece1;
Connection of the payload, piece1, specified at the same time as the robot grips
the load piece1.
Reset gripper;
WaitTime 0.3;
GripLoad load0;
Disconnection of a payload, specified at the same time as the robot releases a payload.
Limitations
The payload should only be defined as a persistent variable (PERS) and not within a
routine. Current values are then saved when storing the program on diskette and are
retrieved on loading.
Arguments of the type load data in the GripLoad instruction should only be an entire
persistent (not array element or record component).
1-loaddata-36
Data Types
loaddata
Predefined data
The load load0 defines a payload, the weight of which is equal to 0 kg, i.e. no load at
all. This load is used as the argument in the instruction GripLoad to disconnect a payload.
The load load0 can always be accessed from the program, but cannot be changed (it is
stored in the system module BASE).
PERS loaddata load0 := [ 0.001, [0, 0, 0.001], [1, 0, 0, 0],0, 0 ,0 ];
Structure
< dataobject of loaddata >
< mass of num >
< cog of pos >
< x of num >
< y of num >
< z of num >
< aom of orient >
< q1 of num >
< q2 of num >
< q3 of num >
< q4 of num >
< ix of num >
< iy of num >
< iz of num >
Related information
Described in:
Coordinate systems
Activation of payload
Instructions - GripLoad
1-loaddata-37
loaddata
1-loaddata-38
Data Types
Data Types
loadsession
loadsession
Description
Data of the type loadsession is used in the instructions StartLoad and WaitLoad, to
identify the load session. Loadsession only contains a reference to the load session.
Characteristics
Loadsession is a non-value data type and cannot be used in value-oriented operations.
Related information
Described in:
Loading program modules during execution
1-loadsession-39
loadsession
1-loadsession-40
Data Types
Data Types
mecunit
mecunit
Mechanical unit
Mecunit is used to define the different mechanical units which can be controlled and
accessed from the robot and the program.
The names of the mechanical units are defined in the system parameters and, consequently, must not be defined in the program.
Description
Data of the type mecunit only contains a reference to the mechanical unit.
Limitations
Data of the type mecunit must not be defined in the program. The data type can, on the
other hand, be used as a parameter when declaring a routine.
Predefined data
The mechanical units defined in the system parameters can always be accessed from
the program (installed data).
Characteristics
Mecunit is a non-value data type. This means that data of this type does not permit
value-oriented operations.
Related information
Described in:
Activating/Deactivating mechanical units
1-mecunit-41
mecunit
1-mecunit-42
Data Types
Data Types
motsetdata
motsetdata
Motsetdata is used to define a number of motion settings that affect all positioning
instructions in the program:
- Max. velocity and velocity override
- Acceleration data
- Behavior around singular points
- Management of different robot configurations
- Override of path resolution
- Motion supervision
This data type does not normally have to be used since these settings can only be set
using the instructions VelSet, AccSet, SingArea, ConfJ, ConfL, PathResol and
MotionSup.
The current values of these motion settings can be accessed using the system variable
C_MOTSET.
Description
The current motion settings (stored in the system variable C_MOTSET) affect all
movements.
Components
vel.oride
1-motsetdata-43
motsetdata
Data Types
sing.wrist
The orientation of the tool is allowed to deviate somewhat in order to prevent arm
singularity (not implemented).
sing.base
Maximum permitted deviation in degrees for axis 1 (not used in this version).
conf.ax4
Maximum permitted deviation in degrees for axis 4 (not used in this version).
conf.ax6
Maximum permitted deviation in degrees for axis 6 (not used in this version).
pathresol
Limitations
One and only one of the components sing.wrist, sing.arm or sing.base may have a value
equal to TRUE.
1-motsetdata-44
Data Types
motsetdata
Example
IF C_MOTSET.vel.oride > 50 THEN
...
ELSE
...
ENDIF
Different parts of the program are executed depending on the current velocity
override.
Predefined data
C_MOTSET describes the current motion settings of the robot and can always be
accessed from the program (installed data). C_MOTSET, on the other hand, can only
be changed using a number of instructions, not by assignment.
The following default values for motion parameters are set
- at a cold start-up
- when a new program is loaded
- when starting program execution from the beginning.
PERS motsetdata C_MOTSET := [
[ 100, 500 ],-> veldata
[ 100, 100 ],-> accdata
[ FALSE, FALSE, TRUE ],-> singdata
[ TRUE, TRUE, 30, 45, 90],-> confsupdata
[100 ],-> path resolution
[TRUE ],-> motionsup
[100 ] ];-> tunevalue
1-motsetdata-45
motsetdata
Data Types
Structure
<dataobject of motsetdata>
<vel of veldata >
< oride of num >
< max of num >
<acc of accdata >
< acc of num >
< ramp of num >
<sing of singdata >
< wrist of bool >
< arm of bool >
< base of bool >
<conf of confsupdata >
< jsup of bool >
<lsup of bool >
< ax1 of num >
< ax4 of num >
< ax6 of num >
<pathresol of num>
<motionsup of bool>
<tunevalue of num>
Related information
Described in:
Instructions for setting motion parameters
1-motsetdata-46
Data Types
num
num
Description
The value of the num data type may be
- an integer; e.g. -5,
- a decimal number; e.g. 3.45.
It may also be written exponentially; e.g.2E3 (= 2*103 = 2000), 2.5E-2 (= 0.025).
Integers between -8388607 and +8388608 are always stored as exact integers.
Decimal numbers are only approximate numbers and should not, therefore, be used in
is equal to or is not equal to comparisons. In the case of divisions, and operations using
decimal numbers, the result will also be a decimal number; i.e. not an exact integer.
E.g.
a := 10;
b := 5;
IF a/b=2 THEN
...
Example
VAR num reg1;
.
reg1 := 3;
reg1 is assigned the value 3.
a := 10 DIV 3;
b := 10 MOD 3;
Integer division where a is assigned an integer (=3) and b is assigned the
remainder (=1).
1-num-47
num
Data Types
Predefined data
The constant pi () is already defined in the system module BASE.
CONST num pi := 3.1415926;
The constants EOF_BIN and EOF_NUM are already defined in the system.
CONST num EOF_BIN := -1;
CONST num EOF_NUM := 9.998E36;
Related information
Described in:
1-num-48
Numeric expressions
Data Types
o_jointtarget
o_jointtarget
o_jointtarget (original joint target) is used in combination with the function Absolute
Limit Modpos. When this function is used to modify a position, the original position is
stored as a data of the type o_jointtarget.
Description
If the function Absolute Limit Modpos is activated and a named position in a movement
instruction is modified with the function Modpos, then the original programmed position is saved.
Example of a program before Modpos:
CONST jointtarget jpos40
:= [[0, 0, 0, 0, 0, 0],
[0, 9E9, 9E9, 9E9, 9E9, 9E9]];
...
MoveAbsJ jpos40, v1000, z50, tool1;
The same program after ModPos in which the point jpos40 is corrected to 2 degrees
for robot axis 1:
CONST jointtarget jpos40
:= [[2, 0, 0, 0, 0, 0],
[0, 9E9, 9E9, 9E9, 9E9, 9E9]];
CONST o_jointtarget o_jpos40 := [[0, 0, 0, 0, 0, 0],
[0, 9E9, 9E9, 9E9, 9E9, 9E9]];
...
MoveAbsJ jpos40, v1000, z50, tool1;
The original programmed point has now been saved in o_jpos40 (by the data type
o_jointtarget) and the modified point saved in jpos40 (by the data type jointtarget).
By saving the original programmed point, the robot can monitor that further Modpos
of the point in question are within the acceptable limits from the original programmed
point.
The fixed name convention means that an original programmed point with the name
xxxxx is saved with the name o_xxxxx by using Absolute Limit Modpos.
1-o_jointtarget-49
o_jointtarget
Data Types
Components
robax
(robot axes)
(external axes)
Structure
< dataobject of o_jointtarget >
< robax of robjoint>
< rax_1 of num >
< rax_2 of num >
< rax_3 of num >
< rax_4 of num >
< rax_5 of num >
< rax_6 of num >
< extax of extjoint >
< eax_a of num >
< eax_b of num >
< eax_c of num >
< eax_d of num >
< eax_e of num >
< eax_f of num >
Related information
Described in:
Position data
1-o_jointtarget-50
Data Types
orient
orient
Orientation
Orient is used for orientations (such as the orientation of a tool) and rotations (such as
the rotation of a coordinate system).
Description
The orientation is described in the form of a quaternion which consists of four elements: q1, q2, q3 and q4. For more information on how to calculate these, see below.
Components
q1
q2
q3
q4
Example
VAR orient orient1;
.
orient1 := [1, 0, 0, 0];
The orient1 orientation is assigned the value q1=1, q2-q4=0; this corresponds to
no rotation.
Limitations
The orientation must be normalised; i.e. the sum of the squares must equal 1:
q 12 + q 22 + q 32 + q 42 = 1
1-orient-51
orient
Data Types
What is a Quaternion?
The orientation of a coordinate system (such as that of a tool) can be described by a
rotational matrix that describes the direction of the axes of the coordinate system in
relation to a reference system (see Figure 7).
z
z
x
Reference
coordinate
system
Rotated
coordinate
system
The rotated coordinate systems axes (x, y, z) are vectors which can be expressed in the
reference coordinate system as follows:
x = (x1, x2, x3)
y = (y1, y2, y3)
z = (z1, z2, z3)
This means that the x-component of the x-vector in the reference coordinate system
will be x1, the y-component will be x2, etc.
These three vectors can be put together in a matrix, a rotational matrix, where each of
the vectors form one of the columns:
x1 y1
x2 y2
z1
z2
x3 y3 z3
A quaternion is just a more concise way to describe this rotational matrix; the quaternions are calculated based on the elements of the rotational matrix:
x1 + y2 + z3 + 1
q1 = ----------------------------------------2
1-orient-52
x 1 y2 z3 + 1
q2 = ---------------------------------------2
y 2 x1 z3 + 1
q3 = ---------------------------------------2
z3 x 1 y2 + 1
q4 = ---------------------------------------2
Data Types
orient
Example 1
A tool is orientated so that its Z-axis points straight ahead (in the same direction as the
X-axis of the base coordinate system). The Y-axis of the tool corresponds to the Yaxis of the base coordinate system (see Figure 8). How is the orientation of the tool
defined in the position data (robtarget)?
The orientation of the tool in a programmed position is normally related to the coordinate system of the work object used. In this example, no work object is used and the
base coordinate system is equal to the world coordinate system. Thus, the orientation
is related to the base coordinate system.
Z
X
Z
X
Figure 8 The direction of a tool in accordance with example 1.
0 0 1
0 1 0
1 0 0
001+1
q4 = ---------------------------------- = 0
2
Example 2
The direction of the tool is rotated 30o about the X- and Z-axes in relation to the wrist
coordinate system (see Figure 8). How is the orientation of the tool defined in the tool
data?
1-orient-53
orient
Data Types
Z
Z
X
X
cos 30 0 sin 30
0
1
0
sin 30 0 cos 30
cos 30 cos 30 1 + 1
q4 = ---------------------------------------------------------------- = 0
2
Structure
<dataobject of orient>
<q1 of num>
<q2 of num>
<q3 of num>
<q4 of num>
Related information
Described in:
Operations on orientations
1-orient-54
Data Types
o_robtarget
o_robtarget
o_robtarget (original robot target) is used in combination with the function Absolute
Limit Modpos. When this function is used to modify a position, the original position is
stored as a data of the type o_robtarget.
Description
If the function Absolute Limit Modpos is activated and a named position in a movement
instruction is modified with the function Modpos, then the original programmed position is saved.
Example of a program before Modpos:
CONST robtarget p50
...
MoveL p50, v1000, z50, tool1;
The same program after ModPos in which the point p50 is corrected to 502 in the xdirection:
CONST robtarget p50
Components
trans
(translation)
The position (x, y and z) of the tool centre point expressed in mm.
1-o_robtarget-55
o_robtarget
Data Types
rot
(rotation)
The orientation of the tool, expressed in the form of a quaternion (q1, q2, q3 and q4).
robconf
(robot configuration)
The axis configuration of the robot (cf1, cf4, cf6 and cfx).
extax
(external axes)
Structure
< dataobject of o_robtarget >
< trans of pos >
< x of num >
< y of num >
< z of num >
< rot of orient >
< q1 of num >
< q2 of num >
< q3 of num >
< q4 of num >
< robconf of confdata >
< cf1 of num >
< cf4 of num >
< cf6 of num >
< cfx of num >
< extax of extjoint >
< eax_a of num >
< eax_b of num >
< eax_c of num >
< eax_d of num >
< eax_e of num >
< eax_f of num >
Related information
Described in:
Position data
1-o_robtarget-56
Data Types
pos
pos
Description
Data of the type pos describes the coordinates of a position: X, Y and Z.
Components
x
Examples
VAR pos pos1;
.
pos1 := [500, 0, 940];
The pos1 position is assigned the value: X=500 mm, Y=0 mm, Z=940 mm.
pos1.x := pos1.x + 50;
The pos1 position is shifted 50 mm in the X-direction.
Structure
<dataobject of pos>
<x of num>
<y of num>
<z of num>
1-pos-57
pos
Data Types
Related information
Described in:
1-pos-58
Operations on positions
Data Types
pose
pose
Coordinate transformations
Pose is used to change from one coordinate system to another.
Description
Data of the type pose describes how a coordinate system is displaced and rotated
around another coordinate system. The data can, for example, describe how the tool
coordinate system is located and oriented in relation to the wrist coordinate system.
Components
trans
(translation)
(rotation)
Example
VAR pose frame1;
.
frame1.trans := [50, 0, 40];
frame1.rot := [1, 0, 0, 0];
The frame1 coordinate transformation is assigned a value that corresponds to a
displacement in position, where X=50 mm, Y=0 mm, Z=40 mm; there is, however, no rotation.
Structure
<dataobject of pose>
<trans of pos>
<rot of orient>
Related information
Described in:
What is a Quaternion?
1-pose-59
pose
1-pose-60
Data Types
Data Types
progdisp
progdisp
Program displacement
Progdisp is used to store the current program displacement of the robot and the external axes.
This data type does not normally have to be used since the data is set using the instructions PDispSet, PDispOn, PDispOff, EOffsSet, EOffsOn and EOffsOff. It is only used
to temporarily store the current value for later use.
Description
The current values for program displacement can be accessed using the system variable
C_PROGDISP.
For more information, see the instructions PDispSet, PDispOn, EOffsSet and EOffsOn.
Components
pdisp
(program displacement)
The program displacement for the robot, expressed using a translation and an orientation. The translation is expressed in mm.
eoffs
(external offset)
The offset for each of the external axes. If the axis is linear, the value is expressed
in mm; if it is rotating, the value is expressed in degrees.
Example
VAR progdisp progdisp1;
.
SearchL sen1, psearch, p10, v100, tool1;
PDispOn \ExeP:=psearch, *, tool1;
EOffsOn \ExeP:=psearch, *;
.
progdisp1:=C_PROGDISP;
PDispOff;
EOffsOff;
.
PDispSet progdisp1.pdisp;
EOffsSet progdisp1.eoffs;
First, a program displacement is activated from a searched position. Then, it is
temporarily deactivated by storing the value in the variable progdisp1 and, later
on, re-activated using the instructions PDispSet and EOffsSet.
System Data Types and Routines
1-progdisp-61
progdisp
Data Types
Predefined data
The system variable C_PROGDISP describes the current program displacement of the
robot and external axes, and can always be accessed from the program (installed data).
C_PROGDISP, on the other hand, can only be changed using a number of instructions,
not by assignment.
Structure
< dataobject of progdisp >
<pdisp of pose>
< trans of pos >
< x of num >
< y of num >
< z of num >
< rot of orient >
< q1 of num >
< q2 of num >
< q3 of num >
< q4 of num >
< eoffs of extjoint >
< eax_a of num >
< eax_b of num >
< eax_c of num >
< eax_d of num >
< eax_e of num >
< eax_f of num >
Related information
Described in:
Instructions for defining program displacement RAPID Summary - Motion Settings
Coordinate systems
1-progdisp-62
Data Types
robjoint
robjoint
Robjoint is used to define the axis position in degrees of the robot axes.
Description
Data of the type robjoint is used to store axis positions in degrees of the robot axes 1
to 6. Axis position is defined as the rotation in degrees for the respective axis (arm) in
a positive or negative direction from the axis calibration position.
Components
rax_1
(robot axis 1)
(robot axis 6)
Structure
< dataobject of robjoint >
< rax_1 of num >
< rax_2 of num >
< rax_3 of num >
< rax_4 of num >
< rax_5 of num >
< rax_6 of num >
Related information
Described in:
Joint position data
Instructions - MoveAbsJ
1-robjoint-63
robjoint
1-robjoint-64
Data Types
Data Types
robtarget
robtarget
Position data
Robtarget (robot target) is used to define the position of the robot and external axes.
Description
Position data is used to define the position in the positioning instructions to which the
robot and external axes are to move.
As the robot is able to achieve the same position in several different ways, the axis
configuration is also specified. This defines the axis values if these are in any way
ambiguous, for example:
- if the robot is in a forward or backward position,
- if axis 4 points downwards or upwards,
- if axis 6 has a negative or positive revolution.
The position is defined based on the coordinate system of the work object,
including any program displacement. If the position is programmed with some
other work object than the one used in the instruction, the robot will not move in
the expected way. Make sure that you use the same work object as the one used
when programming positioning instructions. Incorrect use can injure someone or
damage the robot or other equipment.
Components
trans
(translation)
The position (x, y and z) of the tool centre point expressed in mm.
The position is specified in relation to the current object coordinate system,
including program displacement. If no work object is specified, this is the world
coordinate system.
rot
(rotation)
The orientation of the tool, expressed in the form of a quaternion (q1, q2, q3 and q4).
The orientation is specified in relation to the current object coordinate system,
including program displacement. If no work object is specified, this is the world
coordinate system.
1-robtarget-65
robtarget
Data Types
robconf
(robot configuration)
The axis configuration of the robot (cf1, cf4, cf6 and cfx). This is defined in the
form of the current quarter revolution of axis 1, axis 4 and axis 6. The first
positive quarter revolution 0 to 90 o is defined as 0. The component cfx is only
used for the robot model IRB5400.
For more information, see data type confdata.
extax
(external axes)
Examples
CONST robtarget p15 := [ [600, 500, 225.3], [1, 0, 0, 0], [1, 1, 0, 0],
[ 11, 12.3, 9E9, 9E9, 9E9, 9E9] ];
A position p15 is defined as follows:
- The position of the robot: x = 600, y = 500 and z = 225.3 mm in the object
coordinate system.
- The orientation of the tool in the same direction as the object coordinate system.
- The axis configuration of the robot: axes 1 and 4 in position 90-180o, axis 6 in
position 0-90o.
- The position of the external logical axes, a and b, expressed in degrees or mm
(depending on the type of axis). Axes c to f are undefined.
1-robtarget-66
Data Types
robtarget
Limitations
When using the configurable edit function Absolute Limit Modpos, the number of
characters in the name of the data of the type robtarget, is limited to 14 (in other cases
16).
Structure
< dataobject of robtarget >
< trans of pos >
< x of num >
< y of num >
< z of num >
< rot of orient >
< q1 of num >
< q2 of num >
< q3 of num >
< q4 of num >
< robconf of confdata >
< cf1 of num >
< cf4 of num >
< cf6 of num >
< cfx of num >
< extax of extjoint >
< eax_a of num >
< eax_b of num >
< eax_c of num >
< eax_d of num >
< eax_e of num >
< eax_f of num >
1-robtarget-67
robtarget
Data Types
Related information
Described in:
Positioning instructions
Coordinate systems
What is a quaternion?
1-robtarget-68
Data Types
shapedata
shapedata
Description
World zones can be defined in 3 different geometrical shapes:
- a straight box, with all sides parallel to the world coordinate system and defined
by a WZBoxDef instruction
- a sphere, defined by a WZSphDef instruction
- a cylinder, parallel to the z axis of the world coordinate system and defined by
a WZCylDef instruction
The geometry of a world zone is defined by one of the previous instructions and the
action of a world zone is defined by the instruction WZLimSup or WZDOSet.
Example
VAR wzstationary pole;
VAR wzstationary conveyor;
...
PROC ...
VAR shapedata volume;
...
WZBoxDef \Inside, volume, p_corner1, p_corner2;
WZLimSup \Stat, conveyor, volume;
WZCylDef \Inside, volume, p_center, 200, 2500;
WZLimSup \Stat, pole, volume;
ENDPROC
A conveyor is defined as a box and the supervision for this area is activated. A
pole is defined as a cylinder and the supervision of this zone is also activated. If
the robot reaches one of these areas, the motion is stopped.
Characteristics
shapedata is a non-value data type.
1-shapedata-69
shapedata
Data Types
Related information
Described in:
World Zones
Instructions - WZBoxDef
Instructions - WZSphDef
Instructions - WZCylDef
Instructions - WZLimSup
Instructions - WZDOSet
1-shapedata-70
Data Types
signalxx
signalxx
Data types within signalxx are used for digital and analog input and output signals.
The names of the signals are defined in the system parameters and are consequently
not to be defined in the program.
Description
Data type
Used for
signalai
signalao
signaldi
signaldo
signalgi
signalgo
Variables of the type signalxo only contain a reference to the signal. The value is set
using an instruction, e.g. DOutput.
Variables of the type signalxi contain a reference to a signal as well as the possibility
to retrieve the value directly in the program, if used in value context.
The value of an input signal can be read directly in the program, e.g. :
! Digital input
IF di1 = 1 THEN ...
! Digital group input
IF gi1 = 5 THEN ...
! Analog input
IF ai1 > 5.2 THEN ...
Limitations
Data of the data type signalxx must not be defined in the program. However, if this is
in fact done, an error message will be displayed as soon as an instruction or function
that refers to this signal is executed. The data type can, on the other hand, be used as a
parameter when declaring a routine.
1-signalxx-71
signalxx
Data Types
Predefined data
The signals defined in the system parameters can always be accessed from the program
by using the predefined signal variables (installed data). It should however be noted
that if other data with the same name is defined, these signals cannot be used.
Characteristics
Signalxo is a non-value data type. Thus, data of this type does not permit valueoriented operations.
Signalxi is a semi-value data type.
Related information
Described in:
Summary input/output instructions
Configuration of I/O
1-signalxx-72
Data Types
speeddata
speeddata
Speed data
Speeddata is used to specify the velocity at which both the robot and the external axes
move.
Description
Speed data defines the velocity:
- at which the tool centre point moves,
- of the reorientation of the tool,
- at which linear or rotating external axes move.
When several different types of movement are combined, one of the velocities often
limits all movements. The velocity of the other movements will be reduced in such a
way that all movements will finish executing at the same time.
The velocity is also restricted by the performance of the robot. This differs, depending
on the type of robot and the path of movement.
Components
v_tcp
(velocity tcp)
(velocity orientation)
1-speeddata-73
speeddata
Data Types
Example
VAR speeddata vmedium := [ 1000, 30, 200, 15 ];
The speed data vmedium is defined with the following velocities:
- 1000 mm/s for the TCP.
- 30 degrees/s for reorientation of the tool.
- 200 mm/s for linear external axes.
- 15 degrees/s for rotating external axes.
vmedium.v_tcp := 900;
The velocity of the TCP is changed to 900 mm/s.
Predefined data
A number of speed data are already defined in the system module BASE.
Name
TCP speed
Orientation
v5
v10
v20
v30
v40
v50
v60
v80
v100
v150
v200
v300
v400
v500
v600
v800
v1000
v1500
v2000
v2500
v3000
v4000
v5000
vmax
v6000
v7000
5 mm/s
10 mm/s
20 mm/s
30 mm/s
40 mm/s
50 mm/s
60 mm/s
80 mm/s
100 mm/s
150 mm/s
200 mm/s
300 mm/s
400 mm/s
500 mm/s
600 mm/s
800 mm/s
1000 mm/s
1500 mm/s
2000 mm/s
2500 mm/s
3000 mm/s
4000 mm/s
5000 mm/s
5000 mm/s
6000 mm/s
7000 mm/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
500o/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
5000 mm/s
1-speeddata-74
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
1000o/s
Data Types
speeddata
Structure
< dataobject of speeddata >
< v_tcp of num >
< v_ori of num >
< v_leax of num >
< v_reax of num >
Related information
Described in:
Positioning instructions
Motion/Speed in general
Instructions - VelSet
Motion performance
Product Specification
1-speeddata-75
speeddata
1-speeddata-76
Data Types
Data Types
string
string
Strings
String is used for character strings.
Description
A character string consists of a number of characters (a maximum of 80) enclosed by
quotation marks (),
e.g.
If the quotation marks are to be included in the string, they must be written twice,
e.g.
Example
VAR string text;
.
text := start welding pipe 1;
TPWrite text;
The text start welding pipe 1 is written on the teach pendant.
Limitations
A string may have from 0 to 80 characters; inclusive of extra quotation marks.
A string may contain any of the characters specified by ISO 8859-1 as well as control
characters (non-ISO 8859-1 characters with a numeric code between 0-255).
1-string-77
string
Data Types
Predefined data
A number of predefined string constants are available in the system and can be used
together with string functions.
Name
Character set
STR_DIGIT
<digit> ::=
0|1|2|3|4|5|6|7|8|9
STR_UPPER
STR_LOWER
STR_WHITE
Related information
Described in:
1-string-78
String values
Data Types
symnum
symnum
Symbolic number
Description
A symnum constant is intended to be used when checking the return value from the
functions OpMode and RunMode. See example below.
Example
IF RunMode() = RUN_CONT_CYCLE THEN
.
.
ELSE
.
.
ENDIF
Predefined data
The following symbolic constants of the data type symnum are predefined and can be
used when checking return values from the functions OpMode and RunMode.
Value
Symbolic constant
Comment
RUN_UNDEF
RUN_CONT_CYCLE
RUN_INSTR_FWD
RUN_INSTR_BWD
RUN_SIM
Value
Symbolic constant
Comment
OP_UNDEF
OP_AUTO
OP_MAN_PROG
OP_MAN_TEST
1-symnum-79
symnum
Data Types
Characteristics
Symnum is an alias data type for num and consequently inherits its characteristics.
Related information
Described in:
Data types in general, alias data types
1-symnum-80
Data Types
System Data
System Data
System data is the internal data of the robot that can be accessed and read by the program. It can be used to read the current status, e.g. the current maximum velocity.
The following table contains a list of all system data.
Name
Description
Data Type
Changed by
See also
C_MOTSET
motsetdata
Instructions
- VelSet
- AccSet
- SingArea
- ConfL,ConfJ
- PathResol
- MotionSup
C_PROGDISP
progdisp
Instructions
- PDispSet
- PDispOn
- PDispOff
- EOffsSet
- EOffsOn
- EOffsOff
ERRNO
errnum
The robot
INTNO
intnum
The robot
7-System Data-81
System Data
1-System Data-82
Data Types
Data Types
taskid
taskid
Task identification
Taskid is used to identify available program tasks in the system.
The names of the program tasks are defined in the system parameters and, consequently, must not be defined in the program.
Description
Data of the type taskid only contains a reference to the program task.
Limitations
Data of the type taskid must not be defined in the program. The data type can, on the
other hand, be used as a parameter when declaring a routine.
Predefined data
The program tasks defined in the system parameters can always be accessed from the
program (installed data).
For all program tasks in the system, predefined variables of the data type taskid will be
available. The variable identity will be "taskname"+"Id", e.g. for MAIN task the variable identity will be MAINId, TSK1 - TSK1Id etc.
Characteristics
Taskid is a non-value data type. This means that data of this type does not permit valueoriented operations.
Related information
Described in:
Saving program modules
Instruction - Save
1-taskid-83
taskid
1-taskid-84
Data Types
Data Types
testsignal
testsignal
Test signal
The data type testsignal is used when a test of the robot system is performed.
Description
A number of predefined test signals are available in the robot system. The testsignal
data type is available in order to simplify programming of instructions regarding service and test.
Examples
TestSign 2, revolution_counter, Orbit, 2, 1, 0;
revolution_counter is a constant of the testsignal data type.
Predefined data
A number of predefined constants for the various test signals in the robot system are
loaded into the system at start-up. The service manual describes the test signals more
thoroughly.
Characteristics
Testsignal is an alias data type for num and consequently inherits its characteristics.
Related information
Described in:
Data types in general, alias data types
1-testsignal-85
testsignal
1-testsignal-86
Data Types
Data Types
tooldata
tooldata
Tool data
Tooldata is used to describe the characteristics of a tool, e.g. a welding gun or a gripper.
If the tool is fixed in space (a stationary tool), common tool data is defined for this tool
and the gripper holding the work object.
Description
Tool data affects robot movements in the following ways:
- The tool centre point (TCP) refers to a point that will satisfy the specified path
and velocity performance. If the tool is reorientated or if coordinated external
axes are used, only this point will follow the desired path at the programmed
velocity.
- If a stationary tool is used, the programmed speed and path will relate to the
work object.
- Programmed positions refer to the position of the current TCP and the orientation in relation to the tool coordinate system. This means that if, for example,
a tool is replaced because it is damaged, the old program can still be used if the
tool coordinate system is redefined.
Tool data is also used when jogging the robot to:
- Define the TCP that is not to move when the tool is reorientated.
- Define the tool coordinate system in order to facilitate moving in or rotating
about the tool directions.
It is important to always define the actual tool load and when used, the payload
of the robot too. Incorrect definitions of load data can result in overloading of the
robot mechanical structure.
When incorrect tool load data is specified, it can often lead to the following consequences:
- If the value in the specified load is greater than that of the value of the true load;
-> The robot will not be used to its maximum capacity
-> Impaired path accuracy including a risk of overshooting
- If the value in the specified load is less than the value of the true load;
-> Impaired path accuracy including a risk of overshooting
-> Risk of overloading the mechanical structure
1-tooldata-87
tooldata
Data Types
Components
robhold
(robot hold)
- FALSE
-> The robot is not holding the tool, i.e. a stationary tool.
tframe
(tool frame)
Y
X
Z
1-tooldata-88
Data Types
tooldata
tload
(tool load)
TCP
IX
Y
X
Z
Figure 11 Tool load parameter definitions
For more information (such as coordinate system for stationary tool or restrictions), see the data type loaddata.
If a stationary tool is used, the load of the gripper holding the work object must
be defined.
Note that only the load of the tool is to be specified. The payload handled by a
gripper is connected and disconnected by means of the instruction GripLoad.
1-tooldata-89
tooldata
Data Types
Examples
PERS tooldata gripper := [ TRUE, [[97.4, 0, 223.1], [0.924, 0, 0.383 ,0]],
[5, [23, 0, 75], [1, 0, 0, 0], 0, 0, 0]];
The tool in Figure 10 is described using the following values:
- The robot is holding the tool.
- The TCP is located at a point 223.1 mm straight out from axis 6 and 97.4 mm
along the X-axis of the wrist coordinate system.
- The X and Z directions of the tool are rotated 45o in relation to the wrist coordinate system.
- The tool weighs 5 kg.
- The centre of gravity is located at a point 75 mm straight out from axis 6 and
23 mm along the X-axis of the wrist coordinate system.
- The load can be considered a point mass, i.e. without any moment of inertia.
gripper.tframe.trans.z := 225.2;
The TCP of the tool, gripper, is adjusted to 225.2 in the z-direction.
Limitations
The tool data should be defined as a persistent variable (PERS) and should not be
defined within a routine. The current values are then saved when the program is stored
on diskette and are retrieved on loading.
Arguments of the type tool data in any motion instruction should only be an entire persistent (not array element or record component).
Predefined data
The tool tool0 defines the wrist coordinate system, with the origin being the centre of
the mounting flange. Tool0 can always be accessed from the program, but can never be
changed (it is stored in system module BASE).
PERS tooldata tool0 := [ TRUE, [ [0, 0, 0], [1, 0, 0 ,0] ],
[0.001, [0, 0, 0.001], [1, 0, 0, 0], 0, 0, 0] ];
1-tooldata-90
Data Types
tooldata
Structure
< dataobject of tooldata >
< robhold of bool >
< tframe of pose >
< trans of pos >
< x of num >
< y of num >
< z of num >
< rot of orient >
< q1 of num >
< q2 of num >
< q3 of num >
< q4 of num >
< tload of loaddata >
< mass of num >
< cog of pos >
< x of num >
< y of num >
< z of num >
< aom of orient >
< q1 of num >
< q2 of num >
< q3 of num >
< q4 of num >
< ix of num >
< iy of num >
< iz of num >
Related information
Described in:
Positioning instructions
Coordinate systems
Definition of payload
Instructions - Gripload
Definition of load
1-tooldata-91
tooldata
1-tooldata-92
Data Types
Data Types
tpnum
tpnum
Description
A tpnum constant is intended to be used in instruction TPShow. See example below.
Example
TPShow TP_PROGRAM;
The Production Window will be active if the system is in AUTO mode and the
Program Window will be active if the system is in MAN mode, after execution of
this instruction.
Predefined data
The following symbolic constants of the data type tpnum are predefined and can be
used in instruction TPShow:
Value
Symbolic constant
Comment
TP_PROGRAM
TP_LATEST
TP_SCREENVIEWER
Characteristics
tpnum is an alias data type for num and consequently inherits its characteristics.
1-tpnum-93
tpnum
Data Types
Related information
Described in:
1-tpnum-94
Instructions - TPShow
Data Types
triggdata
triggdata
Triggdata is used to store data about a positioning event during a robot movement.
A positioning event can take the form of setting an output signal or running an interrupt
routine at a specific position along the movement path of the robot.
Description
To define the conditions for the respective measures at a positioning event, variables
of the type triggdata are used. The data contents of the variable are formed in the program using one of the instructions TriggIO or TriggInt, and are used by one of the
instructions TriggL, TriggC or TriggJ.
Example
VAR triggdata gunoff;
TriggIO gunoff, 5 \DOp:=gun, off;
TriggL p1, v500, gunoff, fine, gun1;
The digital output signal gun is set to the value off when the TCP is at a position
5 mm before the point p1.
Characteristics
Triggdata is a non-value data type.
Related information
Described in:
Definition of triggs
Use of triggs
1-triggdata-95
triggdata
1-triggdata-96
Data Types
Data Types
tunetype
tunetype
Description
A tunetype constant is intended to be used as an argument to the instruction TuneServo.
See example below.
Example
TuneServo MHA160R1, 1, 110 \Type:= TUNE_KP;
Predefined data
The following symbolic constants of the data type tunetype are predefined and can be
used as argument for the instruction TuneServo.
Value
Symbolic constant
Comment
TUNE_DF
Reduces overshoots
TUNE_KP
TUNE_KV
TUNE_TI
TUNE_FRIC_LEV
TUNE_FRIC_RAMP
TUNE_DG
Reduces overshoots
TUNE_DH
TUNE_DI
TUNE_DK
Characteristics
Tunetype is an alias data type for num and consequently inherits its characteristics.
1-tunetype-97
tunetype
Data Types
Related information
Described in:
Data types in general, alias data types
Instructions - TuneServo
1-tunetype-98
Data Types
wobjdata
wobjdata
Wobjdata is used to describe the work object that the robot welds, processes, moves
within, etc.
Description
If work objects are defined in a positioning instruction, the position will be based on
the coordinates of the work object. The advantages of this are as follows:
- If position data is entered manually, such as in off-line programming, the values
can often be taken from a drawing.
- Programs can be reused quickly following changes in the robot installation. If,
for example, the fixture is moved, only the user coordinate system has to be
redefined.
- Variations in how the work object is attached can be compensated for. For this,
however, some sort of sensor will be required to position the work object.
If a stationary tool or coordinated external axes are used the work object must be
defined, since the path and velocity would then be related to the work object instead of
the TCP.
Work object data can also be used for jogging:
- The robot can be jogged in the directions of the work object.
- The current position displayed is based on the coordinate system of the work
object.
Components
robhold
(robot hold)
-> The robot is holding the work object, i.e. using a stationary tool.
- FALSE
-> The robot is not holding the work object, i.e. the robot is holding
the tool.
ufprog
- FALSE
1-wobjdata-99
wobjdata
Data Types
ufmec
The mechanical unit with which the robot movements are coordinated. Only
specified in the case of movable user coordinate systems (ufprog is FALSE).
Specified with the name that is defined in the system parameters, e.g. "orbit_a".
uframe
(user frame)
The user coordinate system, i.e. the position of the current work surface or fixture
(see Figure 12):
- The position of the origin of the coordinate system (x, y and z) in mm.
- The rotation of the coordinate system, expressed as a quaternion (q1, q2, q3,
q4).
If the robot is holding the tool, the user coordinate system is defined in the world
coordinate system (in the wrist coordinate system if a stationary tool is used).
When coordinated external axes are used (ufprog is FALSE), the user coordinate
system is defined in the system parameters.
oframe
(object frame)
The object coordinate system, i.e. the position of the current work object (see Figure 12):
- The position of the origin of the coordinate system (x, y and z) in mm.
- The rotation of the coordinate system, expressed as a quaternion (q1, q2, q3,
q4).
The object coordinate system is defined in the user coordinate system.
Tool coordinates
Y
TCP
Z
Y
User coordinates
Z
Object coordinates
Y
X
Base coordinates
X
World coordinates
Figure 12 The various coordinate systems of the robot (when the robot is holding the tool).
1-wobjdata-100
Data Types
wobjdata
Example
PERS wobjdata wobj2 :=[ FALSE, TRUE, "", [ [300, 600, 200], [1, 0, 0 ,0] ],
[ [0, 200, 30], [1, 0, 0 ,0] ] ];
The work object in Figure 12 is described using the following values:
- The robot is not holding the work object.
- The fixed user coordinate system is used.
- The user coordinate system is not rotated and the coordinates of its origin are
x= 300, y = 600 and z = 200 mm in the world coordinate system.
- The object coordinate system is not rotated and the coordinates of its origin are
x= 0, y= 200 and z= 30 mm in the user coordinate system.
wobj2.oframe.trans.z := 38.3;
- The position of the work object wobj2 is adjusted to 38.3 mm in the z-direction.
Limitations
The work object data should be defined as a persistent variable (PERS) and should not
be defined within a routine. The current values are then saved when the program is
stored on diskette and are retrieved on loading.
Arguments of the type work object data in any motion instruction should only be an
entire persistent (not array element or record component).
Predefined data
The work object data wobj0 is defined in such a way that the object coordinate system
coincides with the world coordinate system. The robot does not hold the work object.
Wobj0 can always be accessed from the program, but can never be changed (it is stored
in system module BASE).
PERS wobjdata wobj0 :=
1-wobjdata-101
wobjdata
Data Types
Structure
< dataobject of wobjdata >
< robhold of bool >
< ufprog of bool>
< ufmec of string >
< uframe of pose >
< trans of pos >
< x of num >
< y of num >
< z of num >
< rot of orient >
< q1 of num >
< q2 of num >
< q3 of num >
< q4 of num >
< oframe of pose >
< trans of pos >
< x of num >
< y of num >
< z of num >
< rot of orient >
< q1 of num >
< q2 of num >
< q3 of num >
< q4 of num >
Related information
Described in:
Positioning instructions
Coordinate systems
1-wobjdata-102
Data Types
wzstationary
wzstationary
wzstationary (world zone stationary) is used to identify a stationary world zone and
can only be used in an event routine connected to the event POWER ON.
A world zone is supervised during robot movements both during program execution
and jogging. If the robots TCP reaches this world zone, the movement is stopped or a
digital output signal is set or reset.
Description
A wzstationary world zone is defined and activated by a WZLimSup or a WZDOSet
instruction.
WZLimSup or WZDOSet gives the variable or the persistent of data type stationary a
numeric value. The value identifies the world zone.
A stationary world zone is always active and is only erased by a warm start (switch
power off then on, or change system parameters). It is not possible to deactivate,
activate or erase a stationary world zone via RAPID instructions.
Stationary world zones should be active from power on and should be defined in a
POWER ON event routine or a semistatic task.
Example
VAR wzstationary conveyor;
...
PROC ...
VAR shapedata volume;
...
WZBoxDef \Inside, volume, p_corner1, p_corner2;
WZLimSup \Stat, conveyor, volume;
ENDPROC
A conveyor is defined as a straight box (the volume below the belt). If the robot
reaches this volume, the movement is stopped.
Limitations
A wzstationary data can be defined as a variable (VAR) or as a persistent (PERS).
It can be global in task or local within module, but not local within a routine.
Arguments of the type wzstationary should only be entire data (not array element or
record component).
1-wzstationary-103
wzstationary
Data Types
An init value for data of the type wzstationary is not used by the control system. When
there is a need to use a persistent variable in a multi-tasking system, set the init value
to 0 in both tasks,
e.g. PERS wzstationary share_workarea := [0];
Example
For a complete example see instruction WZLimSup.
Characteristics
wzstationary is an alias data type of wztemporary and inherits its characteristics.
Related information
Described in:
World Zones
Instructions - WZLimSup
Instructions - WZDOSet
1-wzstationary-104
Data Types
wztemporary
wztemporary
wztemporary (world zone temporary) is used to identify a temporary world zone and
can be used anywhere in the RAPID program for the MAIN task.
A world zone is supervised during robot movements both during program execution
and jogging. If the robots TCP reaches this world zone, the movement is stopped or a
digital output signal is set or reset.
Description
A wztemporary world zone is defined and activated by a WZLimSup or a WZDOSet
instruction.
WZLimSup or WZDOSet gives the variable or the persistent of data type wztemporary
a numeric value. The value identifies the world zone.
Once defined and activated, a temporary world zone can be deactivated by
WZDisable, activated again by WZEnable, and erased by WZFree.
All temporary world zones in the MAIN task are automatically erased and all data
objects of type wztemporary in the MAIN task are set to 0:
- when a new program is loaded in the MAIN task
- when starting program execution from the beginning in the MAIN task
Example
VAR wztemporary roll;
...
PROC ...
VAR shapedata volume;
CONST pos t_center := [1000, 1000, 1000];
...
WZCylDef \Inside, volume, t_center, 400, 1000;
WZLimSup \Temp, roll, volume;
ENDPROC
A wztemporary variable, roll, is defined as a cylinder. If the robot reaches this
volume, the movement is stopped.
Limitations
A wztemporary data can be defined as a variable (VAR) or as a persistent (PERS).
It can be global in a task or local within a module, but not local within a routine.
1-wztemporary-105
wztemporary
Data Types
Arguments of the type wztemporary must only be entire data, not an array element or
record component.
A temporary world zone must only be defined (WZLimSup or WZDOSet) and free
(WZFree) in the MAIN task. Definitions of temporary world zones in the background
would affect the program execution in the MAIN task The instructions WZDisable and
WZEnable can be used in the background task. When there is a need to use a persistent
variable in a multi-tasking system, set the init value to 0 in both tasks,
e.g. PERS wztemporary share_workarea := [0];
Example
For a complete example see instruction WZDOSet.
Structure
<dataobject of wztemporary>
<wz of num>
Related information
Described in:
World Zones
Instructions - WZLimSup
Instructions - WZDOSet
Instructions - WZDisable
Instructions - WZEnable
Instructions - WZFree
1-wztemporary-106
Data Types
zonedata
zonedata
Zone data
Zonedata is used to specify how a position is to be terminated, i.e. how close to the
programmed position the axes must be before moving towards the next position.
Description
A position can be terminated either in the form of a stop point or a fly-by point.
A stop point means that the robot and external axes must reach the specified position
(stand still) before program execution continues with the next instruction.
A fly-by point means that the programmed position is never attained.
Instead, the direction of motion is changed before the position is reached.
Two different zones (ranges) can be defined for each position:
- The zone for the TCP path.
- The extended zone for reorientation of the tool and for external axes.
Programmed
position
Start of reorientation
towards next position
Start of TCP corner path
The extended zone
Figure 13 The zones for a fly-by point.
Zones function in the same way during joint movement, but the zone size may differ
somewhat from the one programmed.
The zone size cannot be larger than half the distance to the closest position (forwards
or backwards). If a larger zone is specified, the robot automatically reduces it.
The zone for the TCP path
A corner path (parabola) is generated as soon as the edge of the zone is reached
(see Figure 13).
1-zonedata-107
zonedata
Data Types
Figure 14a Three positions are programmed, the last with different tool orientation.
Figure 14b If all positions were stop points, program execution would look like this.
Zone size
Figure 14c If the middle position was a fly-by point, program execution would look like this
1-zonedata-108
Data Types
zonedata
90 mm
MoveL with 200 mm movements pzone_ori
of the tool, 25o reorientation of
P1 the tool and with zone z60
The relative sizes of the zone are
pzone_tcp
________________________
= 60/200 = 30%
length of movement P1 - P2
pzone_ori
________________________
= 90/200 = 45%
length of movement P1 - P2
zone_ori
________________________
= 9o/25o = 36%
angle of reorientation P1 - P2
60 mm
pzone_tcp
P2
9o
zone_ori
Figure 15 Example of reduced zone for reorientation of the tool to 36% of the motion due to
zone_ori.
90 mm
MoveL with 200 mm movements
60 mm
pzone_ori pzone_tcp
9o
of the tool, 60o reorientation of
zone_ori
the tool and with zone z60
P2
P1
The relative sizes of the zone are
pzone_tcp
________________________
= 60/200 = 30%
length of movement P1 - P2
zone_ori
________________________
= 9o/60o = 15%
angle of reorientation P1 - P2
Figure 16 Example of reduced zone for reorientation of the tool and TCP path to 15% of the
motion due to zone_ori.
When external axes are active they affect the relative sizes of the zone according to
these formulas:
pzone_eax
________________________
length of movement P1 - P2
zone_leax
________________________
length of max linear ext. axis movement P1 - P2
zone_reax
________________________
angle of max reorientation of rotating ext. axis P1 - P2
NOTE: If the TCP zone is reduced because of zone_ori, zone_leax or zone_reax the
path planner enters a mode that can handle the case of no TCP movement. If there is a
TCP movement when in this mode the speed is not compensated for the curvature of
the path in a corner zone. For instance, this will cause a 30% speed reduction in a 90
degree corner. If this is a problem, increase the limiting zone component.
1-zonedata-109
zonedata
Data Types
Components
finep
(fine point)
pzone_tcp
The zone size (the radius) for the tool reorientation. The size is defined as the distance of the TCP from the programmed point in mm.
The size must be larger than the corresponding value for pzone_tcp.
If a lower value is specified, the size is automatically increased to make it the
same as pzone_tcp.
pzone_eax
The zone size (the radius) for external axes. The size is defined as the distance of
the TCP from the programmed point in mm.
The size must be larger than the corresponding value for pzone_tcp.
If a lower value is specified, the size is automatically increased to make it the
same as pzone_tcp.
zone_ori
( zone orientation)
The zone size for the tool reorientation in degrees. If the robot is holding the work
object, this means an angle of rotation for the work object.
zone_leax
1-zonedata-110
Data Types
zonedata
Examples
VAR zonedata path := [ FALSE, 25, 40, 40, 10, 35, 5 ];
The zone data path is defined by means of the following characteristics:
- The zone size for the TCP path is 25 mm.
- The zone size for the tool reorientation is 40 mm (TCP movement).
- The zone size for external axes is 40 mm (TCP movement).
If the TCP is standing still, or there is a large reorientation, or there is a large
external axis movement, with respect to the zone, the following apply instead:
- The zone size for the tool reorientation is 10 degrees.
- The zone size for linear external axes is 35 mm.
- The zone size for rotating external axes is 5 degrees.
path.pzone_tcp := 40;
The zone size for the TCP path is adjusted to 40 mm.
1-zonedata-111
zonedata
Data Types
Predefined data
A number of zone data are already defined in the system module BASE.
Stop points
Name
fine
0 mm
Fly-by points
TCP movement
Tool reorientation
Name
TCP path Orientation Ext. axis Orientation Linear axis Rotating axis
z1
z5
z10
z15
z20
z30
z40
z50
z60
z80
z100
z150
z200
1 mm
5 mm
10 mm
15 mm
20 mm
30 mm
40 mm
50 mm
60 mm
80 mm
100 mm
150 mm
200 mm
1 mm
8 mm
15 mm
23 mm
30 mm
45 mm
60 mm
75 mm
90 mm
120 mm
150 mm
225 mm
300 mm
1 mm
8 mm
15 mm
23 mm
30 mm
45 mm
60 mm
75 mm
90 mm
120 mm
150 mm
225 mm
300 mm
0.1 o
0.8 o
1.5 o
2.3 o
3.0 o
4.5 o
6.0 o
7.5 o
9.0 o
12 o
15 o
23 o
30 o
1 mm
8 mm
15 mm
23 mm
30 mm
45 mm
60 mm
75 mm
90 mm
120 mm
150 mm
225 mm
300 mm
0.1 o
0.8 o
1.5 o
2.3 o
3.0o
4.5 o
6.0 o
7.5 o
9.0 o
12 o
15 o
23 o
30 o
Structure
< data object of zonedata >
< finep of bool >
< pzone_tcp of num >
< pzone_ori of num >
< pzone_eax of num >
< zone_ori of num >
< zone_leax of num >
< zone_reax of num >
1-zonedata-112
Data Types
zonedata
Related information
Described in:
Positioning instructions
Movements/Paths in general
1-zonedata-113
zonedata
1-zonedata-114
Data Types
Instructions
CONTENTS
:=
AccSet
ActUnit
Add
AliasIO
Break
ProcCall
CallByVar
Clear
ClearIOBuff
ClkReset
ClkStart
ClkStop
Close
comment
ConfJ
ConfL
CONNECT
DeactUnit
Decr
EOffsOff
EOffsOn
EOffsSet
ErrWrite
EXIT
ExitCycle
FOR
GetSysData
GOTO
GripLoad
IDelete
Assigns a value
Reduces the acceleration
Activates a mechanical unit
Adds a numeric value
Define I/O signal with alias name
Break program execution
Calls a new procedure
Call a procedure by a variable
Clears the value
Clear input buffer of a serial channel
Resets a clock used for timing
Starts a clock used for timing
Stops a clock used for timing
Closes a file or serial channel
Comment
Controls the configuration during joint movement
Monitors the configuration during linear movement
Connects an interrupt to a trap routine
Deactivates a mechanical unit
Decrements by 1
Deactivates an offset for external axes
Activates an offset for external axes
Activates an offset for external axes using a value
Write an Error Message
Terminates program execution
Break current cycle and start next
Repeats a given number of times
Get system data
Goes to a new instruction
Defines the payload of the robot
Cancels an interrupt
IDisable
IEnable
Compact IF
IF
Incr
Disables interrupts
Enables interrupts
If a condition is met, then... (one instruction)
If a condition is met, then ...; otherwise ...
Increments by 1
2-115
Instructions
InvertDO
IODisable
IOEnable
ISignalAI
ISignalAO
ISignalDI
ISignalDO
ISleep
ITimer
IVarValue
IWatch
label
Load
MechUnitLoad
MoveAbsJ
MoveC
MoveJ
MoveL
MoveCDO
MoveJDO
MoveLDO
MoveCSync
MoveJSync
MoveL Sync
Open
PathResol
PDispOff
PDispOn
PDispSet
PulseDO
RAISE
2-116
Instructions
ReadAnyBin
SingArea
SpyStart
SpyStop
SoftAct
SoftDeact
StartLoad
StartMove
Stop
StopMove
StorePath
TEST
TestSign
TPErase
TPReadFK
TPReadNum
TPShow
TPWrite
TriggC
TriggEquip
TriggInt
TriggIO
TriggJ
Reset
RestoPath
RETRY
RETURN
Rewind
Save
SearchC
SearchL
Set
SetAO
SetDO
SetGO
2-117
Instructions
TriggL
TRYNEXT
TuneReset
TuneServo
UnLoad
WaitDI
WaitDO
WaitLoad
VelSet
WHILE
Write
WriteAnyBin
WriteBin
WriteStrBin
WaitTime
WaitUntil
WZBoxDef
WZCylDef
WZDisable
WZDOSet
WZEnable
WZFree
WZLimSup
WZSphDef
2-118
Instructions
:=
:=
Assigns a value
The := instruction is used to assign a new value to data. This value can be anything
from a constant value to an arithmetic expression, e.g. reg1+5*reg3.
Examples
reg1 := 5;
reg1 is assigned the value 5.
reg1 := reg2 - reg3;
reg1 is assigned the value that the reg2-reg3 calculation returns.
counter := counter + 1;
counter is incremented by one.
Arguments
Data := Value
Data
Value
Examples
tool1.tframe.trans.x := tool1.tframe.trans.x + 20;
The TCP for tool1 is shifted 20 mm in the X-direction.
pallet{5,8} := Abs(value);
An element in the pallet matrix is assigned a value equal to the absolute value of
the value variable.
2-:=-119
:=
Instructions
Limitations
The data (whose value is to be changed) must not be
- a constant
- a non-value data type.
The data and value must have similar (the same or alias) data types.
Syntax
(EBNF)
<assignment target> := <expression> ;
<assignment target> ::=
<variable>
| <persistent>
| <parameter>
| <VAR>
Related information
Described in:
2-:=-120
Expressions
Instructions
AccSet
AccSet
Examples
AccSet 50, 100;
The acceleration is limited to 50% of the normal value.
AccSet 100, 50;
The acceleration ramp is limited to 50% of the normal value.
Arguments
AccSet
Acc Ramp
Acc
Ramp
Time
AccSet 100, 100, i.e. normal acceleration
Acceleration
Acceleration
Time
AccSet 30, 100
Time
AccSet 100, 30
2-AccSet-121
AccSet
Instructions
Program execution
The acceleration applies to both the robot and external axes until a new AccSet instruction is executed.
The default values (100%) are automatically set
- at a cold start-up
- when a new program is loaded
- when starting program executing from the beginning.
Syntax
AccSet
[ Acc := ] < expression (IN) of num > ,
[ Ramp := ] < expression (IN) of num > ;
Related information
Described in:
Positioning instructions
2-AccSet-122
Instructions
ActUnit
ActUnit
Example
ActUnit orbit_a;
Activation of the orbit_a mechanical unit.
Arguments
ActUnit MecUnit
MecUnit
(Mechanical Unit)
Program execution
When the robot and external axes have come to a standstill, the specified mechanical
unit is activated. This means that it is controlled and monitored by the robot.
If several mechanical units share a common drive unit, activation of one of these
mechanical units will also connect that unit to the common drive unit.
Limitations
Instruction ActUnit cannot be used in
- program sequence StorePath ... RestoPath
- event routine RESTART
The movement instruction previous to this instruction, should be terminated with a
stop point in order to make a restart in this instruction possible following a power failure.
2-ActUnit-123
ActUnit
Instructions
Syntax
ActUnit
[MecUnit := ] < variable (VAR) of mecunit> ;
Related information
Described in:
Deactivating mechanical units
Instructions - DeactUnit
Mechanical units
More examples
Instructions - DeactUnit
2-ActUnit-124
Instructions
Add
Add
Examples
Add reg1, 3;
3 is added to reg1, i.e. reg1:=reg1+3.
Add reg1, -reg2;
The value of reg2 is subtracted from reg1, i.e. reg1:=reg1-reg2.
Arguments
Add
Name AddValue
Name
Syntax
Add
[ Name := ] < var or pers (INOUT) of num > ,
[ AddValue := ] < expression (IN) of num > ;
Related information
Described in:
Incrementing a variable by 1
Instructions - Incr
Decrementing a variable by 1
Instructions - Decr
Instructions - :=
2-Add-125
Add
2-Add-126
Instructions
Instructions
AliasIO
AliasIO
Example 1
VAR signaldo alias_do;
PROC prog_start()
AliasIO config_do, alias_do;
ENDPROC
The routine prog_start is connected to the START event in system parameters.
The program defined digital output signal alias_do is connected to the configured digital output signal config_do at program start (start the program from
beginning).
Arguments
AliasIO FromSignal ToSignal
FromSignal
Loaded modules:
The signal identifier named according to the configuration (data type signalxx)
from which the signal descriptor is copied. The signal must be defined in the IO
configuration.
Built-in modules:
A reference (CONST, VAR, PERS or parameter of these) containing the name of
the signal (data type string) from which the signal descriptor after search in the
system is copied. The signal must be defined in the IO configuration.
2-AliasIO-127
AliasIO
Instructions
ToSignal
The signal identifier according to the program (data type signalxx) to which the
signal descriptor is copied. The signal must be declared in the RAPID program.
The same data type must be used (or find) for the arguments FromSignal and ToSignal
and must be one of type signalxx (signalai, signalao, signaldi, signaldo, signalgi or signalgo).
Program execution
The signal descriptor value is copied from the signal given in argument FromSignal to
the signal given in argument ToSignal.
Example 2
VAR signaldi alias_di;
PROC prog_start()
CONST string config_string := "config_di";
AliasIO config_string, alias_di;
ENDPROC
The routine prog_start is connected to the START event in system parameters.
The program defined digital output signal alias_di is connected to the configured
digital output signal config_di (via constant config_string) at program start (start
the program from the beginning).
Limitation
When starting the program, the alias signal cannot be used until the AliasIO instruction
is executed.
Instruction AliasIO must be placed
- either in the event routine executed at program start (event START)
- or in the program part executed after every program start (before use of the
signal)
Instruction AliasIO is not available for programming from the Teach Pendant (only
from Program Maker). Option Developers Functions is required.
2-AliasIO-128
Instructions
AliasIO
Syntax
AliasIO
[ FromSignal := ] < reference (REF) of anytype> ,
[ ToSignal := ] < variable (VAR) of anytype> ;
Related information
Described in:
Input/Output instructions
Configuration of I/O
2-AliasIO-129
AliasIO
2-AliasIO-130
Instructions
Instructions
Break
Break
Example
..
Break;
...
Program execution stops and it is possible to analyse variables, values etc. for
debugging purposes.
Program execution
The instruction stops program execution at once, without waiting for the robot and
external axes to reach their programmed destination points for the movement being
performed at the time. Program execution can then be restarted from the next
instruction.
If there is a Break instruction in some event routine, the routine will be executed from
the beginning of the next event.
Syntax
Break;
Related information
Described in:
Stopping for program actions
Instructions - Stop
Instructions - EXIT
Instructions - EXIT
Instructions - StopMove
2-Break-131
Break
2-Break-132
Instructions
Instructions
ProcCall
ProcCall
A procedure call is used to transfer program execution to another procedure. When the
procedure has been fully executed, program execution continues with the instruction
following the procedure call.
It is usually possible to send a number of arguments to the new procedure. These
control the behaviour of the procedure and make it possible for the same procedure to
be used for different things.
Examples
weldpipe1;
Calls the weldpipe1 procedure.
errormessage;
Set do1;
.
PROC errormessage()
TPWrite "ERROR";
ENDPROC
The errormessage procedure is called. When this procedure is ready, program
execution returns to the instruction following the procedure call, Set do1.
Arguments
Procedure
{ Argument }
Procedure
Identifier
The procedure arguments (in accordance with the parameters of the procedure).
Example
weldpipe2 10, lowspeed;
Calls the weldpipe2 procedure, including two arguments.
2-ProcCall-133
ProcCall
Instructions
weldpipe3 10 \speed:=20;
Calls the weldpipe3 procedure, including one mandatory and one optional
argument.
Limitations
The procedures arguments must agree with its parameters:
- All mandatory arguments must be included.
- They must be placed in the same order.
- They must be of the same data type.
- They must be of the correct type with respect to the access-mode (input, variable
or persistent).
A routine can call a routine which, in turn, calls another routine, etc. A routine can also
call itself, i.e. a recursive call. The number of routine levels permitted depends on the
number of parameters, but more than 10 levels are usually permitted.
Syntax
(EBNF)
<procedure> [ <argument list> ] ;
<procedure> ::= <identifier>
Related information
Described in:
Arguments, parameters
More examples
Program Examples
2-ProcCall-134
Instructions
CallByVar
CallByVar
CallByVar (Call By Variable) can be used to call procedures with specific names, e.g.
proc_name1, proc_name2, proc_name3 ... proc_namex via a variable.
Example
reg1 := 2;
CallByVar proc, reg1;
The procedure proc2 is called.
Arguments
CallByVar Name Number
Name
The numeric value for the number of the procedure. This value will be converted
to a string and gives the 2:nd part of the procedure name e.g. 1. The value must
be a positive integer.
Example
Static selection of procedure call
TEST reg1
CASE 1:
lf_door door_loc;
CASE 2:
rf_door door_loc;
CASE 3:
lr_door door_loc;
CASE 4:
rr_door door_loc;
DEFAULT:
EXIT;
ENDTEST
Depending on whether the value of register reg1 is 1, 2, 3 or 4, different
procedures are called that perform the appropriate type of work for the selected
door.
2-CallByVar-135
CallByVar
Instructions
The door location in argument door_loc.
Limitations
Can only be used to call procedures without parameters.
Execution of CallByVar takes a little more time than execution of a normal procedure
call.
Error handling
In the event of a reference to an unknown procedure, the system variable ERRNO is set
to ERR_REFUNKPRC.
In the event of the procedure call error (not procedure), the system variable ERRNO is
set to ERR_CALLPROC.
These errors can be handled in the error handler.
Syntax
CallByVar
[Name :=] <expression (IN) of string>,
[Number :=] <expression (IN) of num>;
2-CallByVar-136
Instructions
CallByVar
Related information
Described in:
Calling procedures
2-CallByVar-137
CallByVar
2-CallByVar-138
Instructions
Instructions
Clear
Clear
Example
Clear reg1;
Reg1 is cleared, i.e. reg1:=0.
Arguments
Clear
Name
Name
Syntax
Clear
[ Name := ] < var or pers (INOUT) of num > ;
Related information
Described in:
Incrementing a variable by 1
Instructions - Incr
Decrementing a variable by 1
Instructions - Decr
2-Clear-139
Clear
2-Clear-140
Instructions
Instructions
ClkReset
ClkReset
ClkReset is used to reset a clock that functions as a stop-watch used for timing.
This instruction can be used before using a clock to make sure that it is set to 0.
Example
ClkReset clock1;
The clock clock1 is reset.
Arguments
ClkReset
Clock
Clock
Program execution
When a clock is reset, it is set to 0.
If a clock is running, it will be stopped and then reset.
Syntax
ClkReset
[ Clock := ] < variable (VAR) of clock > ;
Related Information
Described in:
Other clock instructions
2-ClkReset-141
ClkReset
2-ClkReset-142
Instructions
Instructions
ClkStart
ClkStart
ClkStart is used to start a clock that functions as a stop-watch used for timing.
Example
ClkStart clock1;
The clock clock1 is started.
Arguments
ClkStart
Clock
Clock
Program execution
When a clock is started, it will run and continue counting seconds until it is stopped.
A clock continues to run when the program that started it is stopped. However, the
event that you intended to time may no longer be valid. For example, if the program
was measuring the waiting time for an input, the input may have been received while
the program was stopped. In this case, the program will not be able to see the event
that occurred while the program was stopped.
A clock continues to run when the robot is powered down as long as the battery backup retains the program that contains the clock variable.
If a clock is running it can be read, stopped or reset.
Example
VAR clock clock2;
ClkReset clock2;
ClkStart clock2;
WaitUntil DInput(di1) = 1;
ClkStop clock2;
time:=ClkRead(clock2);
The waiting time for di1 to become 1 is measured.
2-ClkStart-143
ClkStart
Instructions
Syntax
ClkStart
[ Clock := ] < variable (VAR) of clock > ;
Related Information
Described in:
Other clock instructions
2-ClkStart-144
Instructions
ClkStop
ClkStop
ClkStop is used to stop a clock that functions as a stop-watch used for timing.
Example
ClkStop clock1;
The clock clock1 is stopped.
Arguments
ClkStop
Clock
Clock
Program execution
When a clock is stopped, it will stop running.
If a clock is stopped, it can be read, started again or reset.
Syntax
ClkStop
[ Clock := ] < variable (VAR) of clock > ;
Related Information
Described in:
Other clock instructions
More examples
Instructions - ClkStart
2-ClkStop-145
ClkStop
2-ClkStop-146
Instructions
Instructions
Close
Close
Example
Close channel2;
The serial channel referred to by channel2 is closed.
Arguments
Close
IODevice
IODevice
Program execution
The specified file or serial channel is closed and must be re-opened before reading or
writing. If it is already closed, the instruction is ignored.
Syntax
Close
[IODevice :=] <variable (VAR) of iodev>;
Related information
Described in:
Opening a file or serial channel
2-Close-147
Close
2-Close-148
Instructions
Instructions
ClearIOBuff
ClearIOBuff
ClearIOBuff (Clear I/O Buffer) is used to clear the input buffer of a serial channel. All
buffered characters from the input serial channel are discarded.
Example
VAR iodev channel2;
...
Open "sio1:", channel2 \Bin;
ClearIOBuff channel2;
The input buffer for the serial channel referred to by channel2 is cleared.
Arguments
ClearIOBuff
IODevice
IODevice
The name (reference) of the serial channel whose input buffer is to be cleared.
Program execution
All buffered characters from the input serial channel are discarded. Next read instructions will wait for new input from the channel.
Limitations
This instruction can only be used for serial channels.
Syntax
ClearIOBuff
[IODevice :=] <variable (VAR) of iodev>;
2-ClearIOBuff-149
ClearIOBuff
Instructions
Related information
Described in:
Opening a serial channel
2-ClearIOBuff-150
Instructions
comment
comment
Comment
Comment is only used to make the program easier to understand. It has no effect on the
execution of the program.
Example
! Goto the position above pallet
MoveL p100, v500, z20, tool1;
A comment is inserted into the program to make it easier to understand.
Arguments
! Comment
Comment
Text string
Any text.
Program execution
Nothing happens when you execute this instruction.
Syntax
(EBNF)
! {<character>} <newline>
Related information
Described in:
Characters permitted in a comment
2-comment-151
comment
2-comment-152
Instructions
Instructions
ConfJ
ConfJ
Examples
ConfJ \Off;
MoveJ *, v1000, fine, tool1;
The robot moves to the programmed position and orientation. If this position can
be reached in several different ways, with different axis configurations, the closest possible position is chosen.
ConfJ \On;
MoveJ *, v1000, fine, tool1;
The robot moves to the programmed position, orientation and axis configuration.
If this is not possible, program execution stops.
Arguments
ConfJ
[\On] | [\Off]
\On
\Off
2-ConfJ-153
ConfJ
Instructions
Program execution
If the argument \On (or no argument) is chosen, the robot always moves to the programmed axis configuration. If this is not possible using the programmed position and
orientation, program execution stops before the movement starts.
If the argument \Off is chosen, the robot always moves to the closest axis configuration.
This may be different to the programmed one if the configuration has been incorrectly
specified manually, or if a program displacement has been carried out.
The control is active by default. This is automatically set
- at a cold start-up
- when a new program is loaded
- when starting program executing from the beginning.
Syntax
ConfJ
[ \ On] | [ \ Off] ;
Related information
Described in:
Handling different configurations
2-ConfJ-154
Instructions
ConfL
ConfL
Examples
ConfL \On;
MoveL *, v1000, fine, tool1;
Program execution stops when the programmed configuration is not possible to
reach from the current position.
SingArea \Wrist;
Confl \On;
MoveL *, v1000, fine, tool1;
The robot moves to the programmed position, orientation and wrist axis configuration. If this is not possible, program execution stops.
ConfL \Off;
MoveL *, v1000, fine, tool1;
No error message is displayed when the programmed configuration is not the
same as the configuration achieved by program execution.
Arguments
ConfL
[\On] | [\Off]
\On
\Off
2-ConfL-155
ConfL
Instructions
Program execution
During linear or circular movement, the robot always moves to the programmed position and orientation that has the closest possible axis configuration. If the argument \On
(or no argument) is chosen, then the program execution stops as soon as:
- the configuration of the programmed position will not be attained from the
current position.
- the needed reorientation of any one of the wrist axes to get to the programmed
position from the current position exceeds a limit (140-180 degrees).
However, it is possible to restart the program again, although the wrist axes may continue to the wrong configuration. At a stop point, the robot will check that the configurations of all axes are achieved, not only the wrist axes.
If SingArea\Wrist is also used, the robot always moves to the programmed wrist axes
configuration and at a stop point the remaining axes configurations will be checked.
If the argument \Off is chosen, there is no monitoring.
Monitoring is active by default. This is automatically set
- at a cold start-up
- when a new program is loaded
- when starting program executing from the beginning.
Syntax
ConfL
[ \ On] | [ \ Off] ;
Related information
Described in:
Handling different configurations
Instructions - ConfJ
2-ConfL-156
Instructions
CONNECT
CONNECT
CONNECT is used to find the identity of an interrupt and connect it to a trap routine.
The interrupt is defined by ordering an interrupt event and specifying its identity. Thus,
when that event occurs, the trap routine is automatically executed.
Example
VAR intnum feeder_low;
CONNECT feeder_low WITH feeder_empty;
ISignalDI di1, 1 , feeder_low;
An interrupt identity feeder_low is created which is connected to the trap routine
feeder_empty. The interrupt is defined as input di1 is getting high. In other
words, when this signal becomes high, the feeder_empty trap routine is executed.
Arguments
CONNECT Interrupt WITH Trap routine
Interrupt
Identifier
Program execution
The variable is assigned an interrupt identity which can then be used when ordering or
disabling interrupts. This identity is also connected to the specified trap routine.
Note that before an event can be handled, an interrupt must also be ordered, i.e. the
event specified.
Limitations
An interrupt (interrupt identity) cannot be connected to more than one trap routine.
Different interrupts, however, can be connected to the same trap routine.
When an interrupt has been connected to a trap routine, it cannot be reconnected or
transferred to another routine; it must first be deleted using the instruction IDelete.
System Data Types and Routines
2-CONNECT-157
CONNECT
Instructions
Error handling
If the interrupt variable is already connected to a TRAP routine, the system variable
ERRNO is set to ERR_ALRDYCNT.
If the interrupt variable is not a variable reference, the system variable ERRNO is set
to ERR_CNTNOTVAR.
If no more interrupt numbers are available, the system variable ERRNO is set to
ERR_INOMAX.
These errors can be handled in the ERROR handler.
Syntax
(EBNF)
CONNECT <connect target> WITH <trap>;
<connect target> ::= <variable>
| <parameter>
| <VAR>
<trap> ::= <identifier>
Related information
Described in:
Summary of interrupts
2-CONNECT-158
Instructions
DeactUnit
DeactUnit
Examples
DeactUnit orbit_a;
Deactivation of the orbit_a mechanical unit.
MoveL p10, v100, fine, tool1;
DeactUnit track_motion;
MoveL p20, v100, z10, tool1;
MoveL p30, v100, fine, tool1;
ActUnit track_motion;
MoveL p40, v100, z10, tool1;
The unit track_motion will be stationary when the robot moves to p20 and p30.
After this, both the robot and track_motion will move to p40.
MoveL p10, v100, fine, tool1;
DeactUnit orbit1;
ActUnit orbit2;
MoveL p20, v100, z10, tool1;
The unit orbit1 is deactivated and orbit2 activated.
Arguments
DeactUnit MecUnit
MecUnit
(Mechanical Unit)
Program execution
When the robot and external axes have come to a standstill, the specified mechanical
unit is deactivated. This means that it will neither be controlled nor monitored until it
is re-activated.
If several mechanical units share a common drive unit, deactivation of one of the
mechanical units will also disconnect that unit from the common drive unit.
2-DeactUnit-159
DeactUnit
Instructions
Limitations
Instruction DeactUnit cannot be used
- in program sequence StorePath ... RestoPath
- in event routine RESTART
- when one of the axes in the mechanical unit is in independent mode.
The movement instruction previous to this instruction, should be terminated with a stop
point in order to make a restart in this instruction possible following a power failure.
Syntax
DeactUnit
[MecUnit := ] < variable (VAR) of mecunit> ;
Related information
Described in:
Activating mechanical units
Instructions - ActUnit
Mechanical units
2-DeactUnit-160
Instructions
Decr
Decr
Decrements by 1
Decr is used to subtract 1 from a numeric variable or persistent.
Example
Decr reg1;
1 is subtracted from reg1, i.e. reg1:=reg1-1.
Arguments
Decr
Name
Name
Example
TPReadNum no_of_parts, "How many parts should be produced? ";
WHILE no_of_parts>0 DO
produce_part;
Decr no_of_parts;
ENDWHILE
The operator is asked to input the number of parts to be produced. The variable
no_of_parts is used to count the number that still have to be produced.
Syntax
Decr
[ Name := ] < var or pers (INOUT) of num > ;
2-Decr-161
Decr
Instructions
Related information
Described in:
2-Decr-162
Incrementing a variable by 1
Instructions - Incr
Instructions - Add
Instructions - :=
Instructions
EOffsOff
EOffsOff
EOffsOff (External Offset Off) is used to deactivate an offset for external axes.
The offset for external axes is activated by the instruction EOffsSet or EOffsOn and
applies to all movements until some other offset for external axes is activated or until
the offset for external axes is deactivated.
Examples
EOffsOff;
Deactivation of the offset for external axes.
MoveL p10, v500, z10, tool1;
EOffsOn \ExeP:=p10, p11;
MoveL p20, v500, z10, tool1;
MoveL p30, v500, z10, tool1;
EOffsOff;
MoveL p40, v500, z10, tool1;
An offset is defined as the difference between the position of each axis at p10 and
p11. This displacement affects the movement to p20 and p30, but not to p40.
Program execution
Active offsets for external axes are reset.
Syntax
EOffsOff ;
Related information
Described in:
Definition of offset using two positions
Instructions - EOffsOn
Instructions - EOffsSet
2-EOffsOff-163
EOffsOff
2-EOffsOff-164
Instructions
Instructions
EOffsOn
EOffsOn
EOffsOn (External Offset On) is used to define and activate an offset for external axes
using two positions.
Examples
MoveL p10, v500, z10, tool1;
EOffsOn \ExeP:=p10, p20;
Activation of an offset for external axes. This is calculated for each axis based
on the difference between positions p10 and p20.
MoveL p10, v500, fine, tool1;
EOffsOn *;
Activation of an offset for external axes. Since a stop point has been used in the
previous instruction, the argument \ExeP does not have to be used. The displacement is calculated on the basis of the difference between the actual position of
each axis and the programmed point (*) stored in the instruction.
Arguments
EOffsOn [ \ExeP ] ProgPoint
[\ExeP ]
(Executed Point)
The new position of the axes at the time of the program execution. If this argument
is omitted, the current position of the axes at the time of the program execution is
used.
ProgPoint
(Programmed Point)
2-EOffsOn-165
EOffsOn
Instructions
Program execution
The offset is calculated as the difference between ExeP and ProgPoint for each separate
external axis. If ExeP has not been specified, the current position of the axes at the time
of the program execution is used instead. Since it is the actual position of the axes that
is used, the axes should not move when EOffsOn is executed.
This offset is then used to displace the position of external axes in subsequent positioning instructions and remains active until some other offset is activated (the instruction
EOffsSet or EOffsOn) or until the offset for external axes is deactivated (the instruction
EOffsOff).
Only one offset for each individual external axis can be activated at any one time. Several EOffsOn, on the other hand, can be programmed one after the other and, if they are,
the different offsets will be added.
The external axes offset is automatically reset
- at a cold start-up
- when a new program is loaded
- when starting program executing from the beginning.
Example
SearchL sen1, psearch, p10, v100, tool1;
PDispOn \ExeP:=psearch, *, tool1;
EOffsOn \ExeP:=psearch, *;
A search is carried out in which the searched position of both the robot and the
external axes is stored in the position psearch. Any movement carried out after
this starts from this position using a program displacement of both the robot and
the external axes. This is calculated based on the difference between the searched
position and the programmed point (*) stored in the instruction.
Syntax
EOffsOn
[ \ ExeP := < expression (IN) of robtarget > ,]
[ ProgPoint := ] < expression (IN) of robtarget > ;
2-EOffsOn-166
Instructions
EOffsOn
Related information
Described in:
Deactivation of offset for external axes
Instructions - EOffsOff
Instructions - EOffsSet
Instructions - PDispOn
Coordinate Systems
tems
2-EOffsOn-167
EOffsOn
2-EOffsOn-168
Instructions
Instructions
EOffsSet
Example
VAR extjoint eax_a_p100 := [100, 0, 0, 0, 0, 0];
.
EOffsSet eax_a_p100;
Activation of an offset eax_a_p100 for external axes, meaning (provided that the
external axis a is linear) that:
- The ExtOffs coordinate system is displaced 100 mm for the logical axis a (see
Figure 18).
- As long as this offset is active, all positions will be displaced 100 mm in the
direction of the x-axis.
.
100
Normal
Coordinate System
0
+X
ExtOffs
Coordinate System
0
+X
Arguments
EOffsSet EAxOffs
EAxOffs
The offset for external axes is defined as data of the type extjoint, expressed in:
- mm for linear axes
- degrees for rotating axes
2-EOffsSet-169
EOffsSet
Instructions
Program execution
The offset for external axes is activated when the EOffsSet instruction is activated and
remains active until some other offset is activated (the instruction EOffsSet or EOffsOn)
or until the offset for external axes is deactivated (the EOffsOff).
Only one offset for external axes can be activated at any one time. Offsets cannot be
added to one another using EOffsSet.
The external axes offset is automatically reset
- at a cold start-up
- when a new program is loaded
- when starting program executing from the beginning.
Syntax
EOffsSet
[ EAxOffs := ] < expression (IN) of extjoint> ;
Related information
Described in:
Deactivation of offset for external axes
Instructions - EOffsOff
Instructions - EOffsSet
Instructions - PDispOn
Coordinate Systems
2-EOffsSet-170
Instructions
ErrWrite
ErrWrite
ErrWrite (Error Write) is used to display an error message on the teach pendant and
write it in the robot message log.
Example
ErrWrite PLC error, Fatal error in PLC \RL2:=Call service;
Stop;
A message is stored in the robot log. The message is also shown on the teach
pendant display.
ErrWrite \ W, Search error, No hit for the first search;
RAISE try_search_again;
A message is stored in the robot log only. Program execution then continues.
Arguments
ErrWrite [ \W ] Header Reason [ \RL2] [ \RL3] [ \RL4]
[ \W ]
(Warning)
Gives a warning that is stored in the robot error message log only (not shown
directly on the teach pendant display).
Header
(Reason Line 2)
(Reason Line 3)
(Reason Line 4)
2-ErrWrite-171
ErrWrite
Instructions
Program execution
An error message (max. 5 lines) is displayed on the teach pendant and written in the
robot message log.
ErrWrite always generates the program error no. 80001 or in the event of a warning
(argument \W) generates no. 80002.
Limitations
Total string length (Header+Reason+\RL2+\RL3+\RL4) is limited to 145 characters.
Syntax
ErrWrite
[ \ W , ]
[ Header := ] < expression (IN) of string> ,
[ Reason := ] < expression (IN) of string>
[ \ RL2 := < expression (IN) of string> ]
[ \ RL3 := < expression (IN) of string> ]
[ \ RL4 := < expression (IN) of string> ] ;
Related information
Described in:
Display a message on
the teach pendant only
Instructions - TPWrite
Message logs
Service
2-ErrWrite-172
Instructions
EXIT
EXIT
Example
ErrWrite "Fatal error","Illegal state";
EXIT;
Program execution stops and cannot be restarted from that position in the
program.
Syntax
EXIT ;
Related information
Described in:
Stopping program execution temporarily
Instructions - Stop
2-EXIT-173
EXIT
2-EXIT-174
Instructions
Instructions
ExitCycle
ExitCycle
ExitCycle is used to break the current cycle and move the PP back to the first
instruction in the main routine.
If the program is executed in continuous mode, it will start to execute the next cycle.
If the execution is in cycle mode, the execution will stop at the first instruction in the
main routine.
Example
VAR num cyclecount:=0;
VAR intnum error_intno;
PROC main()
IF cyclecount = 0 THEN
CONNECT error_intno WITH error_trap;
ISignalDI di_error,1,error_intno;
ENDIF
cyclecount:=cyclecount+1;
! start to do something intelligent
....
ENDPROC
TRAP error_trap
TPWrite ERROR, I will start on the next item;
ExitCycle;
ENDTRAP
This will start the next cycle if the signal di_error is set.
Program execution
Execution of ExitCycle in the MAIN program task, results in the following in the
MAIN task:
- On-going robot movements stops
- All robot paths that are not performed at all path levels (both normal and
StorePath level) are cleared
- All instructions that are started but not finished at all execution levels (both
normal and TRAP level) are interrupted
- The program pointer is moved to the first instruction in the main routine
- The program execution continues to execute the next cycle
2-ExitCycle-175
ExitCycle
Instructions
Execution of ExitCycle in some other program task (besides MAIN) results in the
following in the actual task:
- All instructions that are started but not finished on all execution levels (both
normal and TRAP level) are interrupted
- The program pointer is moved to the first instruction in the main routine
- The program execution continues to execute the next cycle
All other modal things in the program and system are not affected by ExitCycle such as:
- The actual value of variables or persistents
- Any motion settings such as StorePath-RestoPath sequence, world zones, etc.
- Open files, directories, etc.
- Defined interrupts, etc.
Syntax
ExitCycle;
Related information
Described in:
Stopping after a fatal error
Instructions - EXIT
Instructions - EXIT
Instructions - Stop
Instructions - RETURN
2-ExitCycle-176
Instructions
FOR
FOR
Example
FOR i FROM 1 TO 10 DO
routine1;
ENDFOR
Repeats the routine1 procedure 10 times.
Arguments
FOR Loop counter FROM Start value TO End value
[STEP Step value] DO ... ENDFOR
Loop counter
Identifier
The name of the data that will contain the value of the current loop counter.
The data is declared automatically and its name should therefore not be the same
as the name of any data that exists already.
Start value
The value by which the loop counter is to be incremented (or decremented) each loop.
(usually integer values)
If this value is not specified, the step value will automatically be set to 1 (or -1 if
the start value is greater than the end value).
2-FOR-177
FOR
Instructions
Example
FOR i FROM 10 TO 2 STEP -1 DO
a{i} := a{i-1};
ENDFOR
The values in an array are adjusted upwards so that a{10}:=a{9}, a{9}:=a{8} etc.
Program execution
1. The expressions for the start, end and step values are calculated.
2. The loop counter is assigned the start value.
3. The value of the loop counter is checked to see whether its value lies between the
start and end value, or whether it is equal to the start or end value. If the value of the
loop counter is outside of this range, the FOR loop stops and program execution continues with the instruction following ENDFOR.
4. The instructions in the FOR loop are executed.
5. The loop counter is incremented (or decremented) in accordance with the step value.
6. The FOR loop is repeated, starting from point 3.
Limitations
The loop counter (of data type num) can only be accessed from within the FOR loop
and consequently hides other data and routines that have the same name. It can only be
read (not updated) by the instructions in the FOR loop.
Decimal values for start, end or stop values, in combination with exact termination conditions for the FOR loop, cannot be used (undefined whether or not the last loop is running).
Syntax
(EBNF)
FOR <loop variable> FROM <expression> TO <expression>
[ STEP <expression> ] DO
<instruction list>
ENDFOR
<loop variable> ::= <identifier>
2-FOR-178
Instructions
FOR
Related information
Described in:
Expressions
Identifiers
2-FOR-179
FOR
2-FOR-180
Instructions
Instructions
GetSysData
GetSysData
GetSysData fetches the value and optional symbol name for the current system data of
specified data type.
With this instruction it is possible to fetch data for and the name of the current active
Tool or Work Object.
Example
PERS tooldata curtoolvalue := [TRUE, [[0, 0, 0], [1, 0, 0, 0]],
[0, [0, 0, 0], [1, 0, 0, 0], 0, 0, 0]];
VAR string curtoolname;
GetSysData curtoolvalue;
Copy current active tool data value to the persistent variable curtoolvalue.
GetSysData curtoolvalue \ObjectName := curtoolname;
Copy also current active tool name to the variable curtoolname.
Arguments
GetSysData
DestObject [\ ObjectName ]
DestObject
Option argument (variable or persistent) to also fetch the current active system
data name.
2-GetSysData-181
GetSysData
Instructions
Program execution
When running the instruction GetSysData the current data value is stored in the specified persistent in argument DestObject.
If argument \ObjectName is used, the name of the current data is stored in the specified
variable or persistent in argument ObjectName.
Current system data for Tool or Work Object is activated by execution of any move
instruction or can be manually set in the jogging window.
Syntax
GetSysData
[ DestObject:=] < persistent(PERS) of anytype>
[\ObjectName:= < expression (INOUT) of string> ] ;
Related information
Described in:
Definition of tools
2-GetSysData-182
Instructions
GOTO
GOTO
Examples
GOTO next;
.
next:
Program execution continues with the instruction following next.
reg1 := 1;
next:
.
reg1 := reg1 + 1;
IF reg1<=5 GOTO next;
The next program loop is executed five times.
IF reg1>100 GOTO highvalue;
lowvalue:
.
GOTO ready;
highvalue:
.
ready:
If reg1 is greater than 100, the highvalue program loop is executed; otherwise
the lowvalue loop is executed.
Arguments
GOTO
Label
Label
Identifier
2-GOTO-183
GOTO
Instructions
Limitations
It is only possible to transfer program execution to a label within the same routine.
It is only possible to transfer program execution to a label within an IF or TEST instruction if the GOTO instruction is also located within the same branch of that instruction.
It is only possible to transfer program execution to a label within a FOR or WHILE
instruction if the GOTO instruction is also located within that instruction.
Syntax
(EBNF)
GOTO <identifier>;
Related information
Described in:
Label
Instructions - label
2-GOTO-184
Instructions
GripLoad
GripLoad
GripLoad is used to define the payload which the robot holds in its gripper.
Description
It is important to always define the actual tool load and when used, the payload
of the robot too. Incorrect definitions of load data can result in overloading of the
robot mechanical structure.
When incorrect load data is specified, it can often lead to the following consequences:
- If the value in the specified load data is greater than that of the value of the true
load;
-> The robot will not be used to its maximum capacity
-> Impaired path accuracy including a risk of overshooting
If the value in the specified load data is less than the value of the true load;
-> Impaired path accuracy including a risk of overshooting
-> Risk of overloading the mechanical structure
Examples
GripLoad piece1;
The robot gripper holds a load called piece1.
GripLoad load0;
The robot gripper releases all loads.
Arguments
GripLoad
Load
Load
2-GripLoad-185
GripLoad
Instructions
Program execution
The specified load affects the performance of the robot.
The default load, 0 kg, is automatically set
- at a cold start-up
- when a new program is loaded
- when starting program executing from the beginning.
Syntax
GripLoad
[ Load := ] < persistent (PERS) of loaddata > ;
Related information
Described in:
Definition of load data
2-GripLoad-186
Instructions
IDelete
IDelete
Cancels an interrupt
IDelete (Interrupt Delete) is used to cancel (delete) an interrupt.
If the interrupt is to be only temporarily disabled, the instruction ISleep or IDisable
should be used.
Example
IDelete feeder_low;
The interrupt feeder_low is cancelled.
Arguments
IDelete
Interrupt
Interrupt
Program execution
The definition of the interrupt is completely erased. To define it again, it must first be
re-connected to the trap routine.
The instruction should be preceded by a stop point. Otherwise the interrupt will be
deactivated before the end point is reached.
Interrupts do not have to be erased; this is done automatically when
- a new program is loaded
- the program is restarted from the beginning
- the program pointer is moved to the start of a routine
Syntax
IDelete
[ Interrupt := ] < variable (VAR) of intnum > ;
2-IDelete-187
IDelete
Instructions
Related information
Described in:
Summary of interrupts
Instructions - ISleep
Instructions - IDisable
2-IDelete-188
Instructions
IDisable
IDisable
Disables interrupts
IDisable (Interrupt Disable) is used to disable all interrupts temporarily. It may, for
example, be used in a particularly sensitive part of the program where no interrupts
may be permitted to take place in case they disturb normal program execution.
Example
IDisable;
FOR i FROM 1 TO 100 DO
character[i]:=ReadBin(sensor);
ENDFOR
IEnable;
No interrupts are permitted as long as the serial channel is reading.
Program execution
Interrupts which occur during the time in which an IDisable instruction is in effect are
placed in a queue. When interrupts are permitted once more, the interrupt(s) of the program then immediately start generating, executed in first in - first out order in the
queue.
Syntax
IDisable;
Related information
Described in:
Summary of interrupts
Permitting interrupts
Instructions - IEnable
2-IDisable-189
IDisable
2-IDisable-190
Instructions
Instructions
IEnable
IEnable
Enables interrupts
Example
IDisable;
FOR i FROM 1 TO 100 DO
character[i]:=ReadBin(sensor);
ENDFOR
IEnable;
No interrupts are permitted as long as the serial channel is reading. When it has
finished reading, interrupts are once more permitted.
Program execution
Interrupts which occur during the time in which an IDisable instruction is in effect, are
placed in a queue. When interrupts are permitted once more (IEnable), the interrupt(s)
of the program then immediately start generating, executed in first in - first out order
in the queue.Program execution then continues in the ordinary program and interrupts
which occur after this are dealt with as soon as they occur.
Interrupts are always permitted when a program is started from the beginning,. Interrupts disabled by the ISleep instruction are not affected by the IEnable instruction.
Syntax
IEnable;
Related information
Described in:
Summary of interrupts
Permitting no interrupts
Instructions - IDisable
2-IEnable-191
IEnable
2-IEnable-192
Instructions
Instructions
Compact IF
Compact IF
Examples
IF reg1 > 5 GOTO next;
If reg1 is greater than 5, program execution continues at the next label.
IF counter > 10 Set do1;
The do1 signal is set if counter > 10.
Arguments
IF
Condition
...
Condition
Syntax
(EBNF)
IF <conditional expression> ( <instruction> | <SMT>) ;
Related information
Described in:
Conditions (logical expressions)
Instructions - IF
2-Compact IF-193
Compact IF
2-Compact IF-194
Instructions
Instructions
IF
IF
Examples
IF reg1 > 5 THEN
Set do1;
Set do2;
ENDIF
The do1 and do2 signals are set only if reg1 is greater than 5.
IF reg1 > 5 THEN
Set do1;
Set do2;
ELSE
Reset do1;
Reset do2;
ENDIF
The do1 and do2 signals are set or reset depending on whether reg1 is greater
than 5 or not.
Arguments
IF Condition THEN ...
{ELSEIF Condition THEN ...}
[ELSE ...]
ENDIF
Condition
The condition that must be satisfied for the instructions between THEN and
ELSE/ELSEIF to be executed.
2-IF-195
IF
Instructions
Example
IF counter > 100 THEN
counter := 100;
ELSEIF counter < 0 THEN
counter := 0;
ELSE
counter := counter + 1;
ENDIF
Counter is incremented by 1. However, if the value of counter is outside the limit
0-100, counter is assigned the corresponding limit value.
Program execution
The conditions are tested in sequential order, until one of them is satisfied. Program
execution continues with the instructions associated with that condition. If none of the
conditions are satisfied, program execution continues with the instructions following
ELSE. If more than one condition is met, only the instructions associated with the first
of those conditions are executed.
Syntax
(EBNF)
IF <conditional expression> THEN
<instruction list>
{ELSEIF <conditional expression> THEN <instruction list> | <EIF>}
[ELSE
<instruction list>]
ENDIF
Related information
Described in:
Conditions (logical expressions)
2-IF-196
Instructions
Incr
Incr
Increments by 1
Incr is used to add 1 to a numeric variable or persistent.
Example
Incr reg1;
1 is added to reg1, i.e. reg1:=reg1+1.
Arguments
Incr
Name
Name
Example
WHILE stop_production=0 DO
produce_part;
Incr no_of_parts;
TPWrite "No of produced parts= "\Num:=no_of_parts;
ENDWHILE
The number of parts produced is updated on the teach pendant each cycle.
Production continues to run as long as the signal stop_production is not set.
Syntax
Incr
[ Name := ] < var or pers (INOUT) of num > ;
Related information
Described in:
Decrementing a variable by 1
Instructions - Decr
Instructions - Add
Instructions - :=
2-Incr-197
Incr
2-Incr-198
Instructions
Instructions
InvertDO
InvertDO
InvertDO (Invert Digital Output) inverts the value of a digital output signal (0 -> 1 and
1 -> 0).
Example
InvertDO do15;
The current value of the signal do15 is inverted.
Arguments
InvertDO
Signal
Signal
Program execution
The current value of the signal is inverted (see Figure 19).
:
1
Signal level
0
Execution of the instruction InvertDO
Execution of the instruction InvertDO
1
Signal level
0
Figure 19 Inversion of a digital output signal.
Syntax
InvertDO
[ Signal := ] < variable (VAR) of signaldo > ;
2-InvertDO-199
InvertDO
Instructions
Related information
Described in:
Input/Output instructions
Configuration of I/O
System Parameters
2-InvertDO-200
Instructions
IODisable
IODisable
IODisable is used to disable an I/O unit during program execution (only in the S4C
system).
I/O units are automatically enabled after start-up if they are defined in the system
parameters. When required for some reason, I/O units can be disabled or enabled
during program execution.
Examples
IODisable cell1, 5;
Disable I/O unit with name cell1.Wait max. 5 s.
Arguments
IODisable
UnitName MaxTime
UnitName
The name of the I/O unit to be disabled (with same name as configured).
MaxTime
Program execution
The specified I/O unit starts the disable steps. The instruction is ready when the disable
steps are finished. If the MaxTime runs out before the I/O unit has finished the disable
steps, a recoverable error will be generated.
After disabling an I/O unit, any setting of outputs in this unit will result in an error.
2-IODisable-201
IODisable
Instructions
Example
PROC go_home()
VAR num recover_flag :=0;
...
! Start to disable I/O unit cell1
recover_flag := 1;
IODisable cell1, 0;
! Move to home position
MoveJ home, v1000,fine,tool1;
! Wait until disable of I/O unit cell1 is ready
recover_flag := 2;
IODisable cell1, 5;
...
ERROR
IF ERRNO = ERR_IODISABLE THEN
IF recover_flag = 1 THEN
TRYNEXT;
ELSEIF recover_flag = 2 THEN
RETRY;
ENDIF
ELSEIF ERRNO = ERR_EXCRTYMAX THEN
ErrWrite IODisable error, Not possible to disable I/O unit cell1;
Stop;
ENDIF
ENDPROC
To save cycle time, the I/O unit cell1 is disabled during robot movement to the
home position. With the robot at the home position, a test is done to establish
whether or not the I/O unit cell1 is fully disabled. After the max. number of retries
(5 with a waiting time of 5 s), the robot execution will stop with an error message.
The same principle can be used with IOEnable (this will save more cycle time
compared with IODisable).
Syntax
IODisable
[ UnitName := ] < expression (IN) of string> ,
[ MaxTime := ] < expression (IN) of num > ;
2-IODisable-202
Instructions
IODisable
Related information
Described in:
Enabling an I/O unit
Instructions - IOEnable
Input/Output instructions
Configuration of I/O
2-IODisable-203
IODisable
2-IODisable-204
Instructions
Instructions
IOEnable
IOEnable
IOEnable is used to enable an I/O unit during program execution (only in the S4C
system).
I/O units are automatically enabled after start-up if they are defined in the system
parameters. When required for some reason, I/O units can be disabled or enabled
during program execution.
Examples
IOEnable cell1, 5;
Enable I/O unit with name cell1. Wait max. 5 s.
Arguments
IOEnable
UnitName MaxTime
UnitName
The name of the I/O unit to be enabled (with same name as configured).
MaxTime
Program execution
The specified I/O unit starts the enable steps. The instruction is ready when the enable
steps are finished. If the MaxTime runs out before the I/O unit has finished the enable
steps, a recoverable error will be generated.
After a sequence of IODisable - IOEnable, all outputs for the current I/O unit will be
set to the old values (before IODisable).
2-IOEnable-205
IOEnable
Instructions
Example
IOEnable can also be used to check whether some I/O unit is disconnected for some
reason.
VAR num max_retry:=0;
...
IOEnable cell1, 0;
SetDO cell1_sig3, 1;
...
ERROR
IF ERRNO = ERR_IOENABLE THEN
IF max_retry < 5 THEN
WaitTime 1;
max_retry := max_retry + 1;
RETRY;
ELSE
RAISE;
ENDIF
ENDIF
Before using signals on the I/O unit cell1, a test is done by trying to enable the I/
O unit with timeout after 0 sec. If the test fails, a jump is made to the error
handler. In the error handler, the program execution waits for 1 sec. and a new
retry is made. After 5 retry attempts the error ERR_IOENABLE is propagated to
the caller of this routine.
Syntax
IOEnable
[ UnitName := ] < expression (IN) of string> ,
[ MaxTime := ] < expression (IN) of num > ;
Related information
Described in:
More examples
Instructions - IODisable
Instructions - IODisable
Input/Output instructions
Configuration of I/O
2-IOEnable-206
Instructions
ISignalAI
ISignalAI
ISignalAI (Interrupt Signal Analog Input) is used to order and enable interrupts from
an analog input signal.
Example
VAR intnum sig1int;
CONNECT sig1int WITH iroutine1;
ISignalAI \Single, ai1, AIO_BETWEEN, 1.5, 0.5, 0, sig1int;
Orders an interrupt which is to occur the first time the logical value of the analog
input signal ai1 is between 0.5 and 1.5. A call is then made to the iroutine1 trap
routine.
ISignalAI ai1, AIO_BETWEEN, 1.5, 0.5, 0.1, sig1int;
Orders an interrupt which is to occur each time the logical value of the analog
input signal ai1 is between 0.5 and 1.5, and the absolute signal difference compared to the stored reference value is bigger than 0.1.
ISignalAI ai1, AIO_OUTSIDE, 1.5, 0.5, 0.1, sig1int;
Orders an interrupt which is to occur each time the logical value of the analog
input signal ai1 is lower than 0.5 or higher than 1.5, and the absolute signal difference compared to the stored reference value is bigger than 0.1.
Arguments
ISignalAI [\Single] Signal Condition HighValue LowValue
DeltaValue [\DPos] | [\DNeg] Interrupt
[\Single]
Signal
2-ISignalAI-207
ISignalAI
Instructions
Condition
- AIO_BELOW_HIGH:
- AIO_ABOVE_LOW:
- AIO_BELOW_LOW:
- AIO_BETWEEN:
- AIO_OUTSIDE:
- AIO_ALWAYS:
HighValue
LowValue
DeltaValue
Defines the minimum logical signal difference before generation of a new interrupt. The actual signal value compared to the stored reference value must be
greater than the specified DeltaValue before generation of a new interrupt.
[\DPos]
Specifies that only positive logical signal differences will give new interrupts.
[\DNeg]
Specifies that only negative logical signal differences will give new interrupts.
If none of \DPos and \DNeg argument is used, both positive and negative differences will generate new interrupts.
Interrupt
The interrupt identity. This interrupt should have previously been connected to a
trap routine by means of the instruction CONNECT.
2-ISignalAI-208
Instructions
ISignalAI
Program execution
When the signal fulfils the specified conditions (both Condition and DeltaValue), a
call is made to the corresponding trap routine. When this has been executed, program
execution continues from where the interrupt occurred.
Conditions for interrupt generation
Before the interrupt subscription is ordered, each time the signal is sampled, the value
of the signal is read, saved, and later used as a reference value for the DeltaValue condition.
At the interrupt subscription time, if specified DeltaValue = 0 and after the interrupt
subscription time always at each time the signal is sampled, its value is then compared
to HighValue and LowValue according to Condition and with consideration to DeltaValue, to generate or not generate an interrupt. If the new read value satisfies the specified HighValue and LowValue Condition, but its difference compared to the last stored
reference value is less or equal to the DeltaValue argument, no interrupt occurs.
If the signal difference is not in the specified direction, no interrupts will occur.
(argument \DPos or \DNeg).
The stored reference value for the DeltaValue condition is updated with a newly read
value for later use at any sample, if the following conditions are satisfied:
- Argument Condition with specified HighValue and LowValue
(within limits)
- Argument DeltaValue
(sufficient signal change in any direction, independently of specified switch
\DPos or \DNeg)
The reference value is only updated at the sample time, not at the interrupt subscription
time.
An interrupt is also generated at the sample for update of the reference value, if the
direction of the signal difference is in accordance with the specified argument
(any direction, \DPos or \DNeg).
When the \Single switch is used, only one interrupt at the most will be generated.
If the switch \Single (cyclic interrupt) is not used, at every sample of the signal value
a new test is done of the specified conditions (both Condition and DeltaValue) compared to the actual signal value and the last stored reference value, to generate or not
generate an interrupt.
2-ISignalAI-209
ISignalAI
Instructions
subscription
False
DeltaValue = 0
True
Interrupt generated
Continue
2-ISignalAI-210
Instructions
ISignalAI
True
False
DNeg specified and
(RefValue - CurrentValue) > DeltaValue
True
False
RefValue := CurrentValue
Interrupt
generated
True
RefValue := CurrentValue
Continue
2-ISignalAI-211
ISignalAI
Instructions
HighValue
Signal Value
LowValue
1
2
3
4
5
6
7
Time for order of interrupt subscription
Storage of reference value
10
11
12
Samples
Assuming the interrupt is ordered between sample 0 and 1, the following instruction
will give the following results:
ISignalAI ai1, AIO_BETWEEN, 6.1, 2,2, 1.0, sig1int;
sample 1 will generate an interrupt, because the signal value is between HighValue and LowValue and the signal difference compared to sample 0 is more than
DeltaValue.
sample 2 will generate an interrupt, because the signal value is between HighValue and LowValue and the signal difference compared to sample 1 is more than
DeltaValue.
samples 3, 4, 5 will not generate any interrupt, because the signal difference is
less than DeltaValue.
sample 6 will generate an interrupt.
samples 7 to 10 will not generate any interrupt, because the signal is above
HighValue
sample 11 will not generate any interrupt, because the signal difference compared
to sample 6 is equal to DeltaValue.
sample 12 will not generate any interrupt, because the signal difference compared
to sample 6 is less than DeltaValue.
2-ISignalAI-212
Instructions
ISignalAI
HighValue
Signal Value
LowValue
1
2
3
4
5
6
7
Time for order of interrupt subscription
Storage of reference value
10
11
12
Samples
Assuming the interrupt is ordered between sample 0 and 1, the following instruction
will give the following results:
ISignalAI ai1, AIO_BETWEEN, 6.1, 2,2, 1.0 \DPos, sig1int;
A new reference value is stored at sample 1 and 2, because the signal is within
limits and the absolute signal difference between the actual value and the last
stored reference value is greater than 1.0.
No interrupt will be generated because the signal changes are in the negative
direction.
sample 6 will generate an interrupt, because the signal value is between HighValue and LowValue and the signal difference in the positive direction compared
to sample 2 is more than DeltaValue.
2-ISignalAI-213
ISignalAI
Instructions
HighValue
Signal Value
LowValue
1
2
3
4
5
6
7
Time for order of interrupt subscription
Storage of reference value
10
11
12
Samples
Assuming the interrupt is ordered between sample 0 and 1, the following instruction
will give the following results:
ISignalAI \Single, ai1, AIO_OUTSIDE, 6.1, 2,2, 1.0 \DPos, sig1int;
A new reference value is stored at sample 7, because the signal is within limits
and the absolute signal difference between the actual value and the last stored reference value is greater than 1.0
sample 8 will generate an interrupt, because the signal value is above HighValue
and the signal difference in the positive direction compared to sample 7 is more
than DeltaValue.
2-ISignalAI-214
Instructions
ISignalAI
HighValue
Signal Value
LowValue
1
2
3
4
5
6
7
Time for order of interrupt subscription
Storage of reference value
10
11
12
Samples
Assuming the interrupt is ordered between sample 0 and 1, the following instruction
will give the following results:
ISignalAI ai1, AIO_ALWAYS, 6.1, 2,2, 1.0 \DPos, sig1int;
A new reference value is stored at sample 1 and 2, because the signal is within
limits and the absolute signal difference between the actual value and the last
stored reference value is greater than 1.0
sample 6 will generate an interrupt, because the signal difference in the positive
direction compared to sample 2 is more than DeltaValue.
sample 7 and 8 will generate an interrupt, because the signal difference in the
positive direction compared to previous sample is more than DeltaValue.
A new reference value is stored at sample 11 and 12, because the signal is within
limits and the absolute signal difference between the actual value and the last
stored reference value is greater than 1.0
Error handling
If there is a subscription of interrupt on an analog input signal, an interrupt will be
given for every change in the analog value that satisfies the condition specified when
ordering the interrupt subscription. If the analog value is noisy, many interrupts can be
generated, even if only one or two bits in the analog value are changed.
2-ISignalAI-215
ISignalAI
Instructions
To avoid generating interrupts for small changes of the analog input value, set the
DeltaValue to a level greater than 0. Then no interrupts will be generated until a change
of the analog value is greater than the specified DeltaValue.
Limitations
The HighValue and LowValue arguments should be in the range: logical maximum
value, logical minimum value defined for the signal.
HighValue must be above LowValue.
DeltaValue must be 0 or positive.
The limitations for the interrupt identity are the same as for ISignalDI.
Syntax
ISignalAI
[ \Single,]
[ Signal:= ]<variable (VAR) of signalai>,
[ Condition:= ]<expression (IN) of aiotrigg>,
[ HighValue:= ]<expression (IN) of num>,
[ LowValue:= ]<expression (IN) of num>,
[ DeltaValue:= ]<expression (IN) of num>
[ \DPos] | [ \DNeg] ,
[ Interrupt:= ]<variable (VAR) of intnum>;
Related information
Described in:
Summary of interrupts
Definition of constants
Instructions - ISignalAO
Instructions - ISignalDI
Instructions - ISignalDO
More examples
2-ISignalAI-216
Instructions
ISignalAO
ISignalAO
ISignalAO (Interrupt Signal Analog Output) is used to order and enable interrupts from
an analog output signal.
Example
VAR intnum sig1int;
CONNECT sig1int WITH iroutine1;
ISignalAO \Single, ao1, AIO_BETWEEN, 1.5, 0.5, 0, sig1int;
Orders an interrupt which is to occur the first time the logical value of the analog
output signal ao1 is between 0.5 and 1.5. A call is then made to the iroutine1 trap
routine.
ISignalAO ao1, AIO_BETWEEN, 1.5, 0.5, 0.1, sig1int;
Orders an interrupt which is to occur each time the logical value of the analog
output signal ao1 is between 0.5 and 1.5, and the absolute signal difference compared to the previous stored reference value is bigger than 0.1.
ISignalAO ao1, AIO_OUTSIDE, 1.5, 0.5, 0.1, sig1int;
Orders an interrupt which is to occur each time the logical value of the analog
output signal ao1 is lower than 0.5 or higher than 1.5, and the absolute signal difference compared to the previous stored reference value is bigger than 0.1.
Arguments
ISignalAO [\Single] Signal Condition HighValue LowValue
DeltaValue [\DPos] | [\DNeg] Interrupt
[\Single]
Signal
2-ISignalAO-217
ISignalAO
Instructions
Condition
- AIO_BELOW_HIGH:
- AIO_ABOVE_LOW:
- AIO_BELOW_LOW:
- AIO_BETWEEN:
- AIO_OUTSIDE:
- AIO_ALWAYS:
HighValue
LowValue
DeltaValue
Defines the minimum logical signal difference before generation of a new interrupt. The actual signal value compared to the previous stored reference value
must be greater than the specified DeltaValue before generation of a new interrupt.
[\DPos]
Specifies that only positive logical signal differences will give new interrupts.
[\DNeg]
Specifies that only negative logical signal differences will give new interrupts.
If neither of the \DPos and \DNeg arguments are used, both positive and negative
differences will generate new interrupts.
Interrupt
The interrupt identity. This interrupt should have previously been connected to a
trap routine by means of the instruction CONNECT.
2-ISignalAO-218
Instructions
ISignalAO
Program execution
See instruction ISignalAI for information about:
- Program execution
- Condition for interrupt generation
- More examples
Same principles are valid for ISignalAO as for ISignalAI.
Limitations
The HighValue and LowValue arguments should be in the range: logical maximum
value, logical minimum value, defined for the signal.
HighValue must be above LowValue.
DeltaValue must be 0 or positive.
The limitations for the interrupt identity are the same as for ISignalDO.
Syntax
ISignalAO
[ \Single,]
[ Signal:= ]<variable (VAR) of signalao>,
[ Condition:= ]<expression (IN) of aiotrigg>,
[ HighValue:= ]<expression (IN) of num>,
[ LowValue:= ]<expression (IN) of num>,
[ DeltaValue:= ]<expression (IN) of num>
[ \DPos] | [ \DNeg] ,
[ Interrupt:= ]<variable (VAR) of intnum>;
2-ISignalAO-219
ISignalAO
Instructions
Related information
Described in:
Summary of interrupts
Definition of constants
Instructions - ISignalAI
Instructions - ISignalDI
Instructions - ISignalDO
More examples
2-ISignalAO-220
Instructions
ISignalDI
ISignalDI
ISignalDI (Interrupt Signal Digital In) is used to order and enable interrupts from a
digital input signal.
System signals can also generate interrupts.
Examples
VAR intnum sig1int;
CONNECT sig1int WITH iroutine1;
ISignalDI di1,1,sig1int;
Orders an interrupt which is to occur each time the digital input signal di1 is set
to 1. A call is then made to the iroutine1 trap routine.
ISignalDI di1,0,sig1int;
Orders an interrupt which is to occur each time the digital input signal di1 is set
to 0.
ISignalDI \Single, di1,1,sig1int;
Orders an interrupt which is to occur only the first time the digital input signal
di1 is set to 1.
Arguments
ISignalDI
[ \Single ]
2-ISignalDI-221
ISignalDI
Instructions
TriggValue
The value to which the signal must change for an interrupt to occur.
The value is specified as 0 or 1 or as a symbolic value (e.g. high/low). The signal
is edge-triggered upon changeover to 0 or 1.
TriggValue 2 or symbolic value edge can be used for generation of interrupts on
both positive flank (0 -> 1) and negative flank (1 -> 0).
Interrupt
The interrupt identity. This should have previously been connected to a trap routine by means of the instruction CONNECT.
Program execution
When the signal assumes the specified value, a call is made to the corresponding trap
routine. When this has been executed, program execution continues from where the
interrupt occurred.
If the signal changes to the specified value before the interrupt is ordered, no interrupt
occurs (see Figure 20).
:
1
Signal level
0
Interrupt ordered
Interrupt ordered
1
Signal level
0
Interrupt occurs
Interrupt occurs
2-ISignalDI-222
Instructions
ISignalDI
Limitations
The same variable for interrupt identity cannot be used more than once, without first
deleting it. Interrupts should therefore be handled as shown in one of the alternatives
below.
PROC main ( )
VAR intnum sig1int;
CONNECT sig1int WITH iroutine1;
ISignalDI di1, 1, sig1int;
WHILE TRUE DO
:
:
ENDWHILE
ENDPROC
All activation of interrupts is done at the beginning of the program. These
instructions are then kept outside the main flow of the program.
PROC main ( )
VAR intnum sig1int;
CONNECT sig1int WITH iroutine1;
ISignalDI di1, 1, sig1int;
:
:
IDelete sig1int;
ENDPROC
The interrupt is deleted at the end of the program, and is then reactivated. It
should be noted, in this case, that the interrupt is inactive for a short period.
Syntax
ISignalDI
[ \ Single,]
[ Signal := ] < variable (VAR) of signaldi > ,
[ TriggValue := ] < expression (IN) of dionum >,
[ Interrupt := ] < variable (VAR) of intnum > ;
2-ISignalDI-223
ISignalDI
Instructions
Related information
Described in:
Summary of interrupts
Instructions - ISignalDO
More examples
2-ISignalDI-224
Instructions
ISignalDO
ISignalDO
ISignalDO (Interrupt Signal Digital Out) is used to order and enable interrupts from a
digital output signal.
System signals can also generate interrupts.
Examples
VAR intnum sig1int;
CONNECT sig1int WITH iroutine1;
ISignalDO do1,1,sig1int;
Orders an interrupt which is to occur each time the digital output signal do1 is
set to 1. A call is then made to the iroutine1 trap routine.
ISignalDO do1,0,sig1int;
Orders an interrupt which is to occur each time the digital output signal do1 is
set to 0.
ISignalDO\Single, do1,1,sig1int;
Orders an interrupt which is to occur only the first time the digital output signal
do1 is set to 1.
Arguments
ISignalDO
[ \Single ]
2-ISignalDO-225
ISignalDO
Instructions
TriggValue
The value to which the signal must change for an interrupt to occur.
The value is specified as 0 or 1 or as a symbolic value (e.g. high/low). The signal
is edge-triggered upon changeover to 0 or 1.
TriggValue 2 or symbolic value edge can be used for generation of interrupts on
both positive flank (0 -> 1) and negative flank (1 -> 0).
Interrupt
The interrupt identity. This should have previously been connected to a trap routine by means of the instruction CONNECT.
Program execution
When the signal assumes the specified value 0 or 1, a call is made to the corresponding
trap routine. When this has been executed, program execution continues from where
the interrupt occurred.
If the signal changes to the specified value before the interrupt is ordered, no interrupt
occurs (see Figure 21).
:
1
Signal level
0
Interrupt ordered
Interrupt ordered
1
Signal level
0
Interrupt occurs
Interrupt occurs
2-ISignalDO-226
Instructions
ISignalDO
Limitations
The same variable for interrupt identity cannot be used more than once, without first
deleting it. Interrupts should therefore be handled as shown in one of the alternatives
below.
PROC main ( )
VAR intnum sig1int;
CONNECT sig1int WITH iroutine1;
ISignalDO do1, 1, sig1int;
WHILE TRUE DO
:
:
ENDWHILE
ENDPROC
All activation of interrupts is done at the beginning of the program. These
instructions are then kept outside the main flow of the program.
PROC main ( )
VAR intnum sig1int;
CONNECT sig1int WITH iroutine1;
ISignalDO do1, 1, sig1int;
:
:
IDelete sig1int;
ENDPROC
The interrupt is deleted at the end of the program, and is then reactivated. It
should be noted, in this case, that the interrupt is inactive for a short period.
Syntax
ISignalDO
[ \ Single,]
[ Signal := ] < variable (VAR) of signaldo > ,
[ TriggValue := ] < expression (IN) of dionum >,
[ Interrupt := ] < variable (VAR) of intnum > ;
2-ISignalDO-227
ISignalDO
Instructions
Related information
Described in:
Summary of interrupts
Instructions - ISignalDI
More examples
2-ISignalDO-228
Instructions
ISleep
ISleep
Deactivates an interrupt
ISleep (Interrupt Sleep) is used to deactivate an individual interrupt temporarily.
During the deactivation time, any generated interrupts of the specified type are
discarded without any trap execution.
Example
ISleep sig1int;
The interrupt sig1int is deactivated.
Arguments
ISleep
Interrupt
Interrupt
Program execution
Any generated interrupts of the specified type are discarded without any trap
execution, until the interrupt has been re-activated by means of the instruction IWatch.
Interrupts which are generated while ISleep is in effect are ignored.
Example
VAR intnum timeint;
CONNECT timeint WITH check_serialch;
ITimer 60, timeint;
.
ISleep timeint;
WriteBin ch1, buffer, 30;
IWatch timeint;
.
TRAP check_serialch
WriteBin ch1, buffer, 1;
IF ReadBin(ch1\Time:=5) < 0 THEN
TPWrite The serial communication is broken;
EXIT;
ENDIF
2-ISleep-229
ISleep
Instructions
ENDTRAP
Communication across the ch1 serial channel is monitored by means of interrupts
which are generated every 60 seconds. The trap routine checks whether the communication is working. When, however, communication is in progress, these
interrupts are not permitted.
Error handling
Interrupts which have neither been ordered nor enabled are not permitted. If the interrupt number is unknown, the system variable ERRNO will be set to ERR_UNKINO
(see Data types - errnum). The error can be handled in the error handler.
Syntax
ISleep
[ Interrupt := ] < variable (VAR) of intnum > ;
Related information
Described in:
Summary of interrupts
Enabling an interrupt
Instructions - IWatch
Instructions - IDisable
Cancelling an interrupt
Instructions - IDelete
2-ISleep-230
Instructions
ITimer
ITimer
Examples
VAR intnum timeint;
CONNECT timeint WITH iroutine1;
ITimer 60, timeint;
Orders an interrupt that is to occur cyclically every 60 seconds. A call is then
made to the trap routine iroutine1.
ITimer \Single, 60, timeint;
Orders an interrupt that is to occur once, after 60 seconds.
Arguments
ITimer
[ \Single ]
Interrupt
The variable (interrupt identity) of the interrupt. This should have previously
been connected to a trap routine by means of the instruction CONNECT.
2-ITimer-231
ITimer
Instructions
Program execution
The corresponding trap routine is automatically called at a given time following the
interrupt order. When this has been executed, program execution continues from where
the interrupt occurred.
If the interrupt occurs cyclically, a new computation of time is started from when the
interrupt occurs.
Example
VAR intnum timeint;
CONNECT timeint WITH check_serialch;
ITimer 60, timeint;
.
TRAP check_serialch
WriteBin ch1, buffer, 1;
IF ReadBin(ch1\Time:=5) < 0 THEN
TPWrite The serial communication is broken;
EXIT;
ENDIF
ENDTRAP
Communication across the ch1 serial channel is monitored by means of interrupts
which are generated every 60 seconds. The trap routine checks whether the communication is working. If it is not, program execution is interrupted and an error
message appears.
Limitations
The same variable for interrupt identity cannot be used more than once, without being
first deleted. See Instructions - ISignalDI.
Syntax
ITimer
[ \Single ,]
[ Time := ] < expression (IN) of num >,
[ Interrupt := ] < variable (VAR) of intnum > ;
2-ITimer-232
Instructions
ITimer
Related information
Described in:
Summary of interrupts
2-ITimer-233
ITimer
2-ITimer-234
Instructions
Instructions
IVarValue
IVarValue
IVarVal(Interrupt Variable Value) is used to order and enable an interrupt when the
value of a variable accessed via the serial sensor interface has been changed.
This instruction can be used, for example, to get seam volume or gap values from a
seam tracker.
Examples
LOCAL PERS num adtVlt{25}:=[1,1.2,1.4,1.6,1.8,2,2.16667,2.33333,2.5,...];
LOCAL PERS num adptWfd{25}:=[2,2.2,2.4,2.6,2.8,3,3.16667,3.33333,3.5,...];
LOCAL PERS num adptSpd{25}:=10,12,14,16,18,20,21.6667,23.3333,25[,...];
LOCAL CONST num GAP_VARIABLE_NO:=11;
PERS num gap_value;
VAR intnum IntAdap;
PROC main()
! Setup the interrupt. The trap routine AdapTrp will be called
! when the gap variable with number GAP_VARIABLE_NO in
! the sensor interface has been changed. The new value will be available
! in the PERS gp_value variable.
CONNECT IntAdap WITH AdapTrp;
IVarValue GAP_VARIABLE_NO, gap_value, IntAdap;
! Start welding
ArcL\On,*,v100,adaptSm,adaptWd,adaptWv,z10,tool\j\Track:=track;
ArcL\On,*,v100,adaptSm,adaptWd,adaptWv,z10,tool\j\Track:=track;
ENDPROC
TRAP AdapTrap
VAR num ArrInd;
!Scale the raw gap value received
ArrInd:=ArrIndx(gap_value);
! Update active welddata PERS variable adaptWd with
! new data from the arrays of predefined parameter arrays.
! The scaled gap value is used as index in the voltage, wirefeed and speed arrays.
adaptWd.weld_voltage:=adptVlt{ArrInd};
adaptWd.weld_wirefeed:=adptWfd{ArrInd};
adaptWd.weld_speed:=adptSpd{ArrInd};
!Request a refresh of AW parameters using the new data i adaptWd
ArcRefresh;
ENDTRAP
2-IVarValue-235
IVarValue
Instructions
Arguments
IVarValue
VarNo
The variable (interrupt identity) of the interrupt. This should have previously
been connected to a trap routine by means of the instruction CONNECT.
Program execution
The corresponding trap routine is automatically called at a given time following the
interrupt order. When this has been executed, program execution continues from where
the interrupt occurred.
Limitations
The same variable for interrupt identity cannot be used more than five times, without
first being deleted.
Syntax
IVarValue
[ VarNo := ] < expression (IN) of num >,
[ Value := ] < persistent(PERS) of num >,
[ Interrupt := ] < variable (VAR) of intnum > ;
Related information
Described in:
Summary of interrupts
2-IVarValue-236
Instructions
IWatch
IWatch
Activates an interrupt
IWatch (Interrupt Watch) is used to activate an interrupt which was previously ordered
but was deactivated with ISleep.
Example
IWatch sig1int;
The interrupt sig1int that was previously deactivated is activated.
Arguments
IWatch
Interrupt
Interrupt
Program execution
Re-activates interrupts of the specified type once again. However, interrupts generated
during the time the ISleep instruction was in effect, are ignored.
Example
VAR intnum sig1int;
CONNECT sig1int WITH iroutine1;
ISignalDI di1,1,sig1int;
.
ISleep sig1int;
weldpart1;
IWatch sig1int;
During execution of the weldpart1 routine, no interrupts are permitted from the
signal di1.
Error handling
Interrupts which have not been ordered are not permitted. If the interrupt number is
unknown, the system variable ERRNO is set to ERR_UNKINO (see Date types - errnum). The error can be handled in the error handler.
2-IWatch-237
IWatch
Instructions
Syntax
IWatch
[ Interrupt := ] < variable (VAR) of intnum > ;
Related information
Described in:
Summary of interrupts
Deactivating an interrupt
Instructions - ISleep
2-IWatch-238
Instructions
label
label
Line name
Label is used to name a line in the program. Using the GOTO instruction, this name
can then be used to move program execution.
Example
GOTO next;
.
next:
Program execution continues with the instruction following next.
Arguments
Label:
Label
Identifier
Program execution
Nothing happens when you execute this instruction.
Limitations
The label must not be the same as
- any other label within the same routine,
- any data name within the same routine.
A label hides global data and routines with the same name within the routine it is
located in.
Syntax
(EBNF)
<identifier>:
2-label-239
label
Instructions
Related information
Described in:
2-label-240
Identifiers
Instructions - GOTO
Instructions
Load
Load
Static mode
Table 1 How different operations affects static loaded program or system modules
Set PP to main from TP
Program Module
Not affected
Unloaded
System Module
Not affected
Not affected
Dynamic mode
Table 2 How different operations affects dynamic loaded program or system modules
Set PP to main from TP
Program Module
Unloaded
Unloaded
System Module
Unloaded
Unloaded
Both static and dynamic loaded modules can be unloaded by the instruction UnLoad.
Example
Load \Dynamic, ram1disk \File:="PART_A.MOD";
Load the program module PART_A.MOD from the ram1disk into the program
memory. ( ram1disk is a predefined string constant "ram1disk:"). Load program
module in dynamic mode.
Arguments
Load [\Dynamic] FilePath [\File]
[\Dynamic]
The switch enables load of a program module in dynamic mode. Otherwise the
load is in static mode.
2-Load-241
Load
Instructions
FilePath
The file path and the file name to the file that will be loaded into the program
memory. The file name shall be excluded when the argument \File is used.
[\File]
When the file name is excluded in the argument FilePath then it must be defined
with this argument.
Program execution
Program execution waits for the program module to finish loading before proceeding
with the next instruction.
To obtain a good program structure, that is easy to understand and maintain, all loading
and unloading of program modules should be done from the main module which is
always present in the program memory during execution.
After the program module is loaded it will be linked and initialised. The initialisation
of the loaded module sets all variables at module level to their init values. Unresolved
references will be accepted if the system parameter for Tasks is set (BindRef = NO).
However, when the program is started or the teach pendant function Program/File/
Check is used, no check for unresolved references will be done if the parameter BindRef = NO. There will be a run time error on execution of an unresolved reference.
Examples
Load \Dynamic, "ram1disk:DOORDIR/DOOR1.MOD";
Loads the program module DOOR1.MOD from the ram1disk at the directory
DOORDIR into the program memory. The program module is loaded in dynamic
mode.
Load \Dynamic, "ram1disk:" \File:="DOORDIR/DOOR1.MOD";
Same as above but another syntax.
Load "ram1disk:" \File:="DOORDIR/DOOR1.MOD";
Same as the two examples above but the module is loaded in static mode.
2-Load-242
Instructions
Load
Limitations
Loading a program module that contains a main routine is not allowed.
Avoid ongoing robot movements during the loading.
Avoid using the floppy disk for loading since reading from the floppy drive is very time
consuming.
Error handling
If the file in the Load instructions cannot be found, then the system variable ERRNO
is set to ERR_FILNOTFND. If the module already is loaded into the program memory
then the system variable ERRNO is set to ERR_LOADED (see "Data types - errnum").
The errors above can be handled in an error handler.
Syntax
Load
[\Dynamic ,]
[FilePath:=]<expression (IN) of string>
[\File:= <expression (IN) of string>];
Related information
Described in:
Unload a program module
Instructions - UnLoad
Instructions - StartLoad-WaitLoad
2-Load-243
Load
2-Load-244
Instructions
Instructions
MechUnitLoad
Example
IRBP_L
axis 1
ActUnit IRBP_L;
MechUnitLoad IRBP_L, 1, load0;
Activate mechanical unit IRBP_L and define the payload load0 corresponding to
no load (at all) mounted on axis 1.
ActUnit IRBP_L;
MechUnitLoad IRBP_L, 1, fixture1;
Activate mechanical unit IRBP_L and define the payload fixture1 corresponding
to fixture fixture1 mounted on axis 1.
ActUnit IRBP_L;
MechUnitLoad IRBP_L, 1, workpiece1;
Activate mechanical unit IRBP_L and define the payload workpiece1 corresponding to fixture and work piece named workpiece1 mounted on axis 1.
2-MechUnitLoad-245
MechUnitLoad
Instructions
Arguments
MechUnitLoad MechUnit AxisNo Load
MechUnit
(Mechanical Unit)
(Axis Number)
The axis number, within the mechanical unit, that holds the load.
Load
Program execution
After execution of MechUnitLoad, when the robot and external axes have come to a
standstill, the specified load is defined for the specified mechanical unit and axis. This
means that the payload is controlled and monitored by the control system.
The default payload at cold start-up, for a certain mechanical unit type, is the predefined maximal payload for this mechanical unit type.
When some other payload is used, the actual payload for the mechanical unit and axis
should be redefined with this instruction. This should always be done after activation
of the mechanical unit.
The defined payload will survive a power failure restart.
The defined payload will also survive a restart of the program after manual activation
of some other mechanical units from the jogging window.
X
Fixture
End-effector coordinate system
for the mechanical unit
Z
Work piece
2-MechUnitLoad-246
Instructions
MechUnitLoad
Example
IRBP_K
axis 2
axis 1
axis 3
Figure 24 A mechanical unit named IRBP_K of type IRBP K with three axes.
Limitations
The movement instruction previous to this instruction should be terminated with a stop
point in order to make a restart in this instruction possible following a power failure.
Syntax
MechUnitLoad
[MechUnit := ] < variable (VAR) of mecunit> ,
[AxisNo := ] <expression (IN) of num ,
[ Load := ] < persistent (PERS) of loaddata > ;
2-MechUnitLoad-247
MechUnitLoad
Instructions
Related information
Described in:
Identification of payload for external
mechanical units
LoadID&CollDetect
- Program muloadid.prg
Mechanical units
Instructions - GripLoad
Data Types - tooldata
2-MechUnitLoad-248
Instructions
MoveCSync
MoveCSync
MoveCSync (Move Circular Synchronously) is used to move the tool centre point (TCP)
circularly to a given destination. The specified RAPID procedure is executed at the middle of the corner path in the destination point. During the movement, the orientation normally remains unchanged relative to the circle.
Examples
MoveCSync p1, p2, v500, z30, tool2, proc1;
The TCP of the tool, tool2, is moved circularly to the position p2, with speed data
v500 and zone data z30. The circle is defined from the start position, the circle
point p1 and the destination point p2. Procedure proc1 is executed in the middle
of the corner path at p2.
Arguments
MoveCSync
CirPoint
The circle point of the robot. The circle point is a position on the circle between
the start point and the destination point. To obtain the best accuracy, it should be
placed about halfway between the start and destination points. If it is placed too
close to the start or destination point, the robot may give a warning. The circle
point is defined as a named position or stored directly in the instruction (marked
with an * in the instruction). The position of the external axes are not used.
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
Speed
The speed data that applies to movements. Speed data defines the velocity of the
TCP, the tool reorientation and external axes.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
and external axes move. It is then substituted for the corresponding speed data.
2-MoveCSync-249
MoveCSync
Instructions
Zone
Tool
[ \WObj]
(Work Object)
The work object (object coordinate system) to which the robot position in the
instruction is related.
This argument can be omitted, and if it is, the position is related to the world coordinate system. If, on the other hand, a stationary TCP or coordinated external
axes are used, this argument must be specified.
ProcName
(Procedure Name)
Name of the RAPID procedure to be executed at the middle of the corner path in
the destination point.
Program execution
See the instruction MoveC for more information about circular movements.
The specified RAPID procedure is executed when the TCP reaches the middle of the
corner path in the destination point of the MoveCSync instruction, as shown in Figure
25:
p4
p1
Zone
p3
p2
Figure 25 Execution of user-defined RAPID procedure at the middle of the corner path.
For stop points, we recommend the use of normal programming sequence with
2-MoveCSync-250
Instructions
MoveCSync
Continuously or Cycle
Forward step
Backward step
Not at all
Limitation
General limitations according to instruction MoveC.
Switching execution mode after program stop from continuously or cycle to stepwise
forward or backward results in an error. This error tells the user that the mode switch
can result in missed execution of a RAPID procedure in the queue for execution on the
path. This error can be avoided if the program is stopped with StopInstr before the
mode switch.
Instruction MoveCSync cannot be used on TRAP level.
The specified RAPID procedure cannot be tested with stepwise execution.
Syntax
MoveCSync
[ CirPoint := ] < expression (IN) of robtarget > ,
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ T := < expression (IN) of num > ] ,
[ Zone := ] < expression (IN) of zonedata > ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ] ,
[ ProcName := ] < expression (IN) of string > ] ;
2-MoveCSync-251
MoveCSync
Instructions
Related information
Described in:
Other positioning instructions
Definition of velocity
Definition of tools
Motion in general
Coordinate systems
2-MoveCSync-252
Instructions
MoveAbsJ
MoveAbsJ
MoveAbsJ (Move Absolute Joint) is used to move the robot to an absolute position,
defined in axes positions.
This instruction need only be used when:
- the end point is a singular point
- for ambiguous positions on the IRB 6400C, e.g. for movements with the tool
over the robot.
The final position of the robot, during a movement with MoveAbsJ, is neither affected
by the given tool and work object, nor by active program displacement. However, the
robot uses these data to calculating the load, TCP velocity, and the corner path. The
same tools can be used as in adjacent movement instructions.
The robot and external axes move to the destination position along a non-linear path.
All axes reach the destination position at the same time.
Examples
MoveAbsJ p50, v1000, z50, tool2;
The robot with the tool tool2 is moved along a non-linear path to the absolute
axis position, p50, with velocity data v1000 and zone data z50.
MoveAbsJ *, v1000\T:=5, fine, grip3;
The robot with the tool grip3, is moved along a non-linear path to a stop point
which is stored as an absolute axis position in the instruction (marked with an *).
The entire movement takes 5 s.
Arguments
MoveAbsJ
[ \Conc ]
(Concurrent)
Subsequent instructions are executed while the robot is moving. The argument is
used to shorten the cycle time when, for example, communicating with external
equipment, if synchronisation is not required.
Using the argument \Conc, the number of movement instructions in succession
is limited to 5. In a program section that includes StorePath-RestoPath, movement instructions with the argument \Conc are not permitted.
2-MoveAbsJ-253
MoveAbsJ
Instructions
If this argument is omitted and the ToPoint is not a stop point, the subsequent
instruction is executed some time before the robot has reached the programmed
zone.
ToJointPos
The destination absolute joint position of the robot and external axes. It is defined
as a named position or stored directly in the instruction (marked with an * in the
instruction).
[ \NoEOffs ]
If the argument NoEOffs is set, then the movement with MoveAbsJ is not affected
by active offsets for external axes.
Speed
The speed data that applies to movements. Speed data defines the velocity of the
tool centre point, the tool reorientation and external axes.
[ \V ]
(Velocity)
This argument is used to specify the velocity of the TCP in mm/s directly in the
instruction. It is then substituted for the corresponding velocity specified in the
speed data.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Zone
[ \Z ]
(Zone)
This argument is used to specify the position accuracy of the robot TCP directly
in the instruction. The length of the corner path is given in mm, which is substituted for the corresponding zone specified in the zone data.
Tool
2-MoveAbsJ-254
Instructions
MoveAbsJ
[ \WObj]
(Work Object)
Program execution
A movement with MoveAbsJ is not affected by active program displacement and if
executed with switch \NoEOffs, there will be no offset for external axes.
Without switch \NoEOffs, the external axes in the destination target are affected by
active offset for external axes.
The tool is moved to the destination absolute joint position with interpolation of the
axis angles. This means that each axis is moved with constant axis velocity and that all
axes reach the destination joint position at the same time, which results in a non-linear
path.
Generally speaking, the TCP is moved at approximate programmed velocity. The tool
is reoriented and the external axes are moved at the same time as the TCP moves. If
the programmed velocity for reorientation, or for the external axes, cannot be attained,
the velocity of the TCP will be reduced.
A corner path is usually generated when movement is transferred to the next section of
the path. If a stop point is specified in the zone data, program execution only continues
when the robot and external axes have reached the appropriate joint position.
Examples
MoveAbsJ *, v2000\V:=2200, z40 \Z:=45, grip3;
The tool, grip3, is moved along a non-linear path to a absolute joint position
stored in the instruction. The movement is carried out with data set to v2000 and
z40, the velocity and zone size of the TCP are 2200 mm/s and 45 mm respectively.
MoveAbsJ \Conc, *, v2000, z40, grip3;
The tool, grip3, is moved along a non-linear path to a absolute joint position
stored in the instruction. Subsequent logical instructions are executed while the
robot moves.
2-MoveAbsJ-255
MoveAbsJ
Instructions
Error handling
When running the program, a check is made that the arguments Tool and \WObj do not
contain contradictory data with regard to a movable or a stationary tool respectively.
Limitations
In order to be able to run backwards with the instruction MoveAbsJ involved, and
avoiding problems with singular points or ambiguous areas, it is essential that the subsequent instructions fulfil certain requirements, as follows (see Figure 1).
Singular point
MoveJ
MoveAbsJ
Ambiguous area
MoveAbsJ
MoveAbsJ
2-MoveAbsJ-256
Instructions
MoveAbsJ
Syntax
MoveAbsJ
[ \ Conc , ]
[ ToJointPos := ] < expression (IN) of jointtarget >
[ \ NoEoffs ] ,
[ Speed := ] < expression (IN) of speeddata >
[ \ V := < expression (IN) of num > ]
| [ \ T := < expression (IN) of num > ] ,
[Zone := ] < expression (IN) of zonedata >
[ \ Z := < expression (IN) of num > ] ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ] ;
Related information
Described in:
Other positioning instructions
Definition of jointtarget
Definition of velocity
Definition of tools
Motion in general
2-MoveAbsJ-257
MoveAbsJ
2-MoveAbsJ-258
Instructions
Instructions
MoveC
MoveC
Examples
MoveC p1, p2, v500, z30, tool2;
The TCP of the tool, tool2, is moved circularly to the position p2, with speed data
v500 and zone data z30. The circle is defined from the start position, the circle
point p1 and the destination point p2.
MoveC *, *, v500 \T:=5, fine, grip3;
The TCP of the tool, grip3, is moved circularly to a fine point stored in the
instruction (marked by the second *). The circle point is also stored in the
instruction (marked by the first *). The complete movement takes 5 seconds.
MoveL p1, v500, fine, tool1;
MoveC p2, p3, v500, z20, tool1;
MoveC p4, p1, v500, fine, tool1;
A complete circle is performed if the positions are the same as those shown in
Figure 2.
p1
p2
p4
p3
Figure 2 A complete circle is performed by two MoveC instructions.
Arguments
MoveC
[ \Conc ]
(Concurrent)
2-MoveC-259
MoveC
Instructions
Using the argument \Conc, the number of movement instructions in succession is
limited to 5. In a program section that includes StorePath-RestoPath, movement
instructions with the argument \Conc are not permitted.
If this argument is omitted, and the ToPoint is not a Stop point the subsequent
instruction is executed some time before the robot has reached the programmed
zone.
CirPoint
The circle point of the robot. The circle point is a position on the circle between
the start point and the destination point. To obtain the best accuracy, it should be
placed about halfway between the start and destination points. If it is placed too
close to the start or destination point, the robot may give a warning. The circle
point is defined as a named position or stored directly in the instruction (marked
with an * in the instruction). The position of the external axes are not used.
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
Speed
The speed data that applies to movements. Speed data defines the velocity of the
TCP, the tool reorientation and external axes.
[ \V ]
(Velocity)
This argument is used to specify the velocity of the TCP in mm/s directly in the
instruction. It is then substituted for the corresponding velocity specified in the
speed data.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
and external axes move. It is then substituted for the corresponding speed data.
Zone
[ \Z ]
(Zone)
This argument is used to specify the position accuracy of the robot TCP directly
in the instruction. The length of the corner path is given in mm, which is
substituted for the corresponding zone specified in the zone data.
Tool
2-MoveC-260
Instructions
MoveC
[ \WObj]
(Work Object)
The work object (object coordinate system) to which the robot position in the
instruction is related.
This argument can be omitted, and if it is, the position is related to the world
coordinate system. If, on the other hand, a stationary TCP or coordinated
external axes are used, this argument must be specified in order for a circle
relative to the work object to be executed.
[ \Corr]
(Correction)
Program execution
The robot and external units are moved to the destination point as follows:
- The TCP of the tool is moved circularly at constant programmed velocity.
- The tool is reoriented at a constant velocity, from the orientation at the start
position to the orientation at the destination point.
- The reorientation is performed relative to the circular path. Thus, if the
orientation relative to the path is the same at the start and the destination points,
the relative orientation remains unchanged during the movement (see Figure 3).
.
CirPoint
Tool orientation
Start point
ToPoint
Figure 3 Tool orientation during circular movement.
- The orientation at the circle point is not critical; it is only used to distinguish
between two possible directions of reorientation. The accuracy of the
reorientation along the path depends only on the orientation at the start and
destination points.
- Uncoordinated external axes are executed at constant velocity in order for them
to arrive at the destination point at the same time as the robot axes. The position
in the circle position is not used.
If it is not possible to attain the programmed velocity for the reorientation or for the
external axes, the velocity of the TCP will be reduced.
System Data Types and Routines
2-MoveC-261
MoveC
Instructions
A corner path is usually generated when movement is transferred to the next section of
a path. If a stop point is specified in the zone data, program execution only continues
when the robot and external axes have reached the appropriate position.
Examples
MoveC *, *, v500 \V:=550, z40 \Z:=45, grip3;
The TCP of the tool, grip3, is moved circularly to a position stored in the
instruction. The movement is carried out with data set to v500 and z40; the
velocity and zone size of the TCP are 550 mm/s and 45 mm respectively.
MoveC \Conc, *, *, v500, z40, grip3;
The TCP of the tool, grip3, is moved circularly to a position stored in the
instruction. The circle point is also stored in the instruction. Subsequent logical
instructions are executed while the robot moves.
MoveC cir1, p15, v500, z40, grip3 \WObj:=fixture;
The TCP of the tool, grip3, is moved circularly to a position, p15, via the circle
point cir1. These positions are specified in the object coordinate system for
fixture.
Limitations
A change of execution mode from forward to backward or vice versa, while the robot
is stopped on a circular path, is not permitted and will result in an error message.
The instruction MoveC (or any other instruction including circular movement) should
never be started from the beginning, with TCP between the circle point and the end
point. Otherwise the robot will not take the programmed path (positioning around the
circular path in another direction compared with that programmed).
Make sure that the robot can reach the circle point during program execution and divide
the circle segment if necessary.
2-MoveC-262
Instructions
MoveC
Syntax
MoveC
[ \ Conc , ]
[ CirPoint := ] < expression (IN) of robtarget > ,
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ V := < expression (IN) of num > ]
| [ \ T := < expression (IN) of num > ] ,
[Zone := ] < expression (IN) of zonedata >
[ \ Z := < expression (IN) of num > ] ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ]
[ \ Corr ];
Related information
Described in:
Other positioning instructions
Definition of velocity
Definition of tools
Instructions - CorrWrite
Motion in general
Coordinate systems
2-MoveC-263
MoveC
2-MoveC-264
Instructions
Instructions
MoveCDO
MoveCDO
MoveCDO (Move Circular Digital Output) is used to move the tool centre point (TCP)
circularly to a given destination. The specified digital output is set/reset in the middle of
the corner path at the destination point. During the movement, the orientation normally
remains unchanged relative to the circle.
Examples
MoveCDO p1, p2, v500, z30, tool2, do1,1;
The TCP of the tool, tool2, is moved circularly to the position p2, with speed data
v500 and zone data z30. The circle is defined from the start position, the circle
point p1 and the destination point p2. Output do1 is set in the middle of the corner
path at p2.
Arguments
MoveCDO
CirPoint
The circle point of the robot. The circle point is a position on the circle between
the start point and the destination point. To obtain the best accuracy, it should be
placed about halfway between the start and destination points. If it is placed too
close to the start or destination point, the robot may give a warning. The circle
point is defined as a named position or stored directly in the instruction (marked
with an * in the instruction). The position of the external axes are not used.
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
Speed
The speed data that applies to movements. Speed data defines the velocity of the
TCP, the tool reorientation and external axes.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
and external axes move. It is then substituted for the corresponding speed data.
2-MoveCDO-265
MoveCDO
Instructions
Zone
Tool
[ \WObj]
(Work Object)
The work object (object coordinate system) to which the robot position in the
instruction is related.
This argument can be omitted, and if it is, the position is related to the world coordinate system. If, on the other hand, a stationary TCP or coordinated external
axes are used, this argument must be specified in order for a circle relative to the
work object to be executed.
Signal
Program execution
See the instruction MoveC for more information about circular movement.
The digital output signal is set/reset in the middle of the corner path for flying points,
as shown in Figure 4.
.
CirPoint
Set/Reset
the signal
Start point
Next
point
ToPoint
Zone
Figure 4 Set/Reset of digital output signal in the corner path with MoveCDO.
For stop points, we recommend the use of normal programming sequence with
MoveC + SetDO. But when using stop point in instruction MoveCDO, the digital output
signal is set/reset when the robot reaches the stop point.
2-MoveCDO-266
Instructions
MoveCDO
The specified I/O signal is set/reset in execution mode continuously and stepwise forward but not in stepwise backward.
Limitations
General limitations according to instruction MoveC.
Syntax
MoveCDO
[ CirPoint := ] < expression (IN) of robtarget > ,
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ T := < expression (IN) of num > ] ,
[ Zone := ] < expression (IN) of zonedata > ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ] ,
[ Signal := ] < variable (VAR) of signaldo>] ,
[ Value := ] < expression (IN) of dionum > ] ;
Related information
Described in:
Other positioning instructions
Definition of velocity
Definition of tools
Motion in general
Coordinate systems
2-MoveCDO-267
MoveCDO
2-MoveCDO-268
Instructions
Instructions
MoveJDO
Examples
MoveJDO p1, vmax, z30, tool2, do1, 1;
The tool centre point (TCP) of the tool, tool2, is moved along a non-linear path
to the position, p1, with speed data vmax and zone data z30. Output do1 is set in
the middle of the corner path at p1.
Arguments
MoveJDO ToPoint Speed [ \T ] Zone Tool
[ \WObj ] Signal Value
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
Speed
The speed data that applies to movements. Speed data defines the velocity of the
tool centre point, the tool reorientation and external axes.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Zone
Tool
2-MoveJDO-269
MoveJDO
Instructions
[ \WObj]
(Work Object)
The work object (coordinate system) to which the robot position in the instruction
is related.
This argument can be omitted, and if it is, the position is related to the world coordinate system. If, on the other hand, a stationary TCP or coordinated external
axes are used, this argument must be specified.
Signal
Program execution
See the instruction MoveJ for more information about joint movement.
The digital output signal is set/reset in the middle of the corner path for flying points,
as shown in Figure 5.
p3
p2
Zone
Figure 5 Set/Reset of digital output signal in the corner path with MoveJDO.
For stop points, we recommend the use of normal programming sequence with
MoveJ + SetDO. But when using stop point in instruction MoveJDO, the digital output
signal is set/reset when the robot reaches the stop point.
The specified I/O signal is set/reset in execution mode continuously and stepwise forward but not in stepwise backward.
2-MoveJDO-270
Instructions
MoveJDO
Syntax
MoveJDO
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ T := < expression (IN) of num > ] ,
[ Zone := ] < expression (IN) of zonedata > ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ] ,
[ Signal := ] < variable (VAR) of signaldo>] ,
[ Value := ] < expression (IN) of dionum > ] ;
Related information
Described in:
Other positioning instructions
Definition of velocity
Definition of tools
Motion in general
Coordinate systems
2-MoveJDO-271
MoveJDO
2-MoveJDO-272
Instructions
Instructions
MoveJ
MoveJ
Examples
MoveJ p1, vmax, z30, tool2;
The tool centre point (TCP) of the tool, tool2, is moved along a non-linear path
to the position, p1, with speed data vmax and zone data z30.
MoveJ *, vmax \T:=5, fine, grip3;
The TCP of the tool, grip3, is moved along a non-linear path to a stop point
stored in the instruction (marked with an *). The entire movement takes 5 seconds.
Arguments
MoveJ
[ \Conc ]
(Concurrent)
Subsequent instructions are executed while the robot is moving. The argument is
used to shorten the cycle time when, for example, communicating with external
equipment, if synchronisation is not required.
Using the argument \Conc, the number of movement instructions in succession
is limited to 5. In a program section that includes StorePath-RestoPath, movement instructions with the argument \Conc are not permitted.
If this argument is omitted and the ToPoint is not a stop point, the subsequent
instruction is executed some time before the robot has reached the programmed
zone.
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
2-MoveJ-273
MoveJ
Instructions
Speed
The speed data that applies to movements. Speed data defines the velocity of the
tool centre point, the tool reorientation and external axes.
[ \V ]
(Velocity)
This argument is used to specify the velocity of the TCP in mm/s directly in the
instruction. It is then substituted for the corresponding velocity specified in the
speed data.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Zone
[ \Z ]
(Zone)
This argument is used to specify the position accuracy of the robot TCP directly
in the instruction. The length of the corner path is given in mm, which is substituted for the corresponding zone specified in the zone data.
Tool
[ \WObj]
(Work Object)
The work object (coordinate system) to which the robot position in the instruction
is related.
This argument can be omitted, and if it is, the position is related to the world coordinate system. If, on the other hand, a stationary TCP or coordinated external
axes are used, this argument must be specified.
Program execution
The tool centre point is moved to the destination point with interpolation of the axis
angles. This means that each axis is moved with constant axis velocity and that all axes
reach the destination point at the same time, which results in a non-linear path.
Generally speaking, the TCP is moved at the approximate programmed velocity
(regardless of whether or not the external axes are coordinated). The tool is reoriented
and the external axes are moved at the same time as the TCP moves. If the programmed
velocity for reorientation, or for the external axes, cannot be attained, the velocity of
the TCP will be reduced.
2-MoveJ-274
Instructions
MoveJ
A corner path is usually generated when movement is transferred to the next section of
the path. If a stop point is specified in the zone data, program execution only continues
when the robot and external axes have reached the appropriate position.
Examples
MoveJ *, v2000\V:=2200, z40 \Z:=45, grip3;
The TCP of the tool, grip3, is moved along a non-linear path to a position stored
in the instruction. The movement is carried out with data set to v2000 and z40;
the velocity and zone size of the TCP are 2200 mm/s and 45 mm respectively.
MoveJ \Conc, *, v2000, z40, grip3;
The TCP of the tool, grip3, is moved along a non-linear path to a position stored
in the instruction. Subsequent logical instructions are executed while the robot
moves.
MoveJ start, v2000, z40, grip3 \WObj:=fixture;
The TCP of the tool, grip3, is moved along a non-linear path to a position, start.
This position is specified in the object coordinate system for fixture.
Syntax
MoveJ
[ \ Conc , ]
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ V := < expression (IN) of num > ]
| [ \ T := < expression (IN) of num > ] ,
[Zone := ] < expression (IN) of zonedata >
[ \ Z := < expression (IN) of num > ] ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ] ;
2-MoveJ-275
MoveJ
Instructions
Related information
Described in:
Other positioning instructions
Definition of velocity
Definition of tools
Motion in general
Coordinate systems
2-MoveJ-276
Instructions
MoveLDO
MoveLDO
MoveLDO (Move Linearly Digital Output) is used to move the tool centre point (TCP)
linearly to a given destination. The specified digital output signal is set/reset at the middle of the corner path.
When the TCP is to remain stationary, this instruction can also be used to reorient the
tool.
Example
MoveLDO p1, v1000, z30, tool2, do1,1;
The TCP of the tool, tool2, is moved linearly to the position p1, with speed data
v1000 and zone data z30. Output do1 is set in the middle of the corner path at p1.
Arguments
MoveLDO ToPoint Speed [ \T ] Zone Tool
[ \WObj ] Signal Value
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
Speed
The speed data that applies to movements. Speed data defines the velocity for the
tool centre point, the tool reorientation and external axes.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Zone
Tool
2-MoveLDO-277
MoveLDO
Instructions
[ \WObj]
(Work Object)
The work object (coordinate system) to which the robot position in the instruction
is related.
This argument can be omitted, and if it is, the position is related to the world coordinate system. If, on the other hand, a stationary TCP or coordinated external
axes are used, this argument must be specified.
Signal
Program execution
See the instruction MoveL for more information about linear movements.
The digital output signal is set/reset in the middle of the corner path for flying points,
as shown in Figure 6.
p3
p2
Zone
Figure 6 Set/Reset of digital output signal in the corner path with MoveLDO.
For stop points, we recommend the use of normal programming sequence with
MoveL + SetDO. But when using stop point in instruction MoveLDO, the digital output
signal is set/reset when the robot reaches the stop point.
The specified I/O signal is set/reset in execution mode continuously and stepwise forward but not in stepwise backward.
2-MoveLDO-278
Instructions
MoveLDO
Syntax
MoveLDO
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ T := < expression (IN) of num > ] ,
[ Zone := ] < expression (IN) of zonedata > ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ] ,
[ Signal := ] < variable (VAR) of signaldo>] ,
[ Value := ] < expression (IN) of dionum > ] ;
Related information
Described in:
Other positioning instructions
Definition of velocity
Definition of tools
Motion in general
Coordinate systems
2-MoveLDO-279
MoveLDO
2-MoveLDO-280
Instructions
Instructions
MoveL
MoveL
Example
MoveL p1, v1000, z30, tool2;
The TCP of the tool, tool2, is moved linearly to the position p1, with speed data
v1000 and zone data z30.
MoveL *, v1000\T:=5, fine, grip3;
The TCP of the tool, grip3, is moved linearly to a fine point stored in the
instruction (marked with an *). The complete movement takes 5 seconds.
Arguments
MoveL
[ \Conc ]
(Concurrent)
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
Speed
The speed data that applies to movements. Speed data defines the velocity for the
tool centre point, the tool reorientation and external axes.
2-MoveL-281
MoveL
Instructions
[ \V ]
(Velocity)
This argument is used to specify the velocity of the TCP in mm/s directly in the
instruction. It is then substituted for the corresponding velocity specified in the
speed data.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Zone
[ \Z ]
(Zone)
This argument is used to specify the position accuracy of the robot TCP directly
in the instruction. The length of the corner path is given in mm, which is
substituted for the corresponding zone specified in the zone data.
Tool
[ \WObj]
(Work Object)
The work object (coordinate system) to which the robot position in the instruction
is related.
This argument can be omitted, and if it is, the position is related to the world
coordinate system. If, on the other hand, a stationary tool or coordinated external
axes are used, this argument must be specified in order to perform a linear
movement relative to the work object.
[ \Corr]
(Correction)
Program execution
The robot and external units are moved to the destination position as follows:
- The TCP of the tool is moved linearly at constant programmed velocity.
- The tool is reoriented at equal intervals along the path.
- Uncoordinated external axes are executed at a constant velocity in order for
them to arrive at the destination point at the same time as the robot axes.
2-MoveL-282
Instructions
MoveL
If it is not possible to attain the programmed velocity for the reorientation or for the
external axes, the velocity of the TCP will be reduced.
A corner path is usually generated when movement is transferred to the next section of
a path. If a stop point is specified in the zone data, program execution only continues
when the robot and external axes have reached the appropriate position.
Examples
MoveL *, v2000 \V:=2200, z40 \Z:=45, grip3;
The TCP of the tool, grip3, is moved linearly to a position stored in the
instruction. The movement is carried out with data set to v2000 and z40; the
velocity and zone size of the TCP are 2200 mm/s and 45 mm respectively.
MoveL \Conc, *, v2000, z40, grip3;
The TCP of the tool, grip3, is moved linearly to a position stored in the
instruction. Subsequent logical instructions are executed while the robot moves.
MoveL start, v2000, z40, grip3 \WObj:=fixture;
The TCP of the tool, grip3, is moved linearly to a position, start. This position is
specified in the object coordinate system for fixture.
Syntax
MoveL
[ \ Conc , ]
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ V := < expression (IN) of num > ]
| [ \ T := < expression (IN) of num > ] ,
[Zone := ] < expression (IN) of zonedata >
[ \ Z := < expression (IN) of num > ] ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ]
[ \ Corr ];
2-MoveL-283
MoveL
Instructions
Related information
Described in:
Other positioning instructions
Definition of velocity
Definition of tools
Instructions - CorrWrite
Motion in general
Coordinate systems
2-MoveL-284
Instructions
MoveJSync
Examples
MoveJSync p1, vmax, z30, tool2, proc1;
The tool centre point (TCP) of the tool, tool2, is moved along a non-linear path
to the position, p1, with speed data vmax and zone data z30. Procedure proc1 is
executed in the middle of the corner path at p1.
Arguments
MoveJSync
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
Speed
The speed data that applies to movements. Speed data defines the velocity of the
tool centre point, the tool reorientation and external axes.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Zone
Tool
2-MoveJSync-285
MoveJSync
Instructions
[ \WObj]
(Work Object)
The work object (coordinate system) to which the robot position in the instruction
is related.
This argument can be omitted, and if it is, the position is related to the world coordinate system. If, on the other hand, a stationary TCP or coordinated external
axes are used, this argument must be specified.
ProcName
(Procedure Name)
Name of the RAPID procedure to be executed at the middle of the corner path in
the destination point.
Program execution
See the instruction MoveJ for more information about joint movements.
The specified RAPID procedure is executed when the TCP reaches the middle of the
corner path in the destination point of the MoveJSync instruction, as shown in Figure 7:
Figure 7 Execution of user-defined RAPID procedure in the middle of the corner path.
For stop points, we recommend the use of normal programming sequence with
MoveJ + other RAPID instructions in sequence.
2-MoveJSync-286
Instructions
MoveJSync
Continuously or Cycle
Forward step
Backward step
Not at all
Limitation
Switching execution mode after program stop from continuously or cycle to stepwise
forward or backward results in an error. This error tells the user that the mode switch
can result in missed execution of a RAPID procedure in the queue for execution on the
path. This error can be avoided if the program is stopped with StopInstr before the
mode switch.
Instruction MoveJSync cannot be used on TRAP level.
The specified RAPID procedure cannot be tested with stepwise execution.
Syntax
MoveJSync
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ T := < expression (IN) of num > ] ,
[ Zone := ] < expression (IN) of zonedata >
[ \ Z := < expression (IN) of num > ] ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ] ,
[ ProcName:= ] < expression (IN) of string > ] ;
Related information
Described in:
Other positioning instructions
Definition of velocity
Definition of tools
Motion in general
Coordinate systems
2-MoveJSync-287
MoveJSync
2-MoveJSync-288
Instructions
Instructions
MoveLSync
MoveL Sync
MoveLSync (Move Linearly Synchronously) is used to move the tool centre point
(TCP) linearly to a given destination.The specified RAPID procedure is executed at the
middle of the corner path in the destination point.
When the TCP is to remain stationary, this instruction can also be used to reorient the
tool.
Example
MoveLSync p1, v1000, z30, tool2, proc1;
The TCP of the tool, tool2, is moved linearly to the position p1, with speed data
v1000 and zone data z30. Procedure proc1 is executed in the middle of the corner
path at p1.
Arguments
MoveLSync ToPoint Speed [ \T ] Zone Tool
[ \WObj ] ProcName
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
Speed
The speed data that applies to movements. Speed data defines the velocity for the
tool centre point, the tool reorientation and external axes.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Zone
Tool
2-MoveLSync-289
MoveLSync
Instructions
[ \WObj]
(Work Object)
The work object (coordinate system) to which the robot position in the instruction
is related.
This argument can be omitted, and if it is, the position is related to the world coordinate system. If, on the other hand, a stationary TCP or coordinated external
axes are used, this argument must be specified.
ProcName
(Procedure Name)
Name of the RAPID procedure to be executed at the middle of the corner path in
the destination point.
Program execution
See the instruction MoveL for more information about linear movements.
The specified RAPID procedure is executed when the TCP reaches the middle of the
corner path in the destination point of the MoveLSync instruction, as shown in Figure 8:
For stop points, we recommend the use of normal programming sequence with
MoveL + other RAPID instructions in sequence.
2-MoveLSync-290
Instructions
MoveLSync
Continuously or Cycle
Forward step
Backward step
Not at all
Limitation
Switching execution mode after program stop from continuously or cycle to stepwise
forward or backward results in an error. This error tells the user that the mode switch
can result in missed execution of a RAPID procedure in the queue for execution on the
path. This error can be avoided if the program is stopped with StopInstr before the
mode switch.
Instruction MoveLSync cannot be used on TRAP level.
The specified RAPID procedure cannot be tested with stepwise execution.
Syntax
MoveLSync
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ T := < expression (IN) of num > ] ,
[ Zone := ] < expression (IN) of zonedata > ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ] ,
[ ProcName:= ] < expression (IN) of string > ] ;
Related information
Described in:
Other positioning instructions
Definition of velocity
Definition of tools
Motion in general
Coordinate systems
2-MoveLSync-291
MoveLSync
2-MoveLSync-292
Instructions
Instructions
Open
Open
Example
VAR iodev logfile;
...
Open "flp1:" \File:= "LOGDIR/LOGFILE1.DOC", logfile;
The file LOGFILE1.DOC in unit flp1: (diskette), directory LOGDIR, is opened
for writing. The reference name logfile is used later in the program when writing
to the file.
Arguments
Open
Object
A reference to the file or serial channel to open. This reference is then used for
reading from and writing to the file or serial channel.
[\Read]
Opens a file or serial channel for reading. When reading from a file, the reading
is started from the beginning of the file.
[\Write]
Opens a file or serial channel for writing. If the selected file already exists, its
contents are deleted. Anything subsequently written is written at the start of the
file.
2-Open-293
Open
Instructions
[\Append]
Opens a file or serial channel for writing. If the selected file already exists, anything subsequently written is written at the end of the file.
Open a file or serial channel with \Append and without the \Bin arguments. The
instruction opens a character-based file or serial channel for writing.
Open a file or serial channel with \Append and \Bin arguments. The instruction
opens a binary file or serial channel for both reading and writing.
The arguments \Read, \Write, \Append are mutually exclusive. If none of these are specified, the instruction acts in the same way as the \Write argument for character-based
files or a serial channel (instruction without \Bin argument) and in the same way as the
\Append argument for binary files or a serial channel (instruction with \Bin argument).
[\Bin]
Example
VAR iodev printer;
...
Open "sio1:", printer \Bin;
WriteStrBin printer, "This is a message to the printer\0D";
Close printer;
The serial channel sio1: is opened for binary reading and writing.
The reference name printer is used later when writing to and closing the serial
channel.
Program execution
The specified file or serial channel is opened so that it is possible to read from or write
to it.
It is possible to open the same physical file several times at the same time, but each
invocation of the Open instruction will return a different reference to the file (data type
iodev). E.g. it is possible to have one write pointer and one different read pointer to the
same file at the same time.
2-Open-294
Instructions
Open
The iodev variable used when opening a file or serial channel must be free from use. If
it has been used previously to open a file, this file must be closed prior to issuing a new
Open instruction with the same iodev variable.
Error handling
If a file cannot be opened, the system variable ERRNO is set to ERR_FILEOPEN. This
error can then be handled in the error handler.
Syntax
Open
[Object :=] <expression (IN) of string>
[\File:= <expression (IN) of string>] ,
[IODevice :=] <variable (VAR) of iodev>
[\Read] | [\Write] | [\Append]
[\Bin] ;
Related information
Described in:
Writing to and reading from
files or serial channels
2-Open-295
Open
2-Open-296
Instructions
Instructions
PathResol
PathResol
PathResol (Path Resolution) is used to override the configured geometric path sample
time defined in the system parameters for the manipulator.
Description
The path resolution affects the accuracy of the interpolated path and the program cycle
time. The path accuracy is improved and the cycle time is often reduced when the
parameter PathSampleTime is decreased. A value for parameter PathSampleTime
which is too low, may however cause CPU load problems in some demanding applications. However, use of the standard configured path resolution (PathSampleTime
100%) will avoid CPU load problems and provide sufficient path accuracy in most situations.
Example of PathResol usage:
Dynamically critical movements (max payload, high speed, combined joint motions
close to the border of the work area) may cause CPU load problems. Increase the
parameter PathSampleTime.
Low performance external axes may cause CPU load problems during coordination.
Increase the parameter PathSampleTime.
Arc-welding with high frequency weaving may require high resolution of the interpolated path. Decrease the parameter PathSampleTime.
Small circles or combined small movements with direction changes can decrease the
path performance quality and increase the cycle time. Decrease the parameter PathSampleTime.
Gluing with large reorientations and small corner zones can cause speed variations.
Decrease the parameter PathSampleTime.
Example
MoveJ p1,v1000,fine,tool1;
PathResol 150;
With the robot at a stop point, the path sample time is increased to 150% of the
configured.
2-PathResol-297
PathResol
Instructions
Arguments
PathResol PathSampleTime
PathSampleTime
Program execution
The path resolutions of all subsequent positioning instructions are affected until a new
PathResol instruction is executed. This will affect the path resolution during all program execution of movements (default path level and path level after StorePath) and
also during jogging.
The default value for override of path sample time is 100%. This value is automatically
set
- at a cold start-up
- when a new program is loaded
- when starting program execution from the beginning.
The current override of path sample time can be read from the variable C_MOTSET
(data type motsetdata) in the component pathresol.
Limitations
The robot must be standing still at a stop point before overriding the path sample time.
When there is a corner path in the program, the system will instead create a stop point
(warning 50146) and it is not possible to restart in this instruction following a power
failure.
Syntax
PathResol
[PathSampleTime := ] < expression (IN) of num> ;
2-PathResol-298
Instructions
PathResol
Related information
Described in:
Positioning instructions
Motion settings
2-PathResol-299
PathResol
2-PathResol-300
Instructions
Instructions
PDispOff
PDispOff
Examples
PDispOff;
Deactivation of a program displacement.
MoveL p10, v500, z10, tool1;
PDispOn \ExeP:=p10, p11, tool1;
MoveL p20, v500, z10, tool1;
MoveL p30, v500, z10, tool1;
PDispOff;
MoveL p40, v500, z10, tool1;
A program displacement is defined as the difference between the positions p10
and p11. This displacement affects the movement to p20 and p30, but not to p40.
Program execution
Active program displacement is reset. This means that the program displacement coordinate system is the same as the object coordinate system, and thus all programmed
positions will be related to the latter.
Syntax
PDispOff ;
Related information
Described in:
Definition of program displacement
using two positions
Instructions - PDispOn
Instructions - PDispSet
2-PDispOff-301
PDispOff
2-PDispOff-302
Instructions
Instructions
PDispOn
PDispOn
Examples
MoveL p10, v500, z10, tool1;
PDispOn \ExeP:=p10, p20, tool1;
Activation of a program displacement (parallel movement). This is calculated
based on the difference between positions p10 and p20.
MoveL p10, v500, fine, tool1;
PDispOn *, tool1;
Activation of a program displacement (parallel movement). Since a stop point
has been used in the previous instruction, the argument \ExeP does not have to
be used. The displacement is calculated on the basis of the difference between
the robots actual position and the programmed point (*) stored in the instruction.
PDispOn \Rot \ExeP:=p10, p20, tool1;
Activation of a program displacement including a rotation. This is calculated
based on the difference between positions p10 and p20.
Arguments
PDispOn [ \Rot ] [ \ExeP ] ProgPoint Tool [ \WObj ]
[\Rot ]
(Rotation)
The difference in the tool orientation is taken into consideration and this involves
a rotation of the program.
[\ExeP ]
(Executed Point)
(Programmed Point)
2-PDispOn-303
PDispOn
Instructions
Tool
[ \WObj]
(Work Object)
The work object (coordinate system) to which the ProgPoint position is related.
This argument can be omitted and, if it is, the position is related to the world
coordinate system. However, if a stationary TCP or coordinated external axes are
used, this argument must be specified.
The arguments Tool and \WObj are used both to calculate the ProgPoint during
programming and to calculate the current position during program execution if
no ExeP argument is programmed.
Program execution
Program displacement means that the ProgDisp coordinate system is translated in
relation to the object coordinate system. Since all positions are related to the ProgDisp
coordinate system, all programmed positions will also be displaced. See Figure 9.
y
New
position, ExeP
y
Original
position, ProgPoint
x
Program displacement
2-PDispOn-304
Instructions
PDispOn
If the argument \Rot is used, the rotation is also calculated based on the tool orientation
at the two positions. The displacement will be calculated in such a way that the new
position (ExeP) will have the same position and orientation in relation to the displaced
coordinate system, ProgDisp, as the old position (ProgPoint) had in relation to the
original coordinate system (see Figure 10).
y
y
New
position, ExeP
New
orientation
Original
position, ProgPoint
Original
orientation Program displacement
x
Object Coordinate System
Example
PROC draw_square()
PDispOn *, tool1;
MoveL *, v500, z10, tool1;
MoveL *, v500, z10, tool1;
MoveL *, v500, z10, tool1;
MoveL *, v500, z10, tool1;
PDispOff;
ENDPROC
.
MoveL p10, v500, fine, tool1;
draw_square;
MoveL p20, v500, fine, tool1;
draw_square;
MoveL p30, v500, fine, tool1;
draw_square;
The routine draw_square is used to execute the same motion pattern at three
different positions, based on the positions p10, p20 and p30. See Figure 11.
2-PDispOn-305
PDispOn
Instructions
p30
p10
p20
Syntax
PDispOn
[ [ \ Rot ]
[ \ ExeP := < expression (IN) of robtarget >] ,]
[ ProgPoint := ] < expression (IN) of robtarget > ,
[ Tool := ] < persistent (PERS) of tooldata>
[ \WObj := < persistent (PERS) of wobjdata> ] ;
Related information
Described in:
Deactivation of program displacement
Instructions - PDispOff
Instructions - PDispSet
Coordinate systems
Definition of tools
More examples
Instructions - PDispOff
2-PDispOn-306
Instructions
PDispSet
PDispSet
PDispSet (Program Displacement Set) is used to define and activate a program displacement using values.
Program displacement is used, for example, when similar motion patterns are repeated
at several different places in the program.
Example
VAR pose xp100 := [ [100, 0, 0], [1, 0, 0, 0] ];
.
PDispSet xp100;
Activation of the xp100 program displacement, meaning that:
- The ProgDisp coordinate system is displaced 100 mm from the object coordinate system, in the direction of the positive x-axis (see Figure 12).
- As long as this program displacement is active, all positions will be displaced
100 mm in the direction of the x-axis.
Object
ProgDisp
100
Arguments
PDispSet DispFrame
DispFrame
(Displacement Frame)
Datatyp: pose
Program execution
Program displacement involves translating and/or rotating the ProgDisp coordinate
system relative to the object coordinate system. Since all positions are related to the
ProgDisp coordinate system, all programmed positions will also be displaced.
See Figure 13.
2-PDispSet-307
PDispSet
Instructions
.
y
y
New
position
New
orientation
Original
position
Original
orientation Program displacement
x
Object Coordinate System
Syntax
PDispSet
[ DispFrame := ] < expression (IN) of pose> ;
Related information
Described in:
Deactivation of program displacement
Instructions - PDispOff
Instructions - PDispOn
Coordinate systems
Instructions - PDispOn
2-PDispSet-308
Instructions
PulseDO
PulseDO
Examples
PulseDO do15;
A pulse with a pulse length of 0.2 s is generated on the output signal do15.
PulseDO \PLength:=1.0, ignition;
A pulse of length 1.0 s is generated on the signal ignition.
Arguments
PulseDO
[ \PLength ] Signal
[ \PLength ]
(Pulse Length)
Program execution
A pulse is generated with a specified pulse length (see Figure 14).
:
Pulse length
1
Signal level
0
Execution of the instruction PulseDO
Execution of the instruction PulseDO
1
Signal level
0
Figure 14 Generation of a pulse on a digital output signal.
2-PulseDO-309
PulseDO
Instructions
The next instruction is executed directly after the pulse starts. The pulse can then be set/
reset without affecting the rest of the program execution.
Limitations
The length of the pulse has a resolution of 0.01 seconds. Programmed values that differ
from this are rounded off.
Syntax
PulseDO
[ \ PLength := < expression (IN) of num > , ]
[ Signal := ] < variable (VAR) of signaldo > ;
Related information
Described in:
Input/Output instructions
Configuration of I/O
2-PulseDO-310
Instructions
RAISE
RAISE
Example
IF ...
IF ...
IF ...
RAISE escape1;
.
ERROR
IF ERRNO=escape1 RAISE;
The routine is interrupted to enable it to remove itself from a low level in the
program. A jump occurs to the error handler of the called routine.
Arguments
RAISE
[ Error no. ]
Error no.
Error number: Any number between 1 and 90 which the error handler can use to
locate the error that has occurred (the ERRNO system variable).
It is also possible to book an error number outside the range 1-90 with the
instruction BookErrNo.
The error number must be specified outside the error handler in a RAISE
instruction in order to be able to transfer execution to the error handler of that
routine.
If the instruction is present in a routines error handler, the error number may not
be specified. In this case, the error is propagated to the error handler of the calling
routine.
2-RAISE-311
RAISE
Instructions
Program execution
Program execution continues in the routines error handler. After the error handler has
been executed, program execution can continue with:
- the routine that called the routine in question (RETURN),
- the error handler of the routine that called the routine in question (RAISE).
If the RAISE instruction is present in a routines error handler, program execution
continues in the error handler of the routine that called the routine in question. The
same error number remains active.
If the RAISE instruction is present in a trap routine, the error is dealt with by the
systems error handler.
Error handling
If the error number is out of range, the system variable ERRNO is set to
ERR_ILLRAISE (see "Data types - errnum"). This error can be handled in the error
handler.
Syntax
(EBNF)
RAISE [<error number>] ;
<error number> ::= <expression>
Related information
Described in:
Error handling
Instructions - BookErrNo
2-RAISE-312
Instructions
ReadAnyBin
ReadAnyBin
ReadAnyBin (Read Any Binary) is used to read any type of data from a binary serial
channel or file.
Example
VAR iodev channel2;
VAR robtarget next_target;
...
Open "sio1:", channel2 \Bin;
ReadAnyBin channel2, next_target;
The next robot target to be executed, next_target, is read from the channel
referred to by channel2.
Arguments
ReadAnyBin
IODevice
[\Time]
The max. time for the reading operation (timeout) in seconds. If this argument is
not specified, the max. time is set to 60 seconds.
If this time runs out before the read operation is finished, the error handler will
be called with the error code ERR_DEV_MAXTIME. If there is no error handler, the execution will be stopped.
The timeout function is in use also during program stop and will be noticed in
the RAPID program at program start.
Program execution
As many bytes as required for the specified data are read from the specified binary
serial channel or file.
2-ReadAnyBin-313
ReadAnyBin
Instructions
Limitations
This instruction can only be used for serial channels or files that have been opened for
binary reading.
The data to be read by this instruction must have a value data type of atomic, string, or
record data type. Semi-value and non-value data types cannot be used.
Array data cannot be used.
Note that the VAR or PERS variable, for storage of the data read, can be updated in several steps. Therefore, always wait until the whole data structure is updated before using
read data from a TRAP or another program task.
Error handling
If an error occurs during reading, the system variable ERRNO is set to
ERR_FILEACC. This error can then be handled in the error handler.
If the end of the file is detected before all the bytes are read, the system variable
ERRNO is set to ERR_RANYBIN_EOF. This error can then be handled in the error
handler.
Example
CONST num NEW_ROBT:=12;
CONST num NEW_WOBJ:=20;
VAR iodev channel;
VAR num input;
VAR robtarget cur_robt;
VAR wobjdata cur_wobj;
Open "sio1:", channel\Bin;
! Wait for the opcode character
input := ReadBin (channel \Time:= 0.1);
TEST input
CASE NEW_ROBT:
ReadAnyBin channel, cur_robt;
CASE NEW_WOBJ:
ReadAnyBin channel, cur_wobj;
ENDTEST
Close channel;
As a first step, the opcode of the message is read from the serial channel. According to this opcode a robtarget or a wobjdata is read from the serial channel.
2-ReadAnyBin-314
Instructions
ReadAnyBin
Syntax
ReadAnyBin
[IODevice:=] <variable (VAR) of iodev>,
[Data:=] <var or pers (INOUT) of ANYTYPE>
[\Time:= <expression (IN) of num>];
Related information
Described in:
Opening (etc.) of serial channels
or files
Instructions - WriteAnyBin
2-ReadAnyBin-315
ReadAnyBin
2-ReadAnyBin-316
Instructions
Instructions
Reset
Reset
Examples
Reset do15;
The signal do15 is set to 0.
Reset weld;
The signal weld is set to 0.
Arguments
Reset
Signal
Signal
Program execution
The true value depends on the configuration of the signal. If the signal is inverted in
the system parameters, this instruction causes the physical channel to be set to 1.
Syntax
Reset
[ Signal := ] < variable (VAR) of signaldo > ;
2-Reset-317
Reset
Instructions
Related information
Described in:
Setting a digital output signal
Instructions - Set
Input/Output instructions
Configuration of I/O
System Parameters
2-Reset-318
Instructions
RestoPath
RestoPath
RestoPath is used to restore a path that was stored at a previous stage using the instruction StorePath.
Example
RestoPath;
Restores the path that was stored earlier using StorePath.
Program execution
The current movement path of the robot and the external axes is deleted and the path
stored earlier using StorePath is restored. Nothing moves, however, until the instruction StartMove is executed or a return is made using RETRY from an error handler.
Example
ArcL p100, v100, seam1, weld5, weave1, z10, gun1;
...
ERROR
IF ERRNO=AW_WELD_ERR THEN
gun_cleaning;
RETRY;
ENDIF
...
PROC gun_cleaning()
VAR robtarget p1;
StorePath;
p1 := CRobT();
MoveL pclean, v100, fine, gun1;
...
MoveL p1, v100, fine, gun1;
RestoPath;
ENDPROC
In the event of a welding error, program execution continues in the error handler
of the routine, which, in turn, calls gun_cleaning. The movement path being executed at the time is then stored and the robot moves to the position pclean where
the error is rectified. When this has been done, the robot returns to the position
where the error occurred, p1, and stores the original movement once again. The
weld then automatically restarts, meaning that the robot is first reversed along
the path before welding starts and ordinary program execution can continue.
2-RestoPath-319
RestoPath
Instructions
Limitations
Only the movement path data is stored with the instruction StorePath.
If the user wants to order movements on the new path level, the actual stop position
must be stored directly after StorePath and before RestoPath make a movement to the
stored stop position on the path.
The movement instruction which precedes this instruction should be terminated with a
stop point.
Syntax
RestoPath;
Related information
Described in:
Storing paths
Instructions - StorePath
More examples
Instructions - StorePath
2-RestoPath-320
Instructions
RETRY
RETRY
Example
reg2 := reg3/reg4;
.
ERROR
IF ERRNO = ERR_DIVZERO THEN
reg4 := 1;
RETRY;
ENDIF
An attempt is made to divide reg3 by reg4. If reg4 is equal to 0 (division by zero),
a jump is made to the error handler, which initialises reg4. The RETRY
instruction is then used to jump from the error handler and another attempt is
made to complete the division.
Program execution
Program execution continues with (re-executes) the instruction that caused the error.
Error handling
If the maximum number of retries (4 retries) is exceeded, the program execution stops
with an error message and the system variable ERRNO is set to ERR_EXCRTYMAX
(see "Data types - errnum").
Limitations
The instruction can only exist in a routines error handler. If the error was created using
a RAISE instruction, program execution cannot be restarted with a RETRY instruction,
then the instruction TRYNEXT should be used.
Syntax
RETRY ;
2-RETRY-321
RETRY
Instructions
Related information
Described in:
Error handlers
Instructions - TRYNEXT
2-RETRY-322
Instructions
RETURN
RETURN
RETURN is used to finish the execution of a routine. If the routine is a function, the
function value is also returned.
Examples
errormessage;
Set do1;
.
PROC errormessage()
TPWrite "ERROR";
RETURN;
ENDPROC
The errormessage procedure is called. When the procedure arrives at the
RETURN instruction, program execution returns to the instruction following the
procedure call, Set do1.
FUNC num abs_value(num value)
IF value<0 THEN
RETURN -value;
ELSE
RETURN value;
ENDIF
ENDFUNC
The function returns the absolute value of a number.
Arguments
RETURN
[ Return value ]
Return value
ration
2-RETURN-323
RETURN
Instructions
Program execution
The result of the RETURN instruction may vary, depending on the type of routine it is
used in:
- Main routine: If a program stop has been ordered at the end of the cycle, the
program stops. Otherwise, program execution continues with
the first instruction of the main routine.
- Procedure:
- Function:
- Trap routine:
Syntax
(EBNF)
RETURN [ <expression> ];
Related information
Described in:
Functions and Procedures
Trap routines
Error handlers
2-RETURN-324
Instructions
Rewind
Rewind
Example
Rewind iodev1;
The file referred to by iodev1 will have the file position set to the beginning of
the file.
Arguments
Rewind
IODevice
IODevice
Program execution
The specified file is rewound to the beginning.
2-Rewind-325
Rewind
Instructions
Example
! IO device and numeric variable for use together with a binary file
VAR iodev dev;
VAR num bindata;
! Open the binary file with \Write switch to erase old contents
Open "flp1:"\File := "bin_file",dev \Write;
Close dev;
! Open the binary file with \Bin switch for binary read and write access
Open "flp1:"\File := "bin_file",dev \Bin;
WriteStrBin dev,"Hello world";
! Rewind the file pointer to the beginning of the binary file
! Read contents of the file and write the binary result on TP
! (gives 72 101 108 108 111 32 119 111 114 108 100 )
Rewind dev;
bindata := ReadBin(dev);
WHILE bindata <> EOF_BIN DO
TPWrite " " \Num:=bindata;
bindata := ReadBin(dev);
ENDWHILE
! Close the binary file
Close dev;
The instruction Rewind is used to rewind a binary file to the beginning so that the
contents of the file can be read back with ReadBin.
Syntax
Rewind
[IODevice :=] <variable (VAR) of iodev>;
Related information
Described in:
Opening (etc.) of files
2-Rewind-326
Instructions
Save
Save
Example
Load "ram1disk:PART_B.MOD";
...
Save "PART_B";
Load the program module with the file name PART_B.MOD from the ram1disk
into the program memory.
Save the program module PART_B with the original file path ram1disk with the
original file name PART_B.MOD.
Arguments
Save
[\Task]
ModuleName
[\FilePath]
The file path and the file name to the place where the program module is to be
saved. The file name shall be excluded when the argument \File is used.
2-Save-327
Save
Instructions
[\File]
When the file name is excluded in the argument \FilePath, it must be specified
with this argument.
The argument \FilePath can only be omitted for program modules loaded with Load or
StartLoad-WaitLoad and the program module will be stored at the same destination as
specified in these instructions. To store the program module at another destination it is
also possible to use the argument \FilePath.
To be able to save a program module that previously was loaded from the teach pendant, external computer, or system configuration, the argument \FilePath must be used.
Program execution
Program execution waits for the program module to finish saving before proceeding
with the next instruction.
Example
Save "PART_A" \FilePath:="ram1disk:DOORDIR/PART_A.MOD";
Save the program module PART_A to the ram1disk in the file PART_A.MOD
and in the directory DOORDIR.
Save "PART_A" \FilePath:="ram1disk: \File:=DOORDIR/PART_A.MOD";
Same as above but another syntax.
Save \Task:=TSK1Id, "PART_A" \FilePath:="ram1disk:DOORDIR/PART_A.MOD";
Save program module PART_A in program task TSK1 to the specified destination. This is an example where the instruction Save is executing in one program
task and the saving is done in another program task.
Limitations
TRAP routines, system I/O events and other program tasks cannot execute during the
saving operation. Therefore, any such operations will be delayed.
The save operation can interrupt update of PERS data done step by step from other program tasks. This will result in inconsistent whole PERS data.
A program stop during execution of the Save instruction can result in a guard stop with
motors off and the error message "20025 Stop order timeout" will be displayed on the
Teach Pendant.
Avoid ongoing robot movements during the saving.
2-Save-328
Instructions
Save
Error handling
If the program module cannot be saved because there is no module name, unknown, or
ambiguous module name, the system variable ERRNO is set to ERR_MODULE.
If the save file cannot be opened because of permission denied, no such directory, or
no space left on device, the system variable ERRNO is set to ERR_IOERROR.
If argument \FilePath is not specified for program modules loaded from the Teach Pendant, System Parameters, or an external computer, the system variable ERRNO is set
to ERR_PATH.
The errors above can be handled in the error handler.
Syntax
Save
[ \ Task := <variable (VAR) of taskid> , ]
[ ModuleName := ] <expression (IN) of string>
[ \ FilePath :=<expression (IN) of string> ]
[ \ File := <expression (IN) of string>] ;
Related information
Described in:
Program tasks
2-Save-329
Save
2-Save-330
Instructions
Instructions
SearchC
SearchC
SearchC (Search Circular) is used to search for a position when moving the tool centre
point (TCP) circularly.
During the movement, the robot supervises a digital input signal. When the value of
the signal changes to the requested one, the robot immediately reads the current
position.
This instruction can typically be used when the tool held by the robot is a probe for
surface detection. Using the SearchC instruction, the outline coordinates of a work
object can be obtained.
Examples
SearchC sen1, sp, cirpoint, p10, v100, probe;
The TCP of the probe is moved circularly towards the position p10 at a speed of
v100. When the value of the signal do1 changes to active, the position is stored
in sp.
SearchC \Stop, sen1, sp, cirpoint, p10, v100, probe;
The TCP of the probe is moved circularly towards the position p10. When the
value of the signal do1 changes to active, the position is stored in sp and the robot
stops immediately.
Arguments
SearchC [ \Stop ] | [ \PStop ] | [ \SStop ] | [ \Sup ] Signal [ \Flanks ]
SearcPoint CirPoint ToPoint Speed [ \V ] | [ \T ] Tool [ \WObj ] [ \Corr
]
[ \Stop ]
(Stiff Stop)
The robot movement is stopped, as quickly as possible, without keeping the TCP
on the path (hard stop), when the value of the search signal changes to active.
However, the robot is moved a small distance before it stops and is not moved
back to the searched position, i.e. to the position where the signal changed.
[ \PStop ]
(Path Stop)
The robot movement is stopped as quickly as possible, while keeping the TCP
on the path (soft stop), when the value of the search signal changes to active.
However, the robot is moved a distance before it stops and is not moved back to
the searched position, i.e. to the position where the signal changed.
8-SearchC-331
SearchC
Instructions
[ \SStop ]
(Smooth Stop)
The robot movement is stopped as quickly as possible, while keeping the TCP
close to or on the path (smooth stop), when the value of the search signal changes
to active. However, the robot is moved only a small distance before it stops and
is not moved back to the searched position, i.e. to the position where the signal
changed. SStop is faster then PStop. But when the robot is running faster than 100
mm/s, it stops in the direction of the tangent of the movement which causes it to
marginally slide of the path.
[ \Sup ]
(Supervision)
The positive and the negative edge of the signal is valid for a search hit.
If the argument \Flanks is omitted, only the positive edge of the signal is valid for
a search hit and a signal supervision will be activated at the beginning of a search
process. This means that if the signal has a positive value already at the beginning
of a search process, the robot movement is stopped as quickly as possible, while
keeping the TCP on the path (soft stop). However, the robot is moved a small
distance before it stops and is not moved back to the start position. A user
recovery error (ERR_SIGSUPSEARCH) will be generated and can be dealt with
by the error handler.
SearchPoint
The position of the TCP and external axes when the search signal has been
triggered. The position is specified in the outermost coordinate system, taking the
specified tool, work object and active ProgDisp/ExtOffs coordinate system into
consideration.
CirPoint
The circle point of the robot. See the instruction MoveC for a more detailed
description of circular movement. The circle point is defined as a named position
or stored directly in the instruction (marked with an * in the instruction).
8-SearchC-332
Instructions
SearchC
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
SearchC always uses a stop point as zone data for the destination.
Speed
The speed data that applies to movements. Speed data defines the velocity of the
tool centre point, the external axes and of the tool reorientation.
[ \V ]
(Velocity)
This argument is used to specify the velocity of the TCP in mm/s directly in the
instruction. It is then substituted for the corresponding velocity specified in the
speed data.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Tool
[ \WObj]
(Work Object)
The work object (coordinate system) to which the robot positions in the
instruction are related.
This argument can be omitted, and if it is, the position is related to the world
coordinate system. If, on the other hand, a stationary TCP or coordinated
external axes are used, this argument must be specified for a linear movement
relative to the work object to be performed.
[ \Corr]
(Correction)
Program execution
See the instruction MoveC for information about circular movement.
The movement is always ended with a stop point, i.e. the robot is stopped at the
destination point.
8-SearchC-333
SearchC
Instructions
When a flying search is used, i.e. the \Sup argument is specified, the robot movement
always continues to the programmed destination point. When a search is made using
the switch \Stop, \PStop or \SStop, the robot movement stops when the first signal is
detected.
The SearchC instruction returns the position of the TCP when the value of the digital
signal changes to the requested one, as illustrated in Figure 15.
1
0
time
Example
SearchC \Sup, sen1\Flanks, sp, cirpoint, p10, v100, probe;
The TCP of the probe is moved circularly towards the position p10. When the
value of the signal do1 changes to active or passive, the position is stored in sp.
If the value of the signal changes twice, program execution stops.
Limitations
Zone data for the positioning instruction that precedes SearchC must be used carefully.
The start of the search, i.e. when the I/O signal is ready to react, is not, in this case, the
programmed destination point of the previous positioning instruction, but a point along
the real robot path. Figure 16 illustrates an example of something that may go wrong
when zone data other than fine is used.
The instruction SearchC should never be restarted after the circle point has been
passed. Otherwise the robot will not take the programmed path (positioning around the
circular path in another direction compared with that programmed).
8-SearchC-334
Instructions
SearchC
Search object
End point
Start point with
zone data fine
Figure 16 A match is made on the wrong side of the object because the wrong zone data was
used.
Error handling
An error is reported during a search when:
- no signal detection occurred - this generates the error ERR_WHLSEARCH.
- more than one signal detection occurred this generates the error
ERR_WHLSEARCH only if the \Sup argument is used.
- the signal has already a positive value at the beginning of the search process this generates the error ERR_SIGSUPSEARCH only if the \Flanks argument
is omitted.
Errors can be handled in different ways depending on the selected running mode:
Continuous forward / ERR_WHLSEARCH
No position is returned and the movement always continues to the programmed
destination point. The system variable ERRNO is set to ERR_WHLSEARCH
and the error can be handled in the error handler of the routine.
Continuous forward / Instruction forward / ERR_SIGSUPSEARCH
No position is returned and the movement always stops as quickly as possible at
the beginning of the search path. The system variable ERRNO is set to
ERR_SIGSUPSEARCH and the error can be handled in the error handler of the
routine.
8-SearchC-335
SearchC
Instructions
Instruction forward / ERR_WHLSEARCH
No position is returned and the movement always continues to the programmed
destination point. Program execution stops with an error message.
Instruction backward
During backward execution, the instruction just carries out the movement
without any signal supervision.
Syntax
SearchC
[ \ Stop, ] | [ \ PStop ,] | [ \ SStop , ] | [ \ Sup , ]
[ Signal := ] < variable (VAR) of signaldi >
[\ Flanks],
[ SearchPoint := ] < var or pers (INOUT) of robtarget > ,
[ CirPoint := ] < expression (IN) of robtarget > ,
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ V := < expression (IN) of num > ]
| [ \ T := < expression (IN) of num > ] ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ]
[ \ Corr ];
Related information
Described in:
Linear searches
Instructions - SearchL
Instructions - CorrWrite
Circular movement
Definition of velocity
Definition of tools
Motion in general
Instructions - SearchL
8-SearchC-336
Instructions
SearchL
SearchL
SearchL (Search Linear) is used to search for a position when moving the tool centre
point (TCP) linearly.
During the movement, the robot supervises a digital input signal. When the value of
the signal changes to the requested one, the robot immediately reads the current
position.
This instruction can typically be used when the tool held by the robot is a probe for
surface detection. Using the SearchL instruction, the outline coordinates of a work
object can be obtained.
Examples
SearchL do1, sp, p10, v100, probe;
The TCP of the probe is moved linearly towards the position p10 at a speed of
v100. When the value of the signal do1 changes to active, the position is stored
in sp.
SearchL \Stop, sen1, sp, p10, v100, probe;
The TCP of the probe is moved linearly towards the position p10. When the
value of the signal do1changes to active, the position is stored in sp and the robot
stops immediately.
Arguments
SearchL [ \Stop ] | [ \PStop ] | [ \SStop ] | [ \Sup ] Signal
[ \Flanks ] SearchPoint ToPoint Speed [ \V ] | [ \T ] Tool [ \WObj ]
[ \Corr ]
[ \Stop ]
(Stiff Stop)
The robot movement is stopped as quickly as possible, without keeping the TCP
on the path (hard stop), when the value of the search signal changes to active.
However, the robot is moved a small distance before it stops and is not moved
back to the searched position, i.e. to the position where the signal changed.
[ \PStop ]
(Path Stop)
The robot movement is stopped as quickly as possible, while keeping the TCP
on the path (soft stop), when the value of the search signal changes to active.
However, the robot is moved a distance before it stops and is not moved back to
the searched position, i.e. to the position where the signal changed.
8-SearchL-337
SearchL
Instructions
[ \SStop ]
(Smooth Stop)
The robot movement is stopped as quickly as possible, while keeping the TCP
close to or on the path (smooth stop), when the value of the search signal changes
to active. However, the robot is moved only a small distance before it stops and
is not moved back to the searched position, i.e. to the position where the signal
changed. SStop is faster then PStop. But when the robot is running faster than 100
mm/s it stops in the direction of the tangent of the movement which causes it to
marginally slide off the path.
[\Sup ]
(Supervision)
The positive and the negative edge of the signal is valid for a search hit.
If the argument \Flanks is omitted, only the positive edge of the signal is valid for
a search hit and a signal supervision will be activated at the beginning of a search
process. This means that if the signal has the positive value already at the
beginning of a search process, the robot movement is stopped as quickly as
possible, while keeping the TCP on the path (soft stop). A user recovery error
(ERR_SIGSUPSEARCH) will be generated and can be handled in the error
handler.
SearchPoint
The position of the TCP and external axes when the search signal has been
triggered. The position is specified in the outermost coordinate system, taking the
specified tool, work object and active ProgDisp/ExtOffs coordinate system into
consideration.
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
SearchL always uses a stop point as zone data for the destination.
8-SearchL-338
Instructions
SearchL
Speed
The speed data that applies to movements. Speed data defines the velocity of the
tool centre point, the external axes and of the tool reorientation.
[ \V ]
(Velocity)
This argument is used to specify the velocity of the TCP in mm/s directly in the
instruction. It is then substituted for the corresponding velocity specified in the
speed data.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Tool
[ \WObj]
(Work Object)
The work object (coordinate system) to which the robot position in the
instruction is related.
This argument can be omitted, and if it is, the position is related to the world
coordinate system. If, on the other hand, a stationary TCP or coordinated
external axes are used, this argument must be specified for a linear movement
relative to the work object to be performed.
[ \Corr]
(Correction)
Program execution
See the instruction MoveL for information about linear movement.
The movement always ends with a stop point, i.e. the robot stops at the destination
point.
If a flying search is used, i.e. the \Sup argument is specified, the robot movement
always continues to the programmed destination point. If a search is made using the
switch \Stop, \PStop or \SStop, the robot movement stops when the first signal is
detected.
The SearchL instruction stores the position of the TCP when the value of the digital
signal changes to the requested one, as illustrated in Figure 17.
8-SearchL-339
SearchL
Instructions
1
0
time
Examples
SearchL \Sup, sen1\Flanks, sp, p10, v100, probe;
The TCP of the probe is moved linearly towards the position p10. When the value
of the signal do1changes to active or passive, the position is stored in sp. If the
value of the signal changes twice, program execution stops after the search
process is finished.
SearchL \Stop, sen1, sp, p10, v100, tool1;
MoveL sp, v100, fine, tool1;
PDispOn *, tool1;
MoveL p100, v100, z10, tool1;
MoveL p110, v100, z10, tool1;
MoveL p120, v100, z10, tool1;
PDispOff;
At the beginning of the search process, a check on the signal do1will be done and
if the signal already has a positive value, the program execution stops.
Otherwise the TCP of tool1 is moved linearly towards the position p10. When the
value of the signal do1changes to active, the position is stored in sp and the robot
is moved back to this point. Using program displacement, the robot then moves
relative to the searched position, sp.
Limitations
Zone data for the positioning instruction that precedes SearchL must be used carefully.
The start of the search, i.e. when the I/O signal is ready to react, is not, in this case, the
programmed destination point of the previous positioning instruction, but a point along
the real robot path. Figure 18 to Figure 20 illustrate examples of things that may go
wrong when zone data other than fine is used.
8-SearchL-340
Instructions
SearchL
Search object
End point
Figure 18 A match is made on the wrong side of the object because the wrong zone data was
used.
Search object
End point
Figure 19 No match detected because the wrong zone data was used.
Search object
End point
Figure 20 No match detected because the wrong zone data was used.
Error handling
An error is reported during a search when:
- no signal detection occurred - this generates the error ERR_WHLSEARCH.
- more than one signal detection occurred this generates the error
ERR_WHLSEARCH only if the \Sup argument is used.
- the signal already has a positive value at the beginning of the search process this generates the error ERR_SIGSUPSEARCH only if the \Flanks argument
is omitted.
8-SearchL-341
SearchL
Instructions
Errors can be handled in different ways depending on the selected running mode:
Continuous forward / ERR_WHLSEARCH
No position is returned and the movement always continues to the programmed
destination point. The system variable ERRNO is set to ERR_WHLSEARCH
and the error can be handled in the error handler of the routine.
Continuous forward / Instruction forward / ERR_SIGSUPSEARCH
No position is returned and the movement always stops as quickly as possible at
the beginning of the search path.The system variable ERRNO is set to
ERR_SIGSUPSEARCH and the error can be handled in the error handler of the
routine.
Instruction forward / ERR_WHLSEARCH
No position is returned and the movement continues to the programmed
destination point. Program execution stops with an error message.
Instruction backward
During backward execution, the instruction just carries out the movement
without any signal supervision.
Example
VAR num fk;
.
MoveL p10, v100, fine, tool1;
SearchL \Stop, sen1, sp, p20, v100, tool1;
.
ERROR
IF ERRNO=ERR_WHLSEARCH THEN
MoveL p10, v100, fine, tool1;
RETRY;
ELSEIF ERRNO=ERR_SIGSUPSEARCH THEN
TPWrite The signal of the SearchL instruction is already high!;
TPReadFK fk,Try again after manual reset of signal ?,YES,,,,NO;
IF fk = 1 THEN
MoveL p10, v100, fine, tool1;
RETRY;
ELSE
Stop;
ENDIF
ENDIF
If the signal is already active at the beginning of the search process, a user dialog
will be activated (TPReadFK ...;). Reset the signal and push YES on the user
dialog and the robot moves back to p10 and tries once more. Otherwise program
execution will stop.
If the signal is passive at the beginning of the search process, the robot searches
from position p10 to p20. If no signal detection occurs, the robot moves back to
p10 and tries once more.
8-SearchL-342
Instructions
SearchL
Syntax
SearchL
[ \ Stop , ] | [ \ PStop ,] | [ \ SStop ,] | [ \ Sup , ]
[ Signal := ] < variable (VAR) of signaldi >
[\ Flanks] ,
[ SearchPoint := ] < var or pers (INOUT) of robtarget > ,
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ V := < expression (IN) of num > ]
| [ \ T := < expression (IN) of num > ] ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ]
[ \ Corr ];
Related information
Described in:
Circular searches
Instructions - SearchC
Instructions - CorrWrite
Linear movement
Definition of velocity
Definition of tools
Motion in general
8-SearchL-343
SearchL
8-SearchL-344
Instructions
Instructions
Set
Set
Examples
Set do15;
The signal do15 is set to 1.
Set weldon;
The signal weldon is set to 1.
Arguments
Set
Signal
Signal
Program execution
The true value depends on the configuration of the signal. If the signal is inverted in
the system parameters, this instruction causes the physical channel to be set to zero.
Syntax
Set
[ Signal := ] < variable (VAR) of signaldo > ;
2-Set-345
Set
Instructions
Related information
Described in:
2-Set-346
Instructions - Reset
Input/Output instructions
Configuration of I/O
System Parameters
Instructions
SetAO
SetAO
Example
SetAO ao2, 5.5;
The signal ao2 is set to 5.5.
Arguments
SetAO
Signal Value
Signal
Program execution
The programmed value is scaled (in accordance with the system parameters) before it
is sent on the physical channel. See Figure 21.
Physical value of the
output signal (V, mA, etc.)
MAX SIGNAL
MAX PROGRAM
Logical value in the
program
MIN PROGRAM
MIN SIGNAL
Figure 21 Diagram of how analog signal values are scaled.
2-SetAO-347
SetAO
Instructions
Example
SetAO weldcurr, curr_outp;
The signal weldcurr is set to the same value as the current value of the variable
curr_outp.
Syntax
SetAO
[ Signal := ] < variable (VAR) of signalao > ,
[ Value := ] < expression (IN) of num > ;
Related information
Described in:
Input/Output instructions
Configuration of I/O
System Parameters
2-SetAO-348
Instructions
SetDO
SetDO
Examples
SetDO do15, 1;
The signal do15 is set to 1.
SetDO weld, off;
The signal weld is set to off.
SetDO \SDelay := 0.2, weld, high;
The signal weld is set to high with a delay of 0.2 s. Program execution, however,
continues with the next instruction.
Arguments
SetDO
[ \SDelay ]
(Signal Delay)
Delays the change for the amount of time given in seconds (0.1 - 32s).
Program execution continues directly with the next instruction. After the given
time-delay, the signal is changed without the rest of the program execution being
affected.
If the argument is omitted, the value of the signal is changed directly.
Signal
2-SetDO-349
SetDO
Instructions
Program execution
The true value depends on the configuration of the signal. If the signal is inverted in the
system parameters, the value of the physical channel is the opposite.
Syntax
SetDO
[ \ SDelay := < expression (IN) of num > , ]
[ Signal := ] < variable (VAR) of signaldo > ,
[ Value := ] < expression (IN) of dionum > ;
Related information
Described in:
Input/Output instructions
Configuration of I/O
2-SetDO-350
Instructions
SetGO
SetGO
Example
SetGO go2, 12;
The signal go2 is set to 12. If go2 comprises 4 signals, e.g. outputs 6-9, outputs
6 and 7 are set to zero, while outputs 8 and 9 are set to one.
SetGO \SDelay := 0.4, go2, 10;
The signal go2 is set to 10. If go2 comprises 4 signals, e.g. outputs 6-9, outputs
6 and 8 are set to zero, while outputs 7 and 9 are set to one, with a delay of 0.4 s.
Program execution, however, continues with the next instruction.
Arguments
SetGO
[ \SDelay ]
(Signal Delay)
Delays the change for the period of time stated in seconds (0.1 - 32s).
Program execution continues directly with the next instruction. After the
specified time delay, the value of the signals is changed without the rest of the
program execution being affected.
If the argument is omitted, the value is changed directly.
Signal
2-SetGO-351
SetGO
Instructions
No. of signals
Permitted value
No. of signals
Permitted value
0-1
0 - 511
0-3
10
0 - 1023
0-7
11
0 - 2047
0 - 15
12
0 - 4095
0 - 31
13
0 - 8191
0 - 63
14
0 - 16383
0 - 127
15
0 - 32767
0 - 255
16
0 - 65535
Program execution
The programmed value is converted to an unsigned binary number. This binary number
is sent on the signal group, with the result that individual signals in the group are set to
0 or 1. Due to internal delays, the value of the signal may be undefined for a short
period of time.
Syntax
SetDO
[ \ SDelay := < expression (IN) of num > , ]
[ Signal := ] < variable (VAR) of signalgo > ,
[ Value := ] < expression (IN) of num > ;
Related information
Described in:
Other input/output instructions
System Parameters
2-SetGO-352
Instructions
SingArea
SingArea
SingArea is used to define how the robot is to move in the proximity of singular points.
SingArea is also used to define linear and circular interpolation for robots with less
than six axes.
Examples
SingArea \Wrist;
The orientation of the tool may be changed slightly in order to pass a singular
point (axes 4 and 6 in line).
Robots with less than six axes may not be able to reach an interpolated tool orientation. By using SingArea \Wrist, the robot can achieve the movement but the
orientation of the tool will be slightly changed.
SingArea \Off;
The tool orientation is not allowed to differ from the programmed orientation. If
a singular point is passed, one or more axes may perform a sweeping movement,
resulting in a reduction in velocity.
Robots with less than six axes may not be able to reach a programmed tool orientation. As a result the robot will stop.
Arguments
SingArea
[ \Wrist] | [ \Off]
[ \Wrist ]
The tool orientation is allowed to differ somewhat in order to avoid wrist singularity. Used when axes 4 and 6 are parallel (axis 5 at 0 degrees). Also used for
linear and circular interpolation of robots with less than six axes where the tool
orientation is allowed to differ.
[\Off ]
The tool orientation is not allowed to differ. Used when no singular points are
passed, or when the orientation is not permitted to be changed.
If none of the arguments are specified, program execution automatically uses the
robots default argument. For robots with six axes the default argument is \Off.
2-SingArea-353
SingArea
Instructions
Program execution
If the arguments \Wrist is specified, the orientation is joint-interpolated to avoid singular points. In this way, the TCP follows the correct path, but the orientation of the tool
deviates somewhat. This will also happen when a singular point is not passed.
The specified interpolation applies to all subsequent movements until a new SingArea
instruction is executed.
The movement is only affected on execution of linear or circular interpolation.
By default, program execution automatically uses the /Off argument for robots with six
axes. Robots with less than six axes may use either the /Off argument (IRB640) or the
/Wrist argument by default. This is automatically set in event routine SYS_RESET.
- at a cold start-up
- when a new program is loaded
- when starting program executing from the beginning.
Syntax
SingArea
[ \ Wrist ] | [ \ Off ] ;
Related information
Described in:
Singularity
Interpolation
2-SingArea-354
Instructions
SoftAct
SoftAct
SoftAct (Soft Servo Activate) is used to activate the so called soft servo on any axis
of the robot or external mechanical unit.
Example
SoftAct 3, 20;
Activation of soft servo on robot axis 3, with softness value 20%.
SoftAct 1, 90 \Ramp:=150;
Activation of the soft servo on robot axis 1, with softness value 90% and ramp
factor 150%.
SoftAct \MechUnit:=orbit1, 1, 40 \Ramp:=120;
Activation of soft servo on axis 1 for the mechanical unit orbit1, with softness
value 40% and ramp factor 120%.
Arguments
SoftAct [\MechUnit] Axis Softness [\Ramp ]
[\MechUnit]
(Mechanical Unit
The name of the mechanical unit. If this argument is omitted, it means activation
of the soft servo for specified robot axis.
Axis
Softness
Ramp factor in percent (>= 100%). The ramp factor is used to control the
engagement of the soft servo. A factor 100% denotes the normal value; with
greater values the soft servo is engaged more slowly (longer ramp). The default
value for ramp factor is 100 %.
2-SoftAct-355
SoftAct
Instructions
Program execution
Softness is activated at the value specified for the current axis. The softness value is
valid for all movements, until a new softness value is programmed for the current axis,
or until the soft servo is deactivated by an instruction.
Limitations
Soft servo for any robot or external axis is always deactivated when there is a power
failure. This limitation can be handled in the user program when restarting after a
power failure.
The same axis must not be activated twice, unless there is a moving instruction in
between. Thus, the following program sequence should be avoided, otherwise there
will be a jerk in the robot movement:
SoftAct n , x ;
SoftAct n , y ;
(n = robot axis n, x and y softness values)
Syntax
SoftAct
[\MechUnit := < variable (VAR) of mecunit> ,]
[Axis := ] < expression (IN) of num> ,
[Softness := ] < expression (IN) of num>
[ \Ramp := < expression (IN) of num> ];
Related information
Described in:
Behaviour with the soft servo engaged
2-SoftAct-356
Instructions
SoftDeact
SoftDeact
SoftDeact (Soft Servo Deactivate) is used to deactivate the so called soft servo on all
robot and external axes.
Example
SoftDeact;
Deactivating the soft servo on all axes.
SoftDeact \Ramp:=150;
Deactivating the soft servo on all axes, with ramp factor 150%.
Arguments
SoftDeact [\Ramp ]
Ramp
Ramp factor in percent (>= 100%). The ramp factor is used to control the deactivating of the soft servo. A factor 100% denotes the normal value; with greater
values the soft servo is deactivated more slowly (longer ramp). The default value
for ramp factor is 100 %.
Program execution
The soft servo is deactivated for all robot and external axes.
Syntax
SoftDeact
[ \Ramp := < expression (IN) of num> ];
Related information
Described in:
Activating the soft servo
Instructions - SoftAct
2-SoftDeact-357
SoftDeact
2-SoftDeact-358
Instructions
Instructions
SpyStart
SpyStart
SpyStart is used to start the recording of instruction and time data during execution.
The execution data will be stored in a file for later analysis.
The stored data is intended for debugging RAPID programs, specifically for multitasking systems (only necessary to have SpyStart - SpyStop in one program task).
Example
SpyStart "ram1disk:spy.log";
Starts recording the execution time data in the file spy.log on the ramdisk.
Arguments
SpyStart File
File
Program execution
The specified file is opened for writing and the execution time data begins to be
recorded in the file.
Recording of execution time data is active until:
- execution of instruction SpyStop
- starting program execution from the beginning
- loading a new program
- next warm start-up
Limitations
Avoid using the floppy disk for recording since writing to the floppy is very time consuming.
Never use the spy function in production programs because the function increases the
cycle time and consumes memory on the mass memory device (ramdisk) in use.
2-SpyStart-359
SpyStart
Instructions
Error handling
If the file in the SpyStart instruction cant be opened then the system variable ERRNO
is set to ERR_FILEOPEN (see Data types - errnum). This error can then be handled
in the error handler.
File format
TASK
INSTR
IN
MAIN ConfJ\Off;
----- SYSTEM TRAP----MAIN ConfL\Off;
MAIN def_wz;
MAIN WZSphDef\Inside,volume,[p1.trans.x+xtrans
MAIN WZDOSet\Temp,wz1\Inside,volume,do1,1;
----- SYSTEM TRAP----MAIN WZSphDef\Inside,volume,[p2.trans.x+xtrans,
MAIN WZDOSet\Temp,wz2\Inside,volume,do2,1;
...
MAIN MoveL home,s,z,toolx\WObj:=wobjx;
----- SYSTEM TRAP ----MAIN MoveL home,s,z,toolx\WObj:=wobjx;
----- SYSTEM TRAP ----MAIN MoveL home,s,z,toolx\WObj:=wobjx;
MAIN writepos;
...
MAIN SpyStop;
CODE OUT
691310:READY :691310
691450:READY :691450
691450:READY :691450
691450:READY :691450
691460:READY :691460
691460:READY :691460
691860:READY :691860
693910:WAIT :694010
726820:WAIT :726820
740300:READY :740300
740300:READY :740300
827610:
2-SpyStart-360
Instructions
SpyStart
Syntax
SpyStart
[File:=]<expression (IN) of string>;
Related information
Described in:
Stop recording of execution data
Instructions - SpyStop
2-SpyStart-361
SpyStart
2-SpyStart-362
Instructions
Instructions
SpyStop
SpyStop
Example
SpyStop;
Stops recording the execution time data in the file specified by the previous
SpyStart instruction.
Program execution
The execution data recording is stopped and the file specified by the previous SpyStart
instruction is closed.
If no SpyStart instruction has been executed before, the SpyStop instruction is ignored.
Examples
IF debug = TRUE SpyStart "ram1disk:spy.log";
produce_sheets;
IF debug = TRUE SpyStop;
If the debug flag is true, start recording execution data in the file spy.log on the
ramdisk; perform actual production; stop recording and close the file spy.log.
Limitations
Avoid using the floppy disk for recording since writing to the floppy is very time consuming.
Never use the spy function in production programs because the function increases the
cycle time and consumes memory on the mass memory device (ramdisk) in use.
Syntax
SpyStop;
2-SpyStop-363
SpyStop
Instructions
Related information
Described in:
Start recording of execution data
2-SpyStop-364
Instructions - SpyStart
Instructions
StartLoad
Program Module
Not affected
Unloaded
System Module
Not affected
Not affected
Dynamic mode
Table 4 How different operations affect dynamic loaded program or system modules
Set PP to main from TP
Program Module
Unloaded
Unloaded
System Module
Unloaded
Unloaded
Both static and dynamic loaded modules can be unloaded by the instruction UnLoad.
Example
VAR loadsession load1;
! Start loading of new program module PART_B containing routine routine_b
! in dynamic mode
StartLoad \Dynamic, ram1disk \File:="PART_B.MOD", load1;
! Executing in parallel in old module PART_A containing routine_a
%"routine_a"%;
! Unload of old program module PART_A
UnLoad ram1disk \File:="PART_A.MOD";
! Wait until loading and linking of new program module PART_B is ready
WaitLoad load1;
! Execution in new program module PART_B
%"routine_b"%;
2-StartLoad-365
StartLoad
Instructions
Starts the loading of program module PART_B.MOD from ram1disk into the program memory with instruction StartLoad. In parallel with the loading, the program executes routine_a in module PART_A.MOD. Then instruction WaitLoad
waits until the loading and linking is finished. The module is loaded in dynamic
mode.
Variable load1 holds the identity of the load session, updated by StartLoad and
referenced by WaitLoad.
To save linking time, the instruction UnLoad and WaitLoad can be combined in
the instruction WaitLoad by using the option argument \UnLoadPath.
Arguments
StartLoad [\Dynamic] FilePath [\File] LoadNo
[\Dynamic]
The switch enables load of a program module in dynamic mode. Otherwise the
loading is in static mode.
FilePath
The file path and the file name to the file that will be loaded into the program
memory. The file name shall be excluded when the argument \File is used.
[\File]
When the file name is excluded in the argument FilePath, then it must be defined
with this argument.
LoadNo
This is a reference to the load session that should be used in the instruction WaitLoad to connect the loaded program module to the program task.
Program execution
Execution of StartLoad will only order the loading and then proceed directly with the
next instruction, without waiting for the loading to be completed.
The instruction WaitLoad will then wait at first for the loading to be completed, if it is
not already finished, and then it will be linked and initialised. The initialisation of the
loaded module sets all variables at module level to their init values.
Unsolved references will be accepted if the system parameter for Tasks/BindRef is set
to NO. However, when the program is started or the teach pendant function Program
Window/File/Check Program is used, no check for unsolved references will be made if
BindRef = NO. There will be a run time error on execution of an unsolved reference.
2-StartLoad-366
Instructions
StartLoad
Another way to use references to instructions, that are not in the task from the beginning, is to use Late Binding. This makes it possible to specify the routine to call with a
string expression, quoted between two %%. In this case the BindRef parameter could
be set to YES (default behaviour). The Late Binding way is preferable.
To obtain a good program structure, that is easy to understand and maintain, all loading
and unloading of program modules should be done from the main module, which is
always present in the program memory during execution.
Examples
StartLoad \Dynamic, "ram1disk:DOORDIR/DOOR1.MOD", load1;
Loads the program module DOOR1.MOD from the ram1disk at the directory
DOORDIR into the program memory. The program module is loaded in dynamic
mode.
StartLoad \Dynamic, "ram1disk:" \File:="DOORDIR/DOOR1.MOD", load1;
Same as above but with another syntax.
StartLoad "ram1disk:" \File:="DOORDIR/DOOR1.MOD", load1;
Same as the two examples above but the module is loaded in static mode.
StartLoad \Dynamic, "ram1disk:" \File:="DOORDIR/DOOR1.MOD", load1;
...
WaitLoad load1;
is the same as
Load \Dynamic, "ram1disk:" \File:="DOORDIR/DOOR1.MOD";
Limitations
It is not allowed to load a system module or a program module that contains a main
routine.
Syntax
StartLoad
[\Dynamic ,]
[FilePath :=] <expression (IN) of string>
[\File := <expression (IN) of string> ] ,
[LoadNo :=] <variable (VAR) of loadsession> ;
2-StartLoad-367
StartLoad
Instructions
Related information
Described in:
Connect the loaded module to the task
Instructions - WaitLoad
Load session
Instructions - Load
Instructions - UnLoad
2-StartLoad-368
Instructions
StartMove
StartMove
StartMove is used to resume robot and external axes motion when this has been
stopped by the instruction StopMove.
Example
StopMove;
WaitDI ready_input, 1;
StartMove;
The robot starts to move again when the input ready_input is set.
Program execution
Any processes associated with the stopped movement are restarted at the same time as
motion resumes.
Error handling
If the robot is too far from the path (more than 10 mm or 20 degrees) to perform a start
of the interrupted movement, the system variable ERRNO is set to ERR_PATHDIST.
This error can then be handled in the error handler.
Syntax
StartMove;
Related information
Described in:
Stopping movements
Instructions - StopMove
More examples
Instructions - StorePath
2-StartMove-369
StartMove
2-StartMove-370
Instructions
Instructions
Stop
Stop
Example
TPWrite "The line to the host computer is broken";
Stop;
Program execution stops after a message has been written on the teach pendant.
Arguments
Stop
[ \NoRegain ]
[ \NoRegain ]
Specifies for the next program start in manual mode, whether or not the robot and
external axes should regain to the stop position. In automatic mode the robot and
external axes always regain to the stop position.
If the argument NoRegain is set, the robot and external axes will not regain to the
stop position (if they have been jogged away from it).
If the argument is omitted and if the robot or external axes have been jogged
away from the stop position, the robot displays a question on the teach pendant.
The user can then answer, whether or not the robot should regain to the stop
position.
Program execution
The instruction stops program execution as soon as the robot and external axes reach
the programmed destination point for the movement it is performing at the time.
Program execution can then be restarted from the next instruction.
If there is a Stop instruction in some event routine, the routine will be executed from
the beginning in the next event.
2-Stop-371
Stop
Instructions
Example
MoveL p1, v500, fine, tool1;
TPWrite Jog the robot to the position for pallet corner 1;
Stop \NoRegain;
p1_read := CRobT();
MoveL p2, v500, z50, tool1;
Program execution stops with the robot at p1. The operator jogs the robot to
p1_read. For the next program start, the robot does not regain to p1, so the
position p1_read can be stored in the program.
Limitations
The movement instruction which precedes this instruction should be terminated with a
stop point, in order to be able to restart in this instruction following a power failure.
Syntax
Stop
[ \ NoRegain ];
Related information
Described in:
2-Stop-372
Instructions - EXIT
Instructions - EXIT
Instructions - StopMove
Instructions
StopMove
StopMove
StopMove is used to stop robot and external axes movements temporarily. If the
instruction StartMove is given, movement resumes.
This instruction can, for example, be used in a trap routine to stop the robot temporarily
when an interrupt occurs.
Example
StopMove;
WaitDI ready_input, 1;
StartMove;
The robot movement is stopped until the input, ready_input, is set.
Program execution
The movements of the robot and external axes stop without the brakes being engaged.
Any processes associated with the movement in progress are stopped at the same time
as the movement is stopped.
Program execution continues without waiting for the robot and external axes to stop
(standing still).
Examples
VAR intnum intno1;
...
CONNECT intno1 WITH go_to_home_pos;
ISignalDI di1,1,intno1;
TRAP go_to_home_pos
VAR robtarget p10;
StopMove;
StorePath;
p10:=CRobT();
MoveL home,v500,fine,tool1;
WaitDI di1,0;
Move L p10,v500,fine,tool1;
RestoPath;
StartMove;
ENDTRAP
2-StopMove-373
StopMove
Instructions
When the input di1 is set to 1, an interrupt is activated which in turn activates the
interrupt routine go_to_home_pos. The current movement is stopped
immediately and the robot moves instead to the home position. When di1 is set
to 0, the robot returns to the position at which the interrupt occurred and
continues to move along the programmed path.
Syntax
StopMove;
Related information
Described in:
Continuing a movement
Instructions - StartMove
Interrupts
2-StopMove-374
Instructions
StorePath
StorePath
StorePath is used to store the movement path being executed when an error or interrupt
occurs. The error handler or trap routine can then start a new movement and, following
this, restart the movement that was stored earlier.
This instruction can be used to go to a service position or to clean the gun, for example,
when an error occurs.
Example
StorePath;
The current movement path is stored for later use.
Program execution
The current movement path of the robot and external axes is saved. After this, another
movement can be started in a trap routine or an error handler. When the reason for the
error or interrupt has been rectified, the saved movement path can be restarted.
Example
TRAP machine_ready
VAR robtarget p1;
StorePath;
p1 := CRobT();
MoveL p100, v100, fine, tool1;
...
MoveL p1, v100, fine, tool1;
RestoPath;
StartMove;
ENDTRAP
When an interrupt occurs that activates the trap routine machine_ready, the
movement path which the robot is executing at the time is stopped at the end of
the instruction (ToPoint) and stored. After this, the robot remedies the interrupt
by, for example, replacing a part in the machine and the normal movement is
restarted.
2-StorePath-375
StorePath
Instructions
Limitations
Only the movement path data is stored with the instruction StorePath.
If the user wants to order movements on the new path level, the actual stop position
must be stored directly after StorePath and before RestoPath make a movement to the
stored stop position on the path.
Only one movement path can be stored at a time.
Syntax
StorePath;
Related information
Described in:
Restoring a path
Instructions - RestoPath
More examples
Instructions - RestoPath
2-StorePath-376
Instructions
TEST
TEST
Example
TEST reg1
CASE 1,2,3 :
routine1;
CASE 4 :
routine2;
DEFAULT :
TPWrite "Illegal choice";
Stop;
ENDTEST
Different instructions are executed depending on the value of reg1. If the value
is 1-3 routine1 is executed. If the value is 4, routine2 is executed. Otherwise, an
error message is printed and execution stops.
Arguments
TEST Test data {CASE Test value {, Test value} : ...}
[ DEFAULT: ...] ENDTEST
Test data
The data or expression with which the test value will be compared.
Test value
The value which the test data must have for the associated instructions to be executed.
Program execution
The test data is compared with the test values in the first CASE condition. If the comparison is true, the associated instructions are executed. After that, program execution
continues with the instruction following ENDTEST.
If the first CASE condition is not satisfied, other CASE conditions are tested, and so
on. If none of the conditions are satisfied, the instructions associated with DEFAULT
are executed (if this is present).
2-TEST-377
TEST
Instructions
Syntax
(EBNF)
TEST <expression>
{( CASE <test value> { , <test value> } :
<instruction list> ) | <CSE> }
[ DEFAULT : <instruction list> ]
ENDTEST
<test value> ::= <expression>
Related information
Described in:
Expressions
2-TEST-378
Instructions
TestSign
TestSign
TestSign is used when output of test signals from the robot system is needed. A test signals mirror the resolver angle for an axis, for example. The test signal is an analogue
output to one of the two test output connection points.
The test signals for the master robot cannot be reached.
Example
TestSign 1, resolver_angle, Orbit, 2, 4, 0;
Test signal connection point 1 will give the value of the resolver_angle for Orbit
axis 2, scaled 4 times the nominal value and sampled at maximum rate (indicated
by 0).
Arguments
TestSign
Output
This argument specifies which of the two test signal output connector points that
the test signal will be available at. Possible values are 1 or 2.
SignalId
(Mechanical Unit)
Argument that holds the name of the mechanical unit to retrieve test signal from.
Axis
Scale
Stime
(Sample Time)
Sample time in seconds. The output signal is updated with a new value at every
sample. A value of 1 updates the output every second and a value of 0 performs
an update as often as possible. The value 0.01 corresponds to a sampling of 100
times per second.
2-TestSign-379
TestSign
Instructions
Program execution
The TestSign instruction mirrors a signal in the robot system to an output. The mirroring of a specified test signal is active until a new TestSign instruction for the output is
performed. A warm start of the robot system removes currently activated test signals.
Error handling
If there is an error in the parameter MechUnit, the system parameter ERRNO is set to
ERR_UNIT_PAR. If there is an error in the parameter Axis, ERRNO is set to
ERR_AXIS_PAR.
Syntax
TestSign
[ Output := ] < expression (IN) of num> ,
[ SignalId := ] < expression (IN) of testsignal>
[ MechUnit := ] < variable (VAR) of mecunit> ,
[Axis := ] < expression (IN) of num> ,
[ Scale := ] < expression (IN) of num > ,
[ Stime := ] < expression (IN) of num> ;
2-TestSign-380
Instructions
TPErase
TPErase
TPErase (Teach Pendant Erase) is used to clear the display of the teach pendant.
Example
TPErase;
TPWrite "Execution started";
The teach pendant display is cleared before Execution started is written.
Program execution
The teach pendant display is completely cleared of all text. The next time text is written, it will be entered on the uppermost line of the display.
Syntax
TPErase;
Related information
Described in:
Writing on the teach pendant
2-TPErase-381
TPErase
2-TPErase-382
Instructions
Instructions
TPReadFK
TPReadFK
TPReadFK (Teach Pendant Read Function Key) is used to write text above the
functions keys and to find out which key is depressed.
Example
TPReadFK reg1, More ?, stEmpty, stEmpty, stEmpty, Yes, No;
The text More ? is written on the teach pendant display and the function keys 4
and 5 are activated by means of the text strings Yes and No respectively (see
Figure 22). Program execution waits until one of the function keys 4 or 5 is
pressed. In other words, reg1 will be assigned 4 or 5 depending on which of the
keys is depressed.
More?
Yes
No
Figure 22 The operator can input information via the function keys.
Arguments
TPReadFK Answer Text FK1 FK2 FK3 FK4 FK5 [\MaxTime]
[\DIBreak] [\BreakFlag]
Answer
The variable for which, depending on which key is pressed, the numeric value
1..5 is returned. If the function key 1 is pressed, 1 is returned, and so on.
Text
FKx
The text to be written as a prompt for the appropriate function key (a maximum
of 7 characters). FK1 is the left-most key.
Function keys without prompts are specified by the predefined string constant
stEmpty with value empty string ().
2-TPReadFK-383
TPReadFK
Instructions
[\MaxTime]
The maximum amount of time [s] that program execution waits. If no function key
is depressed within this time, the program continues to execute in the error handler
unless the BreakFlag is used (see below). The constant ERR_TP_MAXTIME can
be used to test whether or not the maximum time has elapsed.
[\DIBreak]
The digital signal that may interrupt the operator dialog. If no function key is
depressed when the signal is set to 1 (or is already 1), the program continues to
execute in the error handler, unless the BreakFlag is used (see below). The
constant ERR_TP_DIBREAK can be used to test whether or not this has occurred.
[\BreakFlag]
A variable that will hold the error code if maxtime or dibreak is used. If this
optional variable is omitted, the error handler will be executed. The constants
ERR_TP_MAXTIME and ERR_TP_ DIBREAK can be used to select the reason.
Program execution
The information text is always written on a new line. If the display is full of text, this
body of text is moved up one line first. Strings longer than the width of the teach pendant
(40 characters) are split into two lines.
Prompts are written above the appropriate function keys. Keys without prompts are
deactivated.
Program execution waits until one of the activated function keys is depressed.
Description of concurrent TPReadFK or TPReadNum request on Teach Pendant (TP
request) from same or other program tasks:
New TP request from other program task will not take focus (new put in queue)
New TP request from TRAP in the same program task will take focus (old put in queue)
Program stop take focus (old put in queue)
New TP request in program stop state takes focus (old put in queue)
2-TPReadFK-384
Instructions
TPReadFK
Example
VAR errnum errvar;
...
TPReadFK reg1, Go to service position?, stEmpty, stEmpty, stEmpty, Yes, No
\MaxTime:= 600
\DIBreak:= di5\BreakFlag:= errvar;
IF reg1 = 4 or OR errvar = ERR_TP_DIBREAK THEN
MoveL service, v500, fine, tool1;
Stop;
ENDIF
IF errvar = ERR_TP_MAXTIME EXIT;
The robot is moved to the service position if the forth function key (Yes) is
pressed, or if the input 5 is activated. If no answer is given within 10 minutes, the
execution is terminated.
Predefined data
CONST string stEmpty := ;
The predefined constant stEmpty should be used for Function Keys without prompts.
Using stEmpty instead of saves about 80 bytes for every Function Key without
prompts.
Syntax
TPReadFK
[Answer:=] <var or pers (INOUT) of num>,
[Text:=] <expression (IN) of string>,
[FK1 :=] <expression (IN) of string>,
[FK2 :=] <expression (IN) of string>,
[FK3 :=] <expression (IN) of string>,
[FK4 :=] <expression (IN) of string>,
[FK5 :=] <expression (IN) of string>
[\MaxTime := <expression (IN) of num>]
[\DIBreak := <variable (VAR) of signaldi>]
[\BreakFlag := <var or pers (INOUT) of errnum>];
2-TPReadFK-385
TPReadFK
Instructions
Related information
Described in:
Writing to and reading from
the teach pendant
Running Production
2-TPReadFK-386
Instructions
TPReadNum
TPReadNum
TPReadNum (Teach Pendant Read Numerical) is used to read a number from the teach
pendant.
Example
TPReadNum reg1, How many units should be produced?;
The text How many units should be produced? is written on the teach pendant
display. Program execution waits until a number has been input from the numeric
keyboard on the teach pendant. That number is stored in reg1.
Arguments
TPReadNum Answer String [\MaxTime] [\DIBreak]
[\BreakFlag]
Answer
The variable for which the number input via the teach pendant is returned.
String
The digital signal that may interrupt the operator dialog. If no number is input
when the signal is set to 1 (or is already 1), the program continues to execute in
the error handler unless the BreakFlag is used (see below). The constant
ERR_TP_DIBREAK can be used to test whether or not this has occurred.
[\BreakFlag]
A variable that will hold the error code if maxtime or dibreak is used. If this
optional variable is omitted, the error handler will be executed.The constants
ERR_TP_MAXTIME and ERR_TP_ DIBREAK can be used to select the
reason.
2-TPReadNum-387
TPReadNum
Instructions
Program execution
The information text is always written on a new line. If the display is full of text, this
body of text is moved up one line first. Strings longer than the width of the teach
pendant (40 characters) are split into two lines.
Program execution waits until a number is typed on the numeric keyboard (followed by
Enter or OK).
Reference to TPReadFK about description of concurrent TPReadFK or TPReadNum
request on Teach Pendant from same or other program tasks.
Example
TPReadNum reg1, How many units should be produced?;
FOR i FROM 1 TO reg1 DO
produce_part;
ENDFOR
The text How many units should be produced? is written on the teach pendant
display. The routine produce_part is then repeated the number of times that is
input via the teach pendant.
Syntax
TPReadNum
[Answer:=] <var or pers (INOUT) of num>,
[String:=] <expression (IN) of string>
[\MaxTime := <expression (IN) of num>]
[\DIBreak := <variable (VAR) of signaldi>]
[\BreakFlag := <var or pers (INOUT) of errnum>] ;
Related information
Described in:
Writing to and reading from
the teach pendant
Production Running
Instructions - TPReadFK
2-TPReadNum-388
Instructions
TPShow
TPShow
TPShow (Teach Pendant Show) is used to select Teach Pendant Window from RAPID.
Examples
TPShow TP_PROGRAM;
The Production Window will be active if the system is in AUTO mode and the
Program Window will be active if the system is in MAN mode after execution of
this instruction.
TPShow TP_LATEST;
The latest used Teach Pendant Window before the current Teach Pendant
Window will be active after execution of this instruction.
Arguments
TPShow
Window
Window
TP_LATEST
Predefined data
CONST tpnum TP_PROGRAM := 1;
CONST tpnum TP_LATEST := 2;
CONST tpnum TP_SCREENVIEWER := 3;
Program execution
The selected Teach Pendant Window will be activated.
2-TPShow-389
TPShow
Instructions
Syntax
TPShow
[Window:=] <expression (IN) of tpnum> ;
Related information
Described in:
Communicating using
the teach pendant
2-TPShow-390
Instructions
TPWrite
TPWrite
TPWrite (Teach Pendant Write) is used to write text on the teach pendant. The value of
certain data can be written as well as text.
Examples
TPWrite "Execution started";
The text Execution started is written on the teach pendant.
TPWrite "No of produced parts="\Num:=reg1;
If, for example, the answer to No of produced parts=5, enter 5 instead of reg1 on
the teach pendant.
Arguments
TPWrite
String
(Numeric)
The data whose numeric value is to be written after the text string.
[\Bool]
(Boolean)
The data whose logical value is to be written after the text string.
[\Pos]
(Position)
(Orientation)
Program execution
Text written on the teach pendant always begins on a new line. When the display is full
of text, this text is moved up one line first. Strings that are longer than the width of the
teach pendant (40 characters) are divided up into two lines.
2-TPWrite-391
TPWrite
Instructions
If one of the arguments \Num, \Bool, \Pos or \Orient is used, its value is first converted
to a text string before it is added to the first string. The conversion from value to text
string takes place as follows:
Argument
Value
Text string
\Num
23
"23"
\Num
1.141367
"1.14137"
\Bool
TRUE
"TRUE"
\Pos
[1817.3,905.17,879.11]
"[1817.3,905.17,879.11]"
\Orient
[0.96593,0,0.25882,0]
"[0.96593,0,0.25882,0]"
The value is converted to a string with standard RAPID format. This means in principle
6 significant digits. If the decimal part is less than 0.000005 or greater than 0.999995,
the number is rounded to an integer.
Limitations
The arguments \Num, \Bool, \Pos and \Orient are mutually exclusive and thus cannot
be used simultaneously in the same instruction.
Syntax
TPWrite
[String:=] <expression (IN) of string>
[\Num:= <expression (IN) of num> ]
| [\Bool:= <expression (IN) of bool> ]
| [\Pos:= <expression (IN) of pos> ]
| [\Orient:= <expression (IN) of orient> ];
Related information
Described in:
Clearing and reading
the teach pendant
2-TPWrite-392
Instructions
TriggC
TriggC
Examples
VAR triggdata gunon;
TriggIO gunon, 0 \Start \DOp:=gun, on;
MoveL p1, v500, z50, gun1;
TriggC p2, p3, v500, gunon, fine, gun1;
The digital output signal gun is set when the robots TCP passes the midpoint of
the corner path of the point p1.
Start point p1
End point p3
Circle point p2
The output signal gun is set to on
when the TCP of the robot is here
Figure 23 Example of fixed-position IO event.
Arguments
TriggC
[ \Conc ]
(Concurrent)
2-TriggC-393
TriggC
Instructions
If this argument is omitted and the ToPoint is not a stop point, the subsequent
instruction is executed some time before the robot has reached the programmed
zone.
CirPoint
The circle point of the robot. See the instruction MoveC for a more detailed
description of circular movement. The circle point is defined as a named position
or stored directly in the instruction (marked with an * in the instruction).
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
Speed
The speed data that applies to movements. Speed data defines the velocity of the
tool centre point, the external axes and of the tool reorientation.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Trigg_1
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
[ \T2]
(Trigg 2)
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
[ \T3 ]
(Trigg 3)
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
[ \T4 ]
(Trigg 4)
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
Zone
Tool
2-TriggC-394
Instructions
TriggC
[ \WObj]
(Work Object)
The work object (coordinate system) to which the robot position in the
instruction is related.
This argument can be omitted, and if it is, the position is related to the world
coordinate system. If, on the other hand, a stationary TCP or coordinated
external axes are used, this argument must be specified for a linear movement
relative to the work object to be performed.
[ \Corr]
(Correction)
Program execution
See the instruction MoveC for information about circular movement.
As the trigger conditions are fulfilled when the robot is positioned closer and closer to
the end point, the defined trigger activities are carried out. The trigger conditions are
fulfilled either at a certain distance before the end point of the instruction, or at a
certain distance after the start point of the instruction, or at a certain point in time
(limited to a short time) before the end point of the instruction.
During stepping execution forwards, the I/O activities are carried out but the interrupt
routines are not run. During stepping execution backwards, no trigger activities at all
are carried out.
Examples
VAR intnum intno1;
VAR triggdata trigg1;
...
CONNECT intno1 WITH trap1;
TriggInt trigg1, 0.1 \Time, intno1;
...
TriggC p1, p2, v500, trigg1, fine, gun1;
TriggC p3, p4, v500, trigg1, fine, gun1;
...
IDelete intno1;
The interrupt routine trap1 is run when the work point is at a position
0.1 s before the point p2 or p4 respectively.
2-TriggC-395
TriggC
Instructions
Limitations
If the current start point deviates from the usual, so that the total positioning length of
the instruction TriggC is shorter than usual, it may happen that several or all of the
trigger conditions are fulfilled immediately and at the same position. In such cases, the
sequence in which the trigger activities are carried out will be undefined. The program
logic in the user program may not be based on a normal sequence of trigger activities
for an incomplete movement.
The instruction TriggC should never be started from the beginning with the robot in
position after the circle point. Otherwise the robot will not take the programmed path
(positioning around the circular path in another direction compared with that
programmed).
Syntax
TriggC
[\ Conc ,]
[ CirPoint := ] < expression (IN) of robtarget > ,
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ T := < expression (IN) of num > ] ,
[Trigg_1 := ] < variable (VAR) of triggdata >
[ \ T2 := < variable (VAR) of triggdata > ]
[ \ T3 := < variable (VAR) of triggdata > ]
[ \ T4 := < variable (VAR) of triggdata > ] ,
[Zone := ] < expression (IN) of zonedata > ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ]
[ \ Corr ];
2-TriggC-396
Instructions
TriggC
Related information
Described in:
Linear movement with triggers
Instructions - TriggL
Instructions - TriggJ
Definition of triggers
Instructions - CorrWrite
Circular movement
Definition of velocity
Definition of tools
Motion in general
Motion Principles
2-TriggC-397
TriggC
2-TriggC-398
Instructions
Instructions
TriggEquip
TriggEquip
TriggEquip (Trigg Equipment) is used to define conditions and actions for setting a
digital, a group of digital, or an analog output signal at a fixed position along the
robots movement path with possibility to do time compensation for the lag in the
external equipment.
The data defined is used for implementation in one or more subsequent TriggL, TriggC
or TriggJ instructions.
Examples
VAR triggdata gunon;
TriggEquip gunon, 10, 0.1 \DOp:=gun, 1;
TriggL p1, v500, gunon, z50, gun1;
The tool gun1 opens in point p2, when the TCP is 10 mm before the point p1. To
reach this, the digital output signal gun is set to the value 1, when TCP is 0.1 s
before the point p2. The gun is full open when TCP reach point p2.
Start point
End point p1
10 mm
Point p2 for open of the gun
Arguments
TriggEquip TriggData Distance [ \Start ] EquipLag
[ \DOp ] | [ \GOp ] | [\AOp ] | [\ProcID ] SetValue [ \Inhib ]
TriggData
Variable for storing the triggdata returned from this instruction. These triggdata
are then used in the subsequent TriggL, TriggC or TriggJ instructions.
Distance
Defines the position on the path where the I/O equipment event shall occur.
Specified as the distance in mm (positive value) from the end point of the
movement path (applicable if the argument \ Start is not set).
System Data Types and Routines
2-TriggEquip-399
TriggEquip
Instructions
See the section entitled Program execution for further details.
[ \Start ]
Used when the distance for the argument Distance starts at the movement start
point instead of the end point.
EquipLag
(Equipment Lag)
End point
Start point
Distance
\Start
Distance
EquipLag
Figure 25 Use of argument EquipLag.
[ \DOp ]
(Digital OutPut)
The name of the signal, when a digital output signal shall be changed.
[ \GOp ]
(Group OutPut)
The name of the signal, when a group of digital output signals shall be changed.
[ \AOp ]
(Analog Output)
The name of the signal, when a analog output signal shall be changed.
[ \ProcID]
(Process Identity)
2-TriggEquip-400
Instructions
TriggEquip
SetValue
Desired value of output signal (within the allowed range for the current signal).
[ \Inhib ]
(Inhibit)
The name of a persistent variable flag for inhibit the setting of the signal at
runtime.
If this optional argument is used and the actual value of the specified flag is
TRUE at the position-time for setting of the signal then the specified signal
(DOp, GOp or AOp) will be set to 0 in stead of specified value.
Program execution
When running the instruction TriggEquip, the trigger condition is stored in the
specified variable for the argument TriggData.
Afterwards, when one of the instructions TriggL, TriggC or TriggJ is executed, the
following are applicable, with regard to the definitions in TriggEquip:
The distance specified in the argument Distance:
Linear movement
Circular movement
Non-linear movement
The position-time related event will be generated when the start point (end point) is
passed, if the specified distance from the end point (start point) is not within the length
of movement of the current instruction (Trigg...). With use of argument EquipLag with
negative time (delay), the I/O signal can be set after the end point.
2-TriggEquip-401
TriggEquip
Instructions
Examples
VAR triggdata glueflow;
TriggEquip glueflow, 1 \Start, 0.05 \AOp:=glue, 5.3;
MoveJ p1, v1000, z50, tool1;
TriggL p2, v500, glueflow, z50, tool1;
The analog output signal glue is set to the value 5.3 when the TCP passes a point
located 1 mm after the start point p1 with compensation for equipment lag 0.05 s.
...
TriggL p3, v500, glueflow, z50, tool1;
The analog output signal glue is set once more to the value 5.3 when the TCP
passes a point located 1 mm after the start point p2.
Limitations
I/O events with distance (without the argument \Time) is intended for flying points
(corner path). I/O events with distance, using stop points, results in worse accuracy than
specified below.
Regarding the accuracy for I/O events with distance and using flying points, the
following is applicable when setting a digital output at a specified distance from the
start point or end point in the instruction TriggL or TriggC:
- Accuracy specified below is valid for positive EquipLag parameter < 60 ms,
equivalent to the lag in the robot servo (without changing the system parameter
Event Preset Time).
- Accuracy specified below is valid for positive EquipLag parameter <
configured Event Preset Time (system parameter).
- Accuracy specified below is not valid for positive EquipLag parameter >
configured Event Preset Time (system parameter). In this case, an approximate
method is used in which the dynamic limitations of the robot are not taken into
consideration. SingArea \Wrist must be used in order to achieve an acceptable
accuracy.
- Accuracy specified below is valid for negative EquipLag.
I/O events with time (with the argument \Time) is intended for stop points. I/O events
with time, using flying points, results in worse accuracy than specified below.
I/O events with time can only be specified from the end point of the movement. This
time cannot exceed the current braking time of the robot, which is max. approx. 0.5 s
(typical values at speed 500 mm/s for IRB2400 150 ms and for IRB6400 250 ms). If
the specified time is greater that the current braking time, the event will be generated
anyhow, but not until braking is started (later than specified). However, the whole of
the movement time for the current movement can be utilised during small and fast
movements.
2-TriggEquip-402
Instructions
TriggEquip
Typical absolute accuracy values for set of digital outputs +/- 5 ms.
Typical repeat accuracy values for set of digital outputs +/- 2 ms.
Syntax
TriggEquip
[ TriggData := ] < variable (VAR) of triggdata> ,
[ Distance := ] < expression (IN) of num>
[ \ Start ] ,
[ EquipLag := ] < expression (IN) of num>
[ \ DOp := < variable (VAR) of signaldo> ]
| [ \ GOp := < variable (VAR) of signalgo> ]
| [ \ AOp := < variable (VAR) of signalao> ]
| [ \ ProcID := < expression (IN) of num> ] ,
[ SetValue := ] < expression (IN) of num>
[ \ Inhibit := < persistent (PERS) of bool> ] ,
Related information
Described in:
Use of triggers
More examples
Set of I/O
2-TriggEquip-403
TriggEquip
2-TriggEquip-404
Instructions
Instructions
TriggInt
TriggInt
TriggInt is used to define conditions and actions for running an interrupt routine at a
position on the robots movement path.
The data defined is used for implementation in one or more subsequent TriggL, TriggC
or TriggJ instructions.
Examples
VAR intnum intno1;
VAR triggdata trigg1;
...
CONNECT intno1 WITH trap1;
TriggInt trigg1, 5, intno1;
...
TriggL p1, v500, trigg1, z50, gun1;
TriggL p2, v500, trigg1, z50, gun1;
...
IDelete intno1;
The interrupt routine trap1 is run when the TCP is at a position 5 mm
before the point p1 or p2 respectively.
Start point
End point p1 or p2
5 mm
The interrupt is generated
when the TCP is here
Figure 27 Example position related interrupt.
Arguments
TriggInt TriggData Distance [ \Start ] | [ \Time ]
Interrupt
TriggData
Variable for storing the triggdata returned from this instruction. These triggdata
are then used in the subsequent TriggL, TriggC or TriggJ instructions.
2-TriggInt-405
TriggInt
Instructions
Distance
Defines the position on the path where the interrupt shall be generated.
Specified as the distance in mm (positive value) from the end point of the
movement path (applicable if the argument \ Start or \Time is not set).
See the section entitled Program execution for further details.
[ \Start ]
Used when the distance for the argument Distance starts at the movement start
point instead of the end point.
[ \Time ]
Used when the value specified for the argument Distance is in fact a time in
seconds (positive value) instead of a distance.
Position related interrupts in time can only be used for short times (< 0.5 s) before
the robot reaches the end point of the instruction. See the section entitled
Limitations for more details.
Interrupt
Program execution
When running the instruction TriggInt, data is stored in a specified variable for the
argument TriggData and the interrupt that is specified in the variable for the argument
Interrupt is activated.
Afterwards, when one of the instructions TriggL, TriggC or TriggJ is executed, the
following are applicable, with regard to the definitions in TriggInt:
2-TriggInt-406
Instructions
TriggInt
Circular movement
Non-linear movement
The position related interrupt will be generated when the start point (end point) is
passed, if the specified distance from the end point (start point) is not within the length
of movement of the current instruction (Trigg...).
Examples
This example describes programming of the instructions that interact to generate
position related interrupts:
VAR intnum intno2;
VAR triggdata trigg2;
- Declaration of the variables intno2 and trigg2 (shall not be initiated).
CONNECT intno2 WITH trap2;
- Allocation of interrupt numbers that are stored in the variable intno2
- The interrupt number is coupled to the interrupt routine trap2
TriggInt trigg2, 0, intno2;
- The interrupt number in the variable intno2 is flagged as used
- The interrupt is activated
- Defined trigger conditions and interrupt number are stored in the variable
trigg2
TriggL p1, v500, trigg2, z50, gun1;
- The robot is moved to the point p1.
- When the TCP reaches the point p1, an interrupt is generated and the interrupt
routine trap2 is run.
2-TriggInt-407
TriggInt
Instructions
TriggL p2, v500, trigg2, z50, gun1;
- The robot is moved to the point p2
- When the TCP reaches the point p2, an interrupt is generated and the interrupt
routine trap2 is run once more.
IDelete intno2;
- The interrupt number in the variable intno2 is de-allocated.
Limitations
Interrupt events with distance (without the argument \Time) is intended for flying points
(corner path). Interrupt events with distance, using stop points, results in worse
accuracy than specified below.
Interrupt events with time (with the argument \Time) is intended for stop points.
Interrupt events with time, using flying points, results in worse accuracy than specified
below.
I/O events with time can only be specified from the end point of the movement. This
time cannot exceed the current braking time of the robot, which is max. approx. 0.5 s
(typical values at speed 500 mm/s for IRB2400 150 ms and for IRB6400 250 ms). If
the specified time is greater that the current braking time, the event will be generated
anyhow, but not until braking is started (later than specified). However, the whole of
the movement time for the current movement can be utilised during small and fast
movements.
Typical absolute accuracy values for generation of interrupts +/- 5 ms.
Typical repeat accuracy values for generation of interrupts +/- 2 ms.
Normally there is a delay of 5 to 120 ms between interrupt generation and response,
depending on the type of movement being performed at the time of the interrupt.
(Ref. to Basic Characteristics RAPID - Interrupts).
To obtain the best accuracy when setting an output at a fixed position along the robots
path, use the instructions TriggIO or TriggEquip in preference to the instructions
TriggInt with SetDO/SetGO/SetAO in an interrupt routine.
Syntax
TriggInt
[ TriggData := ] < variable (VAR) of triggdata> ,
[ Distance := ] < expression (IN) of num>
[ \ Start ] | [ \ Time ] ,
[ Interrupt := ] < variable (VAR) of intnum> ;
2-TriggInt-408
Instructions
TriggInt
Related information
Described in:
Use of triggers
More examples
Interrupts
2-TriggInt-409
TriggInt
2-TriggInt-410
Instructions
Instructions
TriggIO
TriggIO
TriggIO is used to define conditions and actions for setting a digital, a group of digital,
or an analog output signal at a fixed position along the robots movement path.
To obtain a fixed position I/O event, TriggIO compensates for the lag in the control
system (lag between robot and servo) but not for any lag in the external equipment. For
compensation of both lags use TriggEquip.
The data defined is used for implementation in one or more subsequent TriggL, TriggC
or TriggJ instructions.
Examples
VAR triggdata gunon;
TriggIO gunon, 10 \DOp:=gun, 1;
TriggL p1, v500, gunon, z50, gun1;
The digital output signal gun is set to the value 1 when the TCP is 10 mm before
the point p1.
Start point
End point p1
10 mm
The output signal gun is set
when the TCP is here
Figure 29 Example of fixed-position IO event.
Arguments
TriggIO TriggData Distance [ \Start ] | [ \Time ]
[ \DOp ] | [ \GOp ] | [\AOp ] | [\ProcID ] SetValue
[ \DODelay ]
TriggData
Variable for storing the triggdata returned from this instruction. These triggdata
are then used in the subsequent TriggL, TriggC or TriggJ instructions.
2-TriggIO-411
TriggIO
Instructions
Distance
Defines the position on the path where the I/O event shall occur.
Specified as the distance in mm (positive value) from the end point of the
movement path (applicable if the argument \ Start or \Time is not set).
See the section entitled Program execution for further details.
[ \Start ]
Used when the distance for the argument Distance starts at the movement start
point instead of the end point.
[ \Time ]
Used when the value specified for the argument Distance is in fact a time in
seconds (positive value) instead of a distance.
Fixed position I/O in time can only be used for short times (< 0.5 s) before the
robot reaches the end point of the instruction. See the section entitled Limitations
for more details.
[ \DOp ]
(Digital OutPut)
The name of the signal, when a digital output signal shall be changed.
[ \GOp ]
(Group OutPut)
The name of the signal, when a group of digital output signals shall be changed.
[ \AOp ]
(Analog Output)
The name of the signal, when a analog output signal shall be changed.
[ \ProcID]
(Process Identity)
Desired value of output signal (within the allowed range for the current signal).
[ \DODelay]
Time delay in seconds (positive value) for a digital output signal or group of
digital output signals.
Only used to delay setting digital output signals, after the robot has reached the
specified position. There will be no delay if the argument is omitted.
The delay is not synchronised with the movement.
2-TriggIO-412
Instructions
TriggIO
Program execution
When running the instruction TriggIO, the trigger condition is stored in a specified
variable for the argument TriggData.
Afterwards, when one of the instructions TriggL, TriggC or TriggJ is executed, the
following are applicable, with regard to the definitions in TriggIO:
The distance specified in the argument Distance:
Linear movement
Circular movement
Non-linear movement
The fixed position I/O will be generated when the start point (end point) is passed, if
the specified distance from the end point (start point) is not within the length of
movement of the current instruction (Trigg...).
Examples
VAR triggdata glueflow;
TriggIO glueflow, 1 \Start \AOp:=glue, 5.3;
MoveJ p1, v1000, z50, tool1;
TriggL p2, v500, glueflow, z50, tool1;
The analog output signal glue is set to the value 5.3 when the work point passes
a point located 1 mm after the start point p1.
...
TriggL p3, v500, glueflow, z50, tool1;
The analog output signal glue is set once more to the value 5.3 when the work
point passes a point located 1 mm after the start point p2.
2-TriggIO-413
TriggIO
Instructions
Limitations
I/O events with distance (without the argument \Time) is intended for flying points
(corner path). I/O events with distance, using stop points, results in worse accuracy than
specified below.
I/O events with time (with the argument \Time) is intended for stop points. I/O events
with time, using flying points, results in worse accuracy than specified below.
I/O events with time can only be specified from the end point of the movement. This
time cannot exceed the current braking time of the robot, which is max. approx. 0.5 s
(typical values at speed 500 mm/s for IRB2400 150 ms and for IRB6400 250 ms). If
the specified time is greater that the current braking time, the event will be generated
anyhow, but not until braking is started (later than specified). However, the whole of
the movement time for the current movement can be utilised during small and fast
movements.
Typical absolute accuracy values for set of digital outputs +/- 5 ms.
Typical repeat accuracy values for set of digital outputs +/- 2 ms.
Syntax
TriggIO
[ TriggData := ] < variable (VAR) of triggdata> ,
[ Distance := ] < expression (IN) of num>
[ \ Start ] | [ \ Time ]
[ \ DOp := < variable (VAR) of signaldo> ]
| [ \ GOp := < variable (VAR) of signalgo> ]
| [ \ AOp := < variable (VAR) of signalao> ]
| [ \ ProcID := < expression (IN) of num> ] ,
[ SetValue := ] < expression (IN) of num>
[ \ DODelay := < expression (IN) of num> ] ;
Related information
Described in:
Use of triggers
Instruction - TriggEquip
Instruction - TriggInt
More examples
Set of I/O
2-TriggIO-414
Instructions
TriggJ
TriggJ
Examples
VAR triggdata gunon;
TriggIO gunon, 0 \Start \DOp:=gun, on;
MoveL p1, v500, z50, gun1;
TriggJ p2, v500, gunon, fine, gun1;
The digital output signal gun is set when the robots TCP passes the midpoint of
the corner path of the point p1.
Start point p1
End point p2
Arguments
TriggJ
[ \Conc ]
(Concurrent)
2-TriggJ-415
TriggJ
Instructions
If this argument is omitted and the ToPoint is not a stop point, the subsequent
instruction is executed some time before the robot has reached the programmed
zone .
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
Speed
The speed data that applies to movements. Speed data defines the velocity of the
tool centre point, the external axes and of the tool reorientation.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Trigg_1
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
[ \T2]
(Trigg 2)
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
[ \T3 ]
(Trigg 3)
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
[ \T4 ]
(Trigg 4)
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
Zone
Tool
[ \WObj]
(Work Object)
The work object (coordinate system) to which the robot position in the instruction
is related.
2-TriggJ-416
Instructions
TriggJ
This argument can be omitted, and if it is, the position is related to the world
coordinate system. If, on the other hand, a stationary TCP or coordinated external axes are used, this argument must be specified for a linear movement relative
to the work object to be performed.
Program execution
See the instruction MoveJ for information about joint movement.
As the trigger conditions are fulfilled when the robot is positioned closer and closer to
the end point, the defined trigger activities are carried out. The trigger conditions are
fulfilled either at a certain distance before the end point of the instruction, or at a certain distance after the start point of the instruction, or at a certain point in time (limited
to a short time) before the end point of the instruction.
During stepping execution forwards, the I/O activities are carried out but the interrupt
routines are not run. During stepping execution backwards, no trigger activities at all
are carried out.
Examples
VAR intnum intno1;
VAR triggdata trigg1;
...
CONNECT intno1 WITH trap1;
TriggInt trigg1, 0.1 \Time , intno1;
...
TriggJ p1, v500, trigg1, fine, gun1;
TriggJ p2, v500, trigg1, fine, gun1;
...
IDelete intno1;
The interrupt routine trap1 is run when the work point is at a position
0.1 s before the point p1 or p2 respectively.
Limitations
If the current start point deviates from the usual, so that the total positioning length of
the instruction TriggJ is shorter than usual (e.g. at the start of TriggJ with the robot
position at the end point), it may happen that several or all of the trigger conditions are
fulfilled immediately and at the same position. In such cases, the sequence in which
the trigger activities are carried will be undefined. The program logic in the user program may not be based on a normal sequences of trigger activities for an incomplete
movement.
2-TriggJ-417
TriggJ
Instructions
Syntax
TriggJ
[\ Conc ,]
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ T := < expression (IN) of num > ] ,
[Trigg_1 := ] < variable (VAR) of triggdata >
[ \ T2 := < variable (VAR) of triggdata > ]
[ \ T3 := < variable (VAR) of triggdata > ]
[ \ T4 := < variable (VAR) of triggdata > ] ,
[Zone := ] < expression (IN) of zonedata > ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ] ;
Related information
Described in:
Linear movement with triggs
Instructions - TriggL
Instructions - TriggC
Definition of triggers
Joint movement
Definition of velocity
Definition of tools
Motion in general
Motion Principles
2-TriggJ-418
Instructions
TriggL
TriggL
Examples
VAR triggdata gunon;
TriggIO gunon, 0 \Start \DOp:=gun, on;
MoveJ p1, v500, z50, gun1;
TriggL p2, v500, gunon, fine, gun1;
The digital output signal gun is set when the robots TCP passes the midpoint of
the corner path of the point p1.
Start point p1
End point p2
Arguments
TriggL [\Conc] ToPoint Speed [ \T ] Trigg_1 [ \T2 ] [ \T3 ] [ \T4 ]
Zone Tool [ \WObj ] [ \Corr ]
[ \Conc ]
(Concurrent)
2-TriggL-419
TriggL
Instructions
If this argument is omitted and the ToPoint is not a stop point, the subsequent
instruction is executed some time before the robot has reached the programmed
zone.
ToPoint
The destination point of the robot and external axes. It is defined as a named
position or stored directly in the instruction (marked with an * in the instruction).
Speed
The speed data that applies to movements. Speed data defines the velocity of the
tool centre point, the external axes and of the tool reorientation.
[ \T ]
(Time)
This argument is used to specify the total time in seconds during which the robot
moves. It is then substituted for the corresponding speed data.
Trigg_1
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
[ \T2]
(Trigg 2)
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
[ \T3 ]
(Trigg 3)
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
[ \T4 ]
(Trigg 4)
Variable that refers to trigger conditions and trigger activity, defined earlier in the
program using the instructions TriggIO, TriggEquip or TriggInt.
Zone
Tool
[ \WObj]
(Work Object)
The work object (coordinate system) to which the robot position in the instruction
is related.
2-TriggL-420
Instructions
TriggL
This argument can be omitted, and if it is, the position is related to the world
coordinate system. If, on the other hand, a stationary TCP or coordinated
external axes are used, this argument must be specified for a linear movement
relative to the work object to be performed.
[ \Corr]
(Correction)
Program execution
See the instruction MoveL for information about linear movement.
As the trigger conditions are fulfilled when the robot is positioned closer and closer to
the end point, the defined trigger activities are carried out. The trigger conditions are
fulfilled either at a certain distance before the end point of the instruction, or at a
certain distance after the start point of the instruction, or at a certain point in time
(limited to a short time) before the end point of the instruction.
During stepping execution forwards, the I/O activities are carried out but the interrupt
routines are not run. During stepping execution backwards, no trigger activities at all
are carried out.
Examples
VAR intnum intno1;
VAR triggdata trigg1;
...
CONNECT intno1 WITH trap1;
TriggInt trigg1, 0.1 \Time, intno1;
...
TriggL p1, v500, trigg1, fine, gun1;
TriggL p2, v500, trigg1, fine, gun1;
...
IDelete intno1;
The interrupt routine trap1 is run when the work point is at a position
0.1 s before the point p1 or p2 respectively.
Limitations
If the current start point deviates from the usual, so that the total positioning length of the
instruction TriggL is shorter than usual (e.g. at the start of TriggL with the robot position
at the end point), it may happen that several or all of the trigger conditions are fulfilled
immediately and at the same position. In such cases, the sequence in which the trigger
activities are carried out will be undefined. The program logic in the user program may
not be based on a normal sequence of trigger activities for an incomplete movement.
System Data Types and Routines
2-TriggL-421
TriggL
Instructions
Syntax
TriggL
[\ Conc ,]
[ ToPoint := ] < expression (IN) of robtarget > ,
[ Speed := ] < expression (IN) of speeddata >
[ \ T := < expression (IN) of num > ] ,
[Trigg_1 := ] < variable (VAR) of triggdata >
[ \ T2 := < variable (VAR) of triggdata > ]
[ \ T3 := < variable (VAR) of triggdata > ]
[ \ T4 := < variable (VAR) of triggdata > ] ,
[Zone := ] < expression (IN) of zonedata > ,
[ Tool := ] < persistent (PERS) of tooldata >
[ \ WObj := < persistent (PERS) of wobjdata > ]
[ \ Corr ];
Related information
Described in:
Circular movement with triggers
Instructions - TriggC
Instructions - TriggJ
Definition of triggers
Instructions - CorrWrite
Linear movement
Definition of velocity
Definition of tools
Motion in general
Motion Principles
2-TriggL-422
Instructions
TRYNEXT
TRYNEXT
TRYNEXT is used to jump over an instruction which has caused an error. Instead, the
next instruction is run.
Example
reg2 := reg3/reg4;
.
ERROR
IF ERRNO = ERR_DIVZERO THEN
reg2:=0;
TRYNEXT;
ENDIF
An attempt is made to divide reg3 by reg4. If reg4 is equal to 0 (division by zero),
a jump is made to the error handler, where reg2 is set to 0. The TRYNEXT instruction is then used to continue with the next instruction.
Program execution
Program execution continues with the instruction subsequent to the instruction that
caused the error.
Limitations
The instruction can only exist in a routines error handler.
Syntax
TRYNEXT;
Related information
Described in:
Error handlers
2-TRYNEXT-423
TRYNEXT
2-TRYNEXT-424
Instructions
Instructions
TuneReset
TuneReset
TuneReset is used to reset the dynamic behaviour of all robot axes and external
mechanical units to their normal values.
Example
TuneReset;
Resetting tuning values for all axes to 100%.
Program execution
The tuning values for all axes are reset to 100%.
The default servo tuning values for all axes are automatically set by executing
instruction TuneReset
- at a cold start-up
- when a new program is loaded
- when starting program execution from the beginning.
Syntax
TuneReset ;
Related information
Described in:
Tuning servos
Instructions - TuneServo
2-TuneReset-425
TuneReset
2-TuneReset-426
Instructions
Instructions
TuneServo
TuneServo
Tuning servos
TuneServo is used to tune the dynamic behaviour of separate axes on the robot. It is not
necessary to use TuneServo under normal circumstances, but sometimes tuning can be
optimised depending on the robot configuration and the load characteristics. For
external axes TuneServo can be used for load adaptation.
Incorrect use of the TuneServo can cause oscillating movements or torques that
can damage the robot. You must bear this in mind and be careful when using the
TuneServo.
Avoid doing TuneServo commands at the same time as the robot is moving. It can
result in momentary high CPU loads causing error indication and stops.
Note. To obtain optimal tuning it is essential that the correct load data is used.
Check on this before using TuneServo.
Generally, optimal tuning values often differ between different robots. Optimal tuning
may also change with time.
Improving path accuracy
For robots running at lower speeds, TuneServo can be used to improve the path
accuracy by:
- Tuning tune_kv and tune_ti (see the tune types description below).
- Tuning friction compensation parameters (see below).
These two methods can be combined.
Other possibilities to improve the path accuracy:
- Decreasing path resolution can improve the path. Note: a value of path
resolution which is too low will cause CPU load problems.
- The accuracy of straight lines can be improved by decreasing acceleration using
AccSet. Example: AccSet 20, 10.
2-TuneServo-427
TuneServo
Instructions
Description
Tune_df
Tune_df is used for reducing overshoots or oscillations along the path.
There is always an optimum tuning value that can vary depending on position and
movement length. This optimum value can be found by changing the tuning in small
steps (1 - 2%) on the axes that are involved in this unwanted behaviour. Normally the
optimal tuning will be found in the range 70% - 130%. Too low or too high tuning
values have a negative effect and will impair movements considerably.
When the tuning value at the start point of a long movement differs considerably from
the tuning value at the end point, it can be advantageous in some cases to use an
intermediate point with a corner zone to define where the tuning value will change.
Some examples of the use of TuneServo to optimise tuning follow below:
IRB 6400, in a press service application (extended and flexible load), axes 4 - 6:
Reduce the tuning value for the current wrist axis until the movement is acceptable. A
change in the movement will not be noticeable until the optimum value is approached.
A low value will impair the movement considerably. Typical tuning value 25%.
IRB 6400, upper parts of working area. Axis 1 can often be optimised with a tuning
value of 85% - 95%.
IRB 6400, short movement (< 80 mm). Axis 1 can often be optimised with a tuning
value of 94% - 98%.
IRB 2400, with track motion. In some cases axes 2 - 3 can be optimised with a tuning
value of 110% - 130%. The movement along the track can require a different tuning
value compared with movement at right angles to the track.
Overshoots and oscillations can be reduced by decreasing the acceleration or the
acceleration ramp (AccSet), which will however increase the cycle time. This is an
alternative method to the use of TuneServo.
Tune_dg
Tune_dg can reduce overshoots on rare occasions. Normally it should not be used.
Tune_df should always be tried first in cases of overshoots.
Tuning of tune_dg can be performed with large steps in tune value (eg. 50%, 100%,
200%, 400%).
Never use tune_dg when the robot is moving.
2-TuneServo-428
Instructions
TuneServo
Tune_dh
Tune_dh can be used for reducing vibrations and overshoots (eg. large flexible load).
Tune value must always be lower than 100. Tune_dh increases path deviation and
normally also increases cycle time.
Example:
IRB6400 with large flexible load which vibrates when the robot has stopped. Use
tune_dh with tune value 15.
Tune_dh should only be executed for one axis. All axes in the same mechanical
unit automatically get the same tune_value.
Never use tune_dh when the robot is moving.
Tune_di
Tune_di can be used for reducing path deviation at high speeds.
A tune value in the range 50 - 80 is recommended for reducing path deviation.
Overshoots can increase (lower tune value means larger overshoot).
A higher tune value than 100 can reduce overshoot (but increases path deviation at high
speed).
Tune_di should only be executed for one axis. All axes in the same mechanical unit
automatically get the same tune_value.
Tune_dk
For future use.
Tune_kp, tune_kv, tune_ti external axes
These tune types affect position control gain (kp), speed control gain (kv) and speed
control integration time (ti) for external axes. These are used for adapting external axes
to different load inertias. Basic tuning of external axes can also be simplified by using
these tune types.
Tune_kp, tune_kv, tune_ti robot axes
For robot axes, these tune types have another significance and can be used for reducing
path errors at low speeds (< 500 mm/s).
Recommended values: tune_kv 100 - 180%, tune_ti 50 - 100%. Tune_kp should not be
used for robot axes. Values of tune_kv/tune_ti which are too high or too low will cause
vibrations or oscillations. Be careful if trying to exceed these recommended values.
Make changes in small steps and avoid oscillating motors.
2-TuneServo-429
TuneServo
Instructions
Always tune one axis at a time. Change the tuning values in small steps. Try to
improve the path where this specific axis changes its direction of movement or where
it accelerates or deccelerates.
Never use these tune types at high speeds or when the required path accuracy is fulfilled.
Friction compensation: tune_fric_lev and tune_fric_ramp
These tune types can be used to reduce robot path errors caused by friction and backlash
at low speeds (10 - 200 mm/s). These path errors appear when a robot axis changes
direction of movement. Activate friction compensation for an axis by setting the system
parameter Friction ffw on to TRUE (topic: Manipulator, type: Control parameters).
The friction model is a constant level with opposite sign of the axis speed direction.
Friction ffw level (Nm) is the absolute friction level at (low) speeds and is greater than
Friction ffw ramp (rad/s) (see figure).
Tune_fric_lev overrides the value of the system parameter Friction ffw level.
Tuning Friction ffw level (using tune_fric_lev) for each robot axis can improve the
robots path accuracy considerably in the speed range 20 - 100 mm/s. For larger robots
(especially the IRB6400 family) the effect will however be minimal as other sources of
tracking errors dominate these robots.
Tune_fric_ramp overrides the value of the system parameter Friction ffw ramp. In most
cases there is no need to tune the Friction ffw ramp. The default setting will be
appropriate.
Tune one axis at a time. Change the tuning value in small steps and find the level that
minimises the robot path error at positions on the path where this specific axis changes
direction of movement. Repeat the same procedure for the next axis etc.
The final tuning values can be transferred to the system parameters. Example:
Friction ffw level = 1. Final tune value (tune_fric_lev) = 150%.
Set Friction ffw level = 1.5 and tune value = 100% (default value) which is
equivalent.
2-TuneServo-430
Instructions
TuneServo
Arguments
TuneServo MecUnit Axis TuneValue [\Type]
MecUnit
(Mechanical Unit)
TuneValue
Example
TuneServo MHA160R1, 1, 110 \Type:= TUNE_KP;
Activating of tuning type TUNE_KP with the tuning value 110% on axis 1 in the
mechanical unit MHA160R1.
Program execution
The specified tuning type and tuning value are activated for the specified axis. This
value is applicable for all movements until a new value is programmed for the current
axis, or until the tuning types and values for all axes are reset using the instruction
TuneReset.
The default servo tuning values for all axes are automatically set by executing
instruction TuneReset
- at a cold start-up
- when a new program is loaded
- when starting program execution from the beginning.
2-TuneServo-431
TuneServo
Instructions
Limitations
Any active servo tuning are always set to default values at power fail.
This limitation can be handled in the user program at restart after power failure.
Syntax
TuneServo
[MecUnit := ] < variable (VAR) of mecunit> ,
[Axis := ] < expression (IN) of num> ,
[TuneValue := ] < expression (IN) of num>
[\ Type := <expression (IN) of tunetype>];
Related information
Described in:
Other motion settings
Instructions - TuneReset
Friction compensation
2-TuneServo-432
Instructions
UnLoad
UnLoad
UnLoad is used to unload a program module from the program memory during execution.
The program module must previously have been loaded into the program memory
using the instruction Load or StartLoad - WaitLoad.
Example
UnLoad ram1disk \File:="PART_A.MOD";
UnLoad the program module PART_A.MOD from the program memory, that
previously was loaded into the program memory with Load. (See instructions
Load). (ram1disk is a predefined string constant "ram1disk:").
Arguments
UnLoad [\Save] FilePath [\File]
[\Save]
If this argument is used, the program module is saved before the unloading starts.
The program module will be saved at the original place specified in the Load or
StartLoad instruction.
FilePath
The file path and the file name to the file that will be unloaded from the program
memory. The file path and the file name must be the same as in the previously
executed Load or StartLoad instruction. The file name shall be excluded when
the argument \File is used.
[\File]
When the file name is excluded in the argument FilePath, then it must be defined
with this argument. The file name must be the same as in the previously executed
Load or StartLoad instruction.
Program execution
To be able to execute an UnLoad instruction in the program, a Load or StartLoad WaitLoad instruction with the same file path and name must have been executed earlier
in the program.
2-UnLoad-433
UnLoad
Instructions
The program execution waits for the program module to finish unloading before the
execution proceeds with the next instruction.
After that the program module is unloaded and the rest of the program modules will be
linked.
For more information see the instructions Load or StartLoad-Waitload.
Examples
UnLoad "ram1disk:DOORDIR/DOOR1.MOD";
UnLoad the program module DOOR1.MOD from the program memory, that previously was loaded into the program memory with Load. (See instructions
Load).
UnLoad "ram1disk:" \File:="DOORDIR/DOOR1.MOD";
Same as above but another syntax.
Unload \Save, "ram1disk:" \File:="DOORDIR/DOOR1.MOD";
Same as above but save the program module before unloading.
Limitations
It is not allowed to unload a program module that is executing.
TRAP routines, system I/O events and other program tasks cannot execute during the
unloading.
Avoid ongoing robot movements during the unloading.
Program stop during execution of UnLoad instruction results in guard stop with motors
off and error message "20025 Stop order timeout" on the Teach Pendant.
Error handling
If the file in the UnLoad instruction cannot be unloaded because of ongoing execution
within the module or wrong path (module not loaded with Load or StartLoad), the system variable ERRNO is set to ERR_UNLOAD. This error can then be handled in the
error handler.
2-UnLoad-434
Instructions
UnLoad
Syntax
UnLoad
[\Save ,]
[FilePath:=]<expression (IN) of string>
[\File:= <expression (IN) of string>];
Related information
Described in:
Load a program module
Instructions - Load
Instructions - StartLoad-WaitLoad
2-UnLoad-435
UnLoad
2-UnLoad-436
Instructions
Instructions
WaitDI
WaitDI
WaitDI (Wait Digital Input) is used to wait until a digital input is set.
Example
WaitDI di4, 1;
Program execution continues only after the di4 input has been set.
WaitDI grip_status, 0;
Program execution continues only after the grip_status input has been reset.
Arguments
WaitDI
Signal
(Maximum Time)
(Timeout Flag)
The output parameter that contains the value TRUE if the maximum permitted
waiting time runs out before the condition is met. If this parameter is included in
the instruction, it is not considered to be an error if the max. time runs out.
This argument is ignored if the MaxTime argument is not included in the instruction.
Program Running
If the value of the signal is correct, when the instruction is executed, the program simply continues with the following instruction.
2-WaitDI-437
WaitDI
Instructions
If the signal value is not correct, the robot enters a waiting state and when the signal
changes to the correct value, the program continues. The change is detected with an
interrupt, which gives a fast response (not polled).
When the robot is waiting, the time is supervised, and if it exceeds the max time value,
the program will continue if a Time Flag is specified, or raise an error if its not. If a
Time Flag is specified, this will be set to true if the time is exceeded, otherwise it will
be set to false.
Syntax
WaitDI
[ Signal := ] < variable (VAR) of signaldi > ,
[ Value := ] < expression (IN) of dionum >
[\MaxTime :=<expression (IN) of num>]
[\TimeFlag:=<variable (VAR) of bool>] ;
Related information
Described in:
Waiting until a condition is satisfied
Instructions - WaitUntil
Instructions - WaitTime
2-WaitDI-438
Instructions
WaitDO
WaitDO
WaitDO (Wait Digital Output) is used to wait until a digital output is set.
Example
WaitDO do4, 1;
Program execution continues only after the do4 output has been set.
WaitDO grip_status, 0;
Program execution continues only after the grip_status output has been reset.
Arguments
WaitDO
Signal
(Maximum Time)
(Timeout Flag)
The output parameter that contains the value TRUE if the maximum permitted
waiting time runs out before the condition is met. If this parameter is included in
the instruction, it is not considered to be an error if the max. time runs out.
This argument is ignored if the MaxTime argument is not included in the instruction.
Program Running
If the value of the signal is correct, when the instruction is executed, the program simply continues with the following instruction.
2-WaitDO-439
WaitDO
Instructions
If the signal value is not correct, the robot enters a waiting state and when the signal
changes to the correct value, the program continues. The change is detected with an
interrupt, which gives a fast response (not polled).
When the robot is waiting, the time is supervised, and if it exceeds the max time value,
the program will continue if a Time Flag is specified, or raise an error if its not. If a
Time Flag is specified, this will be set to true if the time is exceeded, otherwise it will
be set to false.
Syntax
WaitDO
[ Signal := ] < variable (VAR) of signaldo > ,
[ Value := ] < expression (IN) of dionum >
[\MaxTime :=<expression (IN) of num>]
[\TimeFlag:=<variable (VAR) of bool>] ;
Related information
Described in:
Waiting until a condition is satisfied
Instructions - WaitUntil
Instructions - WaitTime
2-WaitDO-440
Instructions
WaitLoad
WaitLoad
WaitLoad is used to connect the module, if loaded with StartLoad, to the program task.
The loaded module must be connected to the program task with the instruction WaitLoad before any of its symbol/routines can be used.
The loaded program module will be added to the modules already existing in the program memory.
This instruction can also be combined with the function to unload some other program
module, in order to minimise the number of links (1 instead of 2).
Example
VAR loadsession load1;
...
StartLoad "ram1disk:PART_A.MOD", load1;
MoveL p10, v1000, z50, tool1 \WObj:=wobj1;
MoveL p20, v1000, z50, tool1 \WObj:=wobj1;
MoveL p30, v1000, z50, tool1 \WObj:=wobj1;
MoveL p40, v1000, z50, tool1 \WObj:=wobj1;
WaitLoad load1;
%"routine_x"%;
UnLoad "ram1disk:PART_A.MOD";
Load the program module PART_A.MOD from the ram1disk into the program
memory. In parallel, move the robot. Then connect the new program module to
the program task and call the routine routine_x in the module PART_A.
Arguments
WaitLoad [\UnloadPath] [\UnloadFile] LoadNo
[\UnloadPath]
The file path and the file name to the file that will be unloaded from the program
memory. The file name should be excluded when the argument \UnloadFile is
used.
2-WaitLoad-441
WaitLoad
Instructions
[\UnloadFile]
When the file name is excluded in the argument \UnloadPath, then it must be
defined with this argument.
LoadNo
Program execution
The instruction WaitLoad will first wait for the loading to be completed, if it is not
already done, and then it will be linked and initialised. The initialisation of the loaded
module sets all variables at module level to their init values.
Unsolved references will be accepted, if the system parameter for Tasks/BindRef is set
to NO. However, when the program is started or the teach pendant function Program
Window/File/Check Program is used, no check for unsolved references will be done if
BindRef = NO. There will be a run time error on execution of an unsolved reference.
Another way to use references to instructions, that are not in the task from the beginning, is to use Late Binding. This makes it possible to specify the routine to call with a
string expression, quoted between two %%. In this case the BindRef parameter could
be set to YES (default behaviour). The Late Binding way is preferable.
To obtain a good program structure, that is easy to understand and maintain, all loading
and unloading of program modules should be done from the main module, which is
always present in the program memory during execution.
Examples
StartLoad "ram1disk:DOORDIR/DOOR2.MOD", load1;
...
WaitLoad \UnloadPath:="ram1disk:DOORDIR/DOOR1.MOD", load1;
Load the program module DOOR2.MOD from the ram1disk at the directory
DOORDIR into the program memory and connect the new module to the task.
The program module DOOR1.MOD will be unloaded from the program memory.
StartLoad "ram1disk:" \File:="DOORDIR/DOOR2.MOD", load1;
! The robot can do some other work
WaitLoad \UnloadPath:="ram1disk:" \File:= "DOORDIR/DOOR1.MOD", load1;
is the same as the instructions below but the robot can do some other work during
the loading time and also do it faster (only one link).
Load "ram1disk:" \File:="DOORDIR/DOOR2.MOD";
UnLoad "ram1disk:" \File:="DOORDIR/DOOR1.MOD";
2-WaitLoad-442
Instructions
WaitLoad
Error handling
If the file specified in the StartLoad instruction cannot be found, the system variable
ERRNO is set to ERR_FILNOTFND at execution of WaitLoad.
If argument LoadNo refers to an unknown load session, the system variable ERRNO
is set to ERR_UNKPROC.
If the module is already loaded into the program memory, the system variable ERRNO
is set to ERR_LOADED.
The following errors can only occur when the argument \UnloadPath is used in the
instruction WaitLoad:
- If the program module specified in the argument \UnloadPath cannot be
unloaded because of ongoing execution within the module, the system variable
ERRNO is set to ERR_UNLOAD.
- If the program module specified in the argument \UnloadPath cannot be
unloaded because the program module is not loaded with Load or StartLoadWaitLoad from the RAPID program, the system variable ERRNO is also set to
ERR_UNLOAD.
These errors can then be handled in the error handler.
Syntax
WaitLoad
[ [ \ UnloadPath := <expression (IN) of string> ]
[ \ UnloadFile := <expression (IN) of string> ] , ]
[ LoadNo := ] <variable (VAR) of loadsession> ;
Related information
Load a program module during execution
Instructions - StartLoad
Load session
Instructions - Load
Instructions - UnLoad
2-WaitLoad-443
WaitLoad
2-WaitLoad-444
Instructions
Instructions
VelSet
VelSet
Example
VelSet 50, 800;
All the programmed velocities are decreased to 50% of the value in the instruction. The TCP velocity is not, however, permitted to exceed 800 mm/s.
Arguments
VelSet
Override Max
Override
Program execution
The programmed velocity of all subsequent positioning instructions is affected until a
new VelSet instruction is executed.
The argument Override affects:
- All velocity components (TCP, orientation, rotating and linear external axes) in
speeddata.
- The programmed velocity override in the positioning instruction (the
argument \V).
- Timed movements.
The argument Override does not affect:
- The welding speed in welddata.
- The heating and filling speed in seamdata.
The argument Max only affects the velocity of the TCP.
2-VelSet-445
VelSet
Instructions
The default values for Override and Max are 100% and 5000 mm/s respectively. These
values are automatically set
- at a cold start-up
- when a new program is loaded
- when starting program executing from the beginning.
Example
VelSet 50, 800;
MoveL p1, v1000, z10, tool1;
MoveL p2, v2000, z10, tool1;
MoveL p3, v1000\T:=5, z10, tool1;
The speed is 500 mm/s to point p1 and 800 mm/s to p2. It takes 10 seconds to
move from p2 to p3.
Limitations
The maximum speed is not taken into consideration when the time is specified in the
positioning instruction.
Syntax
VelSet
[ Override := ] < expression (IN) of num > ,
[ Max := ] < expression (IN) of num > ;
Related information
Described in:
Definition of velocity
Positioning instructions
2-VelSet-446
Instructions
WHILE
WHILE
WHILE is used when a number of instructions are to be repeated as long as a given condition is met.
If it is possible to determine the number of repetitions in advance, the FOR instruction
can be used.
Example
WHILE reg1 < reg2 DO
...
reg1 := reg1 +1;
ENDWHILE
Repeats the instructions in the WHILE loop as long as reg1 < reg2.
Arguments
WHILE
Condition
The condition that must be met for the instructions in the WHILE loop to be executed.
Program execution
7. The condition is calculated. If the condition is not met, the WHILE loop terminates
and program execution continues with the instruction following ENDWHILE.
8. The instructions in the WHILE loop are executed.
9. The WHILE loop is repeated, starting from point 1.
Syntax
(EBNF)
WHILE <conditional expression> DO
<instruction list>
ENDWHILE
2-WHILE-447
WHILE
Instructions
Related information
Described in:
Expressions
2-WHILE-448
Instructions
Write
Write
Examples
Write logfile, "Execution started";
The text Execution started is written to the file with reference name logfile.
Write logfile, "No of produced parts="\Num:=reg1;
The text No of produced parts=5, for example, is written to the file with the
reference name logfile (assuming that the contents of reg1 is 5).
Arguments
Write IODevice String [\Num] | [\Bool] | [\Pos] | [\Orient]
[\NoNewLine]
IODevice
(Numeric)
The data whose numeric values are to be written after the text string.
[\Bool]
(Boolean)
The data whose logical values are to be written after the text string.
[\Pos]
(Position)
(Orientation)
Omits the line-feed character that normally indicates the end of the text.
2-Write-449
Write
Instructions
Program execution
The text string is written to a specified file or serial channel. If the argument
\NoNewLine is not used, a line-feed character (LF) is also written.
If one of the arguments \Num, \Bool, \Pos or \Orient is used, its value is first converted
to a text string before being added to the first string. The conversion from value to text
string takes place as follows:
Argument
Value
Text string
\Num
23
"23"
\Num
1.141367
"1.14137"
\Bool
TRUE
"TRUE"
\Pos
[1817.3,905.17,879.11]
"[1817.3,905.17,879.11]"
\Orient
[0.96593,0,0.25882,0]
"[0.96593,0,0.25882,0]"
The value is converted to a string with standard RAPID format. This means in principle
6 significant digits. If the decimal part is less than 0.000005 or greater than 0.999995,
the number is rounded to an integer.
Example
VAR iodev printer;
.
Open "sio1:", printer\Write;
WHILE DInput(stopprod)=0 DO
produce_part;
Write printer, "Produced part="\Num:=reg1\NoNewLine;
Write printer, "
"\NoNewLine;
Write printer, CTime();
ENDWHILE
Close printer;
A line, including the number of the produced part and the time, is output to a
printer each cycle. The printer is connected to serial channel sio1:. The printed
message could look like this:
Produced part=473
09:47:15
Limitations
The arguments \Num, \Bool, \Pos and \Orient are mutually exclusive and thus cannot
be used simultaneously in the same instruction.
This instruction can only be used for files or serial channels that have been opened for
writing.
2-Write-450
Instructions
Write
Error handling
If an error occurs during writing, the system variable ERRNO is set to
ERR_FILEACC. This error can then be handled in the error handler.
Syntax
Write
[IODevice:=] <variable (VAR) of iodev>,
[String:=] <expression (IN) of string>
[\Num:= <expression (IN) of num> ]
| [\Bool:= <expression (IN) of bool> ]
| [\Pos:= <expression (IN) of pos> ]
| [\Orient:= <expression (IN) of orient> ]
[\NoNewLine];
Related information
Described in:
Opening a file or serial channel
2-Write-451
Write
2-Write-452
Instructions
Instructions
WriteBin
WriteBin
Example
WriteBin channel2, text_buffer, 10;
10 characters from the text_buffer list are written to the channel referred to by
channel2.
Arguments
WriteBin
IODevice
(Number of Characters)
Program execution
The specified number of numbers (characters) in the list is written to the serial channel.
Limitations
This instruction can only be used for serial channels that have been opened for binary
reading and writing.
Error handling
If an error occurs during writing, the system variable ERRNO is set to
ERR_FILEACC. This error can then be handled in the error handler.
2-WriteBin-453
WriteBin
Instructions
Example
VAR iodev channel;
VAR num out_buffer{20};
VAR num input;
VAR num nchar;
Open "sio1:", channel\Bin;
out_buffer{1} := 5;
WriteBin channel, out_buffer, 1;
input := ReadBin (channel \Time:= 0.1);
( enq )
IF input = 6 THEN
out_buffer{1} := 2;
out_buffer{2} := 72;
out_buffer{3} := 101;
out_buffer{4} := 108;
out_buffer{5} := 108;
out_buffer{6} := 111;
out_buffer{7} := 32;
out_buffer{8} := StrToByte("w"\Char);
out_buffer{9} := StrToByte("o"\Char);
out_buffer{10} := StrToByte("r"\Char);
out_buffer{11} := StrToByte("l"\Char);
out_buffer{12} := StrToByte("d"\Char);
out_buffer{13} := 3;
WriteBin channel, out_buffer, 13;
ENDIF
( ack )
( stx )
( H )
( e )
( l )
( l )
( o )
()
( w )
( o )
( r )
( l )
( d )
( etx )
The text string Hello world (with associated control characters) is written to a
serial channel. The function StrToByte is used in the same cases to convert a
string into a byte (num) data.
Syntax
WriteBin
[IODevice:=] <variable (VAR) of iodev>,
[Buffer:=] <array {*} (IN) of num>,
[NChar:=] <expression (IN) of num>;
2-WriteBin-454
Instructions
WriteBin
Related information
Described in:
Opening (etc.) of serial channels
Functions - StrToByte
Byte data
2-WriteBin-455
WriteBin
2-WriteBin-456
Instructions
Instructions
WriteAnyBin
WriteAnyBin
WriteAnyBin (Write Any Binary) is used to write any type of data to a binary serial
channel or file.
Example
VAR iodev channel2;
VAR orient quat1 := [1, 0, 0, 0];
...
Open "sio1:", channel2 \Bin;
WriteAnyBin channel2, quat1;
The orient data quat1 is written to the channel referred to by channel2.
Arguments
WriteAnyBin
IODevice Data
IODevice
Program execution
As many bytes as required for the specified data are written to the specified binary
serial channel or file.
Limitations
This instruction can only be used for serial channels or files that have been opened for
binary writing.
The data to be written by this instruction must have a value data type of atomic, string,
or record data type. Semi-value and non-value data types cannot be used.
Array data cannot be used.
2-WriteAnyBin-457
WriteAnyBin
Instructions
Error handling
If an error occurs during writing, the system variable ERRNO is set to ERR_FILEACC.
This error can then be handled in the error handler.
Example
VAR iodev channel;
VAR num input;
VAR robtarget cur_robt;
Open "sio1:", channel\Bin;
! Send the control character enq
WriteStrBin channel, "\05";
! Wait for the control character ack
input := ReadBin (channel \Time:= 0.1);
IF input = 6 THEN
! Send current robot position
cur_robt := CRobT(\Tool:= tool1\WObj:= wobj1);
WriteAnyBin channel, cur_robt;
ENDIF
Close channel;
The current position of the robot is written to a binary serial channel.
Syntax
WriteAnyBin
[IODevice:=] <variable (VAR) of iodev>,
[Data:=] <var or pers (INOUT) of ANYTYPE>;
Related information
Described in:
Opening (etc.) of serial channels
or files
Functions - ReadAnyBin
2-WriteAnyBin-458
Instructions
WriteStrBin
Example
WriteStrBin channel2, "Hello World\0A";
The string "Hello World\0A" is written to the channel referred to by channel2.
The string is in this case ended with new line \0A. All characters and hexadecimal values written with WriteStrBin will be unchanged by the system.
Arguments
WriteStrBin
IODevice Str
IODevice
(String)
Program execution
The text string is written to the specified serial channel or file.
Limitations
This instruction can only be used for serial channels or files that have been opened for
binary reading and writing.
Error handling
If an error occurs during writing, the system variable ERRNO is set to
ERR_FILEACC. This error can then be handled in the error handler.
2-WriteStrBin-459
WriteStrBin
Instructions
Example
VAR iodev channel;
VAR num input;
Open "sio1:", channel\Bin;
! Send the control character enq
WriteStrBin channel, "\05";
! Wait for the control character ack
input := ReadBin (channel \Time:= 0.1);
IF input = 6 THEN
! Send a text starting with control character stx and ending with etx
WriteStrBin channel, "\02Hello world\03";
ENDIF
Close channel;
The text string Hello world (with associated control characters in hexadecimal)
is written to a binary serial channel.
Syntax
WriteStrBin
[IODevice:=] <variable (VAR) of iodev>,
[Str:=] <expression (IN) of string>;
Related information
Described in:
Opening (etc.) of serial channels
2-WriteStrBin-460
Instructions
WaitTime
WaitTime
WaitTime is used to wait a given amount of time. This instruction can also be used to
wait until the robot and external axes have come to a standstill.
Example
WaitTime 0.5;
Program execution waits 0.5 seconds.
Arguments
WaitTime
[\InPos] Time
[\InPos]
If this argument is used, the robot and external axes must have come to a
standstill before the waiting time starts to be counted.
Time
Program execution
Program execution temporarily stops for the given amount of time. Interrupt handling
and other similar functions, nevertheless, are still active.
Example
WaitTime \InPos,0;
Program execution waits until the robot and the external axes have come to a
standstill.
Limitations
If the argument \Inpos is used, the movement instruction which precedes this
instruction should be terminated with a stop point, in order to be able to restart in this
instruction following a power failure.
Argument \Inpos cannot be used together with SoftServo.
2-WaitTime-461
WaitTime
Instructions
Syntax
WaitTime
[\InPos,]
[Time :=] <expression (IN) of num>;
Related information
Described in:
Waiting until a condition is met
Instructions - WaitUntil
Instruction - WaitDI
2-WaitTime-462
Instructions
WaitUntil
WaitUntil
WaitUntil is used to wait until a logical condition is met; for example, it can wait until
one or several inputs have been set.
Example
WaitUntil di4 = 1;
Program execution continues only after the di4 input has been set.
Arguments
WaitUntil
[\InPos]
If this argument is used, the robot and external axes must have stopped moving
before the condition starts being evaluated.
Cond
[\MaxTime]
(Timeout Flag)
The output parameter that contains the value TRUE if the maximum permitted
waiting time runs out before the condition is met. If this parameter is included in
the instruction, it is not considered to be an error if the max. time runs out. This
argument is ignored if the MaxTime argument is not included in the instruction.
Program execution
If the programmed condition is not met on execution of a WaitUntil instruction, the
condition is checked again every 100 ms.
When the robot is waiting, the time is supervised, and if it exceeds the max time value,
the program will continue if a TimeFlag is specified, or raise an error if its not. If a
TimeFlag is specified, this will be set to TRUE if the time is exceeded, otherwise it will
be set to false.
System Data Types and Routines
2-WaitUntil-463
WaitUntil
Instructions
Examples
VAR bool timeout;
WaitUntil start_input = 1 AND grip_status = 1\MaxTime := 60
\TimeFlag := timeout;
IF timeout THEN
TPWrite "No start order received within expected time";
ELSE
start_next_cycle;
ENDIF
If the two input conditions are not met within 60 seconds, an error message will
be written on the display of the teach pendant.
WaitUntil \Inpos, di4 = 1;
Program execution waits until the robot has come to a standstill and the di4 input
has been set.
Limitation
If the argument \Inpos is used, the movement instruction which precedes this instruction should be terminated with a stop point, in order to be able to restart in this instruction following a power failure.
Syntax
WaitUntil
[\InPos,]
[Cond :=] <expression (IN) of bool>
[\MaxTime :=<expression (IN) of num>]
[\TimeFlag:=<variable (VAR) of bool>] ;
Related information
Described in:
Waiting until an input is set/reset
Instructions - WaitDI
Instructions - WaitTime
Expressions
2-WaitUntil-464
Instructions
WZBoxDef
WZBoxDef
WZBoxDef (World Zone Box Definition) is used to define a world zone that has the
shape of a straight box with all its sides parallel to the axes of the World Coordinate
System.
Example
.
corner2
Z
Y
Box
corner1
World Coordinate System
Min. 10 mm
Arguments
WZBoxDef [\Inside] | [\Outside] Shape LowPoint HighPoint
\Inside
\Outside
Shape
Variable for storage of the defined volume (private data for the system).
2-WZBoxDef-465
WZBoxDef
Instructions
LowPoint
HighPoint
Program execution
The definition of the box is stored in the variable of type shapedata (argument Shape),
for future use in WZLimSup or WZDOSet instructions.
Limitations
The LowPoint and HighPoint positions must be valid for opposite corners (with
different x, y and z coordinate values).
If the robot is used to point out the LowPoint or HighPoint, work object wobj0 must be
active (use of component trans in robtarget e.g. p1.trans as argument).
Syntax
WZBoxDef
[\Inside] | [\Outside] ,
[Shape:=]<variable (VAR) of shapedata>,
[LowPoint:=]<expression (IN) of pos>,
[HighPoint:=]<expression (IN) of pos>;
Related information
Described in:
World Zones
Instructions - WZSphDef
Instructions - WZCylDef
Instructions - WZLimSup
Instructions - WZDOSet
2-WZBoxDef-466
Instructions
WZCylDef
WZCylDef
WZCylDef (World Zone Cylinder Definition) is used to define a world zone that has the
shape of a cylinder with the cylinder axis parallel to the z-axis of the World Coordinate
System.
Example
R2 (min. 5 mm)
H2 (min. 10 mm)
Z
Y
C2
World Coordinate System
Arguments
WZCylDef [\Inside] | [\Outside] Shape CentrePoint Radius Height
\Inside
\Outside
2-WZCylDef-467
WZCylDef
Instructions
Shape
Variable for storage of the defined volume (private data for the system).
CentrePoint
Position (x,y,z) in mm defining the centre of one circular end of the cylinder.
Radius
Height
Program execution
The definition of the cylinder is stored in the variable of type shapedata (argument
Shape), for future use in WZLimSup or WZDOSet instructions.
Limitations
If the robot is used to point out the CentrePoint, work object wobj0 must be active (use
of component trans in robtarget e.g. p1.trans as argument).
Syntax
WZCylDef
[\Inside] | [\Outside],
[Shape:=]<variable (VAR) of shapedata>,
[CentrePoint:=]<expression (IN) of pos>,
[Radius:=]<expression (IN) of num>,
[Height:=]<expression (IN) of num>;
2-WZCylDef-468
Instructions
WZCylDef
Related information
Described in:
World Zones
Instructions - WZBoxDef
Instructions - WZSphDef
Instructions - WZLimSup
Instructions - WZDOSet
2-WZCylDef-469
WZCylDef
2-WZCylDef-470
Instructions
Instructions
WZDisable
Example
VAR wztemporary wzone;
...
PROC ...
WZLimSup \Temp, wzone, volume;
MoveL p_pick, v500, z40, tool1;
WZDisable wzone;
MoveL p_place, v200, z30, tool1;
ENDPROC
When moving to p_pick, the position of the robots TCP is checked so that it will
not go inside the specified volume wzone. This supervision is not performed
when going to p_place.
Arguments
WZDisable WorldZone
WorldZone
Program execution
The temporary world zone is deactivated. This means that the supervision of the
robots TCP, relative to the corresponding volume, is temporarily stopped. It can be reactivated via the WZEnable instruction.
Limitations
Only a temporary world zone can be deactivated. A stationary world zone is always
active.
2-WZDisable-471
WZDisable
Instructions
Syntax
WZDisable
[WorldZone:=]<variable or persistent (INOUT) of wztemporary>;
Related information
Described in:
World Zones
Instructions - WZLimSup
Instructions - WZDOSet
Instructions - WZEnable
Instructions - WZFree
2-WZDisable-472
Instructions
WZDOSet
WZDOSet
WZDOSet (World Zone Digital Output Set) is used to define the action and to activate
a world zone for supervision of the robot movements.
After this instruction is executed, when the robots TCP is inside the defined world
zone or is approaching close to it, a digital output signal is set to the specified value.
Example
VAR wztemporary service;
PROC zone_output()
VAR shapedata volume;
CONST pos p_service:=[500,500,700];
...
WZSphDef \Inside, volume, p_service, 50;
WZDOSet \Temp, service \Inside, volume, do_service, 1;
ENDPROC
Definition of temporary world zone service in the application program, that sets
the signal do_service, when the robots TCP is inside the defined sphere during
program execution or when jogging.
Arguments
WZDOSet [\Temp] | [\Stat] WorldZone [\Inside] | [\Before] Shape
Signal SetValue
\Temp
(Temporary)
\Stat
(Stationary)
WorldZone
Variable or persistent variable, that will be updated with the identity (numeric
value) of the world zone.
If use of switch \Temp, the data type must be wztemporary.
If use of switch \Stat, the data type must be wzstationary.
2-WZDOSet-473
WZDOSet
Instructions
\Inside
The digital output signal will be set when the robots TCP is inside the defined
volume.
\Before
The digital output signal will be set before the robots TCP reaches the defined
volume (as soon as possible before the volume).
One of the arguments \Inside or \Outside must be specified.
Shape
Signal
SetValue
Desired value of the signal (0 or 1) when the robots TCP is inside the volume or
just before it enters the volume.
When outside or just outside the volume, the signal is set to the opposite value.
Program execution
The defined world zone is activated. From this moment, the robots TCP position is
supervised and the output will be set, when the robots TCP position is inside the
volume (\Inside) or comes close to the border of the volume (\Before).
2-WZDOSet-474
Instructions
WZDOSet
Example
VAR wztemporary home;
VAR wztemporary service;
PERS wztemporary equip1:=[0];
PROC main()
...
! Definition of all temporary world zones
zone_output;
...
! equip1 in robot work area
WZEnable equip1;
...
! equip1 out of robot work area
WZDisable equip1;
...
! No use for equip1 any more
WZFree equip1;
...
ENDPROC
PROC zone_output()
VAR shapedata volume;
CONST pos p_home:=[800,0,800];
CONST pos p_service:=[800,800,800];
CONST pos p_equip1:=[-800,-800,0];
...
WZSphDef \Inside, volume, p_home, 50;
WZDOSet \Temp, home \Inside, volume, do_home, 1;
WZSphDef \Inside, volume, p_service, 50;
WZDOSet \Temp, service \Inside, volume, do_service, 1;
WZCylDef \Inside, volume, p_equip1, 300, 1000;
WZLimSup \Temp, equip1, volume;
! equip1 not in robot work area
WZDisable equip1;
ENDPROC
Definition of temporary world zones home and service in the application
program, that sets the signals do_home and do_service, when the robot is inside
the sphere home or service respectively during program execution or when
jogging.
Also, definition of a temporary world zone equip1, which is active only in the
part of the robot program when equip1 is inside the working area for the robot.
At that time the robot stops before entering the equip1 volume, both during
program execution and manual jogging. equip1 can be disabled or enabled from
other program tasks by using the persistent variable equip1 value.
2-WZDOSet-475
WZDOSet
Instructions
Limitations
A world zone cannot be redefined by using the same variable in the argument
WorldZone.
A stationary world zone cannot be deactivated, activated again or erased in the RAPID
program.
A temporary world zone can be deactivated (WZDisable), activated again (WZEnable)
or erased (WZFree) in the RAPID program.
Syntax
WZDOSet
(\Temp) | (\Stat) ,
[WorldZone:=]<variable or persistent (INOUT) of wztemporary>
(\Inside) | (\Before) ,
[Shape:=]<variable (VAR) of shapedata>,
[Signal:=]<variable (VAR) of signaldo>,
[SetValue:=]<expression (IN) of dionum>;
Related information
Described in:
World Zones
Instructions - WZBoxDef
Instructions - WZSphDef
Instructions - WZCylDef
Instructions - WZLimSup
2-WZDOSet-476
Instructions
WZEnable
Example
VAR wztemporary wzone;
...
PROC ...
WZLimSup \Temp, wzone, volume;
MoveL p_pick, v500, z40, tool1;
WZDisable wzone;
MoveL p_place, v200, z30, tool1;
WZEnable wzone;
MoveL p_home, v200, z30, tool1;
ENDPROC
When moving to p_pick, the position of the robots TCP is checked so that it will
not go inside the specified volume wzone. This supervision is not performed
when going to p_place, but is reactivated before going to p_home
Arguments
WZEnable WorldZone
WorldZone
Program execution
The temporary world zone is re-activated.
Please note that a world zone is automatically activated when it is created. It need only
be re-activated when it has previously been deactivated by WZDisable.
Limitations
Only a temporary world zone can be deactivated and reactivated. A stationary world
zone is always active.
2-WZEnable-477
WZEnable
Instructions
Syntax
WZEnable
[WorldZone:=]<variable or persistent (INOUT) of wztemporary>;
Related information
Described in:
World Zones
Instructions - WZLimSup
Instructions - WZDOSet
Instructions - WZDisable
Instructions - WZFree
2-WZEnable-478
Instructions
WZFree
WZFree
WZFree (World Zone Free) is used to erase the definition of a temporary world zone,
previously defined either to stop the movement or to set an output.
Example
VAR wztemporary wzone;
...
PROC ...
WZLimSup \Temp, wzone, volume;
MoveL p_pick, v500, z40, tool1;
WZDisable wzone;
MoveL p_place, v200, z30, tool1;
WZEnable wzone;
MoveL p_home, v200, z30, tool1;
WZFree wzone;
ENDPROC
When moving to p_pick, the position of the robots TCP is checked so that it will
not go inside a specified volume wzone. This supervision is not performed when
going to p_place, but is reactivated before going to p_home. When this position
is reached, the world zone definition is erased.
Arguments
WZFree WorldZone
WorldZone
Program execution
The temporary world zone is first deactivated and then its definition is erased.
Once erased, a temporary world zone cannot be either re-activated nor deactivated.
Limitations
Only a temporary world zone can be deactivated, reactivated or erased. A stationary
world zone is always active.
2-WZFree-479
WZFree
Instructions
Syntax
WZFree
[WorldZone:=]<variable or persistent (INOUT) of wztemporary>;
Related information
Described in:
World Zones
Instructions - WZLimSup
Instructions - WZDOSet
Instructions - WZDisable
Instructions - WZEnable
2-WZFree-480
Instructions
WZLimSup
WZLimSup
WZLimSup (World Zone Limit Supervision) is used to define the action and to activate
a world zone for supervision of the working area of the robot.
After this instruction is executed, when the robots TCP reaches the defined world
zone, the movement is stopped both during program execution and when jogging.
Example
VAR wzstationary max_workarea;
...
PROC POWER_ON()
VAR shapedata volume;
...
WZBoxDef \Outside, volume, corner1, corner2;
WZLimSup \Stat, max_workarea, volume;
ENDPROC
Definition and activation of stationary world zone max_workarea, with the shape
of the area outside a box (temporarily stored in volume) and the action work-area
supervision. The robot stops with an error message before entering the area
outside the box.
Arguments
WZLimSup [\Temp] | [\Stat] WorldZone Shape
\Temp
(Temporary)
\Stat
(Stationary)
WorldZone
Variable or persistent variable that will be updated with the identity (numeric
value) of the world zone.
If use of switch \Temp, the data type must be wztemporary.
If use of switch \Stat, the data type must be wzstationary.
2-WZLimSup-481
WZLimSup
Instructions
Shape
Program execution
The defined world zone is activated. From this moment the robots TCP position is
supervised. If it reaches the defined area the movement is stopped.
Example
VAR wzstationary box1_invers;
VAR wzstationary box2;
PROC wzone_power_on()
VAR shapedata volume;
CONST pos box1_c1:=[500,-500,0];
CONST pos box1_c2:=[-500,500,500];
CONST pos box2_c1:=[500,-500,0];
CONST pos box2_c2:=[200,-200,300];
...
WZBoxDef \Outside, volume, box1_c1, box1_c2;
WZLimSup \Stat, box1_invers, volume;
WZBoxDef \Inside, volume, box2_c1, box2_c2;
WZLimSup \Stat, box2, volume;
ENDPROC
Limitation of work area for the robot with the following stationary world zones:
- Outside working area when outside box1_invers
- Outside working area when inside box2
If this routine is connected to the system event POWER ON, these world zones
will always be active in the system, both for program movements and manual
jogging.
Limitations
A world zone cannot be redefined using the same variable in argument WorldZone.
A stationary world zone cannot be deactivated, activated again or erased in the RAPID
program.
A temporary world zone can be deactivated (WZDisable), activated again (WZEnable)
or erased (WZFree) in the RAPID program.
2-WZLimSup-482
Instructions
WZLimSup
Syntax
WZLimSup
[\Temp] | [\Stat],
[WorldZone:=]<variable or persistent (INOUT) of wztemporary>,
[Shape:=] <variable (VAR) of shapedata>;
Related information
Described in:
World Zones
Instructions - WZBoxDef
Instructions - WZSphDef
Instructions - WZCylDef
Instructions - WZDOSet
2-WZLimSup-483
WZLimSup
2-WZLimSup-484
Instructions
Instructions
WZSphDef
WZSphDef
WZSphDef (World Zone Sphere Definition) is used to define a world zone that has the
shape of a sphere.
Example
Z
Y
C1
R1 (min. 5 mm)
Arguments
WZSphDef [\Inside] | [\Outside] Shape CentrePoint Radius
\Inside
\Outside
Shape
Variable for storage of the defined volume (private data for the system).
2-WZSphDef-485
WZSphDef
Instructions
CentrePoint
Radius
Program execution
The definition of the sphere is stored in the variable of type shapedata (argument
Shape), for future use in WZLimSup or WZDOSet instructions.
Limitations
If the robot is used to point out the CentrePoint, work object wobj0 must be active (use
of component trans in robtarget e.g. p1.trans as argument).
Syntax
WZSphDef
[\Inside] | [\Outside],
[Shape:=]<variable (VAR) of shapedata>,
[CentrePoint:=]<expression (IN) of pos>,
[Radius:=]<expression (IN) of num>;
Related information
Described in:
World Zones
Instructions - WZBoxDef
Instructions - WZCylDef
Instructions - WZLimSup
Instructions - WZDOSet
2-WZSphDef-486
Functions
CONTENTS
Abs
ACos
AOutput
ASin
ATan
ATan2
ByteToStr
CalcJointT
CalcRobT
CDate
CJointT
ClkRead
Cos
CPos
CRobT
CTime
CTool
CWObj
DefDFrame
DefFrame
Dim
Distance
DotProd
DOutput
EulerZYX
Exp
FileTime
GOutput
GetTime
IsPers
IsVar
MirPos
ModTime
NOrient
Description
NumToStr
Mirroring of a position
Get time of load for a loaded module
Normalise Orientation
Converts numeric value to string
3-487
Functions
Offs
OpMode
OrientZYX
ORobT
PoseInv
PoseMult
PoseVect
Pow
Present
ReadBin
ReadMotor
ReadNum
ReadStr
ReadStrBin
RelTool
Round
RunMode
Sin
Sqrt
StrFind
StrLen
StrMap
StrMatch
StrMemb
StrOrder
StrPart
StrToByte
StrToVal
Tan
TestAndSet
TestDI
Trunc
ValToStr
VectMagn
3-488
Functions
Abs
Abs
Example
reg1 := Abs(reg2);
Reg1 is assigned the absolute value of reg2.
Return value
Input value
Returned value
-3
-2.53
2.53
Arguments
Abs
(Input)
Input
Example
TPReadNum no_of_parts, "How many parts should be produced? ";
no_of_parts := Abs(no_of_parts);
The operator is asked to input the number of parts to be produced. To ensure that
the value is greater than zero, the value given by the operator is made positive.
Syntax
Abs (
[ Input := ] < expression (IN) of num > )
A function with a return value of the data type num.
3-Abs-489
Abs
Functions
Related information
Described in:
Mathematical instructions and functions
3-Abs-490
Functions
ACos
ACos
Example
VAR num angle;
VAR num value;
.
.
angle := ACos(value);
Return value
Arguments
ACos
(Value)
Value
Syntax
Acos(
[Value :=] <expression (IN) of num>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
3-ACos-491
ACos
3-ACos-492
Functions
Functions
AOutput
AOutput
Example
IF AOutput(ao4) > 5 THEN ...
If the current value of the signal ao4 is greater than 5, then ...
Return value
Arguments
AOutput
(Signal)
Signal
3-AOutput-493
AOutput
Functions
Syntax
AOutput (
[ Signal := ] < variable (VAR) of signalao > )
A function with a return value of data type num.
Related information
Described in:
Input/Output instructions
Configuration of I/O
3-AOutput-494
Functions
ASin
ASin
Example
VAR num angle;
VAR num value;
.
.
angle := ASin(value);
Return value
Arguments
ASin
(Value)
Value
Syntax
ASin(
[Value :=] <expression (IN) of num>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
3-ASin-495
ASin
3-ASin-496
Functions
Functions
ATan
ATan
Example
VAR num angle;
VAR num value;
.
.
angle := ATan(value);
Return value
Arguments
ATan
(Value)
Value
Syntax
ATan(
[Value :=] <expression (IN) of num>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
Functions - ATan2
3-ATan-497
ATan
3-ATan-498
Functions
Functions
ATan2
ATan2
Example
VAR num angle;
VAR num x_value;
VAR num y_value;
.
.
angle := ATan2(y_value, x_value);
Return value
Arguments
ATan2
(Y
X)
Syntax
ATan2(
[Y :=] <expression (IN) of num> ,
[X :=] <expression (IN) of num>
)
A function with a return value of the data type num.
3-ATan2-499
Atan2
Functions
Related information
Described in:
Mathematical instructions and functions
Functions - ATan
3-Atan2-500
Functions
ByteToStr
ByteToStr
ByteToStr (Byte To String) is used to convert a byte into a string data with a defined
byte data format.
Example
VAR string con_data_buffer{5};
VAR byte data1 := 122;
con_data_buffer{1} := ByteToStr(data1);
The content of the array component con_data_buffer{1} will be "122" after the
ByteToStr ... function.
con_data_buffer{2} := ByteToStr(data1\Hex);
The content of the array component con_data_buffer{2} will be "7A" after the
ByteToStr ... function.
con_data_buffer{3} := ByteToStr(data1\Okt);
The content of the array component con_data_buffer{3} will be "172" after the
ByteToStr ... function.
con_data_buffer{4} := ByteToStr(data1\Bin);
The content of the array component con_data_buffer{4} will be "01111010"after
the ByteToStr ... function.
con_data_buffer{5} := ByteToStr(data1\Char);
The content of the array component con_data_buffer{5} will be "z" after the
ByteToStr ... function.
Return value
Characters:
0 - 9
0 - 9, A -F
0 - 7
0 - 1
String length:
1-3
2
3
8
Char ....:
Range:
"0" - "255"
"00" - "FF"
"000" - "377"
"00000000" "11111111"
One ASCII char
(*) If non-writable ASCII char, the return format will be RAPID character code
format (e.g. \07 for BEL control character).
System Data Types and Routines
3-ByteToStr-501
ByteToStr
Functions
Arguments
ByteToStr
BitData
(Hexadecimal)
(Octal)
(Binary)
(Character)
Limitations
The range for a data type byte is 0 to 255 decimal.
Syntax
ByteToStr(
[BitData :=] <expression (IN) of byte>
[\ Hex ] | [\ Okt] | [\ Bin] | [\ Char]
) ;
A function with a return value of the data type string.
3-ByteToStr-502
Functions
Pow
Related information
Described in:
Convert a string to a byte data
Instructions - StrToByte
3-Pow-503
Pow
3-Pow-504
Functions
Functions
CalcJointT
CalcJointT
CalcJointT (Calculate Joint Target) is used to calculate joint angles of the robot axes
and external axes from a specified robtarget data.
The input robtarget data should be specified in the same coordinate system as specified
in argument for Tool, WObj and at execution time active program displacement
(ProgDisp) and external axes offset (EOffs).
The returned jointtarget data is expressed in the calibration coordinate system.
Example
VAR jointtarget jointpos1;
CONST robtarget p1 := [...];
jointpos1 := CalcJointT(p1, tool1 \WObj:=wobj1);
The jointtarget value corresponding to the robtarget value p1 is stored in
jointpos1. The tool tool1 and work object wobj1 are used for calculating the joint
angles jointpos1.
Return value
The angles in degrees for the axes of the robot on the arm side.
The values for the external axes, in mm for linear axes, in degrees for rotational axes.
The returned values are always related to the calibration position.
Arguments
CalcJointT ( Rob_target Tool [\WObj] )
Rob_target
The position of the robot and external axes in the outermost coordinate system,
related to the specified tool and work object and at execution time active program
displacement (ProgDisp) and/or external axes offset (EOffs).
Tool
3-CalcJointT-505
CalcJointT
Functions
[\WObj]
(Work Object)
The work object (coordinate system) to which the robot position is related.
If this argument is omitted the work object wobj0 is used.
This argument must be specified when using stationary tool, coordinated external
axes, or conveyor
Program execution
The returned jointtarget is calculated from the input robtarget.
To calculate the robot joint angles, the specified Tool, WObj (including coordinated
user frame) and the ProgDisp active at execution time, are taken into consideration.
To calculate the external axis position at the execution time, active EOffs is taken into
consideration.
The calculation always selects the robot configuration according to the specified configuration data in the input robtarget data. Instructions ConfL and ConfJ do not affect
this calculation principle. When wrist singularity is used, robot axis 4 will be set to 0
degrees.
If there is any active program displacement (ProgDisp) and/or external axis offset
(EOffs) at the time the robtarget is stored, then the same program displacement and/or
external axis offset must be active when CalcJointT is executed.
Syntax
CalcJointT(
[Rob_target :=] <expression (IN) of robtarget> ,
[Tool := ] <persistent (PERS) of tooldata>
[\WObj := <persistent (PERS) of wobjdata>] )
A function with a return value of the data type jointtarget.
3-CalcJointT-506
Functions
CalcJointT
Related information
Described in:
Calculate robtarget from jointtarget
Functions - CalcRobT
Definition of position
Definition of tools
Coordinate systems
Instructions - PDispOn
Instructions - EOffsOn
3-CalcJointT-507
CalcJointT
3-CalcJointT-508
Functions
Functions
CalcRobT
CalcRobT
CalcRobT (Calculate Robot Target) is used to calculate a robtarget data from a given
jointtarget data.
This function returns a robtarget value with position (x, y, z), orientation (q1 ... q4),
robot axes configuration and external axes position.
The input jointtarget data should be specified in the calibration coordinate system.
The returned robtarget data is expressed in the outermost coordinate system, taking the
specified tool, work object and at execution time active program displacement
(ProgDisp) and external axis offset (EOffs) into consideration.
Example
VAR robtarget p1;
CONST jointtarget jointpos1 := [...];
p1 := CalcRobT(jointpos1, tool1 \WObj:=wobj1);
The robtarget value corresponding to the jointtarget value jointpos1 is stored in
p1. The tool tool1 and work object wobj1 are used for calculating of the position
p1.
Return value
The robot and external axis position is returned in data type robtarget and expressed in
the outermost coordinate system, taking the specified tool, work object and at execution time active program displacement (ProgDisp) and external axes offset (EOffs) into
consideration.
If there is no active ProgDisp, the robot position is expressed in the object coordinate
system.
If there are no active EOffs, the external axis position is expressed in the calibration
coordinate system.
Arguments
CalcRobT ( Joint_target Tool [\WObj] )
Joint_target
The joint position for the robot axes and external axes related to the calibration
coordinate system.
3-CalcRobT-509
CalcRobT
Functions
Tool
[\WObj]
(Work Object)
The work object (coordinate system) to which the robot position returned by the
function is related.
If this argument is omitted the work object wobj0 is used.
This argument must be specified when using stationary tool, coordinated external
axes, or conveyor.
Program execution
The returned robtarget is calculated from the input jointtarget.
To calculate the cartesian robot position, the specified Tool, WObj (including coordinated user frame) and at the execution time active ProgDisp are taken into consideration.
To calculate the external axes position, the EOffs active at execution time is taken into
consideration.
Syntax
CalcRobT(
[Joint_target := ] <expression (IN) of jointtarget> ,
[Tool := ] <persistent (PERS) of tooldata>
[\WObj := <persistent (PERS) of wobjdata>] )
A function with a return value of the data type robtarget.
3-CalcRobT-510
Functions
CalcRobT
Related information
Described in:
Calculate jointtarget from robtarget
Functions - CalcJointT
Definition of position
Definition of tools
Coordinate systems
Instructions - PDispOn
Instructions - EOffsOn
3-CalcRobT-511
CalcRobT
3-CalcRobT-512
Functions
Functions
CDate
CDate
Example
VAR string date;
date := CDate();
The current date is stored in the variable date.
Return value
Example
date := CDate();
TPWrite The current date is: +date;
Write logfile, date;
The current date is written to the teach pendant display and into a text file.
Syntax
CDate ( )
A function with a return value of the type string.
Related Information
Described in:
Time instructions
3-CDate-513
CDate
3-CDate-514
Functions
Functions
CJointT
CJointT
CJointT (Current Joint Target) is used to read the current angles of the robot axes and
external axes.
Example
VAR jointtarget joints;
joints := CJointT();
The current angles of the axes for the robot and external axes are stored in joints.
Return value
The current angles in degrees for the axes of the robot on the arm side.
The current values for the external axes, in mm for linear axes, in degrees for rotational
axes.
The returned values are related to the calibration position.
Syntax
CJointT()
A function with a return value of the data type jointtarget.
Related information
Described in:
Definition of joint
Functions - ReadMotor
3-CJointT-515
CJointT
3-CJointT-516
Functions
Functions
ClkRead
ClkRead
ClkRead is used to read a clock that functions as a stop-watch used for timing.
Example
reg1:=ClkRead(clock1);
The clock clock1 is read and the time in seconds is stored in the variable reg1.
Return value
Argument
ClkRead
(Clock)
Clock
Program execution
A clock can be read when it is stopped or running.
Once a clock is read it can be read again, started again, stopped or reset.
If the clock has overflowed, program execution is stopped with an error message.
Syntax
ClkRead (
[ Clock := ] < variable (VAR) of clock > )
A function with a return value of the type num.
3-ClkRead-517
ClkRead
Functions
Related Information
Described in:
Clock instructions
Clock overflow
More examples
Instructions - ClkStart
3-ClkRead-518
Functions
Cos
Cos
Example
VAR num angle;
VAR num value;
.
.
value := Cos(angle);
Return value
Arguments
Cos
(Angle)
Angle
Syntax
Cos(
[Angle :=] <expression (IN) of num>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
3-Cos-519
Cos
3-Cos-520
Functions
Functions
CPos
CPos
Example
VAR pos pos1;
pos1 := CPos(\Tool:=tool1 \WObj:=wobj0);
The current position of the robot TCP is stored in variable pos1. The tool tool1
and work object wobj0 are used for calculating the position.
Return value
The current position (pos) of the robot with x, y, and z in the outermost coordinate system, taking the specified tool, work object and active ProgDisp coordinate system into
consideration.
Arguments
CPos ([\Tool] [\WObj])
[\Tool]
(Work Object)
The work object (coordinate system) to which the current robot position returned
by the function is related.
If this argument is omitted the current active work object is used.
When programming, it is very sensible to always specify arguments \Tool and \WObj.
The function will always then return the wanted position, although some other tool or
work object has been activated manually.
3-CPos-521
CPos
Functions
Program execution
The coordinates returned represent the TCP position in the ProgDisp coordinate system.
Example
VAR pos pos2;
VAR pos pos3;
VAR pos pos4;
pos2 := CPos(\Tool:=grip3 \WObj:=fixture);
.
.
pos3 := CPos(\Tool:=grip3 \WObj:=fixture);
pos4 := pos3-pos2;
The x, y, and z position of the robot is captured at two places within the program
using the CPos function. The tool grip3 and work object fixture are used for calculating the position. The x, y and z distances travelled between these positions
are then calculated and stored in the pos variable pos4.
Syntax
CPos (
[\Tool := <persistent (PERS) of tooldata>]
[\WObj := <persistent (PERS) of wobjdata>] )
A function with a return value of the data type pos.
Related information
Described in:
Definition of position
Definition of tools
Coordinate systems
Functions - CRobT
3-CPos-522
Functions
CRobT
CRobT
CRobT (Current Robot Target) is used to read the current position of the robot and
external axes.
This function returns a robtarget value with position (x, y, z), orientation (q1 ... q4),
robot axes configuration and external axes position. If only the x, y, and z values of the
robot TCP (pos) are to be read, use the function CPos instead.
Example
VAR robtarget p1;
p1 := CRobT(\Tool:=tool1 \WObj:=wobj0);
The current position of the robot and external axes is stored in p1. The tool tool1
and work object wobj0 are used for calculating the position.
Return value
The current position of the robot and external axes in the outermost coordinate system,
taking the specified tool, work object and active ProgDisp/ExtOffs coordinate system
into consideration.
Arguments
CRobT ([\Tool] [\WObj])
[\Tool]
(Work Object)
The work object (coordinate system) to which the current robot position returned
by the function is related.
If this argument is omitted the current active work object is used.
When programming, it is very sensible to always specify arguments \Tool and \WObj.
The function will always then return the wanted position, although some other tool or
work object has been activated manually.
3-CRobT-523
CRobT
Functions
Program execution
The coordinates returned represent the TCP position in the ProgDisp coordinate system. External axes are represented in the ExtOffs coordinate system.
Example
VAR robtarget p2;
p2 := ORobT( RobT(\Tool:=grip3 \WObj:=fixture) );
The current position in the object coordinate system (without any ProgDisp or
ExtOffs) of the robot and external axes is stored in p2. The tool grip3 and work
object fixture are used for calculating the position.
Syntax
CRobT(
[\Tool := <persistent (PERS) of tooldata>]
[\WObj := <persistent (PERS) of wobjdata>] )
A function with a return value of the data type robtarget.
Related information
Described in:
Definition of position
Definition of tools
Coordinate systems
Instructions - EOffsOn
Functions - CPos
3-CRobT-524
Functions
CTime
CTime
Example
VAR string time;
time := CTime();
The current time is stored in the variable time.
Return value
Example
time := CTime();
TPWrite The current time is: +time;
Write logfile, time;
The current time is written to the teach pendant display and written into a text
file.
Syntax
CTime ( )
A function with a return value of the type string.
3-CTime-525
CTime
Functions
Related Information
Described in:
Time and date instructions
3-CTime-526
Functions
CTool
CTool
Example
PERS tooldata temp_tool:= [ TRUE, [ [0, 0, 0], [1, 0, 0 ,0] ],
[0.001, [0, 0, 0.001], [1, 0, 0, 0], 0, 0, 0] ];
temp_tool := CTool();
The value of the current tool is stored in the variable temp_tool.
Return value
This function returns a tooldata value holding the value of the current tool, i.e. the tool
last used in a movement instruction.
The value returned represents the TCP position and orientation in the wrist centre coordinate system, see tooldata.
Syntax
CTool()
A function with a return value of the data type tooldata.
Related information
Described in:
Definition of tools
Coordinate systems
3-CTool-527
CTool
3-CTool-528
Functions
Functions
CWObj
CWObj
CWObj (Current Work Object) is used to read the data of the current work object.
Example
PERS wobjdata temp_wobj;
temp_wobj := CWObj();
The value of the current work object is stored in the variable temp_wobj.
Return value
This function returns a wobjdata value holding the value of the current work object,
i.e. the work object last used in a movement instruction.
The value returned represents the work object position and orientation in the world
coordinate system, see wobjdata.
Syntax
CWObj()
A function with a return value of the data type wobjdata.
Related information
Described in:
Definition of work objects
Coordinate systems
3-CWObj-529
CWObj
3-CWObj-530
Functions
Functions
DefDFrame
DefDFrame
Example
p6
p3
p5
p4
p1
p2
Three positions, p1- p3, related to an object in an original position, have been stored.
After a displacement of the object the same positions are searched for and stored as
p4-p6. From these six positions the displacement frame is calculated. Then the
calculated frame is used to displace all the stored positions in the program.
CONST robtarget p1 := [...];
CONST robtarget p2 := [...];
CONST robtarget p3 := [...];
VAR robtarget p4;
VAR robtarget p5;
VAR robtarget p6;
VAR pose frame1;
.
!Search for the new positions
SearchL sen1, p4, *, v50, tool1;
.
SearchL sen1, p5, *, v50, tool1;
.
SearchL sen1, p6, *, v50, tool1;
frame1 := DefDframe (p1, p2, p3, p4, p5, p6);
.
!activation of the displacement defined by frame1
PDispSet frame1;
Return value
3-DefDFrame-531
DefDFrame
Functions
Arguments
DefDFrame
(OldP1
OldP2
OldP3
NewP1
OldP1
NewP2
NewP3)
The first displaced position. This position must be measured and determined with
great accuracy.
NewP2
The second displaced position. It should be noted that this position can be
measured and determined with less accuracy in one direction, e.g. this position
must be placed on a line describing the new direction of p1 to p2.
NewP3
The third displaced position. This position can be measured and determined with
less accuracy in two directions, e.g. it has to be placed in a plane describing the
new plane of p1, p2 and p3.
Error handling
If it is not possible to calculate the frame because of bad accuracy in the positions, the
system variable ERRNO is set to ERR_FRAME. This error can then be handled in the
error handler.
Syntax
DefDFrame(
[OldP1 :=] <expression (IN) of robtarget> ,
[OldP2 :=] <expression (IN) of robtarget> ,
[OldP3 :=] <expression (IN) of robtarget> ,
[NewP1 :=] <expression (IN) of robtarget> ,
[NewP2 :=] <expression (IN) of robtarget> ,
[NewP3 :=] <expression (IN) of robtarget> )
A function with a return value of the data type pose.
3-DefDFrame-532
Functions
DefDFrame
Related information
Described in:
Activation of displacement frame
Instructions - PDispSet
3-DefDFrame-533
DefDFrame
3-DefDFrame-534
Functions
Functions
DefFrame
DefFrame
Define a frame
DefFrame (Define Frame) is used to calculate a frame, from three positions defining
the frame.
Example
y
p3
z
x
p2
y
frame1
p1
x
object frame
Three positions, p1- p3, related to the object coordinate system, are used to define the
new coordinate system, frame1. The first position, p1, is defining the origin of frame1,
the second position, p2, is defining the direction of the x-axis and the third position,
p3, is defining the location of the xy-plane. The defined frame1 may be used as a
displacement frame, as shown in the example below:
CONST robtarget p1 := [...];
CONST robtarget p2 := [...];
CONST robtarget p3 := [...];
VAR pose frame1;
.
.
frame1 := DefFrame (p1, p2, p3);
.
.
!activation of the displacement defined by frame1
PDispSet frame1;
Return value
3-DefFrame-535
DefFrame
Functions
Arguments
DefFrame
(NewP1
NewP2
NewP3
[\Origin])
NewP1
The first position, which will define the origin of the new frame.
NewP2
The second position, which will define the direction of the x-axis of the new
frame.
NewP3
The third position, which will define the xy-plane of the new frame. The position
of point 3 will be on the positive y side, see the figure above.
[\Origin]
Optional argument, which will define how the origin of the frame will be placed.
Origin = 1, means that the origin is placed in NewP1, i.e. the same as if this
argument is omitted. Origin = 2 means that the origin is placed in NewP2, see the
figure below.
z
New P3
x
y
object frame
New P2
New P1
frame1
Origin = 3 means that the origin is placed on the line going through NewP1 and NewP2
and so that NewP3 will be placed on the y axis, see the figure below.
3-DefFrame-536
Functions
DefFrame
y
New P3
x
y
New P2
object frame
New P1
frame1
Limitations
The three positions p1 - p3, defining the frame, must define a well shaped triangle. The
most well shaped triangle is the one with all sides of equal length.
p2
p3
p1
The triangle is not considered to be well shaped if the angle a is too small. The angle
is too small if:
cos
<1
10
The triangle p1, p2, p3 must not be too small, i.e. the positions cannot be too close. The
distances between the positions p1 - p2 and p1 - p3 must not be less than 0.1 mm.
Error handling
If the frame cannot be calculated because of the above limitations, the system variable
ERRNO is set to ERR_FRAME. This error can then be handled in the error handler.
3-DefFrame-537
DefFrame
Functions
Syntax
DefFrame(
[NewP1 :=] <expression (IN) of robtarget> ,
[NewP2 :=] <expression (IN) of robtarget> ,
[NewP3 :=] <expression (IN) of robtarget>
[\Origin := <expression (IN) of num> ])
A function with a return value of the data type pose.
Related information
Described in:
Mathematical instructions and functions
Instructions - PDispSet
3-DefFrame-538
Functions
Dim
Dim
Example
PROC arrmul(VAR num array{*}, num factor)
FOR index FROM 1 TO Dim(array, 1) DO
array{index} := array{index} * factor;
ENDFOR
ENDPROC
All elements of a num array are multiplied by a factor.
This procedure can take any one-dimensional array of data type num as an input.
Return value
Arguments
Dim
(ArrPar DimNo)
ArrPar
(Array Parameter)
(Dimension Number)
1 = first dimension
2 = second dimension
3 = third dimension
3-Dim-539
Dim
Functions
Example
PROC add_matrix(VAR num array1{*,*,*}, num array2{*,*,*})
IF Dim(array1,1) <> Dim(array2,1) OR Dim(array1,2) <> Dim(array2,2) OR
Dim(array1,3) <> Dim(array2,3) THEN
TPWrite "The size of the matrices are not the same";
Stop;
ELSE
FOR i1 FROM 1 TO Dim(array1, 1) DO
FOR i2 FROM 1 TO Dim(array1, 2) DO
FOR i3 FROM 1 TO Dim(array1, 3) DO
array1{i1,i2,i3} := array1{i1,i2,i3} + array2{i1,i2,i3};
ENDFOR
ENDFOR
ENDFOR
ENDIF
RETURN;
ENDPROC
Two matrices are added. If the size of the matrices differs, the program stops and
an error message appears.
This procedure can take any three-dimensional arrays of data type num as an
input.
Syntax
Dim (
[ArrPar:=] <reference (REF) of any type> ,
[DimNo:=] <expression (IN) of num> )
A REF parameter requires that the corresponding argument be either a constant, a variable or an entire persistent. The argument could also be an IN parameter, a VAR parameter or an entire PERS parameter.
A function with a return value of the data type num.
Related information
Described in:
3-Dim-540
Array parameters
Array declaration
Functions
Distance
Distance
Distance is used to calculate the distance between two points in the space.
Example
y
p2
x
p1
z
VAR num dist;
CONST pos p1 := [4,0,4];
CONST pos p2 := [-4,4,4];
...
dist := Distance(p1, p2);
The distance in space between the points p1 and p2 is calculated and stored in
the variable dist.
Return value
Arguments
Distance (Point1 Point2)
Point1
3-Distance-541
Distance
Functions
Program execution
Calculation of the distance between the two points:
y
x2, y2, z2
x
x1,y1,z1
z
distance =
( x x ) 2 + ( y y )2 + ( z z ) 2
1 2
1 2
1 2
Syntax
Distance(
[Point1 :=] <expression (IN) of pos> ,
[Point2 :=] <expression (IN) of pos>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
Definition of pos
3-Distance-542
Functions
DotProd
DotProd
DotProd (Dot Product) is used to calculate the dot (or scalar) product of two pos vectors. The typical use is to calculate the projection of one vector upon the other or to
calculate the angle between the two vectors.
Example
B
AB
B cos AB
A
A
The dot or scalar product of two vectors A and B is a scalar, which equals the products
of the magnitudes of A and B and the cosine of the angle between them.
A B = A B cos AB
The dot product:
is less than or equal to the product of their magnitudes.
can be either a positive or a negative quantity, depending whether the angle between
them is smaller or larger then 90 degrees.
is equal to the product of the magnitude of one vector and the projection of the other
vector upon the first one.
is zero when the vectors are perpendicular to each other.
The vectors are described by the data type pos and the dot product by the data type
num:
VAR num dotprod;
VAR pos vector1;
VAR pos vector2;
.
.
vector1 := [1,1,1];
vector2 := [1,2,3];
dotprod := DotProd(vector1, vector2);
3-DotProd-543
DotProd
Functions
Return value
Arguments
DotProd
(Vector1 Vector2)
Vector1
Syntax
DotProd(
[Vector1 :=] <expression (IN) of pos> ,
[Vector2 :=] <expression (IN) of pos>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
3-DotProd-544
Functions
DOutput
DOutput
Example
IF DOutput(do2) = 1 THEN . . .
If the current value of the signal do2 is equal to 1, then . . .
Return value
Arguments
DOutput
(Signal)
Signal
Program execution
The value read depends on the configuration of the signal. If the signal is inverted in
the system parameters, the value returned by this function is the opposite of the true
value of the physical channel.
Example
IF DOutput(auto_on) <> active THEN . . .
If the current value of the system signal auto_on is not active, then ..., i.e. if the
robot is in the manual operating mode, then ... Note that the signal must first be
defined as a system output in the system parameters.
Syntax
DOutput (
[ Signal := ] < variable (VAR) of signaldo > )
A function with a return value of the data type dionum.
System Data Types and Routines
3-DOutput-545
DOutput
Functions
Related information
Described in:
Input/Output instructions
Configuration of I/O
3-DOutput-546
Functions
EulerZYX
EulerZYX
EulerZYX (Euler ZYX rotations) is used to get an Euler angle component from an orient
type variable.
Example
VAR num anglex;
VAR num angley;
VAR num anglez;
VAR pose object;
.
.
anglex := GetEuler(\X, object.rot);
angley := GetEuler(\Y, object.rot);
anglez := GetEuler(\Z, object.rot);
Return value
Arguments
EulerZYX
The arguments \X, \Y and \Z are mutually exclusive. If none of these are specified, a
run-time error is generated.
[\X]
[\Y]
[\Z]
Rotation
3-EulerZYX-547
EulerZYX
Functions
Syntax
EulerZYX(
['\'X ,] | ['\'Y ,] | ['\'Z ,]
[Rotation :=] <expression (IN) of orient>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
3-EulerZYX-548
Functions
Exp
Exp
Example
VAR num x;
VAR num value;
.
.
value:= Exp( x);
Return value
Arguments
Exp
(Exponent)
Exponent
Syntax
Exp(
[Exponent :=] <expression (IN) of num>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
3-Exp-549
Exp
3-Exp-550
Functions
Functions
FileTime
FileTime
FileTime is used to retrieve the last time for modification, access or file status change
of a file. The time is measured in secs since 00:00:00 GMT, Jan. 1 1970. The time is
returned as a num.
Example
Load "ram1disk:notmymod.mod";
WHILE TRUE DO
! Call some routine in notmymod
notmymodrout;
IF FileTime("ram1disk:notmymod.mod" \ModifyTime)
> ModTime("notmymod") THEN
UnLoad "ram1disk:notmymod.mod";
Load "ram1disk:notmymod.mod";
ENDIF
ENDWHILE
This program reloads a module if there is a newer at the source. It uses the
ModTime to retrieve the latest loading time for the specified module, and to compare it to the FileTime\ModifyTime at the source. Then, if the source is newer, the
program unloads and loads the module again.
Return value
Arguments
FileTime ( Path [\ModifyTime] | [\AccessTime] | [\StatCTime] )
Path
ModifyTime
3-FileTime-551
FileTime
Functions
StatCTime
Program execution
This function returns a numeric that specifies the time since the last:
- Modification
- Access
- File status change
of the specified file.
Example
This is a complete example that implements an alert service for maximum 10 files.
LOCAL RECORD falert
string filename;
num ftime;
ENDRECORD
LOCAL VAR falert myfiles[10];
LOCAL VAR num currentpos:=0;
LOCAL VAR intnum timeint;
LOCAL TRAP mytrap
VAR num pos:=1;
WHILE pos <= currentpos DO
IF FileTime(myfiles{pos}.filename \ModifyTime) > myfiles{pos}.ftime THEN
TPWrite "The file "+myfiles{pos}.filename+" is changed";
ENDIF
pos := pos+1;
ENDWHILE
ENDTRAP
PROC alertInit(num freq)
currentpos:=0;
CONNECT timeint WITH mytrap;
ITimer freq,timeint;
ENDPROC
PROC alertFree()
IDelete timeint;
ENDPROC
3-FileTime-552
Functions
FileTime
Error handling
If the file does not exist, the system variable ERRNO is set to ERR_FILEACC. This
error can then be handled in the error handler.
Syntax
FileTime (
[ Path := ] < expression (IN) of string>
[ '\'ModifyTime] |
[ '\'AccessTime] |
[ '\'StatCTime] )
A function with a return value of the data type num.
Related information
Described in:
Last time a module was loaded
Functions - ModTime
3-FileTime-553
FileTime
3-FileTime-554
Functions
Functions
GetTime
GetTime
GetTime is used to read a specified component of the current system time as a numeric
value.
GetTime can be used to :
- have the program perform an action at a certain time
- perform certain activities on a weekday
- abstain from performing certain activities on the weekend
- respond to errors differently depending on the time of day.
Example
hour := GetTime(\Hour);
The current hour is stored in the variable hour.
Return value
Argument
GetTime
[\WDay]
3-GetTime-555
GetTime
Functions
One of the arguments must be specified, otherwise program execution stops with an
error message.
Example
weekday := GetTime(\WDay);
hour := GetTime(\Hour);
IF weekday < 6 AND hour >6 AND hour < 16 THEN
production;
ELSE
maintenance;
ENDIF
If it is a weekday and the time is between 7:00 and 15:59 the robot performs production. At all other times, the robot is in the maintenance mode.
Syntax
GetTime (
[\ WDay ]
| [ \ Hour ]
| [ \ Min ]
| [ \ Sec ] )
A function with a return value of the type num.
Related Information
Described in:
Time and date instructions
3-GetTime-556
Functions
GOutput
Example
IF GOutput(go2) = 5 THEN ...
If the current value of the signal go2 is equal to 5, then ...
Return value
Return value
No. of signals
Return value
0-1
0 - 511
0-3
10
0 - 1023
0-7
11
0 - 2047
0 - 15
12
0 - 4095
0 - 31
13
0 - 8191
0 - 63
14
0 - 16383
0 - 127
15
0 - 32767
0 - 255
16
0 - 65535
Arguments
GOutput
(Signal)
Signal
3-GOutput-557
GOutput
Functions
Syntax
GOutput (
[ Signal := ] < variable (VAR) of signalgo > )
A function with a return value of data type num.
Related information
Described in:
Input/Output instructions
Configuration of I/O
3-GOutput-558
Functions
IsPers
IsPers
Is Persistent
IsPers is used to test if a data object is a persistent variable or not.
Example
PROC procedure1 (INOUT num parameter1)
IF IsVar(parameter1) THEN
! For this call reference to a variable
...
ELSEIF IsPers(parameter1) THEN
! For this call reference to a persistent variable
...
ELSE
! Should not happen
EXIT;
ENDIF
ENDPROC
The procedure procedure1 will take different actions depending on whether the
actual parameter parameter1 is a variable or a persistent variable.
Return value
Arguments
IsPers
(DatObj)
DatObj
(Data Object)
Syntax
IsPers(
[ DatObj := ] < var or pers (INOUT) of any type > )
A function with a return value of the data type bool.
3-IsPers-559
IsPers
Functions
Related information
Described in:
Test if variable
Function - IsVar
3-IsPers-560
Functions
IsVar
IsVar
Is Variable
IsVar is used to test whether a data object is a variable or not.
Example
PROC procedure1 (INOUT num parameter1)
IF IsVAR(parameter1) THEN
! For this call reference to a variable
...
ELSEIF IsPers(parameter1) THEN
! For this call reference to a persistent variable
...
ELSE
! Should not happen
EXIT;
ENDIF
ENDPROC
The procedure procedure1 will take different actions, depending on whether the
actual parameter parameter1 is a variable or a persistent variable.
Return value
Arguments
IsVar
(DatObj)
DatObj
(Data Object)
Syntax
IsVar(
[ DatObj := ] < var or pers (INOUT) of any type > )
A function with a return value of the data type bool.
3-IsVar-561
IsVar
Functions
Related information
Described in:
Test if persistent
Function - IsPers
3-IsVar-562
Functions
MirPos
MirPos
Mirroring of a position
MirPos (Mirror Position) is used to mirror the translation and rotation parts of a position.
Example
CONST robtarget p1;
VAR robtarget p2;
PERS wobjdata mirror;
.
.
p2 := MirPos(p1, mirror);
p1 is a robtarget storing a position of the robot and an orientation of the tool. This
position is mirrored in the xy-plane of the frame defined by mirror, relative to the
world coordinate system. The result is new robtarget data, which is stored in p2.
Return value
The new position which is the mirrored position of the input position.
Arguments
MirPos
(Point
MirPlane
[\WObj]
Point
[\MirY])
Data type: robtarget
The input robot position. The orientation part of this position defines the current
orientation of the tool coordinate system.
MirPlane
(Mirror Plane)
The work object data defining the mirror plane. The mirror plane is the xy-plane
of the object frame defined in MirPlane. The location of the object frame is
defined relative to the user frame, also defined in MirPlane, which in turn is
defined relative to the world frame.
[\WObj]
(Work Object)
The work object data defining the object frame, and user frame, relative to which
the input position, Point, is defined. If this argument is left out, the position is
defined relative to the World coordinate system.
Note. If the position is created with a work object active, this work object must
be referred to in the argument.
3-MirPos-563
MirPos
Functions
[\MirY]
(Mirror Y)
If this switch is left out, which is the default rule, the tool frame will be mirrored
as regards the x-axis and the z-axis. If the switch is specified, the tool frame will
be mirrored as regards the y-axis and the z-axis.
Limitations
No recalculation is done of the robot configuration part of the input robtarget data.
Syntax
MirPos(
[ Point := ] < expression (IN) of robtarget>,
[MirPlane :=] <expression (IN) of wobjdata> ,
[\WObj := <expression (IN) of wobjdata> ]
[\MirY ])
A function with a return value of the data type robtarget.
Related information
Described in:
Mathematical instructions and functions
3-MirPos-564
Functions
ModTime
ModTime
ModTime (Module Time) is used to retrieve the time of loading a specified module. The
module is specified by its name and must be in the task memory. The time is measured
in secs since 00:00:00 GMT, Jan 1 1970. The time is returned as a num.
Example
MODULE mymod
VAR num mytime;
PROC printMyTime()
mytime := ModTime("mymod");
TPWrite "My time is "+NumToStr(mytime,0);
ENDPROC
Return value
Arguments
ModTime ( Object )
Object
Program execution
This function return a numeric that specify the time when the module was loaded.
3-ModTime-565
ModTime
Functions
Example
This is a complete example that implements an update if newer service.
MODULE updmod
PROC callrout()
Load "ram1disk:mymod.mod";
WHILE TRUE DO
! Call some routine in mymod
mymodrout;
IF FileTime("ram1disk:mymod.mod" \ModifyTime)
> ModTime("mymod") THEN
UnLoad "ram1disk:mymod.mod";
Load "ram1disk:mymod.mod";
ENDIF
ENDWHILE
ENDPROC
ENDMODULE
This program reloads a module if there is a newer one at the source. It uses the
ModTime to retrieve the latest loading time for the specified module, and compares it to the FileTime\ModifyTime at the source. Then, if the source is newer,
the program unloads and loads the module again.
Syntax
ModTime (
[ Object := ] < expression (IN) of string>)
A function with a return value of the data type num.
Related information
Described in:
Retrieve time info. about a file
3-ModTime-566
Functions - FileTime
Functions
NOrient
NOrient
Normalise Orientation
Description
An orientation must be normalised, i.e. the sum of the squares must
equal 1:
q 12 + q 22 + q 32 + q 42 = 1
ABS ( q 1 + q 2 + q 3 + q 4 1 ) = normerr
Unusable
Slightly unnormalised
Normalised
Example
We have a slightly unnormalised position ( 0.707170, 0, 0, 0.707170 )
3-NOrient-567
NOrient
Functions
Return value
Arguments
NOrient
(Rotation)
Orient
Syntax
NOrient(
[Rotation :=] <expression (IN) of orient>
)
A function with a return value of the data type orient.
Related information
Described in:
Mathematical instructions and functions
3-NOrient-568
Functions
NumToStr
NumToStr
Example
VAR string str;
str := NumToStr(0.38521,3);
The variable str is given the value "0.385".
reg1 := 0.38521
str := NumToStr(reg1, 2\Exp);
The variable str is given the value "3.85E-01".
Return value
The numeric value converted to a string with the specified number of decimals, with
exponent if so requested. The numeric value is rounded if necessary. The decimal point
is suppressed if no decimals are included.
Arguments
NumToStr
Val
(Value)
(Decimals)
(Exponent)
To use exponent.
3-NumToStr-569
NumToStr
Functions
Syntax
NumToStr(
[ Val := ] <expression (IN) of num> ,
[ Dec := ] <expression (IN) of num>
[ \Exp ]
)
A function with a return value of the data type string.
Related information
Described in:
String functions
Definition of string
String values
3-NumToStr-570
Functions
Offs
Offs
Examples
MoveL Offs(p2, 0, 0, 10), v1000, z50, tool1;
The robot is moved to a point 10 mm from the position p2 (in the z-direction).
p1 := Offs (p1, 5, 10, 15);
The robot position p1 is displaced 5 mm in the x-direction, 10 mm in the y-direction and 15 mm in the z-direction.
Return value
Arguments
Offs
Point
XOffset
3-Offs-571
Offs
Functions
Example
PROC pallet (num row, num column, num distance, PERS tooldata tool,
PERS wobjdata wobj)
VAR robtarget palletpos:=[[0, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0],
[9E9, 9E9, 9E9, 9E9, 9E9, 9E9]];
palettpos := Offs (palettpos, (row-1)*distance, (column-1)*distance, 0);
MoveL palettpos, v100, fine, tool\WObj:=wobj;
ENDPROC
A routine for picking parts from a pallet is made. Each pallet is defined as a work
object (see Figure 35). The part to be picked (row and column) and the distance
between the parts are given as input parameters.
Incrementing the row and column index is performed outside the routine.
Columns
Rows
Y-axis
O O
O O O
X-axis
O O O
Figure 35 The position and orientation of the pallet is specified by defining a work object.
Syntax
Offs (
[Point :=] <expression (IN) of robtarget> ,
[XOffset :=] <expression (IN) of num> ,
[YOffset :=] <expression (IN) of num> ,
[ZOffset :=] <expression (IN) of num> )
A function with a return value of the data type robtarget.
Related information
Described in:
Position data
3-Offs-572
Functions
OpMode
OpMode
OpMode (Operating Mode) is used to read the current operating mode of the system.
Example
TEST OpMode()
CASE OP_AUTO:
...
CASE OP_MAN_PROG:
...
CASE OP_MAN_TEST:
...
DEFAULT:
...
ENDTEST
Different program sections are executed depending on the current operating mode.
Return value
Symbolic constant
Comment
OP_UNDEF
OP_AUTO
OP_MAN_PROG
OP_MAN_TEST
Syntax
OpMode( )
A function with a return value of the data type symnum.
Related information
Described in:
Different operating modes
Functions - RunMode
3-OpMode-573
OpMode
3-OpMode-574
Functions
Functions
OrientZYX
OrientZYX
OrientZYX (Orient from Euler ZYX angles) is used to build an orient type variable out
of Euler angles.
Example
VAR num anglex;
VAR num angley;
VAR num anglez;
VAR pose object;
.
object.rot := OrientZYX(anglez, angley, anglex)
Return value
Arguments
OrientZYX
ZAngle
3-OrientZYX-575
OrientZYX
Functions
Syntax
OrientZYX(
[ZAngle :=] <expression (IN) of num> ,
[YAngle :=] <expression (IN) of num> ,
[XAngle :=] <expression (IN) of num>
)
A function with a return value of the data type orient.
Related information
Described in:
Mathematical instructions and functions
3-OrientZYX-576
Functions
ORobT
ORobT
ORobT (Object Robot Target) is used to transform a robot position from the program
displacement coordinate system to the object coordinate system and/or to remove an
offset for the external axes.
Example
VAR robtarget p10;
VAR robtarget p11;
p10 := CRobT();
p11 := ORobT(p10);
The current positions of the robot and the external axes are stored in p10 and p11.
The values stored in p10 are related to the ProgDisp/ExtOffs coordinate system.
The values stored in p11 are related to the object coordinate system without any
offset on the external axes.
Return value
Arguments
ORobT (OrgPoint [\InPDisp] | [\InEOffs])
OrgPoint
(Original Point)
Returns the TCP position in the ProgDisp coordinate system, i.e. removes external axes offset only.
[\InEOffs]
Returns the external axes in the offset coordinate system, i.e. removes program
displacement for the robot only.
3-ORobT-577
ORobT
Functions
Examples
p10 := ORobT(p10 \InEOffs );
The ORobT function will remove any program displacement that is active, leaving the TCP position relative to the object coordinate system. The external axes
will remain in the offset coordinate system.
p10 := ORobT(p10 \InPDisp );
The ORobT function will remove any offset of the external axes. The TCP position will remain in the ProgDisp coordinate system.
Syntax
ORobT (
[ OrgPoint := ] < expression (IN) of robtarget>
[\InPDisp] | [\InEOffs])
A function with a return value of the data type robtarget.
Related information
Described in:
Definition of program displacement for
the robot
Coordinate systems
3-ORobT-578
Functions
PoseInv
PoseInv
Example
z1
Pose1
Frame1
z0
y1
x1
Frame0
y0
Pose2
x0
Pose1 represents the coordinates of Frame1 related to Frame0.
The transformation giving the coordinates of Frame0 related to Frame1 is obtained by
the reverse transformation:
VAR pose pose1;
VAR pose pose2;
.
.
pose2 := PoseInv(pose1);
Return value
Arguments
PoseInv
(Pose)
Pose
3-PoseInv-579
PoseInv
Functions
Syntax
PoseInv(
[Pose :=] <expression (IN) of pose>
)
A function with a return value of the data type pose.
Related information
Described in:
Mathematical instructions and functions
3-PoseInv-580
Functions
PoseMult
PoseMult
PoseMult (Pose Multiply) is used to calculate the product of two frame transformations. A typical use is to calculate a new frame as the result of a displacement acting
on an original frame.
Example
z1
y1
pose1
z0
Frame1
pose2
z2
Frame2
x1
Frame0
y2
y0
pose3
x0
x2
Return value
3-PoseMult-581
PoseMult
Functions
Arguments
PoseMult
(Pose1 Pose2)
Pose1
Syntax
PoseMult(
[Pose1 :=] <expression (IN) of pose> ,
[Pose2 :=] <expression (IN) of pose>
)
A function with a return value of the data type pose.
Related information
Described in:
Mathematical instructions and functions
3-PoseMult-582
Functions
PoseVect
PoseVect
PoseVect (Pose Vector) is used to calculate the product of a pose and a vector.
It is typically used to calculate a vector as the result of the effect of a displacement on
an original vector.
Example
pos2
pos1
z1
z0
pose1
Frame0
y1
Frame1
y0
x1
x0
pose1 represents the coordinates of Frame1 related to Frame0.
pos1 is a vector related to Frame1.
The corresponding vector related to Frame0 is obtained by the product:
VAR pose pose1;
VAR pos pos1;
VAR pos pos2;
.
.
pos2:= PoseVect(pose1, pos1);
Return value
The value of the product of the pose and the original pos.
3-PoseVect-583
PoseVect
Functions
Arguments
PoseVect
(Pose Pos)
Pose
Pos
Syntax
PoseVect(
[Pose :=] <expression (IN) of pose> ,
[Pos :=] <expression (IN) of pos>
)
A function with a return value of the data type pos.
Related information
Described in:
Mathematical instructions and functions
3-PoseVect-584
Functions
Pow
Pow
Example
VAR num x;
VAR num y
VAR num reg1;
.
reg1:= Pow(x, y);
reg1 is assigned the value xy.
Return value
Arguments
Pow
(Base Exponent)
Base
Exponent
Limitations
The execution of the function xy will give an error if:
. x < 0 and y is not an integer;
. x = 0 and y < 0.
3-Pow-585
Pow
Functions
Syntax
Pow(
[Base :=] <expression (IN) of num> ,
[Exponent :=] <expression (IN) of num>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
3-Pow-586
Functions
Present
Present
Present is used to test if an optional argument has been used when calling a routine.
An optional parameter may not be used if it was not specified when calling the routine.
This function can be used to test if a parameter has been specified, in order to prevent
errors from occurring.
Example
PROC feeder (\switch on | \switch off)
IF Present (on) Set do1;
IF Present (off) Reset do1;
ENDPROC
The output do1, which controls a feeder, is set or reset depending on the argument used when calling the routine.
Return value
TRUE = The parameter value or a switch has been defined when calling the routine.
FALSE = The parameter value or a switch has not been defined.
Arguments
Present
(OptPar)
OptPar
(Optional Parameter)
3-Present-587
Present
Functions
Example
PROC glue (\switch on, num glueflow, robtarget topoint, speeddata speed,
zonedata zone, PERS tooldata tool, \PERS wobjdata wobj)
IF Present (on) PulseDO glue_on;
SetAO gluesignal, glueflow;
IF Present (wobj) THEN
MoveL topoint, speed, zone, tool \WObj=wobj;
ELSE
MoveL topoint, speed, zone, tool;
ENDIF
ENDPROC
A glue routine is made. If the argument \on is specified when calling the routine,
a pulse is generated on the signal glue_on. The robot then sets an analog output
gluesignal, which controls the glue gun, and moves to the end position. As the
wobj parameter is optional, different MoveL instructions are used depending on
whether this argument is used or not.
Syntax
Present (
[OptPar:=] <reference (REF) of any type> )
A REF parameter requires, in this case, the optional parameter name.
A function with a return value of the data type bool.
Related information
Described in:
Routine parameters
3-Present-588
Functions
ReadBin
ReadBin
ReadBin (Read Binary) is used to read a byte (8 bits) from a file or serial channel.
This function works on both binary and character-based files or serial channels.
Example
VAR num character;
VAR iodev inchannel;
...
Open "sio1:", inchannel\Bin;
character := ReadBin(inchannel);
A byte is read from the binary serial channel inchannel.
Return value
A byte (8 bits) is read from a specified file or serial channel. This byte is converted to
the corresponding positive numeric value and returned as a num data type.
If a file is empty (end of file), the number -1 is returned.
Arguments
ReadBin
(IODevice [\Time])
IODevice
The max. time for the reading operation (timeout) in seconds. If this argument is
not specified, the max. time is set to 60 seconds.
If this time runs out before the reading operation is finished, the error handler
will be called with the error code ERR_DEV_MAXTIME. If there is no error
handler, the execution will be stopped.
The timeout function is in use also during program stop and will be noticed in
the RAPID program at program start.
Program execution
Program execution waits until a byte (8 bits) can be read from the file or serial channel.
System Data Types and Routines
3-ReadBin-589
ReadBin
Functions
Example
VAR num bindata;
VAR iodev file;
Open flp1:myfile.bin, file \Read \Bin;
bindata := ReadBin(file);
WHILE bindata <> EOF_BIN DO
TPWrite ByteToStr(bindata\Char);
bindata := ReadBin(file);
ENDWHILE
Read the contents of a binary file myfile.bin from the beginning to the end and
displays the received binary data converted to chars on the teach pendant (one
char on each line).
Limitations
The function can only be used for files and serial channels that have been opened with
read access (\Read for character based files, \Bin or \Append \Bin for binary files).
Error handling
If an error occurs during reading, the system variable ERRNO is set to
ERR_FILEACC. This error can then be handled in the error handler.
Predefined data
The constant EOF_BIN can be used to stop reading at the end of the file.
CONST num EOF_BIN := -1;
Syntax
ReadBin(
[IODevice :=] <variable (VAR) of iodev>
[\Time:= <expression (IN) of num>])
A function with a return value of the type num.
3-ReadBin-590
Functions
ReadBin
Related information
Described in:
Opening (etc.) files or serial channels
Functions - ByteToStr
3-ReadBin-591
ReadBin
3-ReadBin-592
Functions
Functions
ReadMotor
ReadMotor
ReadMotor is used to read the current angles of the different motors of the robot and
external axes. The primary use of this function is in the calibration procedure of the
robot.
Example
VAR num motor_angle2;
motor_angle2 := ReadMotor(2);
The current motor angle of the second axis of the robot is stored in
motor_angle2.
Return value
The current motor angle in radians of the stated axis of the robot or external axes.
Arguments
ReadMotor [\MecUnit ] Axis
MecUnit
(Mechanical Unit)
The name of the mechanical unit for which an axis is to be read. If this argument
is omitted, the axis for the robot is read. (Note, in this release only robot is permitted for this argument).
Axis
Program execution
The motor angle returned represents the current position in radians for the motor and
independently of any calibration offset. The value is not related to a fix position of the
robot, only to the resolver internal zero position, i.e. normally the resolver zero position closest to the calibration position (the difference between the resolver zero position and the calibration position is the calibration offset value). The value represents
the full movement of each axis, although this may be several turns.
3-ReadMotor-593
ReadMotor
Functions
Example
VAR num motor_angle3;
motor_angle3 := ReadMotor(\MecUnit:=robot, 3);
The current motor angle of the third axis of the robot is stored in motor_angle3.
Syntax
ReadMotor(
[\MecUnit := < variable (VAR) of mecunit>,]
[Axis := ] < expression (IN) of num>
)
A function with a return value of the data type num.
Related information
Described in:
Reading the current joint angle
3-ReadMotor-594
Functions - CJointT
Functions
ReadNum
ReadNum
ReadNum (Read Numeric) is used to read a number from a character-based file or serial
channel.
Example
VAR iodev infile;
...
Open "flp1:file.doc", infile\Read;
reg1 := ReadNum(infile);
Reg1 is assigned a number read from the file file.doc on the diskette.
Return value
Arguments
ReadNum
IODevice
(Delimiters)
A string containing the delimiters to use when parsing a line in the file or serial
channel. By default (without \Delim), the file is read line by line and the line-feed
character (\0A) is the only delimiter considered by the parsing. When the \Delim
argument is used, any character in the specified string argument will be considered to determine the significant part of the line.
When using the argument \Delim, the control system always adds the characters
carriage return (\0D) and line-feed (\0A) to the delimiters specified by the user.
To specify non-alphanumeric characters, use \xx, where xx is the hexadecimal
representation of the ASCII code of the character (example: TAB is specified by
\09).
3-ReadNum-595
ReadNum
Functions
[\Time]
The max. time for the reading operation (timeout) in seconds. If this argument is
not specified, the max. time is set to 60 seconds.
If this time runs out before the read operation is finished, the error handler will
be called with the error code ERR_DEV_MAXTIME. If there is no error handler,
the execution will be stopped.
The timeout function is also in use during program stop and will be noticed in the
RAPID program at program start.
Program execution
Starting at the current file position, the function reads and discards any heading delimiters. A heading delimiter without the argument \Delim is a line-feed character. Heading
delimiters with the argument \Delim are any characters specified in the \Delim argument plus carriage return and line-feed characters. It then reads everything up to and
including the next delimiter character (will be discarded), but not more than 80 characters. If the significant part exceeds 80 characters, the remainder of the characters will
be read on the next reading.
The string that is read is then converted to a numeric value; e.g. "234.4" is converted to
the numeric value 234.4.
Example
reg1 := ReadNum(infile\Delim:="\09 ");
IF reg1 > EOF_NUM THEN
TPWrite "The file is empty";
...
Reads a number in a line where numbers are separated by TAB ("\09") or
SPACE (" ") characters.
Before using the number read from the file, a check is performed to make sure
that the file is not empty.
Limitations
The function can only be used for character based files that have been opened for reading.
3-ReadNum-596
Functions
ReadNum
Error handling
If an access error occurs during reading, the system variable ERRNO is set to
ERR_FILEACC.
If there is an attempt to read non-numeric data, the system variable ERRNO is set to
ERR_RCVDATA. These errors can then be dealt with by the error handler.
Predefined data
The constant EOF_NUM can be used to stop reading, at the end of the file.
CONST num EOF_NUM := 9.998E36;
Syntax
ReadNum (
[IODevice :=]<variable (VAR) of iodev>
[\Delim:=<expression (IN) of string>]
[\Time:=<expression (IN) of num>])
A function with a return value of the type num.
Related information
Described in:
Opening (etc.) files or serial channels
3-ReadNum-597
ReadNum
3-ReadNum-598
Functions
Functions
ReadStr
ReadStr
ReadStr (Read String) is used to read a string from a character-based file or serial channel.
Example
VAR string text;
VAR iodev infile;
...
Open "flp1:file.doc", infile\Read;
text := ReadStr(infile);
Text is assigned a string read from the file file.doc on the diskette.
Return value
Arguments
ReadStr
IODevice
(Delimiters)
A string containing the delimiters to use when parsing a line in the file or serial
channel. By default the file is read line by line and the line-feed character (\0A)
is the only delimiter considered by the parsing. When the \Delim argument is
used, any character in the specified string argument plus by default line-feed
character will be considered to determine the significant part of the line.
To specify non-alphanumeric characters, use \xx, where xx is the hexadecimal
representation of the ASCII code of the character (example: TAB is specified by
\09).
3-ReadStr-599
ReadStr
Functions
[\RemoveCR]
A switch used to remove the trailing carriage return character when reading PC
files. In PC files, a new line is specified by carriage return and line feed (CRLF).
When reading a line in such files, the carriage return character is by default read
into the return string. When using this argument, the carriage return character will
be read from the file but not included in the return string.
[\DiscardHeaders]
This argument specifies whether the heading delimiters (specified in \Delim plus
default line-feed) are skipped or not before transferring data to the return string.
By default, if the first character at the current file position is a delimiter, it is read
but not transferred to the return string, the line parsing is stopped and the return
will be an empty string. If this argument is used, all delimiters included in the line
will be read from the file but discarded, and the return string will contain the data
starting at the first non-delimiter character in the line.
[\Time]
The max. time for the reading operation (timeout) in seconds. If this argument is
not specified, the max. time is set to 60 seconds.
If this time runs out before the read operation is finished, the error handler will
be called with the error code ERR_DEV_MAXTIME. If there is no error handler,
the execution will be stopped.
The timeout function is in use also during program stop and will be noticed in the
RAPID program at program start.
Program execution
Starting at the current file position, if the \DiscardHeaders argument is used, the function reads and discards any heading delimiters (line-feed characters and any character
specified in the \Delim argument). In all cases, it then reads everything up to the next
delimiter character, but not more than 80 characters. If the significant part exceeds 80
characters, the remainder of the characters will be read on the next reading. The delimiter that caused the parsing to stop is read from the file but not transferred to the return
string. If the last character in the string is a carriage return character and the \RemoveCR
argument is used, this character will be removed from the string.
3-ReadStr-600
Functions
ReadStr
Example
text := ReadStr(infile);
IF text = EOF THEN
TPWrite "The file is empty";
...
Before using the string read from the file, a check is performed to make sure that
the file is not empty.
Example
Consider a file containing:
<LF><SPACE><TAB>Hello<SPACE><SPACE>World<CR><LF>
text := ReadStr(infile);
text will be an empty string: the first character in the file is the default <LF>
delimiter.
text := ReadStr(infile\DiscardHeaders);
text will contain <SPACE><TAB>Hello<SPACE><SPACE>World<CR>: the
first character in the file, the default <LF> delimiter, is discarded.
text := ReadStr(infile\RemoveCR\DiscardHeaders);
text will contain <SPACE><TAB>Hello<SPACE><SPACE>World: the first
character in the file, the default <LF> delimiter, is discarded; the final carriage
return character is removed
text := ReadStr(infile\Delim:= \09\RemoveCR\DiscardHeaders);
text will contain Hello: the first characters in the file that match either the
default <LF> delimiter or the character set defined by \Delim (space and tab) are
discarded. Data is then transferred up to the first delimiter that is read from the
file but not transferred into the string. A new invocation of the same statement
will return World.
Example
Consider a file containing:
<CR><LF>Hello<CR><LF>
text := ReadStr(infile);
text will contain the <CR> (\0d) character: <CR> and <LF> characters are read
from the file, but only <CR> is transferred to the string. A new invocation of the
same statement will return Hello\0d.
3-ReadStr-601
ReadStr
Functions
text := ReadStr(infile\RemoveCR);
text will contain an empty string: <CR> and <LF> characters are read from the
file; <CR> is transferred but removed from the string. A new invocation of the
same statement will return Hello.
text := ReadStr(infile\Delim:=\0d);
text will contain an empty string: <CR> is read from the file but not transferred
to the return string. A new invocation of the same instruction will return an empty
string again: <LF> is read from the file but not transferred to the return string.
text := ReadStr(infile\Delim:=\0d\DiscardHeaders);
text will contain Hello. A new invocation of the same instruction will return
EOF (end of file).
Limitations
The function can only be used for files or serial channels that have been opened for
reading in a character-based mode.
Error handling
If an error occurs during reading, the system variable ERRNO is set to
ERR_FILEACC. This error can then be handled in the error handler.
Predefined data
The constant EOF can be used to check if the file was empty when trying to read from
the file or to stop reading at the end of the file.
CONST string EOF := "EOF";
Syntax
ReadStr (
[IODevice :=] <variable (VAR) of iodev>
[\Delim:=<expression (IN) of string>]
[\RemoveCR]
[\DiscardHeaders]
[\Time:= <expression (IN) of num>])
A function with a return value of the type string.
3-ReadStr-602
Functions
ReadStr
Related information
Described in:
Opening (etc.) files or serial channels
3-ReadStr-603
ReadStr
3-ReadStr-604
Functions
Functions
RelTool
RelTool
Example
MoveL
The robot is moved to a position that is 100 mm from p1 in the direction of the
tool.
MoveL
Return value
The new position with the addition of a displacement and/or a rotation, if any, relative
to the active tool.
Arguments
RelTool
(Point
Point
Dx
Dy
Dz
[\Rx]
[\Ry]
[\Rz])
Data type: robtarget
The input robot position. The orientation part of this position defines the current
orientation of the tool coordinate system.
Dx
Dy
Dz
[\Rx]
3-RelTool-605
RelTool
Functions
[\Ry]
[\Rz]
In the event that two or three rotations are specified at the same time, these will be performed first around the x-axis, then around the new y-axis, and then around the new
z-axis.
Syntax
RelTool(
[ Point := ] < expression (IN) of robtarget>,
[Dx :=] <expression (IN) of num> ,
[Dy :=] <expression (IN) of num> ,
[Dz :=] <expression (IN) of num>
[\Rx := <expression (IN) of num> ]
[\Ry := <expression (IN) of num> ]
[\Rz := <expression (IN) of num> ])
A function with a return value of the data type robtarget.
Related information
Described in:
Mathematical instructions and functions
Positioning instructions
3-RelTool-606
Functions
Round
Round
Example
VAR num val;
val := Round(0.38521\Dec:=3);
The variable val is given the value 0.385.
val := Round(0.38521\Dec:=1);
The variable val is given the value 0.4.
val := Round(0.38521);
The variable val is given the value 0.
Return value
Arguments
Round
( Val [\Dec])
Val
(Value)
(Decimals
Number of decimals.
If the specified number of decimals is 0 or if the argument is omitted, the value
is rounded to an integer.
The number of decimals must not be negative or greater than the available precision for numeric values.
3-Round-607
Round
Functions
Syntax
Round(
[ Val := ] <expression (IN) of num>
[ \Dec := <expression (IN) of num> ]
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
Truncating a value
Functions - Trunc
3-Round-608
Functions
ReadStrBin
ReadStrBin
ReadStrBin (Read String Binary) is used to read a string from a binary serial channel
or file.
Example
VAR iodev channel2;
VAR string text;
...
Open sio1:, channel2 \Bin;
text := ReadStrBin (channel2, 10);
Text is assigned a 10 characters text string read from the serial channel referred
to by channel2.
Return value
The text string read from the specified serial channel or file. If the file is empty (end of
file), the string "EOF" is returned.
Arguments
ReadStrBin
IODevice
The number of characters to be read from the binary serial channel or file.
[\Time]
The max. time for the reading operation (timeout) in seconds. If this argument is
not specified, the max. time is set to 60 seconds.
If this time runs out before the read operation is finished, the error handler will
be called with the error code ERR_DEV_MAXTIME. If there is no error handler, the execution will be stopped.
The timeout function is in use also during program stop and will be noticed in
the RAPID program at program start.
3-ReadStrBin-609
ReadStrBin
Functions
Program execution
The function reads the specified number of characters from the binary serial channel or
file.
Example
text := ReadStrBin(infile,20);
IF text = EOF THEN
TPWrite "The file is empty";
Before using the string read from the file, a check is performed to make sure that
the file is not empty.
Limitations
The function can only be used for serial channels or files that have been opened for
reading in a binary mode.
Error handling
If an error occurs during reading, the system variable ERRNO is set to
ERR_FILEACC. This error can then be handled in the error handler.
Predefined data
The constant EOF can be used to check if the file was empty, when trying to read from
the file or to stop reading at the end of the file.
CONST string EOF := "EOF";
Syntax
ReadStrBin (
[IODevice :=] <variable (VAR) of iodev>,
[NoOfChars :=] <expression (IN) of num>
[\Time:= <expression (IN) of num>])
A function with a return value of the type string.
3-ReadStrBin-610
Functions
ReadStrBin
Related information
Described in:
Opening (etc.) serial channels
or files
Instructions - WriteStrBin
3-ReadStrBin-611
ReadStrBin
3-ReadStrBin-612
Functions
Functions
RunMode
RunMode
RunMode (Running Mode) is used to read the current running mode of the program
task.
Example
IF RunMode() = RUN_CONT_CYCLE THEN
..
ENDIF
The program section is executed only for continuous or cycle running.
Return value
Symbolic constant
Comment
RUN_UNDEF
RUN_CONT_CYCLE
RUN_INSTR_FWD
RUN_INSTR_BWD
RUN_SIM
Arguments
RunMode ( [ \Main] )
[ \Main ]
3-RunMode-613
RunMode
Functions
Syntax
RunMode ( [\Main] )
A function with a return value of the data type symnum.
Related information
Described in:
Reading operating mode
3-RunMode-614
Functions - OpMode
Functions
Sin
Sin
Example
VAR num angle;
VAR num value;
.
.
value := Sin(angle);
Return value
Arguments
Sin
(Angle)
Angle
Syntax
Sin(
[Angle:=] <expression (IN) of num>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
3-Sin-615
Sin
3-Sin-616
Functions
Functions
Sqrt
Sqrt
Example
VAR num x_value;
VAR num y_value;
.
.
y_value := Sqrt( x_value);
Return value
Arguments
Sqrt
(Value)
Value
The argument value for square root (
0.
Syntax
Sqrt(
[Value:=] <expression (IN) of num>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
3-Sqrt-617
Sqrt
3-Sqrt-618
Functions
Functions
StrFind
StrFind
StrFind (String Find) is used to search in a string, starting at a specified position, for a
character that belongs to a specified set of characters.
Example
VAR num found;
found := StrFind("Robotics",1,"aeiou");
The variable found is given the value 2.
found := StrFind("Robotics",1,"aeiou"\NotInSet);
The variable found is given the value 1.
found := StrFind("IRB 6400",1,STR_DIGIT);
The variable found is given the value 5.
found := StrFind("IRB 6400",1,STR_WHITE);
The variable found is given the value 4.
Return value
The character position of the first character, at or past the specified position, that
belongs to the specified set. If no such character is found, String length +1 is returned.
Arguments
StrFind
Str
(String)
(Character Position)
Start character position. A runtime error is generated if the position is outside the
string.
Set
3-StrFind-619
StrFind
Functions
[\NotInSet]
Syntax
StrFind(
[ Str := ] <expression (IN) of string> ,
[ ChPos := ] <expression (IN) of num> ,
[ Set:= ] <expression (IN) of string>
[\NotInSet ]
)
A function with a return value of the data type num.
Related information
Described in:
String functions
Definition of string
String values
3-StrFind-620
Functions
StrLen
StrLen
Example
VAR num len;
len := StrLen("Robotics");
The variable len is given the value 8.
Return value
Arguments
StrLen
(Str)
Str
(String)
Syntax
StrLen(
[ Str := ] <expression (IN) of string>
)
A function with a return value of the data type num.
Related information
Described in:
String functions
Definition of string
String values
3-StrLen-621
StrLen
3-StrLen-622
Functions
Functions
StrMap
StrMap
Maps a string
StrMap (String Mapping) is used to create a copy of a string in which all characters are
translated according to a specified mapping.
Example
VAR string str;
str := StrMap("Robotics","aeiou","AEIOU");
The variable str is given the value "RObOtIcs".
str := StrMap("Robotics",STR_LOWER, STR_UPPER);
The variable str is given the value "ROBOTICS".
Return value
The string created by translating the characters in the specified string, as specified by
the "from" and "to" strings. Each character, from the specified string, that is found in
the "from" string is replaced by the character at the corresponding position in the "to"
string. Characters for which no mapping is defined are copied unchanged to the resulting string.
Arguments
StrMap
Str
(String)
3-StrMap-623
StrMap
Functions
Syntax
StrMap(
[ Str := ] <expression (IN) of string> ,
[ FromMap:= ] <expression (IN) of string> ,
[ ToMap:= ] <expression (IN) of string>
)
A function with a return value of the data type string.
Related information
Described in:
String functions
Definition of string
String values
3-StrMap-624
Functions
StrMatch
StrMatch
Example
VAR num found;
found := StrMatch("Robotics",1,"bo");
The variable found is given the value 3.
Return value
The character position of the first substring, at or past the specified position, that is
equal to the specified pattern string. If no such substring is found, string length +1 is
returned.
Arguments
StrMatch
Str
(String)
(Character Position)
Start character position. A runtime error is generated if the position is outside the
string.
Pattern
Syntax
StrMatch(
[ Str := ] <expression (IN) of string> ,
[ ChPos := ] <expression (IN) of num> ,
[ Pattern:= ] <expression (IN) of string>
)
A function with a return value of the data type num.
System Data Types and Routines
3-StrMatch-625
StrMatch
Functions
Related information
Described in:
String functions
Definition of string
String values
3-StrMatch-626
Functions
StrMemb
StrMemb
Example
VAR bool memb;
memb := StrMemb("Robotics",2,"aeiou");
The variable memb is given the value TRUE, as o is a member of the set "aeiou".
memb := StrMemb("Robotics",3,"aeiou");
The variable memb is given the value FALSE, as b is not a member of the set
"aeiou".
memb := StrMemb("S-721 68 VSTERS",3,STR_DIGIT);
The variable memb is given the value TRUE.
Return value
TRUE if the character at the specified position in the specified string belongs to the
specified set of characters.
Arguments
StrMemb
Str
(String)
(Character Position)
3-StrMemb-627
StrMemb
Functions
Syntax
StrMemb(
[ Str := ] <expression (IN) of string> ,
[ ChPos := ] <expression (IN) of num> ,
[ Set:= ] <expression (IN) of string>
)
A function with a return value of the data type bool.
Related information
Described in:
String functions
Definition of string
String values
3-StrMemb-628
Functions
StrOrder
StrOrder
StrOrder (String Order) is used to check whether two strings are in order, according to
a specified character ordering sequence.
Example
VAR bool le;
le := StrOrder("FIRST","SECOND",STR_UPPER);
The variable le is given the value TRUE, because "FIRST" comes before
"SECOND" in the character ordering sequence STR_UPPER.
Return value
TRUE if the first string comes before the second string (Str1 <= Str2) when characters
are ordered as specified.
Characters that are not included in the defined ordering are all assumed to follow the
present ones.
Arguments
StrOrder
Str1
(String 1)
(String 2)
3-StrOrder-629
StrOrder
Functions
Syntax
StrOrder(
[ Str1 := ] <expression (IN) of string> ,
[ Str2 := ] <expression (IN) of string> ,
[ Order := ] <expression (IN) of string>
)
A function with a return value of the data type bool.
Related information
Described in:
String functions
Definition of string
String values
3-StrOrder-630
Functions
StrPart
StrPart
Example
VAR string part;
part := StrPart("Robotics",1,5);
The variable part is given the value "Robot".
Return value
The substring of the specified string, which has the specified length and starts at the
specified character position.
Arguments
StrPart
Str
(String)
(Character Position)
Start character position. A runtime error is generated if the position is outside the
string.
Len
(Length)
Syntax
StrPart(
[ Str := ] <expression (IN) of string> ,
[ ChPos := ] <expression (IN) of num> ,
[ Len:= ] <expression (IN) of num>
)
A function with a return value of the data type string.
System Data Types and Routines
3-StrPart-631
StrPart
Functions
Related information
Described in:
String functions
Definition of string
String values
3-StrPart-632
Functions
StrToByte
StrToByte
StrToByte (String To Byte) is used to convert a string with a defined byte data format
into a byte data.
Example
VAR string con_data_buffer{5} := ["10", "AE", "176", "00001010", "A"];
VAR byte data_buffer{5};
data_buffer{1} := StrToByte(con_data_buffer{1});
The content of the array component data_buffer{1} will be 10 decimal after the
StrToByte ... function.
data_buffer{2} := StrToByte(con_data_buffer{2}\Hex);
The content of the array component data_buffer{2} will be 174 decimal after the
StrToByte ... function.
data_buffer{3} := StrToByte(con_data_buffer{3}\Okt);
The content of the array component data_buffer{3} will be 126 decimal after the
StrToByte ... function.
data_buffer{4} := StrToByte(con_data_buffer{4}\Bin);
The content of the array component data_buffer{4} will be 10 decimal after the
StrToByte ... function.
data_buffer{5} := StrToByte(con_data_buffer{5}\Char);
The content of the array component data_buffer{5} will be 65 decimal after the
StrToByte ... function.
Return value
3-StrToByte-633
StrToByte
Functions
Arguments
StrToByte
ConStr
(Hexadecimal)
(Octal)
(Binary)
(Character)
Limitations
Depending on the format of the string to be converted, the following string data
is valid:
Format:
Dec .....: 0 - 9
Hex .....: 0 - 9, a -f, A - F
Okt ......: 0 - 7
Bin ......: 0 - 1
Char ....: Any ASCII char (*)
String length:
3
2
3
8
1
Range:
"0" - "255"
"0" - "FF"
"0" - "377"
"0" - "11111111"
One ASCII char
(*) RAPID character codes (e.g. "\07" for BEL control character) can be used as
arguments in ConStr.
3-StrToByte-634
Functions
Pow
Syntax
StrToByte(
[ConStr :=] <expression (IN) of string>
[\ Hex ] | [\ Okt] | [\ Bin] | [\ Char]
) ;
A function with a return value of the data type byte.
Related information
Described in:
Convert a byte to a string data
Instructions - ByteToStr
3-Pow-635
Pow
3-Pow-636
Functions
Functions
StrToVal
StrToVal
StrToVal (String To Value) is used to convert a string to a value of any data type.
Example
VAR bool ok;
VAR num nval;
ok := StrToVal("3.85",nval);
The variable ok is given the value TRUE and nval is given the value 3.85.
Return value
Arguments
StrToVal
( Str Val )
Str
(String)
A string value containing literal data with format corresponding to the data type
used in argument Val. Valid format as for RAPID literal aggregates.
Val
(Value)
Name of the variable or persistent of any data type for storage of the result from
the conversion. The data is unchanged if the requested conversion failed.
Example
VAR string 15 := [600, 500, 225.3];
VAR bool ok;
VAR pos pos15;
ok := StrToVal(str15,pos15);
The variable ok is given the value TRUE and the variable p15 is given the value
that are specified in the string str15.
3-StrToVal-637
StrToVal
Functions
Syntax
StrToVal(
[ Str := ] <expression (IN) of string> ,
[ Val := ] <var or pers (INOUT) of ANYTYPE>
)
A function with a return value of the data type bool.
Related information
Described in:
String functions
Definition of string
String values
3-StrToVal-638
Functions
Tan
Tan
Example
VAR num angle;
VAR num value;
.
.
value := Tan(angle);
Return value
Arguments
Tan
(Angle)
Angle
Syntax
Tan(
[Angle :=] <expression (IN) of num>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
Arc tangent with return value in the
range [-180, 180]
3-Tan-639
Tan
3-Tan-640
Functions
Functions
TestDI
TestDI
Return value
Arguments
TestDI
(Signal)
Signal
Syntax
TestDI (
[ Signal := ] < variable (VAR) of signaldi > )
A function with a return value of the data type bool.
3-TestDI-641
TestDI
Functions
Related information
Described in:
Reading the value of a digital input signal
Functions - DInput
Input/Output instructions
3-TestDI-642
Functions
TestAndSet
TestAndSet
TestAndSet can be used together with a normal data object of the type bool, as a binary
semaphore, to retrieve exclusive right to specific RAPID code areas or system
resources. The function could be used both between different program tasks and different execution levels (TRAP or Event Routines) within the same program task.
Example of resources that can need protection from access at the same time:
- Use of some RAPID routines with function problems when executed in
parallel.
- Use of the Teach Pendant - Operator Output & Input
Example
MAIN program task:
PERS bool tproutine_inuse := FALSE;
....
WaitUntil TestAndSet(tproutine_inuse);
TPWrite First line from MAIN;
TPWrite Second line from MAIN;
TPWrite Third line from MAIN;
tproutine_inuse := FALSE;
BACK1 program task:
PERS bool tproutine_inuse := FALSE;
....
WaitUntil TestAndSet(tproutine_inuse);
TPWrite First line from BACK1;
TPWrite Second line from BACK1;
TPWrite Third line from BACK1;
tproutine_inuse := FALSE;
To avoid mixing up the lines, one from MAIN and one from BACK1, the use of the
TestAndSet function guarantees that all three lines from each task are not separated.
If program task MAIN takes the semaphore TestAndSet(tproutine_inuse) first, then
program task BACK1 must wait until the program task MAIN has left the semaphore.
Return value
3-TestAndSet-643
TestAndSet
Functions
Arguments
TestAndSet
Object
Object
User defined data object to be used as semaphore. The data object could be a VAR
or a PERS. If TestAndSet are used between different program tasks, the object
must be a PERS or an installed VAR (intertask objects).
Program execution
This function will in one indivisible step check the user defined variable and, if it is
unset, will set it and return TRUE, otherwise it will return FALSE.
IF Object = FALSE THEN
Object := TRUE;
RETURN TRUE;
ELSE
RETURN FALSE;
ENDIF
Example
LOCAL VAR bool doit_inuse := FALSE;
...
PROC doit(...)
WaitUntil TestAndSet (doit_inuse);
....
doit_inuse := FALSE;
ENDPROC
If a module is installed built-in and shared, it is possible to use a local module
variable for protection of access from different program tasks at the same time.
Note in this case: If program execution is stopped in the routine doit and the
program pointer is moved to main, the variable doit_inuse will not be reset. To
avoid this, reset the variable doit_inuse to FALSE in the START event routine.
Syntax
TestAndSet (
[ Object := ] < variable or persistent (INOUT) of bool> )
A function with a return value of the data type bool.
3-TestAndSet-644
Functions
TestAndSet
Related information
Described in:
Built-in and shared module
Intertask objects
3-TestAndSet-645
TestAndSet
3-TestAndSet-646
Functions
Functions
Trunc
Trunc
Example
VAR num val;
val := Trunc(0.38521\Dec:=3);
The variable val is given the value 0.385.
reg1 := 0.38521
val := Trunc(reg1\Dec:=1);
The variable val is given the value 0.3.
val := Trunc(0.38521);
The variable val is given the value 0.
Return value
Arguments
Trunc
( Val [\Dec] )
Val
(Value)
(Decimals)
Number of decimals.
If the specified number of decimals is 0 or if the argument is omitted, the value
is truncated to an integer.
The number of decimals must not be negative or greater than the available precision for numeric values.
3-Trunc-647
Trunc
Functions
Syntax
Trunc(
[ Val := ] <expression (IN) of num>
[ \Dec := <expression (IN) of num> ]
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
Rounding a value
Functions - Round
3-Trunc-648
Functions
ValToStr
ValToStr
ValToStr (Value To String) is used to convert a value of any data type to a string.
Example
VAR string str;
VAR pos p := [100,200,300];
str := ValToStr(1.234567);
The variable str is given the value "1.23457".
str := ValToStr(TRUE);
The variable str is given the value "TRUE".
str := ValToStr(p);
The variable str is given the value "[100,200,300]".
Return value
The value is converted to a string with standard RAPID format. This means in principle
6 significant digits. If the decimal part is less than 0.000005 or greater than 0.999995,
the number is rounded to an integer.
A runtime error is generated if the resulting string is too long.
Arguments
ValToStr
( Val )
Val
(Value)
Syntax
ValToStr(
[ Val := ] <expression (IN) of ANYTYPE>
)
A function with a return value of the data type string.
3-ValToStr-649
ValToStr
Functions
Related information
Described in:
String functions
Definition of string
String values
3-ValToStr-650
Functions
VectMagn
VectMagn
Example
z
Az
y
Ay
x
Ax
A vector A can be written as the sum of its components in the three orthogonal directions:
A = Ax x + Ay y + Az z
The magnitude of A is:
A =
A x + Ay + A z
The vector is described by the data type pos and the magnitude by the data type num:
VAR num magnitude;
VAR pos vector;
.
.
vector := [1,1,1];
magnitude := VectMagn(vector);
Return value
3-VectMagn-651
VectMagn
Functions
Arguments
VectMagn
(Vector)
Vector
Syntax
VectMagn(
[Vector :=] <expression (IN) of pos>
)
A function with a return value of the data type num.
Related information
Described in:
Mathematical instructions and functions
3-VectMagn-652
INDEX
A
Abs 489
absolute value 489
acceleration reduction 121
AccSet 121
ACos 491
ActUnit 123
Add 125
AliasIO 127
analog output
set 347
AOutput 493
arcus cosine 491
arcus sine 495
arcus tangent 497, 499
arithmetic 119
array
get size 539
ASin 495
assignment 119
ATan 497
ATan2 499
B
bit manipulation 7
bool 5
Break 131
byte 7
C
C_MOTSET 81
C_PROGDISP 81
call 133
CallByVar 135
CDate 513
circular movement 249, 259, 265
CJointT 505, 515
Clear 139
ClkRead 517
ClkReset 141
ClkStart 143
ClkStop 145
clock 9
read 517
reset 141
start 143
stop 145
Close 147, 149
comment 151
common drive unit 123, 159
Compact IF 193
condition 195
confdata 11
ConfJ 153
ConfL 155
CONNECT 157
corner path 107
Cos 519
CPos 521
CRobT 509, 523
CTime 525
CTool 527
CWobj 529
D
date 513
DeactUnit 159
Decr 161
decrease velocity 445
decrement 161
DefDFrame 531
DefFrame 535
digital output 545
pulse 309
reset 317
set 345, 349
Dim 539
dionum 17
displace
position 571
displacement
tool direction 605
displacement frame 531, 535
DotProd 543, 567, 651
DOutput 545
E
Enable I/O unit 205
EOffsOff 163
EOffsOn 165
EOffsSet 169
4-653
activate 237
at a position 405
connect 157
deactivate 229
delete 187
disable 189
enable 191
from digital input 221
identity 27
timed 231
INTNO 81
intnum 27
InvertDO 199
IO unit
disable 201
enable 205
iodev 3, 29
IODisable 201
IOEnable 205
ISignalDI 221
ISignalDO 225
ISleep 229
IsPers 559
IsVar 561
ITimer 231
IVarValue 235
IWatch 237
J
joint movement 269, 273, 285
jump 183
GetTime 555
GOTO 183
GOutput 493, 557
GripLoad 185
group of I/O 351, 493, 557
label 239
linear movement 277, 281, 289, 379
Load 241, 327
load
activate payload 185
loaddata 33
loadsession 39
logical value 5
I
IDelete 187
IDisable 189
IEnable 191
IF 193, 195
Incr 197
increment 197
interrupt
4-654
M
maximum velocity 445
mechanical unit 41
activate 123
deactivate 159
activate 185
PDispOff 301
PDispOn 303
pos 57
pose 59
PoseInv 579
PoseMult 581
position fix I/O 411
Pow 585, 633
Present 587
ProcCall 133
procedure call 133, 135
program displacement
activate 303
deactivate 301
remove from position 577
PulseDO 309
quaternion 52
num 47
numeric value 47
NumToStr 569
O
o_jointtarget 49
object coordinate system 99
Offs 571
offset 571
Open
file 293
serial channel 293
operating mode
read 573
OpMode 573
orient 51
OrientZYX 575
ORobT 577
output
at a position 411
P
path resolution
change 297
PathResol 297
payload 33
RAISE 311
read
clock 517
current date 513
current joint angles 505, 515
current robot position 509, 523
current time 525, 555
current tool data 527
current work object 529
digital output 545
file 589, 595, 599, 609
function key 383
group of outputs 493, 557
serial channel 589, 595, 599, 609
ReadBin 589
ReadMotor 593
ReadNum 595
ReadStr 599, 609
RelTool 499, 535, 573, 585, 605, 613
repeat 177, 447
Reset 317
RestoPath 319
RETRY 321
RETURN 323
Rewind 325
robot position 55, 65
4-655
robtarget 55, 65
Round 607
routine call 133
RunMode 613
running mode
read 613
S
SearchC 331
SearchL 337
serial channel
close 147, 149
file 313, 453, 457, 459
open 293
read 589, 595, 599, 609
rewind 325
write 449
Set 345
SetAO 347
SetDO 349
SetGO 351
shapedata 69
signalai 71
signalao 71
signaldi 71
signaldo 71
signalgi 71
signalgo 71
Sin 615
SingArea 353
soft servo
activating 355
deactivating 357
SoftAct 355
SoftDeact 357
speeddata 73
SpyStart 207, 217, 359
SpyStop 363
Sqrt 617
square root 617
StartMove 369
Stop 371
stop point 107
StopMove 373
stopwatch 9, 143
StorePath 375
StrFind 619
string 77
4-656
StrLen 621
StrMap 623
StrMatch 625
StrMemb 627
StrOrder 629
StrPart 631
StrToVal 637
symnum 79
system data 81
T
Tan 639
TEST 377
TestDI 641
text string 77
time 525, 555
tooldata 87
TPErase 381
tpnum 93
TPReadFK 383
TPReadNum 387
TPShow 389
TPWrite 391
TriggC 393
triggdata 95
TriggEquip 399
TriggInt 405
TriggIO 411
TriggJ 415
TriggL 419
Trunc 647
TRYNEXT 423
TuneReset 425
TuneServo 427
tunetype 97
U
UnLoad 433, 441, 541
user coordinate system 99
V
ValToStr 649
velocity 73
decrease 445
max. 445
VelSet 445
W
wait
a specific time 461
any condition 463
digital input 437
digital output 439
until the robot is in position 461
WaitDI 437
WaitDO 439
WaitTime 461
WaitUntil 463
WHILE 447
wobjdata 99
work object 99
Write 449
write
error message 171
on the teach pendant 389, 391
WriteBin 453
WriteStrBin 313, 457, 459
WZBoxDef 465
WZCylDef 467
WZDisable 471
WZDOSet 473
WZEnable 477
WZFree 479
WZLimSup 481
WZSphDef 485
wzstationary 103
wztemporary 105
Z
zonedata 107
4-657
4-658