KR CS Box 2.7 MC-Basic Commands en
KR CS Box 2.7 MC-Basic Commands en
7
For KUKA.ControlStudio 2.7
Issued: 18.04.2024
MC-Basic Commands 2.7 V1
© Copyright 2024
KUKA Robotics Guangdong Co., Ltd.
No.3, Liaoxin Road
Beijiao Town, Shunde District, Foshan City
Guangdong Province
China
This documentation or excerpts therefrom may not be reproduced or disclosed to third parties without
the express permission of KUKA Robotics Guangdong Co., Ltd.
Other functions not described in this documentation may be operable in the controller. The user has no
claims to these functions, however, in the case of a replacement or service work.
We have checked the content of this documentation for conformity with the hardware and software
described. Nevertheless, discrepancies cannot be precluded, for which reason we are not able to
guarantee total conformity. The information in this documentation is checked on a regular basis,
however, and necessary corrections will be incorporated in the subsequent edition. Subject to
technical alterations without an effect on the function.
Contents
Summary of Common Commands ...................................................................................... 4
System Commands ...........................................................................................................................4
Torque Commands ............................................................................................................................5
I/O Commands ...................................................................................................................................5
Coordinate Commands .....................................................................................................................6
Program Control Commands............................................................................................................6
File Operation Commands ................................................................................................................7
Socket Communication Commands ................................................................................................7
Variable Commands ..........................................................................................................................7
Point Operation Commands .............................................................................................................8
Numeric Value Commands ...............................................................................................................8
String Commands ..............................................................................................................................9
Motion Parameters Commands ......................................................................................................10
System Built-in Application Commands .......................................................................................12
MC-Basic Commands Reference ....................................................................................... 13
A .........................................................................................................................................................16
B .........................................................................................................................................................44
C ........................................................................................................................................................52
D ........................................................................................................................................................83
E .......................................................................................................................................................105
F .......................................................................................................................................................118
G ......................................................................................................................................................124
H ......................................................................................................................................................132
I ........................................................................................................................................................135
J .......................................................................................................................................................148
L .......................................................................................................................................................168
M ......................................................................................................................................................178
N ......................................................................................................................................................193
O ......................................................................................................................................................197
P .......................................................................................................................................................206
R ......................................................................................................................................................253
S .......................................................................................................................................................266
T .......................................................................................................................................................313
U ......................................................................................................................................................341
V .......................................................................................................................................................345
W ......................................................................................................................................................380
X .......................................................................................................................................................388
Y .......................................................................................................................................................390
Z .......................................................................................................................................................392
Example............................................................................................................................. 394
Scope................................................................................................................................. 407
Common Syntax Error List .............................................................................................. 413
System Commands
CLOCK Return the number of system clock ticks
IPADDRESSMASK Set or query the IP address and subnet mask for the
Ethernet interface
JUMP Move the robot arm from the one position to another
position in an arch-shaped motion, contains three
point to point segments
JUMP3 Move the robot arm from the one position to another
position in an arch-shaped motion, contain two line
segments and one point to point segment
JUMP3CP Move the robot arm from the one position to another
position in an arch-shaped motion, contain three line
segments
Torque Commands
TORQUEADDCOMMAND Returns the axis additive torque command value
I/O Commands
Coordinate Commands
BASE Informs the used base in system
Variable Commands
COMMON_OR_DIM_SHARED_..._A Create a user exception and define a corresponding
S_NOTE_OR_ERROR_ASCII_NUM error message
BER
String Commands
ASC Return an ASCII character value from within an ASCII-
8 string, and the Unicode value from within a UTF-8
string
Command (example)
Description
The description of this Command.
NOTE
The notices of this Command
ABS
Description
This function returns the absolute value of the argument.
Syntax
Abs(<expression>)
Parameters
<expression>: any valid expression , Double , ±MaxDouble
Return Value
returns the absolute value of the argument
Limitations
Read only
Examples
?Abs(-5.67)
VaSCARA = Abs(var2)
ABSOLUTE
Description
Defines whether the commands to the element are absolute or incremental. In
absolute mode, the position commands to the element are the required
absolute position. In incremental mode, the position commands are the
required change in position. This property can be used inside a motion
command to override the permanent value.
Short form
<element>.Abs
Syntax
<element>.Absolute = <value>
?<element>.Absolute
Domain
ELEMENT
Parameters
<element>: valid motion element
A1.Absolute = False
?A1.Absolute
SCARA.Absolute = False
ACCELCMDCART
Description
Returns the commanded robot acceleration in Cartesian coordinates. This
variable is computed each sampling period from the motor command position
or according to the current interpolation type.
Syntax
<point_variable> = <robot_name>.AccelCmdCart
? <robot_name>. AccelCmdCart
Domain
ROBOT
Parameters
<robot_name>: any valid robot
Return Value
Returns the commanded robot acceleration in Cartesian coordinates
<point_variable>: Double
Limitations
Modal , Read only
Examples
P1= Scara.AccelCmdCart
? Scara. AccelCmdCart
See Also
ACCELERATIONCOMMAND, POSITIONCOMMAND
ACCELERATION
Description
This property sets the acceleration rate of the motion profile.
?<element>.Acceleration
Domain
ELEMENT
Parameters
<element>: valid motion element
where T is the sample time in seconds. For a cycle time of 2 msec, this value
is 282.74.
To set the value within a task, the element must be attached to that task
(using the ATTACH command).
Examples
Axis
A1.acceleration = 1e10
SCARA.acceleration = 1e10
ACCELERATIONCOMMAND
Description
This property returns the acceleration command generated by the motion
profiler. Type Double
Short form
<element>.AccelCmd
Syntax
?<element>.AccelerationCommand
Domain
ELEMENT
Return Value
returns the acceleration command generated by the motion profiler
Limitations
Read only
Examples
Axis
?A1.AccelCmd
Robot
?SCARA.AccelCmd
See Also
VELOCITYCOMMAND, ACCELERATION, ACCELCMDCART,
POSITIONCOMMAND
ACCELERATIONERROR
Description
This property returns the acceleration following error, which is the difference
between acceleration command and the acceleration feedback. This property
is used for query only. There is no checking against a max threshold, unlike
PE and PEmax.
The calculation uses the position error delay, such that the acceleration
feedback is subtracted from the command issued a number of cycles
previously, as defined in the POSITIONERRORDELAY property.
In a group, the acceleration error is the square root of the sum of squares of
all axes acceleration errors.
In a robot, the acceleration error is calculated using the position part (only
XYZ values, orientation part is not used) of the difference between
acceleration command and feedback of the tool-tip:
SQRT((AccelCmd{1}-AccelFbk{1})2 + (AccelCmd{2}-AccelFbk{2})2
+(AccelCmd{3}-AccelFbk{3})2)
Short form
<element>.AE
Syntax
?<element>.AccelerationError
Domain
ELEMENT
Parameters
<element>: valid motion element
Return Value
returns the acceleration following error
Limitations
Read only
Examples
Axis
?A1.AE
Robot
?SCARA.AE
See Also
ACCELERATION
ACCELERATIONFEEDBACK
Description
This property returns the actual acceleration of the element. The value is
returned as a vector of the respective element accelerations.
Short form
<element>.AccelFbk
Syntax
?<element>.AcclerationFeedback
Domain
ELEMENT
Parameters
<element>: valid motion element
Return Value
returns the actual acceleration of the element
± MaxDouble
Limitations
Read only
Examples
?A1.AccelFbk
?SCARA.AccelFbk
See Also
ACCELERATIONCOMMAND
ACCELERATIONMAX
Description
Defines the maximum allowed element acceleration.
?<element>.AccelerationMax
Domain
ELEMENT
Parameters
<element>: valid motion element
< expression >: Double, the maximum acceleration value, Greater than 0
Limitations
To set the value within a task, the element must be attached to that task
(using the ATTACH command).
Examples
Axis
A1.Amax = 20e3
Robot
SCARA.Amax = 20e3
See Also
ACCELERATION, ACCELERATIONSCALE, DECELERATIONMAX
ACCELERATIONMAXROT
Description
Defines the maximum rotation acceleration of the robot. Used for both AROT
and DROT.
The value limits only the Cartesian motion interpolations (MOVES, CIRCLE).
This parameter does not affect joint interpolated movements (MOVE).
Short form
<ROBOT>.amrot
Syntax
<ROBOT>.amrot=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot
ACCELERATIONMAXTRANS
Description
Defines the maximum translation acceleration of the robot. Used for both
ATRAN and DTRAN.
The value limits the Cartesian motion interpolations only (MOVES, CIRCLE).
This parameter does not affect joint interpolated movements (MOVE).
Short form
<ROBOT>.amtran
Syntax
<ROBOT>.amtran=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot
ACCELERATIONROT
Description
Defines the rotation acceleration of the robot. Together with ATRAN, defines
the acceleration of a Cartesian motion.
This value is used only in two motion commands: MOVES and CIRCLE. In
joint interpolated movements (MOVE), this value is ignored.
ACCELERATIONSCALE
Description
This property specifies percentage of desired acceleration and deceleration
compared to maximal possible velocity for this type of movement.
?<element>. ACCELERATIONSCALE
Domain
ELEMENT
Parameters
<element>: valid motion element
< value >: Double, the percentage of desired acceleration and deceleration
compared to maximal value, 0.1 to 100
Limitations
To set the value within a task, the element must be attached to that task
(using the ATTACH command).
Examples
Axis
A1.AScale =30
SCARA.AScale =40
ACCELERATIONTRANS
Description
Defines the translation acceleration of the robot. Together with AROT, defines
the acceleration of a Cartesian motion.
This value is used only in two motion commands: MOVES and CIRCLE. In
joint interpolated movements (MOVE), this value is ignored.
ACCEPT
Description
Binds a TCP socket to specific port and accepts a connection. Listens to a
TCP socket. The <port number> defines TCP port.
Syntax
Accept({#<listening device number>}, #<accepting device number>, <port
number>)
Parameters
<listening device number>: Long , 1 to 255, optional parameter, if not set,
listening port and communication port will use the same device number as
default.
ACOS
Description
This function returns the inverse cosine of the expression in radians.
Syntax
Acos(<expression>)
Parameters
<expression>: any valid expression , Double , -1~+1
Return Value
returns the inverse cosine of the expression in radians
Limitations
Read only
Examples
Value = Acos(0.5)
See Also
ATN, ATAN2, ASIN, COS
ARMCMD
Description
Defines the working (command) robot configuration. When the target position
is given as location variable, it is Cartesian point. This flag determines which
of the solutions will be taken for the joint coordinates of the target position.
Setting it to zero AUTO means taking the current ARMFBK for the value.
ARMFBK
Description
Returns the actual (current) robot configuration.
These two solutions represent two solutions of the robots inverse kinematics
equations, or in other words the robot configurations.
This flag indicates which of them is taken. Also, when this flag is different from
the commanded one (armcmd) no straight line motion can be made.
For example in SCARA kinematic model this flag is computed according to the
sign of position of the second joint.
0 - Undefined
1 - Lefty
2 - Righty
Limitations
Read Only, Modal Only
Examples
?scara.armfbk
See Also
ARMCMD
ARRAYSIZE
Description
Returns the size of an array’s dimension according to the dimension number
(1 for the first dimension, 2 for the second dimension, etc.).
Returns zero if the dimension number is larger than the number of dimensions
defined for the array. Also returns zero if the dimension number is zero or
negative.
Syntax
<variable> = arraysize (<array_name>, <long_expression>)
Parameters
<array_name>: any valid array variable
ASC
Description
ASC returns an ASCII character value from within an ASCII-8 string, and the
Unicode value from within a UTF-8 string.
Syntax
?ASC(<string>{,<Index>})
Parameters
<string>: String, string expression from which the character is to be picked. If the
sting is empty, the function returns the value 0
<index>: optional real value defining the position in <string> of the ASCII-8
character or UTF-8 symbol to select. Long, 0 to MaxLong
Return Value
returns an ASCII character value from within an ASCII-8 string, and the Unicode
value from within a UTF-8 string
<return value>: Double , 0 to 127 for an ASCII-8 <string>, 0 to MAXLONG for a
UTF-8 <string>
Limitations
Read only
Examples
?ASC("example",3)
?ASC("example")
?ASC(UTF8str,2)
197
See Also
INSTR, SPACE$, STRING$, UTF$, CHR$
ASIN
Description
This function returns the inverse sine of the expression in radians.
Syntax
Asin(<expression>)
Parameters
<expression>: any valid expression , Double , -1~+1
Return Value
returns the inverse sine of the expression in radians
Limitations
Read only
Examples
Value = Asin(0.5)
See Also
ACOS, ATN, ATAN2, SIN
ATAN2
Description
ATAN2 is used when it is necessary to know both the absolute value of the
angle and the quadrant. The first expression is the value on the y axis and the
second is the value on the x axis. The result gives the real angle in the range
±π radians.
Syntax
Atan2(<y_expression>, <x_expression>)
Parameters
< y_expression >: value in y axis, any valid expression , Double , ±
MaxDouble
returns 0.75×π
?Atan2(-1, 1)
returns -0.25×π
See Also
ACOS, ASIN, ATN, TAN
ATN
Description
ATN returns the inverse tangent of the expression in radians. The expression
is the ratio of the length on the y-axis to the length on the x-axis, and the result
is in the range ±π/2 radians.
Syntax
Atn(<expression>)
Parameters
<expression>: any valid expression , Double , ± MaxDouble
Return Value
returns the inverse tangent of the expression in radians
Limitations
Read only
Examples
Program
Dim x as double
Dim y as double
x=1
y=2
Theta=ATN(y/x)
End Program
See Also
ACOS, ASIN, ATAN2, TAN
ATTACH
Description
Attaches a task to a motion element (group or axis). Attachment is necessary
to perform certain operations (such as MOVE) on a motion element from
within a task. The attachment prevents other tasks from accessing the
element.
A motion element may be moved from the terminal. In this case, an implicit
attachment is performed.
Syntax
Attach <element>
Parameters
< element>: Defined motion element
Limitations
A motion element that has been attached by a task may not be attached by
another task.
Examples
Attach SCARA
See Also
DETACH, ATTACHEDTO, ATTACHTO, ATTACHTO$, DETACHFROM,
DETACHFROM$
ATTACHEDTO
Description
Returns name of an attached task to the given element.
NOTE
If a group is not attached but the axes belonging to it are, the list of active
axes and their tasks is returned. If the element is not attached to any program,
an empty string is returned.
Syntax
?<element>.AttachedTo
Domain
ELEMENT
Parameters
<element>: valid motion element
Return Value
Returns name of an attached task to the given element
?A1.AttachedTo
Robot
?SCARA.AttachedTo
See Also
ATTACH, DETACH, ATTACHTO$, DETACHFROM, DETACHFROM$
ATTACHTO
Description
Attach the given element to the given task. Same functionality as ATTACH but
from external context.
Syntax
AttachTo <element> File = <task>
Parameters
<task>: File specification, including file name and extension.
ATTACHTO$
Description
Attach the given element to the given task. Same functionality as ATTACH but
from external context.
Syntax
AttachTo$ <element name> File = <task name>
Parameters
<task name >: String containing File specification, including file name and
extension.
AVERAGELOAD
Description
This query returns the average real time load on the CPU measured during a
0.5 second interval, expressed in percent.
Short form
Sys.ALoad
System.ALoad
Syntax
?Sys.AverageLoad
?System.AverageLoad
Domain
SYSTEM
Return Value
Returns the average real time load on the CPU measured during a 0.5 second
interval
AXISLIST
Description
This query returns a comma-separated list of the names of the axes defined in
the system. If Optional String is given and wildcards are used, the query
returns the appropriate axes.
Syntax
?AxisList {<Optional string>}
Parameters
<Optional string>: String .
Return Value
returns a comma-separated list of the names of the axes defined in the
system
Examples
?AxisList
?axislist a*
See Also
PLSLIST, GROUPLIST, TASKLIST, VARLIST, VARLIST$
BASE
Description
Base is a Robot property which informs the system to use the specified
location as the base transformation.
It defines the position and orientation of the arm in the cell according to the
WORLD reference.
?Base
Domain
ROBOT
Parameters
<robot location point> : Location
Return Value
returns the base location in world coordinate
?Scara.UserFrame:WorkPiece:Base:Tool
BIN$
Description
BIN$ returns the string representation of a number in a binary format.
Syntax
BIN$(<number>)
Parameters
<number>: Long , MinLong to MaxLong
Return Value
returns the string representation of a number in a binary format
?myStr
BLENDDISTANCE
Description
Defines the distance of the movement’s length that will be blended with the
next movement.
< value >: Double, the path length of motion to blend with next motion, 0 to
Maxdouble, unit is millimeter
Limitations
Nodal-only
Examples
Axis
BLENDENDPROTECTED
Description
Set the path length of motion that will be guaranteed without blending,
measured from end point. The protected part of current motion will be
executed completely separated from the previous or next motions.
< value >: Double, path length of motion that will be guaranteed without
blending, measured from end point, 0 to Max double, unit is millimeter
Limitations
Nodal-only
Examples
Axis
Move A1 10 BlendEndProtected=50
Robot
BLENDMETHOD
Description
Selects which blending method (algorithm) to be used.
0 – no blending
1 – SP (superposition)
2 – AI (advance interpolation)
The superposition blending allows user to blend motions at any point of time
starting from middle point of the movement up to the target.
<element>.BlendMethod= <value>
Domain
ELEMENT
Parameters
<element>: valid motion element
If other motion commands are entered (CIRCLE) an error will be returned and
the command will be not executed.
A1.BlendMethod = 1
?A1.BlendMethod
Robot
SCARA. BlendMethod = 1
?SCARA.BlendMethod
See Also
BLENDSTARTPROTECTED, BLENDENDPROTECTED,
BLENDPERCENTAGE, MOVE, CIRCLE, MOVES, BLENDDISTANCE,
DOUBLEMODEPERCENTAGE, BLENDORIENTATION
BLENDORIENTATION
Description
Set the distance of a movement in terms of orientation that will be blended
with the next movement.
< value >: Double, the robot orientation during the motion blending, 0 to
Maxdouble, unit is degree
Limitations
Nodal-only
Examples
Axis
BLENDPERCENTAGE
Description
Set the Percentage of the movement’s length that will be blended with the
next movement.
0% – no blending at all
BLENDSTARTPROTECTED
Description
Set the path length of motion that will be guaranteed without blending,
measured from start point. The protected part of current motion will be
executed completely separated from the previous or next motions.
< value >: Double, path length of motion that will be guaranteed without
blending, measured from start point, 0 to Max double, unit is millimeter
Limitations
Nodal-only
Examples
Axis
Move A1 10 BlendStartProtected=1000
Robot
CALL
Description
The CALL command transfers execution of the task to the subprogram being
referenced.
Syntax
Call <subprogram name>
Parameters
< subprogram name >: sub
Examples
Program
End Program
See Also
SUB_..._END_SUB, PROGRAM_..._END_PROGRAM
CASTJOINT
Description
Creates and returns a generic joint type of point, using the robot type given by
the second, long-type argument, while the coordinate values are taken from
the first argument.
If the first argument is scalar, the resulting point will be composed of identical
coordinates. Using an array as the first argument will result in a point
composed of the first "number-of-coordinates" (determined by the robot type)
array elements.
Syntax
<joint_variable> = castjoint (<long_scalar_expression>, <long_expression>)
See Point_Type_List
? CASTJOINT(ArrayOf4Doubles, TYPE_XYZR)
See Also
CASTPOINT, CASTLOCATION
CASTLOCATION
Description
Creates and returns a generic location type of point, using the robot type given
by the second, long-type argument, while coordinate values are taken from
the first argument.
If the first argument is scalar, the resulting point will be composed of identical
coordinates. Using an array as the first argument will result in a point
composed of the first "number-of-coordinates" (determined by the robot type)
array elements.
Syntax
<location_variable> = castlocation (<long_scalar_expression>,
<long_expression>)
See Point_Type_List
? CASTLOCATION(ArrayOf6Longs, TYPE_XYZR)
See Also
CASTPOINT, CASTJOINT
CASTPOINT
Description
Creates and returns a generic point using the robot type given by the second,
long-type argument, while the point type (i.e., joint or location) and coordinate
values are taken from the first, list-of-coordinates argument.
Syntax
<point_variable> = castpoint (<list_of_coordinates>, <long_expression>)
Parameters
<list_of_coordinates >:Joint or Location, specify the coordinate values
See Point_Type_List
Return Value
Returns a generic point
Limitations
The robot type given in the second argument must match the number of
coordinates of the list-of-coordinates argument.
Examples
GenJoint = CASTPOINT({0.0, 10.0, 20.0}, TYPE_XYZ)
CHR$
Description
This function returns a one-character string corresponding to a given ASCII
value.
Syntax
CHR$(<number>)
Parameters
<number>: Long, 0 to 255
Return Value
returns a one-character string corresponding to a given ASCII value
CIRCLE
Description
The CIRCLE command issues a circular(arc) path trajectory for the specified
group/robot in Cartesian space. For robot models the CIRCLE command
issues a circular path in Cartesian space (XYZ). Orientation angles are
interpolated proportionally to the circle angle.
The CIRCLE command has two formats. One specifies the group name, the
angle and the circle center. This format enables multi-turn circular motion. The
other is defined by a circle point and the final point of the arc.
Syntax
Circle {ROBOT} Angle CircleCenter {CirclePlane =<value> } { VTRAN
=<value>} { ATRAN =<value>}{ JTRAN =<value>}{ VROT =<value>}{ AROT
=<value>}{ JROT =<value>} {Blend=<value>}
{BlendDistance=<value>}{BlendOrientation=<value>}
{Blendendprotected=<value>} {Blendstartprotected=<value>}
{AScale=<value>} {WithPls=<value>} {Until <signalName>=<value>}
{Abs=<value>}
0 (XY)
1 (XZ)
2 (YZ)
For example, when this parameter is set to 100, the center point of the entire
trajectory becomes both the entry and exit point, which indicates that the
trajectory consists of only one point while the rest is used for smoothing.
When the parameter is set to 25, the entry point is located at 1/8 of the
trajectory length from the beginning, and the exit point is located at 1/8 of the
trajectory length from the end. If this parameter is not set, the default value is
0.
<BlendDistance >: blend distance
In every Moves statement, Blend parameter can be defined by BlendDistance.
For example, when the parameter is BlendDistance=100, it indicates that the
smoothing length of current command and the next command is 100mm. the
smooth length will not exceed the length of the shorter half of moving arc of
the two commands. If not set, the default value is 0.
<BlendOrientation>: blend orientation length
In every Moves statement, Blend parameter can be defined by
BlendOrientation.
For example, if the orientation rotation of current motion command is 90°,
BlendOrientation=20, it indicates that when the orientation rotation is 70°, the
remaining 20°will blend with that of the next motion command. Defined
maximum value will not exceed the half of total rotation degree, that is, 45°.
If Blendstartprotected set value is larger than 0, then this trajectory will not
blend with last trajectory.
If Blendendprotected is set larger than 0, than this trajectory will not blend with
last trajectory.
<Armcmd>:robot armcmd
This flag defines the method to reach target position through joint frame. 0:
automatic, 1: left armcmd, 2: right armcmd.
When executing this motion command, the robot will trigger IO signal after
reached designated position. Each position trigger should be created and
configured in project setting. When programming, this parameter can be
directly linked to the name of a configured position trigger.
When configured signal value equals to expected value, the executing motion
will be stopped, and the next motion continues. Until command should be
added at the end of motion command, and it is an optional property for motion
<Abs>: Absolute. This property is used to define whether input target point is
absolute position or relative position.
When executing motion command, this property should smaller than or equals
to system maximum translation velocity. If the property is larger, the system
maximum translation velocity should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum translation acceleration. If the property is larger, the
system maximum translation acceleration should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum rotation velocity. If the property is larger, the system
maximum rotation velocity should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum rotation acceleration. If the property is larger, the system
maximum rotation acceleration should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum rotation deceleration. If the property is larger, the system
maximum rotation deceleration should be used to execute motion.
Limitations
The element could not be moved if the element is attached to other tasks.
Motion will report error and stop when passing singular point.
For Control Studio higher than version 2.5, all motion commands are equipped
with until function (except SMOVE).
Examples
Circle SCARA Angle = 90 CircleCenter = {10,10,0,0} VTran = 500 ‘ enter joint
coordinate manually, target point is circle center, central angle 90°
Circle SCARA CirclePoint = {600,0,-100,0} TargetPoint = {600,200,-100,0}
VTran = 500 Until signal1 = Off ‘ enter joint coordinate supplement point and
target point manually
Note: the format of input target point does not affect other parameter settings,
and different parameters are independent and do not influence each other. In
addition, if you expect to stuck program pointer to interrupt command pre-
read, add WaitForMotion at behind.
Program
Attach
Move PL3
Detach
end program
See Also
BLENDPERCENTAGE, MOVE, MOVES, ACCELERATIONMAXROT,
ACCELERATIONMAXTRANS, ACCELERATIONROT,
ACCELERATIONTRANS, BLENDMETHOD, DECELERATIONROT,
DECELERATIONTRANS, JERKMAXROT, JERKMAXTRANS, JERKROT,
JERKTRANS, POSITIONFINAL, VELOCITYFINALROT,
VELOCITYFINALTRANS, VELOCITYMAXROT, VELOCITYMAXTRANS,
VELOCITYROT, VELOCITYROTVALUE, VELOCITYTRANS,
VELOCITYTRANSVALUE, VSMODE
CLEARMSG
Description
Clear all the message logs.
Syntax
ClearMsg()
Examples
Program
?33
ClearMsg()
?55
End Program
55
See Also
PRINT
CLOCK
Description
Returns the number of system clock ticks. This is the clock run by the
operating system. One clock tick corresponds to 1 millisecond.
Syntax
?Sys.Clock
?System.Clock
Domain
SYSTEM
Return Value
Returns the number of system clock ticks
CLOSE
Description
Releases a file handle and closes the file.
COMMON_OR_DIM_SHARED_OR_DIM_..._AS_LONG
Description
These commands are used to define user variables as LONG type. Long data
is an integer number and it can also be used as a Boolean type by assign
True or False.
Task variables are defined through Dim Shared in user tasks (before program
block). These variables have task-wide visibility. All function and subroutine
blocks in this task may use the variables.
Local variables are defined through Dim command in user tasks within
program, subroutine and function blocks. These variables may have the same
name in different subroutine, function and program blocks. Other blocks can
not use the variables in local blocks.
User constants must be given a value during declaration. User constants are
writable only during declaration statement. Afterwards, they become read
only. User constants cannot be passed “by-reference” to subroutines and
functions. They must always be passed “by value”.
Examples
Common Shared CLConst as Const Long = 100
Program
End Program
COMMON_OR_DIM_SHARED_OR_DIM_..._AS_DOUBLE
Description
These commands are used to define user variables as DOUBLE type. Double
data is a double-precision floating-point number.
Task constants are defined through Dim Shared in user tasks (before program
block).
Local constants are defined through Dim command in user tasks within
program, subroutine and function blocks.
Syntax
Common Shared | Dim Shared | Dim <name> As {Const} Double =
<const_value>
Parameters
{ Const } : Optional Keyword to set variable as a constant variable
User constants must be given a value during declaration. User constants are
writable only during declaration statement. Afterwards, they become read
only. User constants cannot be passed “by-reference” to subroutines and
functions. They must always be passed “by value”.
Examples
Common Shared CDConst as Const Double = 1.2345
Program
End Program
COMMON_OR_DIM_SHARED_OR_DIM_..._AS_STRING
Description
These commands are used to define user variables as STRING type.
Task variables are defined through Dim Shared in user tasks (before program
block). These variables have task-wide visibility. All function and subroutine
blocks in this task may use the variables.
Local variables are defined through Dim command in user tasks within
program, subroutine and function blocks. These variables may have the same
name in different subroutine, function and program blocks. Other blocks can
not use the variables in local blocks.
User constants must be given a value during declaration. User constants are
writable only during declaration statement. Afterwards, they become read
only. User constants cannot be passed “by-reference” to subroutines and
functions. They must always be passed “by value”.
Examples
Common Shared CDConst as Const String = “aaaaaa”
Program
End Program
See Also
UTF$, CHR$
COMMON_OR_DIM_SHARED_OR_DIM_..._AS_JOINT_OF
Description
These commands are used to define user variables as JOINT type. Joint data
is a double data vector to represent a location in joint coordinate.
Task variables are defined through Dim Shared in user tasks (before program
block). These variables have task-wide visibility. All function and subroutine
blocks in this task may use the variables.
Local variables are defined through Dim command in user tasks within
program, subroutine and function blocks. These variables may have the same
name in different subroutine, function and program blocks. Other blocks can
not use the variables in local blocks.
User constants must be given a value during declaration. User constants are
writable only during declaration statement. Afterwards, they become read
only. User constants cannot be passed “by-reference” to subroutines and
functions. They must always be passed “by value”.
Examples
Common Shared CJConst as Const Joint of XYZR = {0,0,0,0}
Program
End Program
COMMON_OR_DIM_SHARED_OR_DIM_..._AS_LOCATION_OF
Description
These commands are used to define user variables as LOCATION type.
Location data is a double data vector to represent a location in Cartesian
coordinate.
Task variables are defined through Dim Shared in user tasks (before program
block). These variables have task-wide visibility. All function and subroutine
blocks in this task may use the variables.
Local variables are defined through Dim command in user tasks within
program, subroutine and function blocks. These variables may have the same
name in different subroutine, function and program blocks. Other blocks can
not use the variables in local blocks.
User constants must be given a value during declaration. User constants are
writable only during declaration statement. Afterwards, they become read
only. User constants cannot be passed “by-reference” to subroutines and
functions. They must always be passed “by value”.
Examples
Common Shared CLConst as Const Location of XYZR = #{0,0,0,0}
Program
End Program
COMMON_OR_DIM_SHARED_..._AS_NOTE_OR_ERROR_ASCII_NU
MBER
Description
Creates a user exception and defines a corresponding error message.
COMMON_SHARED_..._AS_SEMAPHORE
Description
Defines new semaphore variables in the system. There are only two function
for accessing this variable type: SEMTAKE and SEMGIVE. No other
operations (e.g., printing, arguments) are allowed with this data type.
Syntax
COMMON SHARED < variable > AS SEMAPHORE
Parameters
< variable >: variable name user specify
Examples
common shared sem as semaphore
?semtake(sem)
semgive(sem)
See Also
SEMAPHOREGIVE, SEMAPHORETAKE, DELETESEM
COMMON_SHARED_OR_DIM_SHARED_OR_DIM_..._AS_TYPE
Description
Because a structure is a new data type, it must first be defined in configuration
file. Only then the name of the new data type structure can be used to declare
a structure variable.
Structure variables can be defined in all scopes, i.e., either in configuration file
and from terminal (global variables), or within tasks, before (static variables)
and within the Program block (local variables). Structures can also be defined
as parameters of subroutines and functions, as well as returned-values of
functions. A structure variable may be a scalar or an array. An array may have
up to 10 dimensions.
Syntax
for assigning a single element of a structure:
Type X
L1 as Long
Length as Long
End Type
Dim shared S1 as X
Program
S1->Length =2
?S1->Length
74 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024
MC-Basic Commands 2.7
End program
See Also
STRUCTURE_TYPE_DEFINITION
CONNECT
Description
Requests a TCP connection from the remote host.
Syntax
Connect(#<device number>, <ip address>,<port number>{,<timeout>})
Parameters
<device number>: Long, 1 to 255
<timeout>: Long
Limitations
Task only
Examples
OpenSocket Options=1 as #200
Connect(#200,"127.0.0.1",6002)
close #200
See Also
CLOSE, OPENSOCKET, ACCEPT, PING, IPADDRESSMASK
CONTINUEPATH
Description
This command can be used to resume the motion command stored in
STOPPATH. The stored motion command will start executing after the current
motion command is completed.
COLLISIONDETECT
Description
This command can be used to open/close collision detect function.
NOTE
CollisionDetect can be set for single axis or for axes group, query is only
appliable to single axis instead of axes group.
Syntax
<robot | axis>.CollisionDetect = on/off
? <axis>.CollisionDetect
Parameters
<robot | axis>: Any valid robot or axis
Limitations
Read/write
Examples
SCARA. CollisionDetect = on
J1. CollisionDetect = on
?J1. CollisionDetect
See Also
RESETPEAKVALUE, SETVELERRTHRESHOLD, DRIVETORQUELIMIT,
PEAKTORQUE, PEAKVELERR, VELERRTHRESHOLD,
SETDRIVETORQUELIMIT, SETDEFVELERRTHRESHOLD
COS
Description
This function returns the cosine of the expression in radians.
Syntax
Cos(<expression>)
Parameters
<expression>: any valid expression , Double
± 9.223372036853900e+18
Return Value
returns the cosine of the expression in radians
Limitations
Write only
Examples
?Cos(3.14159/2)
VaSCARA = Cos(3.14159)
See Also
ACOS, SIN, TAN
CUMULATIVEPOSITION
Description
This property returns the cumulative change in the position value of an axis, in
absolute values.
Syntax
<axis>.CumulativePosition = <value>
?<axis>.CumulativePosition
Domain
AXIS
Parameters
<axis> : any valid axis
?A1.CumulativePosition
CURRENTABSOLUTE
Description
Returns the absolute property of the currently executing motion
Short form
<element>.CAbs
Syntax
? <element>.CurrentAbsolute
Domain
ELEMENT
Parameters
<element>: valid motion element
Return Value
Returns the absolute property of the currently executing motion
?A1.CAb
Robot
?SCARA.CAbs
See Also
ABSOLUTE
CURRENTTIME
Description
Returns the total time of the currently executing motion. Values:
-1 = No motion active
?A1.currenttime
Robot
?SCARA.currenttime
DECELERATION
Description
This property sets the deceleration rate of the motion profile.
?<element>.Deceleration
Domain
ELEMENT
Parameters
<element>: valid motion element
< value >: Double, the deceleration rate of the motion profile value, Greater
than 0
Limitations
The ratio between Jerk and Deceleration is limited by the following relation:
To set the value within a task, the element must be attached to that task
(using the ATTACH command).
Examples
Axis
A1.deceleration = 1e10
SCARA.deceleration = 1e10
DECELERATIONMAX
Description
Defines the maximum allowed element deceleration. If you specify a
deceleration rate greater than DECELERATIONMAX, the system sets the
value to DECELERATIONMAX and notifies you.
Short form
<element>.DMax
Syntax
<element>.DecelerationMax = <expression>
?<element>.DecelerationMax
Domain
ELEMENT
Parameters
<element>: valid motion element
< value >: Double, the maximum allowed element deceleration value, Greater
than 0
Limitations
To set the value within a task, the axis must be attached to that task (using the
ATTACH command).
Examples
Axis
A1.Dmax = 20e3
Robot
SCARA.Dmax = 20e3
See Also
ACCELERATIONMAX, DECELERATION
DECELERATIONROT
Description
Defines the rotation deceleration of the robot. Together with DTRAN, defines
the deceleration of a Cartesian motion.
This value is used only in two motion commands: MOVES and CIRCLE. In
joint interpolated movements (MOVE), this value is ignored. The group must
be defined with a robot model (model !=1).
DECELERATIONTRANS
Description
Defines the translation deceleration of the robot. Together with DROT, defines
the decleration of a Cartesian motion.
This value is used only in two motion commands: MOVES and CIRCLE. In
joint interpolated movements (MOVE), this value is ignored. The group must
be defined with a robot model (model !=1).
DELETE
Description
This command is used to delete a file from the Flash Disk.
Syntax
Delete <filename>
Parameters
<filename>: File specification, name of a file that exists on the disk
Limitations
Write only.Only files that are not loaded into RAM can be deleted.
DELETE$
Description
This command is used to delete a file from the Flash Disk.
Syntax
Delete <filename string>
Parameters
<filename>: string, name of a file that exists on the disk
Limitations
Write only. Only files that are not loaded into RAM can be deleted.
Or
Delete$ FName
See Also
DELETE
DELETESEM
Description
Deletes semaphore variable previously defined in the system
Short form
dsem
Syntax
dsem <semaphore name>
Parameters
< semaphore name >: semaphore variable
Examples
common shared sem as semaphore
deletesem sem
See Also
COMMON_SHARED_..._AS_SEMAPHORE
DEPPOINT
Description
The endpoint position of the STOPPATH instruction will be stored in
DEPPOINT. This is a cartesian point without any motion frame with arm
configuration.
? <element_name>.deppoint
Domain
ELEMENT
Parameters
< elementName >: valid motion element
Return Value
Return the cartesian value of deppoint
P1= A1.Deppoint
?A1.Deppoint
Robot
P1= Scara.Deppoint
?Scara.Deppoint
DEST
Description
Retrieves the current destination point of the movement in user units. If the
element finished its movement, it is equal to PCMD. If the element was
stopped either by the STOP command, the destination of the stopped
(canceled) movement is returned.
Syntax
<point_variable> = <elementName>.dest
? <element_name>.dest
Domain
ELEMENT
Parameters
< elementName >: valid motion element
Return Value
Returns the current destination point of the movement in user units
P1= A1.Dest
?A1.Dest
Robot
P1= Scara.Dest
?Scara.Dest
See Also
MOVES
DETACH
Description
This command is used to detach a task from a motion element, freeing it for
use by another task. Motion element may be axis or group.
NOTE
If the motion element is moving, DETACH waits until the motion of the
element ends. Therefore, the user task will be in suspended state until the
current movement is completed.
DETACHFROM
Description
Detach given element from the given task. Same functionality as DETACH but
from external context.
Syntax
DetachFrom <element> File = <task>
Parameters
<task>: File specification, including file name and extension.
DETACHFROM$
Description
Detach given element from the given task. Same functionality as DETACH but
from external context.
Syntax
DetachFrom$ <element name> File = "<task name>"
Parameters
<task name>: String containing file specification, including file name and
extension.
DISABLETIMEOUT
Description
Maximum time the System waits from disabling the drive until the drive
becomes disabled.
If the drive fails to disable after this time, the System returns error 12008 “Axis
cannot be disabled.”
Where:
A1.DisableTimeout = 10000
DISTL
Description
Calculates the distance (in length units) between two points
Syntax
<variable> = distl (<location_expression>, <location_expression>)
Parameters
<location_expression >: Joint or Location
Return Value
returns the distance (in length units) between two points
<variable>: Double
Limitations
Both location parameters must have the same number of coordinates
Examples
? DistL (#{1,2,3}, #{4,5,6})
DISTR
Description
Calculates the distance (in angle units) between two points
Syntax
<variable> = distr (<location_expression>, <location_expression>)
Parameters
<location_expression >: Joint or Location
Return Value
returns the distance (in angle units) between two points
<variable>: Double
Limitations
Both location parameters must have the same number of coordinates
Examples
? DistR (#{1,2,3,1}, #{4,5,6,3})
DO_..._LOOP
Description
The DO…LOOP is used to execute a section of code an indefinite number of
times. The statements are executed at least once, since the loop termination
condition is evaluated at the end of the loop.
<code to execute>
Program
I=0
Do
I=I+1
Print I
End Program
Do … Loop While
Program
Do
I=I+1
Print I
End Program
See Also
WHILE_..._END_WHILE, FOR_..._NEXT, PROGRAM_..._END_PROGRAM
DOUBLEMODE
Description
Queries the DOUBLEMODE interpolation status during blending of two
movements. Possible values are:
1 – blending is in progress
Short form
<element>.DMode
Syntax
?<element>.DoubleMode
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
Returns the DOUBLEMODE interpolation status during blending of two
movements
?A1.DoubleMode
Robot
?SCARA.DoubleMode
See Also
DOUBLEMODEPERCENTAGE
DOUBLEMODEPERCENTAGE
Description
Queries the actual percentage of the blending during Double Mode.
0 - beginning of blending
?A1.DoubleModePercentage
Robot
?SCARA.DoubleModePercentage
See Also
BLENDMETHOD, DOUBLEMODE
DOUBLETOLONG
Description
Converts a double data type to a long data type and support simultaneous
conversion of multiple data types.
Syntax
DoubleToLong(< dArrayData[*] >, < lArrayData[*] >,< lNum >, < lEndian >)
Parameters
< lArrayData[*] >: array of long
dArrayData[1] = 105.56
DRIVE_ENABLE_I2T_PROTECTION
Description
Open I2T protection.
Notes:
This command only applys to KUKA.ControlStudio higher than version
2.7.1.
Syntax
Call Drive_Enable_I2t_Protection
Return
firmware version not match.
DRIVE_DISABLE_I2T_PROTECTION
Description
Close I2T protection.
Notes:
This command only applys to KUKA.ControlStudio higher than version
2.7.1.
Syntax
Call Drive_Disable_I2t_Protection
Return
DRIVETORQUELIMIT
Description
Set maximum drive torque value of singular axis.
Syntax
<element>.DriveTorqueLimit = 50
? <element>.DriveTorqueLimit
Domain
ELEMENT
Parameters
Set maximum drive torque percentage.
? J1. DriveTorqueLimit
dArrayData[1] = 105.56
DoubleToLong(dArrayData, lArrayData,1,0)
?lArrayData[2] =>15626
?lArrayData[3] =>55139
?lArrayData[4] =>23104
See Also
RESETPEAKVALUE, SETVELERRTHRESHOLD, COLLISIONDETECT,
PEAKTORQUE, PEAKVELERR, VELERRTHRESHOLD,
SETDRIVETORQUELIMIT
ELEMENTID
Description
For axis - Returns unique ID of the axis.
<return value>:Long
Axis: 1 to 64.
Group: 65 to 96.
Limitations
Modal Only, Read only
Examples
Axis
?A1.ElementID
Robot
?SCARA.ElementID
See Also
ELEMENTSIZE, ELEMENTNAME, ELEMENTSTATUS
ELEMENTNAME
Description
Returns the element name in a string.
Syntax
?<element>.ElementName
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
Returns the element name in a string
<return value>:String
Limitations
Modal Only, Read only
Examples
Axis
s = A1.ElementName
Robot
t= SCARA.ElementName
See Also
ELEMENTID, ELEMENTSIZE
ELEMENTSIZE
Description
Returns how many axes are belonging to this element
Syntax
?<element>.ElementSize
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
Returns how many axes are belonging to this element
<return value>:Long
Others: 1 to 64
Limitations
Modal Only, Read only
Examples
Axis
n = A1.ElementSize
Robot
m = SCARA.ElementSize
See Also
ELEMENTID, ELEMENTNAME, ELEMENTSTATUS
ELEMENTSTATUS
Description
Returns the line number of the program from where the currently executing
motion was invoked. Due to the buffering mechanism of motion commands,
program execution can continue far from the line where motion was given.
Therefore when querying the task status, the line number returned has no
relation to the line number from where the currently executing motion was
issued. In order to get the line number from where the currently executing
motion was commanded this command should be used.
Main Program line : <line number> File : <program file name>, Library line :
<line number of the library> File : <library file name>
Syntax
? <element>.ElementStatus
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
Returns the line number of the program from where the currently executing
motion was invoked
?A1.ElementStatus
?SCARA.ElementStatus
ERROR
Description
Queries the last system error message. If the keyword is prefixed with a task
name, the error message corresponding to the last error in that task is
returned
NOTE
This command returns an error message that includes the error number.
The ?ERRORNUMBER query returns only the number of the error.
Syntax
?Error
?<task>.Error
Parameters
< task >: task name
Return Value
returns an error message that includes the error number
?MyTask.prg.error
See Also
TASKERROR
ERRORHANDLERMODE
Description
ErrorHandlerMode defines the effect of the errors , generated directly by an
action taken by the executing task .
When Sys.ErrorHandlerMode = TRUE (Default value). Stop all motion, idle all
tasks that have attached elements, set Sys.MotionFlag to OFF.
?System. ErrorHandlerMode
Domain
SYSTEM
Parameters
<value>: Long, 0 or 1
0 = FALSE
1 = TRUE
Examples
?Sys.ErrorHandlerMode
Sys.ErrorHandlerMode = 1
ERRORNUMBER
Description
Queries the number of the last system error.
Syntax
?Sys.ErrorNumber
?System.ErrorNumber
Domain
SYSTEM
Return Value
returns the number of the last system error
Limitations
Read only. Only returns the error number.
Examples
?System.ErrorNumber
See Also
SYSTEM.ERROR
EVENT
Description
This command defines an event with specific conditions and related
subprograms. The command can also define the priority. When the conditions
are met, the related subprograms will be executed.
An event with low priority will be interrupted, then the event with high priority
will start its execution.
Syntax
Event <event> <condition> {Priority = <prio>} Do <sub program>
Parameters
<event>: event name
<sub program>: subprogram that will be executed when the condition is met.
Limitations
The priority of the event must be higher than the priority of the task which is
defined.
The priority of UPG task is 15. The priority of event defined in UPG can only
be set from 1 to 14.
The priority of BKG task is 15. The priority of event defined in BKG can only
be set from 1 to 14.
Examples
Event EV1 VAR1 = 1 Priority = 1 Do MYSUB
EVENTDELETE
Description
This command deletes the specified event. The event does not respond to the
specified condition until the task is executed again and the event is enabled.
Syntax
EventDelete <event>
Parameters
< event >: event name
Limitations
Write only
Examples
EventDelete EV1
See Also
EVENTLIST, EVENTOFF, EVENTON
EVENTLIST
Description
List of the names of the existing events and their states. The information is
returned in the following format:
If the event is enabled, the value of State is 1. If the condition has been
detected (i.e., the event has been triggered), the value of Edge is 1. If the
event action code is running, the value of State is set to Running.
If the event is enabled, the Status is On. If the condition has been detected
(the event has been triggered), the value of Edge is Triggered (1). If the parent
task or one of its events is running, Action is set to Run.
?<task>.EventList
Parameters
< task >: task name
Return Value
returns the List of the names of the existing events and their states
Print as following:
EventName=EV1,State=Running,Priority=1,Owner=EVENTAPP.UPG,Edge=T
riggered,Scan=1,Status=OFF
See Also
EVENTOFF, EVENTON, ONEVENT, EVENTDELETE
EVENTOFF
Description
This command disables the specified event. An event that is disabled does not
respond when the event condition is met.
Syntax
Eventoff <event>
Parameters
< event >: event name
Limitations
Write only
Examples
Eventoff EV1
See Also
EVENTLIST, EVENTON, ONEVENT, EVENTDELETE
EVENTON
Description
This command enables a specified event. An event must be enabled before
the specified condition is checked.
Syntax
Eventon <event>
Parameters
< event >: event name
Limitations
Write only
Examples
Eventon EV1
See Also
EVENTLIST, EVENTOFF, ONEVENT, EVENTDELETE
EXP
Description
The exponent math function that calculates the exponential function.(e raised
to the power of a numeric expression).
Syntax
Exp(<expression>)
Parameters
<expression>: Double
Return Value
<Return value>: Double, ± 709.7827 (Log(MaxDouble) )
Limitations
Read only
Examples
?Exp(1)
VaSCARA = Exp(Var2*Var3)
See Also
LOG
FILESIZE
Description
Returns the size of a file in bytes.
Syntax
FileSize <file_name>
Parameters
< file_name>: file name
Return Value
Returns the size of a file in bytes
FILESIZE$
Description
Returns the size of a file in bytes.
Syntax
FileSize$ (<file_name>)
Parameters
< file_name>: string the path of the file
Return Value
Returns the size of a file in bytes
FLOATTOLONG
Description
Convert a type from float to long and support simultaneous conversion of
multiple data types.
Syntax
FloatToLong(< dArrayData[*] >, < lArrayData[*] >,< lNum >, < lEndian >)
Parameters
< lArrayData[*] >: array of long
< lEndian >: data format, 0- small endian (DCBA), 1-big endian(ABCD)
Examples
Dim lArrayData[4] as long
dArrayData[1] = 45.7
FloatToLong(dArrayData, lArrayData,1,0)
FOR_..._NEXT
Description
The FOR...NEXT loop repeats the statements enclosed in the loop a number
of times, counting from a starting value to an ending value by incrementing or
decrementing a loop counter.
The loop continues to execute as long as the loop counter has not reached
the ending value.
The counter variable initially has the value of the start value expression. The
STEP value may be a floating point or integer value. The default STEP value
is 1.
After each repetition of the loop, the value of the counter is incremented or
decremented by the value of the step size, and compared with the end value.
At this point the loop is complete if:
- the loop is counting up and the counter is greater than the end value, or
- the loop is counting down and the counter is less that the end value.
The start value, end value, and step size may be expressions. The end value
and the step size expressions are evaluated each time they are referenced in
the loop.
The counter argument to the NEXT keyword is optional. However, when FOR
loops are nested, the counter for a nested loop must appear before the
counter for any enclosing loop.
NOTE
Do not use a loop structure that does not contain any statements or only
contains simple operation statements. If you must use it this way, please
insert at least one SLEEP 1 instruction to avoid CPU overload and system
exceptions.
Syntax
FOR <counter> = <start value> TO <end value> {STEP <stepsize>}
{<loopstatements>}
NEXT {<counter>}
Parameters
<counter>: variable as counter
<end value>: The loop is complete when the counter value exceeds this value.
For positive <stepsize>, this occurs when <counter> is greater than this value.
For negative <stepsize>, this occurs when <counter> is less than this value
Example
Program
dim I as long
For I = 1 to 5
Print I 'Prints 2, 3, 4, 5
Next I
Next I
See Also
DO_..._LOOP, WHILE_..._END_WHILE, PROGRAM_..._END_PROGRAM
FUNCTION_..._END_FUNCTION
Description
The FUNCTION and END FUNCTION keywords are used to delimit a function
within a task. The function(s) must appear after the main section of the code
(delimited by PROGRAM….END PROGRAM).
{function code}
END Function
Parameters
{Public}: Optional keyword that specifies the scope of function(s)
?add1(5)
End Program
Add1=a+1
GETIO
Description
This command is used to read current value of signal
Syntax
? <signal_name>
Parameters
< singal_name >: name of signals
Return Value
Returns the signal value
Examples
?signal1
See Also
PULSE, SETIO
GETARM
Description
This command is used to get armcmd of specified point location
Syntax
? GetArm(< Location >)
Parameters
< Location >: Cartesian point
Return Value
Return the current queried armcmd of Cartesian point, 0-Auto, 1- left arm, 2-
right arm
Examples
Common shared P1 as location of xyzr
P1 = #{1,2,3,4;2}
?GetArm(P1)
See Also
SETARM , ARMFBK
GOHOME
Description
This command is used to move group to the HOME position.
GOTO
Description
The GOTO statement is used to perform an unconditional branch to another
section of code. It references a label that must appear in the code.
Labels are written as a name followed by a colon. Labels must appear on their
own lines and they may be commented.
You can only branch within a program, event, function, or subroutine. The
GOTO statement and the label must be within the same program block.
<program label>:
Parameters
<program label>: program label.
Limitations
Write only.
A GOTO branch must reference a label within the same program block
(PROGRAM…END PROGRAM, SUB…END SUB, FUNCTION…END
FUNCTION, and ONEVENT…END ONEVENT).
Examples
Program
<code>
GOTO Reference1
Reference1:
End Program
GOTOLIMIT
Description
Flag causing the given straight-line motion to extend till reaching one of the
position limits of t the robot (PMIN/PMAX, XMIN/XMAX, ....).
The given target (in MOVES line) point is used for direction computation only.
The real target of the motion lies on the line between initial point of the motion
and the given point either closer or further away.
Syntax
<ROBOT>.GoToLimit= <numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot
' this command will move the robot in positive X direction as far as it can go.
See Also
MOVES
GROUPLIST
Description
This query returns a list of the names of the groups that are defined in the
system.
Each {group_name} is followed by a list of the names of the axes that are part
of that group. Wildcards may be used.
GRP_CLOSE_GRIPPER
Description
This command closes the specify gripper.
Syntax
GRP_CLOSE_GRIPPER (<EndEffectorName>, <GripperName>)
Parameters
< EndEffectorName >: any valid EndEffector, String
GRP_OPEN_GRIPPER
Description
This command opens the specify gripper.
Syntax
GRP_OPEN_GRIPPER (<EndEffectorName>, <GripperName>)
Parameters
< EndEffectorName >: any valid EndEffector, String
HERE
Description
Returns the actual robot Cartesian coordinates or axis angle.
This variable is computed each sampling period from the motor feedback
position.
? Scara.Here
? A1.Here
See Also
POSITIONFEEDBACK
HEX$
Description
HEX$ returns the string representation of a number in a hexadecimal format.
?myStr
HaltTask
Description
This command will immediately pause the current call and run the UPG/BKG
program which contains in the HaltTask and stop the robot motion associated
with the program.
Syntax
HaltTask()
ICMD
Description
This property returns the electric-current command issued by the drive, in user
units.
The drive units are converted to user units using the property IFAC.
Short form
<axis>.ICMD
Syntax
?<axis>.ICMD
?<joint>.ICMD
Domain
AXIS
Parameters
<axis> : any valid axis
?J1.icmd
See Also
IFBK
IF_..._THEN_..._ELSE
Description
This decision construct enables one section of code or another to be
executed, depending on the state of a specified condition.
The ELSE section is optional, but must be followed by at least one statement.
{ELSE
END IF
Parameters
<condition> : any expression can be transformed to (True or False)
Examples
IF SYSTEM.din.1 = 0 Then ‘check input #1
move A1 100
Else
move A1 200
End If
See Also
SELECT_..._CASE, PROGRAM_..._END_PROGRAM
IFBK
Description
This property returns the electric-current feedback measured in the drive, in
user units.
The drive units are converted to user units using the property IFAC.
Short form
<axis>.IFBK
Syntax
?<axis>.IFBK
?<joint>.IFBK
Domain
AXIS
Parameters
<axis> : any valid axis
?J1.ifbk
See Also
ICMD
IMPORT
Description
Imports a library file into a task.
To use a subroutine defined in a library file, the .lib file must first be imported
at the top of the program and then called by one of its defined subroutines.
Syntax
Import <lib file name>
Parameters
< lib file name > : lib file name in memory
Limitations
Library must be loaded into memory (using load command).
Examples
Import lib1.lib
Program
End Program
INFORMATION
Description
Returns information found during system power-up. Measures the average
cycle time of the motion bus. The result is the average cycle time found in the
test. The test duration is 500 milliseconds.
Syntax
?Sys.Information
?System.Information
Domain
SYSTEM
Return Value
Returns information found during system power-up
INPUT$
Description
Returns a string of characters from the specified port or file The return string
length is limited by <length> parameter.
Syntax
Input$ ({<length>}, #<DeviceHandle>)
Parameters
<length>: Long, number of Bytes to return. Length is optional when reading
from file – if not specified reads till end of line or 511 Bytes, whatever comes
first.
Test=Input$(1, #1)
X=Input$(LOC(1), #1)
See Also
CLOSE, LOC, OPEN_FILE, PRINT_HASH, PRINTPOINTUSING,
PRINTUSING, PRINTUSING$, PRINTUSING_HASH-SIGN
INSTR
Description
Returns the position of the starting character of a substring in a string.
If one of the input strings is of UTF-8 type and the other is not, the code of the
non-UTF-8 input string will be implicitly converted to the UTF-8 coding
method.
Syntax
INSTR({<expression>},<search_string>,<sub_string>)
Parameters
<expression>: Long
<search_string>: String
<sub_string>: String
Return Value
Returns the position of the starting character of a substring in a string. If
<sub_string> does not occur within <search_string>, a value of 0 is returned.
?INSTR("file.exe", "exe")
?INSTR(7,"1-2-3-4-5-6", "-")
INT
Description
This function returns the largest long value less than or equal to a numeric
expression .
Syntax
Int(<expression>)
Parameters
<expression>: Double, -MaxDouble to +MaxDouble
Return Value
returns the largest long value less than or equal to a numeric expression
?Int(12.5)
12 ‘returns 12
?Int(-12.5)
INTERPOLATIONTYPE
Description
Returns the interpolation type of the current or interrupted movements:
0 or 1 = MOVE joint-interpolation
2 = CIRCLE circular-interpolation
3 = JOG movement
7 = DELAY
8 = Advanced interpolation
14 = Torque interpolation
15 = DOPASS
16 = Kino-Dynamic interpolation
For axis only - Returns the type of interpolation of the current or interrupted
movements:
1 = MOVE interpolation
3 = JOG movement
Short form
IType
Syntax
<element>.IType
Domain
ELEMENT
Parameters
<element>: any valid motion element
Return Value
Returns the interpolation type of the current or interrupted movements
Read only
Modal only
Examples
Axis
?A1.Itype
Robot
?SCARA.IType
IPADDRESSMASK
Description
Sets or queries the IP address and subnet mask for the Ethernet interface.
The system performs a primary test to ensure that the address and subnet
mask match. Manual changing of the IP address or subnet mask may stop
communication between ControlStudio and the System . When IP address is
set to “dhcp”, System will try to connect DHCP server and obtain IP address.
NOTE
Manually changing the IP address or mask may stop communication between
ControlStudio and the System .
System.IPAddressMask=<address:mask>
System.IPAddressMask=<dhcp>
?Sys.IPAddressMask
?System.IPAddressMask
Domain
SYSTEM
Parameters
<address:mask>: String
Return Value
Returns the IP address and subnet mask for the Ethernet interface
sys.IPAddressMask="212.25.84.109:255.255.255.128"
Sys. IPAddressMask="dhcp"
See Also
ACCEPT, CLOSE, CONNECT, OPENSOCKET, PING
ISMOVING
Description
This property indicates whether the motion profiler is active. This flag indicates
the motion profiler phase.
3 – element is at the third motion phase (reaching final velocity ). If final velocity
is less than cruise velocity, it indicates that the axes are decelerating.
Special modes:
Sleep(10)
End While
?SCARA.IsMoving
MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 145 / 415
MC-Basic Commands 2.7
See Also
ISSETTLED, STARTTYPE
ISSETTLED
Description
This flag indicates whether the actual element position is within the specified
settling range. The settling range is defined by the PESETTLE property and is
further qualified by the TIMESETTLE property.
When the motion profiler has completed, the absolute value of the position
error (Target Position - Actual Position) is compared to the PESETTLE
property.
When the result is less than or equal to this property for the time given by
TIMESETTLE, the ISSETTLED flag is set. The TIMESETTLEMAX property
sets a limit on the time to settle from the time the profiler has completed.
0 – Not in position
1 – In position
This property is not relevant moving frame tracking. The return value in this
cases is 0
Syntax
?<element>.IsSettled
Domain
ELEMENT
Parameters
<element>: any valid motion element
Return Value
Returns whether the actual element position is within the specified settling
range
0 – Not in position
1 – In position
Limitations
Read only.
Examples
Axis
?A1.IsSettled
Robot
?SCARA.IsSettled
See Also
POSITIONERRORSETTLE, ISMOVING, STARTTYPE
JERK
Description
This property is used to set the jerk (rate of change of acceleration) on the
element. It is manifested in the amount of smoothing applied to the motion
profile. It is frequently more convenient to use SMOOTHFACTOR to set the
smoothing being applied to the profile. This property can be used inside a
motion command to override the permanent value.
Greater than 0. The upper limit is defined by the ratio between jerk and
acceleration or deceleration, according to the following relationship:
where T is the sample time in seconds. For a cycle time of 2 msec, this value
is 282.743.
Syntax
<element>.Jerk = <expression>
?<element>.Jerk
Domain
ELEMENT
Parameters
< element >: valid motion element
To set the value within a task, the group must be attached to that task (using
the ATTACH command).
Examples
Axis
A1.Jerk = 1.2
Robot
SCARA.Jerk = 1.2
See Also
ACCELERATION, JERKMAX, JUMP, JUMP3, JUMP3CP, MOVE, MOVES
JERKACCELERATIONPERCENTAGE
Description
Defines the percentage scale according to which the actual jerk will be
reduced from its given value (Jerk, Jtran, Jrot) and applied in the acceleration
phase.
Short form
<element>.JAPERC
Syntax
<element>.JAPERC=<numeric expression>
Domain
ELEMENT
Parameters
< element >: valid motion element
Read/Write
Examples
Axis
A1.japrec = 20
Robot
SCARA.japrec = 20
See Also
JERKDECELERATIONPERCENTAGE
JERKDECELERATIONPERCENTAGE
Description
Defines the percentage scale according to which the actual jerk will be
reduced from its given value (Jerk, Jtran, Jrot) and applied in the deceleration
phase.
Short form
<element>.JDPERC
Syntax
<element>.JDPERC=<numeric expression>
Domain
ELEMENT
Parameters
< element >: valid motion element
Read/Write
Examples
Axis
A1.jdprec = 20
Robot
SCARA.jdprec = 20
See Also
JERKACCELERATIONPERCENTAGE
JERKMAX
Description
Defines the maximum allowed jerk. If the trajectory generator issues a JERK
command higher than JERKMAX, the system sets the value to JERKMAX and
notifies you.
Short form
<element>.JMax
Syntax
<element>.JerkMax = <expression>
?<element>.JerkMax
Domain
ELEMENT
Parameters
< element >: valid motion element
< expression > : the maximum allowed jerk, Double, Greater than 0
Limitations
JERKMAX has an effect only if SMOOTHFACTOR is set to -1. To set the
value within a task, the element must be attached to that task (using the
ATTACH command).
Examples
Axis
A1.JMax=1.2
Robot
SCARA.JMax=1.2
See Also
ATTACH, JERK
JERKMAXROT
Description
Defines the maximum rotation jerk of the robot. Used for limiting JROT. The
value limits only the Cartesian motion interpolations (MOVES, CIRCLE).
JERKMAXTRANS
Description
Defines the maximum translation jerk of the robot. Used for limiting JTRAN.
The value limits only the Cartesian motion interpolations (MOVES, CIRCLE).
JERKROT
Description
Defines the rotation jerk of the robot. Together with JTRAN defines the jerk
value of a Cartesian motion.
This value is used only in two motion commands: MOVES and CIRCLE. In
joint interpolated movements (MOVE), this value is ignored. The group must
be defined with a robot model (model !=1).
The value cannot be greater than JERKMAXROT. The system always takes
the smaller of the two with a notification message sent to the user.
Short form
<ROBOT>.jofollow
Syntax
<ROBOT>.jofollow=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: SCARA only
JERKTRANS
Description
Defines the translation jerk of the robot. Together with JROT, defines the jerk
value of a Cartesian motion.
This value is used only in two motion commands: MOVES and CIRCLE. In
joint interpolated movements (MOVE), this value is ignored. The group must
be defined with a robot model (model !=1).
JOFFOLOW
Description
It is a MOVE command, which is used for a given Cartesian position, controls
the endpoint position of the joint.
The value is used for axis interpolation motion in MOVE, JUMP and JUMP3
commands. The value will be ignored in Cartesian interpolation motion
(MOVES, CIRCLE, SMOVE, JUMP3CP). The axis group must be defined
through a robot model (model !=1).
1 – The rotation direction of the 4th joint movement will follow the direction of
the Roll angle change.
Short form
<ROBOT>.jofollow
Syntax
<ROBOT>. jofollow =<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: SCARA only
JUMP
Description
Jump command move the robot arm from the one position to another position
in an arch-shaped motion. Jump command has three basic phases: up, across
and down. These three phases are joint space movements, and the tool
orientation remains unchanged during the up and the down movement phase,
three phases are executed through joint run.
Jump motion is shown in the above figure. Point 6 and point 1 are the
Ascending Point and the Descending Point. Point 6 and point 1 has the same
heights, defined by LimtZ.
Phase 5 and phase 2 are distance of up and down motion, that is, length that
should be protected to avoid blending, corresponding to AscendingZ and
DescendingZ of ArchNo.
Syntax
Jump{ROBOT} Targetpoint {LimZ=<value>} {ArchNo=<value>}
{VScale=<value>} {Blend=<value>} {AScale=<value>} {Armcmd=<value>}
{WithPls=<value>} {Until <signalName>=<value>} {Acc=<value>}
{Dec=<value>} {Jerk=<value>}
Parameters
<ROBOT>: any valid robot. Here can use a blank or write SCARA.
Targetpoint:the end position that user want to go, Cartesian or Joint. It can
use clarified variables as input, or directly input position value.
Note: After system vScale is assigned in the program, its applied range is
inside the program and does not influence the whole system.
<Blend>: blend percentage, range 0 – 100%.
Blend parameters set in each Moves statement refer to, when the motion
trajectory of this statement is entering and exiting, the ratio of entry distance or
exit distance to half of this statement's trajectory.
For example, when this parameter is set to 100, the center point of the entire
trajectory becomes both the entry and exit point, which indicates that the
trajectory consists of only one point while the rest of the path is used for
smoothing. When the parameter is set to 25, the entry point is located at 1/8 of
the trajectory length from the beginning, and the exit point is located at 1/8 of
the trajectory length from the end. If this parameter is not set, the default value
is 0.
<Armcmd>:Armcmd of robot
This flag defines the method to reach target position through joint frame. 0:
automatic, 1: left armcmd, 2: right armcmd.
When executing this motion command, the robot will trigger IO signal after
reached specified position. Each position trigger should be created and
configured in project setting. When programming, this parameter can be
directly linked to the name of a configured position trigger.
When the configurated signal value equals to the expected value, the
executing motion will be stopped, and next motion continues. Until command
should be added at the end of motion command, it is an optional property for
motion command. Its basic format is “Until <Signal> = <StopCondition>”.
<Signal> is digital input signal and should be created in “Input&Output” page
of Project in advance. <StopCondition> is on/off, used as a condition for
interruption.
When executing motion command, this property should smaller than or equals
to system maximum acceleration. If the property is large, the system
maximum acceleration should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum deceleration. If the property is larger, the system
maximum deceleration should be used to execute motion.
Above property parameters can be used in one motion command at the same
time and with random order in accordance with actual needs.
158 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024
MC-Basic Commands 2.7
Limitations
A motion element may not be moved if it is attached by another task.
For Control Studio higher than version 2.5, all motion commands are equipped
with until function (except SMOVE).
Examples
Jump SCARA PL1 ArchNo=1 LimZ=0 Blend=50 VScale=100 AScale=20
WithPls=PT_1 ‘add position trigger.
Note: if not use ArchNo, then no blend will exist between up, across and down
motion.
Note: The LimZ height should larger than the height of start point and end
point coordinates.
program
Attach
Detach
end program
See Also
JUMP3, JUMP3CP, VELOCITYSCALE, ACCELERATION, DECELERATION,
JERK, STARTTYPE, WITHPLS, BLENDPERCENTAGE, MOVE, VSMODE
JUMP3
Description
Jump3 command is used to move the robot arm from the one position to
another position in an arch-shaped motion. Jump3 command has three basic
phases: up, across and down. The up and the down phases are cartesian
space movements and the across phase is joint space movement.
Jump3 motion is shown in the above figure. Point 6 and point 1 are Ascending
Point and the Descending Point.
Phase 5 and phase 2 are distance of up and down motion, that is, length that
should be protected to avoid blending, corresponding to AscendingZ and
DescendingZ of ArchNo.
The difference Jump3 from Jump lies in that it can designate the target point
of up motion and the start point of down motion. Across motion between point
6 and point 1 is joint motion.
Syntax
Jump3 {ROBOT} AscendingPoint = < value > DescendingPoint = < value >
TargetPoint = < value > >} {VScale=<value>} {Blend=<value>}
{BlendDistance=<value>}{BlendOrientation=<value>}
{Blendendprotected=<value>} {Blendstartprotected=<value>}
{AScale=<value>} {Armcmd=<value>} {WithPls=<value>} {Until
<signalName>=<value>} {Acc=<value>} {Dec=<value>}
{Jerk=<value>}{ VTRAN =<value>} { ATRAN =<value>}{ JTRAN
=<value>}{ VROT =<value>}{ AROT =<value>}{ JROT =<value>}
Parameters
<ROBOT>: any valid robot. Here can leave a blank or use SCARA.
Target point : the end position that user want to go, Cartesian or Joint. It can
use clarified variables as input, or directly input position value.
If Blendstartprotected is set larger than 0, than this trajectory will not blend
with last trajectory.
<Armcmd>:Armcmd of robot
This flag defines the method to reach target position through joint frame. 0
represents automatic, 1 represents left armcmd, 2 represents right armcmd.
When executing this motion command, the robot will trigger IO signal after
reached designated position. Each position trigger should be created and
configured in project setting. When programming, this parameter can be
directly linked to the name of a configured position trigger.
When the configurated signal value equals to the expected value, the
executing motion will be stopped, and next motion continues. Until command
should be added at the end of motion command, it is also an optional property
for motion command. Its basic format is “Until <Signal> = <StopCondition>”.
<Signal> is digital input signal and should be created in “Input&Output” page
of Project in advance. <StopCondition> is on/off, used to judge whether
interrupt motion.
When executing motion command, this property should smaller than or equals
to system maximum acceleration. If the property is larger, the system
maximum acceleration should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum deceleration. If the property is larger, the system
maximum deceleration should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum translation acceleration. If the property is larger, the
system maximum translation acceleration should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum rotation velocity. If the property is larger, the system
maximum rotation velocity should be used to execute motion.
degree/sec2.
When executing motion command, this property should smaller than or equals
to system maximum rotation acceleration. If the property is larger, the system
maximum rotation acceleration should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum rotation deceleration. If the property is larger, the system
maximum rotation deceleration should be used to execute motion.
Above property parameters can be used in one motion command at the same
time and with random order in accordance with actual needs.
Examples
Jump3 SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint =
PL3 ArchNo = 1 Vtran = 1000 AScale = 20 WithPls=PT_1 ‘Add position trigger
program
Attach
Detach
end program
See Also
JUMP, JUMP3CP, VELOCITYTRANS, JERK, STARTTYPE, WITHPLS,
BLENDPERCENTAGE, VSMODE , BLENDPERCENTAGE,
BLENDSTARTPROTECTED , BLENDORIENTATION
JUMP3CP
Description
Jump3 command is used to move the robot arm from the one position to
another position in an arch-shaped motion. Jump3 command has three basic
phases: up, across and down. These three phases are cartesian space
movements. The tool orientation remains unchanged during the up and the
Jump3cp motion is shown in the above figure. Point 6 and point 1 are
Ascending Point and the Descending Point.
Phase 5 and phase 2 are distance of up and down motion, that is, length that
should be protected to avoid blending, corresponding to AscendingZ and
DescendingZ of ArchNo.
The difference Jump3cp from Jump lies in the across motion between point 6
and point 1 is Cartesian rectilinear motion.
Syntax
Jump3cp {ROBOT} AscendingPoint = < value > DescendingPoint = < value >
TargetPoint = < value > >} {Blend=<value>}
{BlendDistance=<value>}{BlendOrientation=<value>}
{Blendendprotected=<value>} {Blendstartprotected=<value>}
{WithPls=<value>} {Until <signalName>=<value>} { VTRAN
=<value>}{ ATRAN =<value>}{ JTRAN =<value>}{ VROT =<value>}{ AROT
=<value>}{ JROT =<value>}
Parameters
<ROBOT>: any valid robot. Here can leave a blank or use SCARA.
Target point : the end position that user want to go, Cartesian or Joint. It can
use clarified variables as input, or directly input position value.
If Blendstartprotected is set larger than 0, than this trajectory will not blend
with last trajectory.
When executing this motion command, the robot will trigger IO signal after
reached designated position. Each position trigger should be created and
configured in project setting. When programming, this parameter can be
directly linked to the name of a configured position trigger.
when configured signal value equals to expected value, the executing motion
will be stopped, and the next motion continues. Until command should be
added at the end of motion command, and it is an optional property for motion
command also Its basic format is “Until <Signal> = <StopCondition>”.
<Signal> is digital input signal and should be created in “IO” page of Project in
advance. <StopCondition> is on/off, it is a condition for interruption.
When executing motion command, this property should smaller than or equals
to system maximum translation velocity. If the property is larger, the system
maximum translation velocity should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum rotation velocity. If the property is larger, the system
maximum rotation velocity should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum rotation acceleration. If the property is larger, the system
maximum rotation acceleration should be used to execute motion.
Above property parameters can be used in one motion command at the same
time and with random order in accordance with actual needs.
Limitations
The element could not be moved if the element is attached to other tasks.
Motion will report error and stop when passing singular point.
For Control Studio higher than version 2.5, all motion commands are equipped
with until function (except SMOVE).
Examples
Jump3cp SCARA AscendingPoint = PL1 DescendingPoint = PL2 TargetPoint
= PL3 ArchNo = 1 Vtran = 1000 WithPls=PT_1 ‘Add position trigger
program
Attach
WaitForMotion
Detach
end program
See Also
JUMP, JUMP3, VELOCITYTRANS, JERK, STARTTYPE, WITHPLS,
BLENDPERCENTAGE, VSMODE, BLENDPERCENTAGE,
BLENDSTARTPROTECTED, BLENDORIENTATION
LCASE$
Description
LCASE$ returns a copy of the string passed to it with all the uppercase letters
converted to lowercase.
Syntax
LCASE$(<string>)
Parameters
<string>: String
Return Value
returns a copy of the string passed to it with all the uppercase letters
converted to lowercase
LEFT$
Description
The LEFT$ returns the specified number of characters from the left-hand side
of the string.
Syntax
LEFT$(<string>, <expression>)
Parameters
<string>: String
PRINT LEFT$(Test,4)
LEN
Description
This function returns the length of the inputstring as the number of characters
in an ASCII-8 string, or the number of symbols in a UTF-8 string.
NULL characters are not cut out from strings, resulting in a different behavior:
Len of Chr$(0) is 1:
?Len(Chr$(0))
1
Syntax
Len (<string>)
Parameters
<string>: String
Return Value
returns the length of the inputstring as the number of characters in an ASCII-8
string, or the number of symbols in a UTF-8 string
LOC
Description
Returns the number of characters waiting in the input buffer.
Syntax
?Loc(<DeviceHandle>)
Parameters
<DeviceHandle>: Long, file handle, 1 to 255
Return Value
Returns the number of characters waiting in the input buffer
LOG
Description
Returns the natural logarithm of the expression.
Syntax
Log(<expression>)
Parameters
<expression>: Double, Greater than 0
Return Value
Returns the natural logarithm of the expression
VaSCARA = Log(Var2)
See Also
EXP
LOGGER
Description
Logs an application exception. Only the actions of printing and logging the
exception are performed. <error name> is the exception name defined by the
user.
Syntax
Logger <error name>
Parameters
< error name >: the exception name defined by the user.
Limitations
<error name>must be defined. Only the exception name is accepted as the
argument.
Examples
Logger myerror
See Also
ONERROR
LTRIM$
Description
The LTRIM$ function returns the right-hand part of a string after removing any
blank spaces at the beginning.
Syntax
LTRIM$(<string>)
Parameters
<string>: String
Return Value
returns the right-hand part of a string after removing any blank spaces at the
beginning
LONGTOFLOAT
Description
Convert a long data type to float data type and support simultaneous
conversion of multiple data type.
Syntax
LongToFloat(< lArrayData[*] >, < dArrayData[*] >,< lNum >, < lEndian >)
Parameters
< lArrayData[*] >: array of long
lArrayData[1] = 52684
lArrayData[2] = 13890
LongToFloat(lArrayData, dArrayData,1,0)
? dArrayData[1]
Result 45.7
See Also
FLOATTOLONG, DOUBLETOLONG, LONGTODOUBLE
LONGTODOUBLE
Description
Convert a data type from long to double and support simultaneous conversion
of multiple data types.
Syntax
LongToDouble(< lArrayData[*] >, < dArrayData[*] >,< lNum >, < lEndian >)
Parameters
< lArrayData[*] >: array of long
lArrayData[1] = 42096
lArrayData[2] = 15626
lArrayData[3] = 55139
lArrayData[4] = 23104
LongToDouble(lArrayData, dArrayData,1,0)
? dArrayData[1]
Result 105.56
See Also
FLOATTOLONG, DOUBLETOLONG, LONGTOFLOAT
MAINFILENAME
Description
Tasks may receive new temporal names when loaded through the Load$…As
command. MainFileName property returns the original file name of the task.
? MainFileName
Domain
TASK
Parameters
<task>: any task in memory
Return Value
returns the original file name of the task
?Task2.prg.MainFileName
Task1.prg
Program
End Program
See Also
TASKLIST
MID$
Description
The MID$ function returns the specified number of characters from the string,
starting at the character at position <start>. If <start> is greater than the length
of <string>, the returned <string> is empty.
MOTION
Description
The MOTION value must be 1 (ON) for any motion command to be executed
successfully. In addition, the status of MOTION is terminated by the servo
interrupt.
?<element>.Motion
Domain
ELEMENT
Parameters
< element >: valid motion element
0 = OFF
1 = ON
Limitations
The value must be 1 (ON) for any motion command to be executed
successfully.
Examples
Axis
A1.Motion = 1
?A1.Motion
Robot
SCARA.Motion = 1
?SCARA.Motion
See Also
MOVE, SYSTEM.MOTION
MOTIONOVERLAP
Description
The MOTIONOVERLAP property defines a condition whether the interpreter
will execute the next motion command.
It means that when the property is set to 0 (Off), the next motion command will
be executed only if the previous motion command has completed.
If set to 1 (ON), the interpreter will execute the next motion command as
usual.
1 = ON
0 = OFF
Short form
<element>.MotionOverLap
Syntax
<element>.MotionOverLap = <value>
?<element>.MotionOverLap
Domain
ELEMENT
Parameters
< element >: valid motion element
0 = OFF
1 = ON
Examples
Axis
A1.MotionOverLap = 1
?A1.MotionOverLap
Robot
SCARA.MotionOverLap = 1
?SCARA.MotionOverLap
See Also
WAITFORMOTION
MOVE
Description
Executes point-to-point moves from current position to target position of a
single axis or a group of axes.
Target point:the end position that user want to go, Cartesian or Joint. It can
use clarified variables as input, or directly input position value.
If Move element is one specified axis of the robot, the format should be angle
or length, which represent the angle/distance of operation axis movement.
Note: After system vScale is assigned in the program, its applied range is
inside the program, will not influence the whole system.
<Blend>: blend percentage, range 0 – 100%.
Blend parameters set in each Moves statement refer to, when the motion
trajectory of this statement is entering and exiting, the ratio of entry distance or
exit distance to half of this statement's trajectory.
For example, when this parameter is set to 100, the center point of the entire
trajectory becomes both the entry and exit point, resulting in a trajectory that
consists of only one point while the rest of the path is used for smoothing.
When the parameter is set to 25, the entry point is located at 1/8 of the
trajectory length from the beginning, and the exit point is located at 1/8 of the
trajectory length from the end. If this parameter is not set, the default value is
0.
<Armcmd>:Armcmd of robot
This flag defines the method to reach target position through joint frame. 0
represents automatic, 1 represents left armcmd, 2 represents right armcmd.
When executing this motion command, the robot will trigger IO signal after
reached specified position. Each position trigger should be created and
configured in project setting. When programming, this parameter can be
directly linked to the name of a configured position trigger.
When the configurated signal value equals to the expected value, the
executing motion will be stopped, and next motion continues. Until command
should be added at the end of motion command, it is also an optional property
for motion command. Its basic format is “Until <Signal> = <StopCondition>”.
<Signal> is digital input signal and should be created in “Input & Output” page
of Project in advance. <StopCondition> is on/off, used to judge whether
interrupt motion.
<Abs>: Absolute. This property is used to define whether input target point is
absolute position or relative position.
When executing motion command, this property should smaller than or equals
to system maximum acceleration. If the property is larger, the system
maximum acceleration should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum deceleration. If the property is larger, the system
maximum deceleration should be used to execute motion.
Above property parameters can be used in one motion command at the same
time and with random order in accordance with actual needs.
Limitations
A motion element may not be moved if it is attached by another task.
For Control Studio higher than version 2.5, all motion commands are equipped
with until function (except SMOVE).
Examples
Move PL1 ‘Cartesian or Joint, all parameters use default value
Note: the format of input target point does not affect other parameter setting,
different parameters are independent and do not influence each other. In
addition, after the motion of Move command, the program pin pointer will
continue going down, command pre-read function will come into effect. If you
expect to stuck program pointer to interrupt command pre-read, add
WaitForMotion at behind.
Move PL2 ‘Default command armcmd as 2 set by last command (Right hand)
Move PL2 Until SIGNAL1=on ‘Add Unitl interrupt function, triggered when
SIGNAL1 is on.
Move PL1 Until SIGNAL2=off ‘Add Unitl interrupt function, triggered when
SIGNAL2 is off.
Note: the armcmd value should remain the same with target position value, or
at least one should be 0 (automatic), otherwise armcmd unmatched error will
be reported.
program
Attach
Armcmd=0
Armcmd=2
Armcmd=0
Detach
end program
See Also
JUMP, ABSOLUTE, ACCELERATION, DECELERATION, JERK,
STARTTYPE, WITHPLS, BLENDPERCENTAGE, BLENDMETHOD, CIRCLE,
MOTION, MOVES, POSITIONFINAL, SELECTAXES, WAITFORMOTION,
VSMODE
MOVES
Description
The MOVES command moves the robot along a straight line in Cartesian-
space.
The parameters of the motion are: VTRAN, ATRAN, DTRAN, VRTO, AROT,
DROT. The syntax for the properties is:
The permanent value is overridden for the duration of the MOVES. All
standard motion specification of the MOVE command are also available
(STARTTYPE, ABS) with exactly the same functionality. For Control Studio
higher than version 2.5, all motion commands are equipped with until function
(except SMOVE).
Syntax
Moves {ROBOT} Target point { VTRAN =<value>} { ATRAN
=<value>}{ JTRAN =<value>}{ VROT =<value>}{ AROT =<value>}{ JROT
=<value>}
{Blend=<value>}{BlendDistance=<value>}{BlendOrientation=<value>}
{Blendendprotected=<value>} {Blendstartprotected=<value>}
{WithPls=<value>} {Until <signalName>=<value>} {Abs=<value>}
Parameters
< robot >: any valid robot. If motion element is robot, then here can use a
blank or write SCARA.
< target point >: Cartesian or Joint. It can use clarified variables as input, or
directly input position value.
If Blendstartprotected is set larger than 0, than this trajectory will not blend
with last trajectory.
<Armcmd>:Armcmd of robot
This flag defines the method to reach target position through joint frame. 0:
automatic, 1: left armcmd, 2: right armcmd.
When executing this motion command, the robot will trigger IO signal after
reached specified position. Each position trigger should be created and
configured in project setting. When programming, this parameter can be
directly linked to the name of a configured position trigger.
When the configurated signal value equals to the expected value, the
executing motion will be stopped, and next motion continues. Until command
should be added at the end of motion command, it is an optional property for
motion command. Its basic format is “Until <Signal> = <StopCondition>”.
<Signal> is digital input signal and should be created in “Input & Output” page
of Project in advance. <StopCondition> is on/off, used as condition for motion
interruption.
<Abs>: Absolute. This property is used to define whether input target point is
absolute position or relative position.
When executing motion command, this property should smaller than or equals
to system maximum translation velocity. If the property is larger, the system
maximum translation velocity should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum translation acceleration. If the property is larger, the
system maximum translation acceleration should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum rotation velocity. If the property is larger than system
maximum rotation velocity, the system maximum rotation velocity should be
used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum rotation acceleration. If the property is larger than system
maximum rotation acceleration, the system maximum rotation acceleration
should be used to execute motion.
When executing motion command, this property should smaller than or equals
to system maximum rotation deceleration. If the property is larger, the system
maximum rotation deceleration should be used to execute motion.
Above property parameters can be used in one motion command at the same
time and with random order in accordance with actual needs.
Limitations
The element could not be moved if the element is attached to other tasks.
Motion will report error and stop when passing singular point.
For Control Studio higher than version 2.5, all motion commands are equipped
with until function (except SMOVE).
Examples
Moves PL1 ‘Cartesian or Joint, all parameters use default value
Note: the format of input target point does not affect other parameter setting,
different parameters are independent and do not influence each other. In
addition, if you expect to stuck program pointer to interrupt command pre-
read, add WaitForMotion at behind.
Moves PL2 Until SIGNAL1=on ‘‘Add Unitl interrupt function, triggered when
SIGNAL1 is on
Moves PL1 Until SIGNAL2=off ‘Add Unitl interrupt function, triggered when
SIGNAL2 is off
Note: target point armcmd of straight line motion is determined by start point, if
designated armcmd is different from start point armcmd, the motion will pass
singular point. Generally additional designation is not necessary, if needed, it
is recommended to move to straight line motion start point with designated
armcmd first, then start straight motion.
Moves PL2
program
Attach
BlendDistance=30
Detach
end program
See Also
VELOCITYTRANS, JERK, STARTTYPE, WITHPLS, BLENDPERCENTAGE,
CIRCLE, DEST, MOVE, ABSOLUTE, ACCELERATIONMAXROT,
ACCELERATIONMAXTRANS, ACCELERATIONROT,
ACCELERATIONTRANS, BLENDMETHOD, DECELERATIONROT,
DECELERATIONTRANS, JERKMAXROT, JERKMAXTRANS, JERKROT,
JERKTRANS, VELOCITYFINALROT, VELOCITYFINALTRANS,
VELOCITYMAXROT, VELOCITYMAXTRANS, VELOCITYROT,
VELOCITYROTVALUE, VELOCITYTRANSVALUE, VSMODE, XMAX, XMIN,
YMAX, YMIN, ZMAX, ZMIN, BLENDPERCENTAGE,
BLENDSTARTPROTECTED , BLENDORIENTATION
MSG
Description
This query returns the message of the user-defined exception.
Syntax
?<user exception>.Msg
Domain
ERROR
Parameters
< user exception >: User defined error name
Return Value
returns the message of the user-defined exception
NAME
Description
This property sets the name of the controller. The query returns the name of
the controller. If the no name was set (or an empty string), the reply is, "no
name."
Syntax
Sys.Name = “<name>”
System.Name = “<name>”
?Sys.Name
?System.Name
Domain
SYSTEM
Parameters
<name>: new name to set, String
Return Value
returns the name of the controller
?System.name
See Also
INFORMATION
NOOFCOORDINATES
Description
Returns the number of coordinates of a point.
Syntax
<long_variable> = noofcoordinates (<point_expression>)
Parameters
< point_expression >: Joint or Location
Return Value
Returns the number of coordinates of a point
<long_variable>: Long
Examples
LongVar = NOOFCOORDINATES(#{0.0, 10.0, 20.0})
? NOOFCOORDINATES(JointVar)
LongVar = NOOFCOORDINATES(Robot.PCMD)
NUM
Description
This query returns the number of the user-defined exception.
Syntax
?<user exception>.Num
Domain
ERROR
Parameters
< user exception >: User defined error name
Return Value
returns the number of the user-defined exception
NUMBEROFLOOPS
Description
This query returns a Long value, indicating the number of task loop left
May be queried as from another task context , as from the same task.
In case of query from the same task the task name is unnecessary.
Syntax
?<task>.NumberOfLoops
?NumberOfLoops
Domain
TASK
Parameters
<task>: any task in memory
Return Value
returns a Long value, indicating the number of task loop left
?Task1.prg.NumberOfLoops
program
end program
ONERROR
Description
The ONERROR statement is used to trap and process both synchronous and
asynchronous errors in a task.
A synchronous error is one caused by the user task, and is detected by the
interpreter, while an asynchronous error is not associated with a specific line
of program code.
When an error is trapped, the specified error processing code is run and the
task is stopped. The task is in state 4.
<Code>
{catch else
<Code>
catch 3017
killtask task2.prg
End OnError
See Also
LOGGER, TRY_..._END_TRY
ONEVENT
Description
The ONEVENT command defines a synchronous task that periodically checks
the occurrence of the event condition once the event has been enabled (using
EVENTON).
When the condition is met, the event action block is executed. Event
conditions may be any conditional expression.
The event action code runs as an interrupt to the task in which it is defined.
Multiple events in the same task may interrupt each other, but they are not
multitasked among themselves. Events defined in different tasks are
multitasked.
Priority is the priority level at which the action code is executed. It may be
assigned any value from 1 to 16. Event priority must be higher than the priority
of the task in which it is defined.
If an event is defined without any condition, the event action is executed every
scan time, thus allowing periodic execution of application code.
Syntax
OnEvent <event> {<condition>} {Priority=<priority>} {ScanTime=}
End Onevent
Parameters
<event>: Alphanumeric string, the event name
<condition>: an expression
<priority>: Long
End OnEvent
See Also
EVENTLIST, EVENTOFF, EVENTON
ONSYSTEMERROR
Description
The ONSYSTEMERROR statement is used to trap and process errors in the
system.
It is the upper level of the hierarchical error processing structure formed by the
combination of TRY, ONERROR and ONSYSTEMERROR.
Synchronous errors are caused by the user task and detected by the
interpreter, while an asynchronous errors are not associated with a specific
line of program code. Examples include position following errors.
When an error is trapped, the specified error processing code is executed and
the task is stopped. The task is in state 4. Task execution is resumed by
explicitly entering the CONTINUETASK command within the error processing
code.
<Code>
{catch else
<Code>
End OnSystemError
See Also
ONERROR
OPEN_FILE
Description
Opens an existing file or creates new one (in “write” mode) with the name
given in the string expression.
Open text file for read, write or append to the existing file according to mode
flag.
Use APPEND to add new lines at the end of the original contents of the file.
Use WRITE to overwrite the previous file or for the new one creation .
Syntax
Open<file name>MODE= <mode flag>As #<DeviceHandle>
Parameters
< file name>: String, not more, then 12 characters (8 char. name + dot + 3
char. extension)
Or
OPENSOCKET
Description
Creates a TCP socket and put socked descriptor to the specified device
handle.
Syntax
OpenSocket Options=<num> as # <device number>
Parameters
Options: set the socket type , Long
0: Data is buffered until buffer is full or time-out is reached, this mode shall be
used to improve network utilization
OPMODE
Description
Axis property. Assigning this property allows you to change the drive operation
mode.
2 - TORQUEMODE
Position-error or acceleration max are NOT checked, but vfb < vospd, te <
terrmax and tcmd < tmax are checked as usual.
1 - VELOCITYMODE
Position-error is not NOT checked , but: vfb < vospd, te < terrmax, acmd <
amax and tcmd < tmax are checked as usual.
0 - POSITIONMODE
All the standard deviation thresholds are checked: pe < pemax,vfb < vospd, te
< terrmax, acmd < amax and tcmd < tmax.
DRIVEOPMODE does not change the axis operational mode, so the axis does
not "know" that it is in e.g. TORQUE and continues checking position and
velocity. Also in this case the TORQUE command will not operate correctly.
NOTE
Note the difference between DRIVEOPMODE and OPMODE.
The command DRIVEOPMODE can also change the drive operation mode,
but this is not supported by the motion module.
At Motion Bus phase different then 4 query on Opmode will return -1.
Syntax
<axis>.OpMode = <value>
<lvalue> = <axis>.OpMode
Domain
AXIS
Parameters
<axis>: any valid axis
Modal only
Examples
A1.OpMode = 2
i = A1.OpMode
See Also
TORQUECOMMAND, TORQUEFEEDBACK
ORITYPE
Description
The ORITYPE is used to control the orientation of the SMOVE command
during its movement.
1-- Constant Orientation Mode: which means SMOVE will remain the same
orientation as the starting point.
2 – Optimal Mode: which means SMOVE will calculate the optimal orientation
trajectory. The orientation of the given point is not guaranteed.
The initial value is set to zero if the ORITYPE value is not appointed.
Short form
<ROBOT>.oritype
Syntax
<ROBOT>.oritype=<numeric expression>
Domain
ROBOT
Parameters
<expression>: INT, range from 0 to 2.
Limitations
Read/Write, Modal/Nodal
Examples
SCARA.ORITYPE = 0
See Also
SMOVE
PASSINDEX
Description
PASSINDEX is used to control how many points in the given array are
passed to the SMOVE command.
Syntax
PASSINDEX = INDEX1, INDEX2
Domain
Only applicable to the SMOVE command
Parameters
INDEX1: INT, start index of given point array
Nodal only
Examples
SMOVE Array PASSINDEX=1,50
See Also
SMOVE
PAYLOADINERTIA
Description
Payload inertia of mass around the axis of the last joint.
Modal only
Examples
SCARA.PayloadInertia = 0.05
? SCARA.PayloadInertia
See Also
PAYLOADLX, PAYLOADLY, PAYLOADMASS
PAYLOADLX
Description
Payload center of mass (C.M) distance of a robot in the tool's x direction.
Modal only
Examples
SCARA.PAYLOADLX = 0.0
? SCARA.PAYLOADLX
See Also
PAYLOADLY, PAYLOADINERTIA, PAYLOADMASS
PAYLOADLY
Description
Payload center of mass (C.M) distance of a robot in the tool's y direction.
Modal only
Examples
SCARA.PAYLOADLY = 0.0
? SCARA.PAYLOADLY
See Also
PAYLOADLX, PAYLOADINERTIA, PAYLOADMASS
PAYLOADMASS
Description
Payload mass of an element.
Modal only
Examples
SCARA.PAYLOADMASS = 3
? SCARA.PAYLOADMASS
See Also
PAYLOADLX, PAYLOADLY, PAYLOADINERTIA
PAYLOADMAX
Description
The maximum allowed mass for the payload of the element.
Modal only
Examples
SCARA. PAYLOADMAX = 10
? SCARA. PAYLOADMAX
See Also
PAYLOADLX, PAYLOADLY, PAYLOADMASS
PEAKTORQUE
Description
Return peak torque of specified axis, unit: maximum peak torque percentage.
Syntax
?< ELEMENT >.PeakTorque
Domain
ELEMENT
Parameters
< ELEMENT>: valid motion element
Limitations
Read/Write
Modal only
Examples
?J1.PeakTorque
See Also
RESETPEAKVALUE, SETVELERRTHRESHOLD, COLLISIONDETECT,
DRIVETORQUELIMIT, PEAKVELERR, VELERRTHRESHOLD,
SETDRIVETORQUELIMIT
PEAKVELERR
Description
Return velocity error of specified axis, unit: peak error percentage.
Syntax
?< ELEMENT >.PeakVelErr
Domain
ELEMENT
Parameters
< ELEMENT>: valid motion element
Limitations
Read/Write
Modal only
Examples
?J1. PeakVelErr
See Also
RESETPEAKVALUE, SETVELERRTHRESHOLD, COLLISIONDETECT,
DRIVETORQUELIMIT, PEAKTORQUE, VELERRTHRESHOLD,
SETDRIVETORQUELIMIT, SETDEFVELERRTHRESHOLD
PING
Description
The PING command is used to test whether or not a remote host is reachable.
A run-time error is returned if the host is not reachable or does not answer.
Syntax
?Ping (<ip address>)
Parameters
<ip address> : String, IP address
Return Value
<returned value>:
0 = OK
Examples
? Ping (”212.25.84.109”)
See Also
ACCEPT, CLOSE, CONNECT, OPENSOCKET, IPADDRESSMASK
PLSLIST
Description
This query returns a list of the PLS names defined in the system, The
information is displayed in the following format:
If wildcards are used the query returns the proper existing PLS data.
Syntax
?PlsList {<pls>}
Parameters
< pls > : the specified pls
Return Value
<return value>: String
Returns a list of the PLS names defined in the system, The information is
displayed in the following format:
?plslist PT*
See Also
AXISLIST, GROUPLIST, TASKLIST, VARLIST, VARLIST$
PLSOUTPUT
Description
This property sets or queries the output associated with a PLS.
Short form
<pls>.Pout
Syntax
<pls>.PlsOutput = <digital output signal >
?<pls>.PlsOutput
Domain
PLS
Parameters
< pls >: any valid pls variable
PLSPOLARITY
Description
Sets or queries the initial polarity of the system output associated with a PLS.
The value of the output is determined by the axis position at the moment of
PLSenable according to the following scheme:
?<pls>.PlsPolarity
Domain
PLS
Parameters
< pls >: any valid pls variable
PLSPOSITION
Description
Sets or queries individual PLS position values.
When a PLS is first defined, it does not have any associated positions. The
CreatePLSData command is used to define the values for the PLS positions.
An unlimited number of PLS positions can be defined, but the array must be
monotonic increasing.
PLS position values are always absolute (and not incremental). PLS positions
are given in user units, and as such are affected by axis Displacement and
PositionFactor properties.
PLS positions units are dependent upon the type of position defined by
PLSSource. For example, if PLSSource type is PlsPercentage, the units are
percentage. If PLSSource type is PlsTime the units are milliseconds.
Short form
<pls>.Ppos
Syntax
<pls>.PlsPosition[<index>] = <PLS position>
Domain
PLS
Parameters
< pls >: any valid pls variable
PLSRELATEDTO
Description
This is a flag used by the PathLength, PathPercentage and PathTime to
define whether PLS positions are computed relative to the motion start
position or to the target position.
Syntax
<pls>.PlsRelatedTo = <value>
?<pls>.PlsRelatedTo
Domain
PLS
Parameters
< pls >: any valid pls variable
PLSSOURCE
Description
Defines the type of position that toggles the PLS output.
PLT_GET_INDEX_STATUS
Description
This command is used to get the current item index of the pallet.
Syntax
PLT_GET_INDEX_STATUS (<PalletName>)
Parameters
<PalletName>: String, any valid pallet
Return value
Return the number of the current item index of the pallet.
Examples
?PLT_GET_INDEX_STATUS ("PLT1")
See Also
PLT_SET_INDEX_STATUS
PLT_MOVE_TO_ENTRY_POSITION
Description
This command instructs the robot to move to the entry position of one pallet. If
the robot is next to an item(in either a Pick or Place location), it will pass throw
the Retract position on its way to the entry position, if it is defined and
enabled.
Syntax
PLT_MOVE_TO_ENTRY_POSITION (<ROBOT>, <PalletName>)
Parameters
<ROBOT>: any valid Robot
PLT_PICK_FROM_PALLET
Description
This command instructs the robot to move to the next item on the pallet. The
robot moves through the Entry and Approach point, if they are defined and
enabled.
Syntax
PLT_PICK_FROM_PALLET(<ROBOT>, <PalletName>)
Parameters
<ROBOT>: any valid Robot
PLT_PLACE_ON_PALLET
Description
This command instructs the robot (which is holding an item) to move to the next
available position on the pallet. The robot moves through the Entry and the
Approach position, if they are defined and enabled.
Syntax
PLT_PLACE_ON_PALLET(<ROBOT>, <PalletName>)
Parameters
<ROBOT>: any valid Robot
PLT_RETRACT_FROM_ITEM
Description
This command instructs the robot to move to the Retract position of current
item in one pallet.
Syntax
PLT_RETRACT_FROM_ITEM (<ROBOT>, <PalletName>)
Parameters
<ROBOT>: any valid Robot
PLT_SET_INDEX_STATUS
Description
This command defines the quantity of items on a pallet. This command is
useful at the start of an application.
Syntax
PLT_SET_INDEX_STATUS (<PalletName>, <index>)
Parameters
<PalletName>: String, any valid pallet
PLT_SET_INDEX_STATUS_EMPTY
Description
This command defines the quantity of items to be 0 on a pallet. This command
is useful at the start of an application.
Syntax
PLT_SET_INDEX_STATUS_EMPTY (<PalletName>)
Parameters
<PalletName>: String, any valid pallet
Examples
PLT_SET_INDEX_STATUS_EMPTY ("PLT1")
See Also
PLT_SET_INDEX_STATUS, PLT_SET_INDEX_STATUS_FULL
PLT_SET_INDEX_STATUS_FULL
Description
This command defines the quantity of items to be full on a pallet. This
command is useful at the start of an application.
Syntax
PLT_SET_INDEX_STATUS_FULL (<PalletName>)
Parameters
<PalletName>: String, any valid pallet
Examples
PLT_SET_INDEX_STATUS_FULL ("PLT1")
See Also
PLT_SET_INDEX_STATUS, PLT_SET_INDEX_STATUS_EMPTY
POSITIONCOMMAND
Description
This property returns the position command generated by the motion profiler.
When an axis in the group is in following mode, the position command is set to
the value of the position feedback. An axis is in following mode when the drive
is disabled or when you explicitly put the axis in following mode using the
<axis>.FOLLOWINGMODE property.
NOTE
The coordinates are joint and not motor coordinates. The values are returned
after multiplication by the coupling matrix.
Short form
<element>.PCmd
Syntax
?<element>.PositionCommand
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
returns the position command generated by the motion profiler
?A1.PCmd
Robot
?SCARA.PCmd
See Also
ACCELERATIONCOMMAND, VELOCITYCOMMAND,
POSITIONFEEDBACK, POSITIONFINAL, POSITIONTOGO,
ACCELCMDCART, POSITIONCOMMANDHISTORY, START_JOINT
POSITIONCOMMANDHISTORY
Description
This property returns the history of position command generated by the motion
profiler. It can return position history buffer as a function of position error delay
value.
<element>.PositionErrorDelay= <NUM>
<element>.PositionCommandHistory[1]→ PCMD(t-1)
<element>.PositionCommandHistory[<NUM>] → PCMD(t-<NUM>)
NOTE
Querying on position history where t=0 should return the same value of
querying on PCMD. This is true only in case of querying from event or
recording. From terminal/user task it can’t be promised.
Short form
<element>.PCmdH
Syntax
?<element>.PositionCommandHistory[t]
Domain
ELEMENT
Parameters
< element >: valid motion element
?A1.PCmdH
Robot
?SCARA.PCmdh
See Also
POSITIONCOMMAND
POSITIONERROR
Description
This property returns the position following error, which is the difference
between position command and the position feedback. The calculation takes
the MOTION BUS delay into account, such that the position feedback is
subtracted from the command issued two cycles previously. It is calculated
every sample time and compared to maximum position error (PEMAX).
The calculation takes into account the position error delay, such that the
position feedback is subtracted from the command issued a number of cycles
previously, as defined in the POSITIONERRORDELAY property.
For Robot - Returns actual distance between position parts of SetPoint and
Here:
?A1.PE
Robot
?SCARA.PE
See Also
POSITIONERRORSETTLE
POSITIONERRORSETTLE
Description
This property defines the range in which the element is defined as settled.
When the motion profiler is complete, the absolute value of the position error
(Target Position - Actual Position) is compared to the PESETTLE value. When
the result is less than or equal to this value, for the time given by
TIMESETTLE, the ISSETTLED flag is set.
Short form
<element>.PESettle
Syntax
<element>.PositionErrorSettle = < expression >
?<element>.PositionErrorSettle
Domain
ELEMENT
Parameters
< element >: valid motion element
< expression > : the range in which the element is defined as settled , Double,
0 to MaxDouble
Limitations
To set the value within a task, the element must be attached to that task
(using the ATTACH command).
Examples
Axis
A1.PESettle =0.0144
Robot
SCARA.PESettle =0.0144
See Also
ATTACH, ISSETTLED, POSITIONERROR, STARTTYPE
POSITIONFEEDBACK
Description
This property returns the actual position of the element. The value is returned
as a vector of the respective axis positions.
NOTE
The coordinates are joint and not motor coordinates. The values are returned
after multiplication by the coupling matrix.
Short form
<element>.PFb
Syntax
?<element>.PositionFeedback
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
returns the actual position of the element
?A1.pfb
Robot
?SCARA.pfb
See Also
POSITIONCOMMAND
POSITIONFINAL
Description
This property returns the element target position.
For axis - The target position is set within the MOVE or CIRCLE motion
commands.
For group - This is a vector with a dimension equal to the number of axes in
the group.
Short form
<element>.PFinal
Syntax
?<element>.PositionFinal
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
returns the element target position
?A1.Pfinal
Robot
?SCARA.Pfinal
See Also
POSITIONCOMMAND, POSITIONTOGO, CIRCLE, MOVE
POSITIONTOGO
Description
This property returns the distance between commanded element position and
the final position..
Short form
<axis>.PToGo
Syntax
?<axis >.PositionToGo
Domain
AXIS
Parameters
< axis >: valid motion axis
Return Value
returns the distance between commanded element position and the final
position
POWER_OFF
Description
This command set the group disable. Power_off command should be used
after moving command.
Syntax
Power_off()
Examples
In task:
Program
Power_on()
Attach scara
Waitformotion scara
Detach scara
Power_off()
End program
See Also
POWER_ON
POWER_ON
Description
This command set the group enable. Power_on command should be use
before moving command.
Syntax
Power_on()
Examples
In task:
Program
Power_on()
Attach scara
Waitformotion scara
Detach scara
Power_off()
End program
See Also
POWER_OFF
PRINT
Description
Multiple strings and expressions are printed, separated by either a comma or
a semicolon.
The semicolon puts the two expressions next to each other while the comma
puts a tab between them. The semicolon at the end of the expression
suppresses CR-LF, allowing several print statements to be concatenated.
The message is printed to the output window of ControlStudio with the last
print statement printed without a semicolon at the end. Variables are
“watched” by simply querying them.
You can press the carriage return at the end of a line by terminating PRINT
with a semicolon.
The DetectOverflow parameter handles printouts that do not fit into the
internal message queue (64 messages).
When value is zero, these printouts are silently dropped and task is not
delayed. However, if DetectOverflow is “1” and there is no free space in the
print queue, task is stopped with run-time error. This optional flag defaults to
Zero when not used.
Short form
?
Syntax
PRINT <Expression> {, <Expression>}
Print "world."
Hello,world.
Or
Hello,world.
Or
Hello, world.
Or
Print "Hello,"
Print "world."
Hello,
world.
Or
Hello,world.
See Also
PRINTUSING, PRINTTOBUFF, PRINTUSINGTOBUFF, PRINTPOINT,
PRINT_HASH, PRINTPOINTUSING
PRINT_HASH
Description
Multiple strings and expressions are printed to a serial port, separated by
either a comma or semicolon.
The semicolon puts the two expressions next to each other, while the comma
puts a tab between them.
Syntax
PRINT #<DeviceHandle> <Expression>{, <Expression>}
PRINTPOINT
Description
PrintPoint prints only variables that were declared as a location.
The rest of the properties of this command are similar to PRINT command.
Syntax
PRINTPOINT < Expression >
Parameters
< Expression>: Location
Limitations
Variables defined within a task may be queried from outside the task (for
example, from the terminal) only when the task is idle.
Within a task, local variables are only available if the task is idled in a section
of code wherein the local variable was declared.
Examples
common shared PNT as Location of XYZR
PNT = #{0,0,0,0}
PrintPoint PNT
PNT = {0,0,0,0}
PrintPoint PNT
PRINTPOINTUSING
Description
Prints formatted numeric variables of type point, using the specified format
string. The format string contains literal text to be printed, as well as
characters for formatting numeric expressions.
# digital position
.decimal position
PNT = #{0,0,0,0}
PRINTTOBUFF
Description
Multiple expressions are printed to a buffer in the serial port, separated by
either a comma or semicolon.
The semicolon puts the two expressions next to each other, while the comma
puts a tab between them.
The value assigned to the optional Send parameter determines whether the
buffer content will be send to serial port at the end of the command (Send =
True) or stored in the buffer (Send = False).
PRINTUSING
Description
Prints formatted numeric variables, using the specified format string. The
format string contains literal text to be printed, as well as characters for
formatting numeric expressions.
# digital position
.decimal position
printu "#.################";My_Var
Only prints 15 digits, and not 16 as specified by the format string. Only 16
digits before the decimal point are displayed. The statement:
printu "#.#";1e15
Is printed as
100000000000000.0
While
printu "#.#";1e16
Is printed as
1.0e16
Examples
Specify a minimum number of characters to print by using the “#” sign and
decimal point.
B = 33.344
‘prints B IS 33.34
‘prints B IS 33.3440
‘prints B IS 3.33e+01
Another example:
Specifying the number of digits to print, prints data in tabular form since the
number of places printed does not vary with the value of the number:
PRINTUSING$
Description
Prints formatted numeric variables to a string type variable using the specified
format <string>.
The format string contains literal text to be printed as well as characters for
formatting numeric expressions.
Short form
PrintU$
Syntax
PrintUsing$<string_name>{[ ]}, <format_string>;
[<expression>];{[<expression>]}*
<format_string>: String
printu “#.################”;My_Var
Examples
Specify a minimum number of characters to print by using the “#” sign and
decimal point.
B = 33.344
?StSCARA
‘Prints “B is 33.34”
See Also
CLOSE, INPUT$, LOC, PRINTUSING
PRINTUSING_HASH-SIGN
Description
PRINTUSING #
Prints formatted numeric variables to a serial port using the specified format
<string>. The format string contains literal text to be printed as well as
characters for formatting numeric expressions. Only a single formatting string
(containing text and formatting characters) followed by the expressions to print
is allowed.
Short form
PrintU #
Syntax
PrintUsing #<DeviceHandle>, <format_string>;
[<expression>];{[<expression>]}*
Parameters
<DeviceHandle>: file handle, Long , 1 to 255
<format_string>: String
printu “#.################”;My_Var,
Examples
Specify a minimum number of characters to print by using the “#” sign and
decimal point. B = 33.344 PrintU #1 “B is ##.##”;B ‘prints B is 33.34
PRINTUSINGTOBUFF
Description
PRINTUSINGTOBUFF #
Prints formatted numeric variables to the serial port buffer by using the
specified <format_string>.
The format string contains literal text to be printed and characters for
formatting numeric expressions.
The value assigned to Send parameter determines whether the buffer content
will be send to serial port at the end of the command (Send = True) or stored
in the buffer (Send = False).
<format_string>: String
Limitations
Only 15 digits after the decimal point can be displayed. The statement, printu
“#.################”;My_Var,
Examples
PrintUToBuff #1 “B is ##.##”;B
See Also
CLOSE, PRINTUSING, PRINT
PROCEED
Description
This command is required to continue executing motion after that motion had
been stopped by a STOP command from a different context.
Thus PROCEED is not required when the STOP command appears in the
same task as the move commands, but it is required when the STOP
command is issued by a task other than the one moving the axis or group.
<proceed type> can be:
1 (Continue)
2 (NextMotion)
3 (ClearMotion)
Syntax
Proceed <group | axis> {ProceedType=<proceed type>}
Parameters
<robot | axis>: any valid robot or axis
PROCEEDTYPE
Description
This property defines the action to be taken by the PROCEED command. It
can be set as a permanent value (modal), or it can be used within (nodal) a
PROCEED command to temporarily override the permanent value.
1 (CONTINUE) – Continue with stopped motion. In case there are two motions
in the buffer it executes both (one that was executed and one that was pending
while the STOP command was issued).
4 (INTERRUPTED) - Execute only the interrupted motion but not the pending
one (Note: program will not continue, in order to release the waiting program
you need to issue PENDING option)
5 (PENDING) - Execute the pending motion and release the waiting task. (Note:
can be issue only after INTERRUPTED option has been executed.)
Syntax
<element>.ProceedType = <expression>
? <element>.ProceedType
Domain
ELEMENT
Parameters
< element >: valid motion element
A1.ProceedType = Continue
?A1.ProceedType
Proceed A1 ProceedType=Next
Robot
SCARA.ProceedType = Continue
?SCARA.ProceedType
PROGRAM_..._END_PROGRAM
Description
The PROGRAM…END PROGRAM keywords are used to delimit the main
section of code in a task.
Task variables, defined using DIM SHARED, must appear before the Program
keyword. Local variables (defined using DIM alone), appear after the Program
keyword, but before the code. Subprograms must appear after the End
Program keywords.
When a program is loaded into memory (using the LOAD command), it does
not start executing until the STARTTASK command is executed.
When a task reaches End Program, it stops running, but remains loaded in
memory. End Program may be replaced by Terminate Program.
In this case, the task is automatically unloaded from memory when it finishes.
Syntax
Program
<code to execute>
End Program
Examples
Dim Shared vaSCARA as Long
Program
Dim I As Long
for I = 1 to 10
vaSCARA = vaSCARA + 1
Next I
End Program
See Also
SUB_..._END_SUB, FUNCTION_..._END_FUNCTION,
WHILE_..._END_WHILE, FOR_..._NEXT, TRY_..._END_TRY, DO_..._LOOP,
WITH, WITHGLOBAL, REM, IF_..._THEN_..._ELSE, SELECT_..._CASE,
CALL
PULSE
Description
The PULSE command is used to output a pulse wave signal. Only the digital
output type signal variable can be used in the command. You can set the
pulse width from 100 to 30000 milliseconds.
NOTE
This command is non-blocking and can be executed simultaneously with up to
8 pulse signal operations. Therefore, you need to pay attention to avoid using
the PULSE command when there are 8 pulse wave operations being
executed.
Syntax
PULSE <digital io signal> PVALUE = <pulse value> PWIDTH = <pulse width>
Parameters
<digital io signal>: Signal, digital output signal defined by user
<pulse value>: Long, On/ Off (1/ 0), to set the type of the pulse wave
<pulse width>: Long, 100 to 30000 ms, to set the width of the pulse wave
Examples
PULSE signal PVALUE = on PWIDTH = 500
See Also
GETIO , SETIO
RECORD
Description
This command is used to arm (not trigger) data recording.
Data are recorded into the specified file, which is then retrieved for viewing.
The record file must always have the extension REC. The recorded data file is
stored on RAM drive, so the file is lost after power off.
NOTE
Data are recorded in realtime, so complex expressions add to the system
load. Recording of expressions containing strings, points or structures may
result in an overlap error, due to memory allocation processes. RECORD only
defines the data to be recorded.
setting negative value for number of points will result in activating continuous
recording. Same as setting RingBuffer to ON.
Syntax
RECORD <record file name> <number of points> {Gap = <record gap>}
{RingBuffer = <ON|OFF>}RecData = <expression>{, <expression>}
Parameters
<record file name>: File specification, including file name and extension. Any
filename extension must be REC
1 = ON
0 = OFF
<record gap>: Long, Sample Period, unit is millisecond, 1 to 64, specifies the
number of EtherCAT cycles between samples
RecordOn
RecordOff
RecordClose
See Also
RECORD$, RECORDCLOSE, RECORDING, RECORDOFF, RECORDON
RECORD$
Description
This command is used to arm (not trigger) data recording.
Data are recorded into the specified file, which is then retrieved for viewing.
The record file must always have the extension REC. The recorded data file is
stored on RAM drive, so the file is lost after power off.
NOTE
Data are recorded in realtime, so complex expressions add to the system
load. Recording of expressions containing strings, points or structures may
result in an overlap error, due to memory allocation processes. RECORD only
defines the data to be recorded.
1 = ON
0 = OFF
RecordOn
RecordClose
RecordOn
254 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024
MC-Basic Commands 2.7
RecordClose
See Also
RECORD, RECORDCLOSE, RECORDING, RECORDOFF, RECORDON
RECORDCLOSE
Description
This command closes the record data file and enables it to be retrieved.
You must issue this command before the next RECORD command is issued.
Syntax
RecordClose
Limitations
Write only
Examples
RecordClose
See Also
RECORD, RECORDING, RECORDOFF, RECORDON, RECORD$
RECORDING
Description
This query returns the state of the data recorder. The following values are
returned:
RECORDOFF
Description
The recording action is stopped using this command or if the specified number
of points have been recorded.
Syntax
RecordOff
Limitations
Write only
Examples
RecordOff
See Also
RECORD, RECORDCLOSE, RECORDING, RECORDON, RECORD$
RECORDON
Description
This command starts the recording process.
Syntax
RecordOn
Limitations
Write only. The data to be recorded must be defined using the RECORD
command.
Examples
RecordOn
See Also
RECORD, RECORDCLOSE, RECORDING, RECORDOFF, RECORD$
RECOVERPATH
Description
This command is used to recover the motion commands stored by the
STOPPATH. The stored motion commands will start executing after the
current motion command is completed.
RECOVERPATH will start running from the current motion commands stored
in STOPPATH.
RECOVERPATH should be used after reaching the DEPPOINT and with the
same arm configuration.
Short form
RecoverPath
Syntax
RecoverPath < robot | axis>
Parameters
< robot | axis>: any valid robot or axis
Limitations
Write only
Examples
RecoverPath SCARA
See Also
CONTINUEPATH,
REM
Description
Comments are freely inserted into code, either as individual lines or at the end
of a line of code.
Comments begin with either the REM keyword or with the apostrophe
character (’), and end with the end of the line.
Short form
'
Syntax
REM <comments>
Parameters
< comments >: String, Comments.
Limitations
The maximum length of a line is 16,384 characters.
Examples
REM This is a comment line
RESETPEAKVALUE
Description
Clear peak torque and peak velocity error of all axes.
Syntax
RESETPEAKVALUE()
Examples
RESETPEAKVALUE()
See Also
SETVELERRTHRESHOLD, COLLISIONDETECT, DRIVETORQUELIMIT,
PEAKTORQUE, PEAKVELERR, VELERRTHRESHOLD,
SETDRIVETORQUELIMIT, SETDEFVELERRTHRESHOLD
RIGHT$
Description
RIGHT$ returns the specified number of characters from the right-hand side of
the string.
Syntax
RIGHT$(<string>,<expression>)
Parameters
<string>: String
PRINT RIGHT$(Test,4)
ROUND
Description
Rounds the argument to the nearest even whole number so the cumulative
error in a random sample is never more than 0.5. For example:
VaSCARA = Round(Var2)
See Also
INT
RTRIM$
Description
RTRIM$ returns the left-hand part of a string after removing any blank spaces
at the end.
Syntax
RTRIM$(<string>)
Parameters
<string>: String
Return Value
returns the left-hand part of a string after removing any blank spaces at the
end
SELECT_..._CASE
Description
This decision construct enables one of a number of code sections to be
executed, depending on the value of a <SelectExpression>.
On the first line of a CASE block of commands, you specify the variable or
expression you want tested.
After you have specified the variable or expression, list one or more values or
value ranges that the variable can take.
There are four ways you can specify cases: Exact Value, Logical Condition,
Range, Else.
The flow control structure is preferred to IF…THEN when there are many
execution paths based on the value.
If you use the TO keyword to indicate a range of values, the smaller value
must appear first.
If the first expression is greater than the second, the CASE statement is
ignored and no error is flagged.
If CASE ELSE is used, its associated statements are executed only if the
<SelectExpression> does not match any of the other CASE selections.
Syntax
SELECT CASE <SelectExpression>
{CASE <expression>
{statement_list} }
{statement_list} }
{statement_list} }
{statement_list} }
{CASE ELSE
266 / 415 | www.kuka.com MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024
MC-Basic Commands 2.7
{statement_list} }
END SELECT
Parameters
< SelectExpression >: variable or const Double, Long, String
Select Case I
Case 0
Case is >= 10
Case 5 To 10
Case Else
End Select
See Also
IF_..._THEN_..._ELSE, PROGRAM_..._END_PROGRAM
SELECTAXES
Description
Select which of the target coordinates will be taken, and which not (those with
the corresponding bit value set to zero). The value is a bit-field defining the
axes that will be involved in the movement. (1 – axis is taken). Used when
there is a need to disengage movement of some axis throughout the system.
For example:
<value>: Long, 1 to 15
Limitations
Valid for groups only.
Examples
SCARA.selectaxes = 1+2
Move SCARA {10,20,30,40} saxes = 1+2 ‘only first two axes move
Move scara {10,20,30,40} saxes = 1+2+4 ‘ only first three axes move
See Also
MOVE
SELECTBASE
Description
This command can be used to switch base frame in program. The selected
base frame should be predefined. It will overwrite the global base frame
setting in this program.
NOTE
This command can be used in attach …. Detach program segment, and when
frames are changed, TCP may suddenly change. Therefore, you should make
sure your Motion Target is correct!
Syntax
SelectBase (<BaseFrame>)
Parameters
< BaseFrame >: String, any valid Base Frame
Examples
SelectBase (“BASE1”)
See Also
BASE, SELECTTOOL, SELECTUSERFRAME, SETWORKSPACE
SELECTTOOL
Description
This command can be used to switch tool frame in program. The selected tool
frame should be predefined. It will overwrite the global tool frame setting in
this program.
NOTE
This command can be used in attach …. Detach program segment, and when
frames are changed, TCP may suddenly change. Therefore, you should make
sure your Motion Target is correct!
Syntax
SelectTool (<ToolFrame>)
Parameters
< ToolFrame >: String, any valid Tool Frame
Examples
SelectTool (“TOOL1”)
See Also
TOOL, SELECTBASE, SELECTUSERFRAME, SETWORKSPACE
SELECTUSERFRAME
Description
This command can be used to switch user frame in program. The selected
user frame should be predefined. It will overwrite the global user frame setting
in this program.
NOTE
This command can be used in attach …. Detach program segment, and when
frames are changed, TCP may suddenly change. Therefore, you should make
sure your Motion Target is correct!
Syntax
SelectUserFrame (<UserFrame>)
Parameters
< UserFrame >: String, any valid User Frame
Examples
SelectUserFrame (“US1”)
See Also
USERFRAME, SELECTBASE, SELECTTOOL, SETWORKSPACE
SETDEFVELERRTHRESHOLD
Description
This command can be used to set default velocity error threshold, which is
used as trigger condition of collision detect.
NOTE
Until: peak velocity error percentage. Use default error value, collision detect
effect is under performance, measured value is recommended.
Syntax
SetDefVelErrThreshold ()
Examples
SetDefVelErrThreshold ()
See Also
RESETPEAKVALUE, SETVELERRTHRESHOLD, COLLISIONDETECT,
DRIVETORQUELIMIT, PEAKTORQUE, PEAKVELERR,
VELERRTHRESHOLD, SETDRIVETORQUELIMIT
SETDRIVETORQUELIMIT
Description
This command can be used to set maximum drive torque value.
NOTE
Unit: maximum drive torque percentage
Syntax
SetDriveTorqueLimit (<LimitJ1>, < LimitJ2>,< LimitJ3>,< LimitJ4>)
Parameters
< LimitJ1>: double, range[1-100]
SETTOOL
Description
This command can be used to set tool frame in program. The selected tool
frame should be predefined. It will overwrite the global tool frame value.
NOTE
When tool frames are changed, TCP may suddenly change. Therefore, you
should make sure your Motion Target is correct!
Syntax
SetTool (<ToolFrame>, <location>)
Parameters
< ToolFrame >: String, any valid Tool Frame
SETUSERFRAME
Description
This command can be used to set a user frame in the program. The selected
user frame can be redefined, and its value can override the value of the global
user frame system.
NOTE
TCP will change when the user frame is changed. Therefore, you should
make sure whether the motion target is correct.
Syntax
SetUserFrame (<UserFrame>, <location>)
Parameters
< UserFrame >: String, any valid User Frame
SEMAPHOREGIVE
Description
SEMGIVE releases a semaphore.
If the semaphore was taken before, it is marked as a free semaphore and any
task may take it by using the SEMTAKE command.
If the semaphore was already free, its status does not change.
In task1:
semTake(SEM1)
globalVariable = globalVariable + 1
sleep(1000)
In task2:
Sleep(100)
Sleep(10)
End While
globalVariable = globalVariable + 1
SEMAPHORESTATE
Description
SEMSTATE returns the semaphore status: 1 , if the semaphore is taken
before (busy) or 0 , if the semaphore is released .
?SemState(sem1)
?SemTake(sem1)
?semstate(sem1)
SemGive(sem1)
?SemState(sem1)
SEMAPHORETAKE
Description
SEMTAKE acquires a semaphore that can be used for multi-task
synchronization.
<timeout>: 0 to 5000
Return Value
returns 1 and the semaphore is marked as ‘taken’
Sleep(10)
End While
Or
semTake(SEM1 , 100 )
See Also
COMMON_SHARED_..._AS_SEMAPHORE, SEMAPHORESTATE
SETIO
Description
Set value for signal.
Syntax
<signal_name > = <value >
Domain
IO
Parameters
<signal_name>: name of signal
SETPOINT
Description
Returns the commanded robot Cartesian coordinates.
This variable is computed each sampling period from the motor command
position or according to the current interpolation type. Equals
TOCART(PCMD). It is a counterpart of HERE.
Syntax
<point_variable> = <robot_name>.setpoint
? <robot_name>.setpoint
? <axis_name>.setpoint
Domain
ROBOT
Parameters
<robot_name>: any valid robot
? Scara.SetPoint
See Also
START
SETARM
Description
Set the arm configuration of the location point.
Note
TCP may change when the arm configuration of a point is changed.
Therefore, it is necessary to confirm again whether the motion endpoint is
correct.
Syntax
SetArm(< Location >,< Arm >)
Parameters
<Location >: location of xyzr
SETWORKSPACE
Description
This command sets the specify workspace enable or disable.
Syntax
SetWorkSpace (<WorkSpaceFrame>, <BoolValue>)
Parameters
< WorkSpaceFrame >: String, any valid Work Space Frame
SGN
Description
This function returns the sign of the expression.
I = SGN(Var2)
SHL
Description
SHL is a bit operator. SHL (shift left) shifts each bit in <Number> N places to
the left. N zeros are shifted into the N rightmost positions.
Syntax
<Number> SHL <N>
Parameters
<Number>:Long, - MaxLong to MaxLong
<N>: Long, 0 to 31
Return Value
<return value>: Long
Examples
?16 SHL 3
SHR
Description
SHR is a bit operator. SHR (shift right) shifts each bit in <Number> N places to
the right. The N rightmost bits are lost.
Syntax
<Number> SHR <N>
Parameters
<Number>:Long, - MaxLong to MaxLong
<N>: Long, 0 to 31
Return Value
<return value>: Long
Examples
?16 SHR 3
SIMULATED
Description
This property is used to define the axis mode of operation as simulated or
real. In simulated mode, motion commands are not sent to the drives as the
axis is not associated with a physical drive. Simulated axes need to be
enabled (using <axis>.ENABLE=ON) before a motion command is applied.
0 (Real)
1 (Simulated)
Syntax
<axis>.Simulated = <expression>
?<axis>.Simulated
Domain
AXIS
Parameters
<expression>: Long, 0 or 1
Limitations
Can only be set during MOTION BUS communications phase 0.
Examples
A1.Simulated=1
SIN
Description
This function returns the sine of an angle in radians.
Syntax
SIN(<expression>)
Parameters
<expression>: any valid expression , Double
± 9.223372036853900e+18
Return Value
returns the sine of an angle in radians
Limitations
Read only
Examples
?Sin (3.14159/2)
VaSCARA = Sin(3.14159)
See Also
ASIN, COS, TAN
SIZE
Description
This function returns the number of bytes taken up by the input string.
?SIZE (UTF$(0xC4))
SLEEP
Description
This command delays the task to start after the specified time period (in
milliseconds).
The delay command will start when the previous command is completed.
SMOVE
Description
SMOVE performs a spline path motion that moves the robot from a given point
to a target point in the world space.
The parameters of the motion are: vtran, atran, dtran, vrot, arot, drot.
The permanent value is overridden during the duration of the SMOVE. The
length of the given point array should be between 3 to 256. The SMOVE
command does not support blending transitions with other motion commands,
nor does it support the until function. The WithPLS command can be used
with SMOVE. In addition, SMOVE supports PLS triggered by index.
Please distribute the points evenly in both distance and orientation. The
following points distribution behaviors should be avoided:
Small angles between two points or two points are in opposite directions.
If the above principles are not met, the SMOVE motion may result
unpredictable path and cause speed jump during motion.
Please check the generated path at low speed to make sure it won’t collide
with the environment. If the given points are modified, please verify again
whether the generated path is safe.
Pleased note the points which are too close to the last point will be
automatically excluded.
standard.
SPACE$
Description
SPACE$ generates a string consisting of the specified number of blank
spaces.
Syntax
SPACE$(<number>)
Parameters
<number>: Long
Return Value
<return value>: String
Limitations
Read only
Examples
Test = “First” + Space$(10) + ”Next”
?Test
SQRT
Description
This function returns the square root of the numeric expression.
Syntax
SQRT(<expression>)
Parameters
<expression>: Double, Greater than or equal to zero
Return Value
returns the square root of the numeric expression
Limitations
Read only
Examples
?Sqrt (VaSCARA)
VaSCARA = Sqrt(Var2)
START
Description
Retrieves the current initial point of the movement in Cartesian coordinates.
If the group was stopped either by the STOP command, the initial point of the
stopped (canceled) movement is returned.
Syntax
<point_variable> = <element>.start
? Scara.Start
See Also
SETPOINT
START_JOINT
Description
Retrieves the current initial point of the movement in joint coordinates.
If the group was stopped either by the STOP command, the initial point of the
stopped (canceled) movement is returned.
Syntax
<point_variable> = < element >.start_joint
? Scara.Start_Joint
See Also
POSITIONCOMMAND
STARTTYPE
Description
This property determines the point in time at which the next motion command
begins. It is relevant when a motion command is issued while a previous
motion command is still being executed. The INPOSITION option is the most
stringent condition for motion completion.
The INPOSITION option is the most stringent condition for motion completion.
This property is used inside a motion command to override the permanent
value.
NOTE
Use IMMEDIATE and SUPERIMMEDIATE on single axis motion, usage in
groups/robots can lead to undesired effects (jumps).
Syntax
<element>.StartType = <expression>
?<element>.StartType
Domain
ELEMENT
Parameters
< element >: valid motion element
A1.Strattype - InPosition
SCARA.StartType = InPosition
STATE
Description
This query returns a Long value, indicating the state of the event task.
1: Running (TASK_RUNNING)
STATUS
Description
This query returns the status of an event that is loaded in memory. The
information returned will be in the following format:
State <state>: <description> Error <last error number> Source <line of source
code> Owner: <calling task>
1: Running
STOPPATH
Description
This command is used to stop the current motion of the bound robot and axis.
The current and Pending motion commands will be stored. After STOPPATH
is executed, the user task will not be blocked. Following motion command will
automatically start executing in the user program.
STOP
Description
This command stops the group or axis motion. If the StopType is not
specified, the permanent value of StopType is used. This command stops a
slave axis and clears it from being a slave (the SLAVE property is set to 0). To
stop all system elements simultaneously, set SYSTEM.MOTION to 0. Motion
is inhibited until SYSTEM.MOTION is set back to 1.
In case there exist another pending motion (waiting in the motion buffer), it will
be stored and not executed. If the STOP is issued from another instance
(another task or terminal-window) proceeding new movements is only possible
after issuing PROCEED command.
In case there exist another pending motion (waiting in the motion buffer), it will
be stored and not executed. If the STOP is issued from another instance
(another task or terminal-window) proceeding new movements is only possible
after issuing PROCEED command.
In case there exist another pending motion (waiting in the motion buffer), it will
be stored and not executed. If the STOP is issued from another instance
(another task or terminal-window) proceeding new movements is only possible
after issuing PROCEED command.
In case there exist another pending motion (waiting in the motion buffer), it will
be stored and not executed. In order to proceed with other motions, the
PROCEED command is NOT NEEDED.
In case there exist another pending motion (waiting in the motion buffer), it will
be stored and not executed. If the STOP is issued from another instance
(another task or terminal-window) proceeding new movements is only possible
after issuing PROCEED command.
NOTE
STOP does not directly effect task execution. It stops motion, but does not
stop task execution.
Short form
Stop
Syntax
Stop < robot | axis> {StopType=<stop type>}
Parameters
< robot | axis>: any valid robot or axis
Stop A1 StopType=EndMotion
See Also
PROCEED
STR$
Description
STR$ returns the string representation of a number.
Syntax
STR$(<number>)
Parameters
<number>: Double, 0 to MaxDouble
Return Value
returns the string representation of a number
PRINT STR$(i1)+"A"
STRD$
Description
STRD$ returns the string representation of a double-type number.
NOTE
If an invalid format string is used, the behavior is undefined.
Syntax
STRD$(<number>, <format_string>)
Parameters
<number>: Double, Long, MinDouble to MaxDouble
%f - a non-exponential display
PRINT STRD$(45.5,"%e")
PRINT STRD$(45.5,"%g")
STRING$
Description
STRING$ produces a new string with the specified number of characters.
Each character is the first character of the specified string argument or the
specified ASCII code.
NOTE
The ASCII code set comprises 256 codes (0 to 255). If the specified <ascii
code> is greater than 255, <ascii code> is evaluated modulo 256 and the
remainder is used as the ASCII code.
Syntax
STRING$(<number>,<string>)
STRING$(<number>,<ascii code>)
Parameters
<number>: Long
<string>: String
STRL$
Description
STRL$ returns the string representation of long-type number.
NOTE
A double-type input is implicitly converted to long
%u - unsigned decimal
%o - octal
%x, %X - hexadecimal
%c - unsigned char
Return Value
returns the string representation of long-type number
PRINT STRL$(60,"%o")
PRINT STRL$(60,"%x")
PRINT STRL$(60,"%c")
SPLITSTR$
Description
Split a string using a specific delimiter.
Syntax
SplitStr(<string>, <split>,sOutput[*])
Parameters
< string >: string, the string that needs to be split.
?SplitStr(“100,200,300”,”,”,sOutput)
Return 3
?sOutput[1] = “100”
?sOutput[2] = “200”
?sOutput[3] = “300”
?SplitStr(“100,200,300”,”,”,sOutput)
Return 2
?sOutput[1] = “100”
?sOutput[2] = “200,300”
?SplitStr(“100,200,300”,”:”,sOutput)
Return 1
?sOutput[1] = “100,200,300”
See Also
MID$, RIGHT$, LEFT$
STRUCTURE_TYPE_DEFINITION
Description
Because a structure is a new data type, it must first be defined.
Only then the name of the new data type structure can be used to declare a
structure variable.
Structure data type definition can be done within the declarations part of the
config.prg file (before the PROGRAM block), or a library file (before the first
function block). This block defines names, types and array sizes of structure
elements.
The different types that are supported for the structure are the following: long,
double, string, joint and location, generic axis, generic group, semaphore, user
error and user note.
User error and note structure elements are generic, i.e., should be assigned to
acquire error number and message.
Syntax
TYPE <structure_type_name>
END TYPE
Parameters
<structure_type_name>: type name
Changes in type definition are not allowed during reloading of the library.
Examples
Type ST
End Type
'usage
dim st1 as ST
st1->DblElem = 0.1
SUB_..._END_SUB
Description
Defines a library subroutine that can be called from local task. If use Keyword
Public as prefix of SUB..END SUB, subroutines will be in a global action
scope and can be called from any other tasks.
Syntax
{Public} SUB <name> ({{ByVal} <p_1> as <type_1>}…{, {ByVal} <p_n> as
<type_n>})
{subroutine code}
END SUB
Parameters
{Public}: Optional keyword that specifies the scope of subroutines.
move a1 1 abs = 0
Next Index
End Sub
See Also
CALL, FUNCTION_..._END_FUNCTION, PROGRAM_..._END_PROGRAM
SYSTEM.ERROR
Description
Query the last system error message. This command returns an error
message which includes the error number.
?System.Error
Domain
SYSTEM
Return Value
returns an error message which includes the error number
Limitations
Read only
SYSTEM.MOTION
Description
SYSTEM.MOTION must be 1 (ON) for any motion command to be executed
successfully. The status of motion is terminated by the motion profiler.
The motion flag for each axis must also be ON for a motion command to be
executed.
Syntax
Sys.Motion = <value>
System.Motion = <value>
?Sys.Motion
?System.Motion
Domain
SYSTEM
Parameters
<value>: Long, 0 or 1
0 = OFF
1 = ON
Limitations
The SYSTEM.MOTION flag is set to zero by the default system error handler.
When this occurs, the SYSTEM.MOTION flag can be reset to 1 only from the
terminal.
Examples
System.Motion = On
See Also
MOVE, MOTION
TAN
Description
This function returns the tangent of an angle given in radians.
Syntax
TAN(<expression>)
Parameters
<expression>: any valid expression, Double, ± MaxDouble
Return Value
returns the tangent of an angle given in radians.
Limitations
Read only
Examples
?Tan (3.14159/2)
VaSCARA = Tan(3.14159)
See Also
ATAN2, ATN, COS, SIN
TASKERROR
Description
Prints textual description of the last error, occurred in the task.
Syntax
?TaskError ( <task name> )
Parameters
<task name>: String
Return Value
returns textual description of the last error, occurred in the task.
Or
StSCARA = “Task1.Prg”
?TaskError( StSCARA)
See Also
ERROR
TASKERRORNUMBER
Description
Prints the number of the last error that occurred in the task.
Syntax
?TaskErrorNumber ( <task name> )
Parameters
<task name>: String
Return Value
returns the number of the last error that occurred in the task.
Or
StSCARA = “Task1.Prg”
?TaskErrorNumber( StSCARA)
See Also
TASKERROR
TASKID
Description
This query returns a Long value, indicating the unique task identification
number .
May be queried as from another task context , as from the same task.
In case of query from the same task the task name is unnecessary.
Syntax
?<task>.TASKID
?TASKID
Domain
TASK
Parameters
<task>: name of task in memory
Return Value
return a Long value, indicating the unique task identification number
0x7B6CEE0
program
? TaskID hex
end program
TASKLIST
Description
Lists the names and states of loaded tasks. Each has the following format:
Task state:
1:Running
2:Stopped
4:Error
5:Terminated
6:Step-over mode
Also task may be "+Locked" in addition to the above states .The task priority
ranges from 1 through 16. The highest priority is 1.
The FileName field is displayed only when the task was loaded with a different
name from its original file name, using the Loas$…As command.
Syntax
?TaskList
Return Value
returns the names and states of loaded tasks.
TaskName=TP_ALIVE.PRG,State=Running,Priority=1
TaskName=RBT_CFG.PRG,State=Killed,Priority=16
TaskName=MCU.PRG,State=Running,Priority=16
GlobalLibraryName=UTILS.LIB
GlobalLibraryName=I18N.LIB
See Also
PLSLIST, AXISLIST, GROUPLIST, VARLIST, MAINFILENAME, VARLIST$
TASKSTATE
Description
This query returns a Long value, indicating the state of the task. There are two
conditions in which the regular task state is modified:
In this case, the value 256 (0x100) is added to the regular task state. This
could occur when a task has three moves, one after the other. The interpreter
is waiting to execute the second move until the first has completed.
If you enter a STOP command from the terminal, the task remains in the
Running mode.
Enter the IDLETASK command from the terminal and the task switches to a
Stopped and Locked state. It is locked because it is waiting for the Proceed
command to resume motion.
A task is interrupted by either OnEvent or OnError. In this case, the value 512
(0x200) is added to the regular task state.
1: Running (TASK_RUNNING)
5: Terminated
9:Task Kill Start . It's a first state of task termination procedure, after successful
If the task is interrupted by an event, the task state has the value 512 added to
it. If the task is Locked, the task state has the value 256 added to it.
Syntax
?TaskState (<task name> )
Parameters
<task name> : String
Return Value
returns a Long value, indicating the state of the task
Or
StSCARA = “Task1.prg”
?TaskState(StSCARA)
See Also
TASKSTATUS, ELEMENTSTATUS
TASKSTATUS
Description
This query returns the status of a task that is loaded in memory. The
information returned will be in the following format:
State <state>: <description> Error <last error number> Source <line of source
code> Main program <line of source code>
1: Running
5: Terminated.
1. Terminate program
2. Unload
State <state>: <description> Error <last error number> Source <line of source
code> Main program <line of source code>
Limitations
The task must be loaded in memory.
Examples
Dim Shared MyTask as string = "<TaskName.PRG>"
?TaskStatus(MyTask)
See Also
TASKSTATE
THROW
Description
Assert an application exception. Error name is the user-defined exception
name. If error name is not specified, last error occurring in the task will be
asserted.
Syntax
Throw <error name>
Parameters
< error name >: error name
Limitations
Only the exception name is accepted as the argument.
Examples
Throw myerror
TIME
Description
This command queries or sets the current time of day.
Hours, minutes, and seconds are each specified using two digits. The System
uses 24 hour clock notation.
Syntax
Sys.Time = “<hours>:<minutes>:<seconds>”
System.Time = “<hours>:<minutes>:<seconds>”
Domain
SYSTEM
Parameters
String
<hours>: 00 to 23
<minutes>: 0 to 59
<seconds'>: 0 to 59
Examples
System.Time = “15:15:25” ‘set time to 15:15:25
TMOUT
Description
This command queries if WAIT command timeout in current task.
Syntax
? Sys.Tmout
Domain
SYSTEM
Parameters
None
Return Value
Return status that if WAIT command timeout in current task. TRUE-time out,
FALSE-No timeout
Examples
WAIT Signal1 = on tmout = 1000
? Sys.Tmout
TOASCII8$
Description
Converts the UTF-8 coding format of the input string into the ASCII-8 coding
format. Symbols located outside ASCII-8 range (Unicode value higher than
0xFF) are replaced by question marks.
Syntax
? TOASCII8$(<string>)
Parameters
<string>: string, UTF-8 coding format
Return Value
Returns the ASCII-8 coding format string
? TOASCII8$(UTF8Str)
See Also
TYPEOF
TOCART
Description
Converts a joint point to a location point. The Direct Kinematics function
implementation. Input parameters:
<Robot> = name of the group for which the direct kinematics is computed, when
a WITH command is executed, this argument is not needed (the comma can
also be omitted).
TOJOINT
Description
Converts a location point to a joint point the inverse kinematics function
implementation.
Input parameters:
<Robot>
name of the group for which the direct kinematics is computed, when a WITH
command is executed this argument is not needed (the comma should also be
omitted).
<Location>
<configuration>
integer describing the configuration of the returned joint position (for SCARA it is
the same as ARMCMD or ARMFBK).
The number and type of configuration flags depend on each robot type.
Note that robot properties ARMCMD, ECMD, WCMD have all three values(0,
1, 2), where 0 is reserved for AUTO option.
The configuration bits however have only two values (0, 1).
Arm (Bit 0)
The values of the configuration argument (the long type parameter) can be
TOOL
Description
Tool is a Robot property which informs the system to use the specified
location as the tool transformation.
It defines the position and orientation of the tool tip in relation to the center of
the tool flange.
?Scara.UserFrame:WorkPiece:Base:Tool
{90 , 90 , 90 , 180}
See Also
BASE, USERFRAME, WORKPIECE, SELECTTOOL
TORQUEADDCOMMAND
Description
Axis additive torque command value.
Short form
<axis>.TAddCmd
Syntax
?<axis>. TORQUEADDCOMMAND
Domain
AXIS
Parameters
< axis >: any valid axis
Return Value
Returns the axis additive torque command value
<return value>:
?A1.TAddCmd
See Also
TORQUEFEEDBACK, TORQUEERROR, OPMODE
TORQUECOMMAND
Description
element torque command value
Short form
<element>.TCMD
Syntax
?<element>. TORQUECOMMAND
Domain
ELEMENT
Parameters
<element>: any valid motion element
Return Value
Returns the element torque command value
<return value>:
Group - Point
?A1.TCMD
Robot
?SCARA. TCMD
See Also
TORQUEFEEDBACK, OPMODE
TORQUEERROR
Description
Axis torque error value. The real-time (on-line) difference between
TorqueAddCommand and TorqueFeedback.
<return value>:
?A1. TE
See Also
TORQUEFEEDBACK, TORQUEADDCOMMAND, OPMODE
TORQUEFEEDBACK
Description
element torque feedback value
Short form
<element>.Tfb
Syntax
?<element>. TORQUEFEEDBACK
Domain
ELEMENT
Parameters
<element>: any valid motion element
Return Value
Returns the element torque feedback value
<return value>:
Group - Point
?A1.Tfb
Robot
?SCARA. Tfb
See Also
TORQUECOMMAND, TORQUEERROR, TORQUEADDCOMMAND,
OPMODE
TORQUEGEARCOMMAND
Description
This property returns the calculated torque acting on the gearbox output shaft,
subtracting the friction torque and rotor inertia torque reflected to the gearbox
output shaft. The calculation is based on the dynamic model used to calculate
the additive torque command.
Short form
<element>.TGCmd
Syntax
?<element>.TORQUEGEARCOMMAND
Domain
ELEMENT
Parameters
< element >: any valid motion element
Return Value
Returns the calculated torque acting on the gearbox output shaft
<return value>:
Group - Point
?A1.TGCmd
Robot
?SCARA.TGCmd
See Also
TORQUEGEARFEEDBACK, OPMODE
TORQUEGEARFEEDBACK
Description
This property returns the torque acting on the gearbox output shaft,
subtracting the friction torque and rotor inertia torque reflected to the gearbox
output shaft. The calculation is based on the dynamic model used to calculate
the counterpart property TorqueGearCommand, but uses feedback instead of
command values.
Short form
<element>.TgFbk
Syntax
?<element>.TorqueGearFeedback
Domain
ELEMENT
Parameters
< element >: any valid motion element
Return Value
Returns the calculated torque acting on the gearbox output shaft
<return value>:
Group - Point
?A1. TgFbk
Robot
?SCARA. TgFbk
See Also
TORQUEGEARCOMMAND, OPMODE
TOTALTIME
Description
Returns the total time of the motion currently being executing.
Values:
-1 – No motion active.
?A1.totaltime
Robot
?SCARA.totaltime
TOUTF8$
Description
Converts the ASCII-8 coding format of the input string into the UTF-8 coding
format.
Syntax
? TOUTF8$(<string>)
Parameters
<string>: string, ASCII-8 coding format
Return Value
Returns the UTF-8 coding format string
? TOUTF8$(ASCII8Str)
See Also
TYPEOF
TRY_..._END_TRY
Description
TRY…END TRY is used to trap synchronous errors.
A synchronous error is one caused by the user task and detected by the
interpreter.
This type of error is associated with a specific line of program code in the
user-defined task.
The TRY block is used to take specific action with relation to a particular area
of the program code. It may be used within an OnError or OnSystemError
block.Can catch user errors using .num property of User Error.
NOTE
If the catch clause throws itself again, it should not be caught by "Catch Else"
or "Finally"instructions.
Syntax
Try ‘ Start of Try block
{Catch <MyError.num>
{Catch Else
{Finally
program
try
catch 8001
catch appErroSCARA.num
end try
end program
See Also
ONERROR, PROGRAM_..._END_PROGRAM
TYPEOF-ROBOT
Description
Returns the group model:
Syntax
<point_variable> = <robot_name>.typeof
? <robot_name>.typeof
Domain
ROBOT
Parameters
<robot_name>: any valid robot
Return Value
Returns the group model
<point_variable>: Long
Examples
? Scara.Typeof
TYPEOF
Description
This function returns a number representing the type of the string (0 for no-
type, 1 for ASCII-8, or 2 for UTF-8).
Syntax
TYPEOF(<string>)
Parameters
<string>: String
Return Value
returns a number representing the type of the string (0 for no-type, 1 for
ASCII-8, or 2 for UTF-8)
‘ returns 0
?TYPEOF(TOASCII8$(“…”))
‘ returns 1
?TYPEOF(TOUTF8$(“…”))
‘ returns 2
See Also
TOASCII8$, TOUTF8$
UCASE$
Description
UCASE$ function returns a copy of the string passed to it with all the
lowercase letters converted to uppercase.
Syntax
UCASE$(<string>)
Parameters
<string>: String
Return Value
returns a copy of the string passed to it with all the lowercase letters converted
to uppercase
USERFRAME
Description
UserFrame is a Robot property which informs the system to use the specified
location as the UserFrame transformation.
It defines the position and orientation machine working frame relative to the
WORLD reference.
?Scara.UserFrame:WorkPiece:Base:Tool
{90 , 90 , 90 , 180}
See Also
BASE, TOOL, WORKPIECE, SELECTUSERFRAME
UTF$
Description
This function returns a UTF-8 string corresponding to a given Unicode value.
Syntax
UTF$(<number>)
Parameters
<number>: Long, 0 to MAXLONG
Return Value
returns a UTF-8 string corresponding to a given Unicode value
UTFSTRING$
Description
UTFSTRING$ produces a new UTF-8 string with the specified number of
symbols. Each symbol is the first symbol of the specified string argument or
the specified Unicode value.
Syntax
UTFSTRING$(<number>,<string>)
UTFSTRING$(<number>,<Unicode_value>)
Parameters
<number>: Long, 0 to MaxLong
VAL
Description
VAL returns the real value represented by the characters in the input string.
The input string can be a number in decimal mode, scientific mode, scientific
notation, or hexadecimal mode (but not binary mode).
Syntax
VAL(<string>)
Parameters
<string>: String
Return Value
returns the real value represented by the characters in the input string
value = VAL("1.2E-2")
value = 0.012
value = VAL("0xFF")
value = 255
?VAL("")
?VAL("One hundred")
?VAL("12e7a3")
?VAL("65+32")
?VAL("cos(32)")
?VAL("321")
STRD$, STRL$
VARLIST
Description
This query returns a list of the variable and constant names defined in the
system. If wildcards are used, the query returns the proper existing variable or
constant data. when querying varlist of a namespaced variable, question-mark
(?) can be used instead of wildcard.
The variable types and their values are displayed in the following format:
VARLIST$
Description
This query returns a list of the variable and constant names defined in the
system. If wildcards are used, the query returns the proper existing variable or
constant data.
The variable types and their values are displayed in the following format:
VCLOSETCP
Description
This command can be used to manually close a socket which is opened by
VOPENTCP command.
Syntax
VCloseTcp(<StationName>)
Parameters
<StationName> : String, any valid vision station
Examples
VOpenTcp(“VS1”)
VSendCmd("VS1","TrigerStart",lState)
If lState then
VReceiveData("VS1",SDATA,lState, 1000)
End if
VCloseTcp(“VS1”)
See Also
VOPENTCP, VRUNJOBFULL
VELERRTHRESHOLD
Description
This command can be used to set error threshold of specified axis, used as
trigger condition of collision detect, must set after attach SCARA.
Syntax
<ELEMENT>.VelErrThreshold
Parameters
< ELEMENT >: valid motion element
Examples
J1. VelErrThreshold = 100
? J1. VelErrThreshold
See Also
RESETPEAKVALUE, SETVELERRTHRESHOLD, COLLISIONDETECT,
DRIVETORQUELIMIT, PEAKTORQUE, PEAKVELERR,
SETDRIVETORQUELIMIT, SETDEFVELERRTHRESHOLD,
VELOCITYCOMMAND
Description
This property returns the velocity command. This value is generated by the
motion profiler.
Short form
<element>.VCmd
Syntax
?<element>.VelocityCommand
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
returns the velocity command
± Max Double
Limitations
Read only
Examples
Axis
?A1.VCmd
Robot
?SCARA.VCmd
See Also
VELOCITYCOMMANDCARTESIAN, VELOCITYFEEDBACK,
ACCELERATIONCOMMAND, POSITIONCOMMAND
VELOCITYCOMMANDCARTESIAN
Description
Returns the current Cartesian command velocity of the robot's TCP.
The first three components are the linear velocity, and the last component(s)
is the angular velocity.
Short form
<ROBOT>.VCMDCART
Syntax
<ROBOT>.VelocityCommandCartesian
Domain
ROBOT
Parameters
< ROBOT >: any valid robot
Return Value
Returns the current Cartesian command velocity of the robot's TCP
VELOCITYERROR
Description
This property returns the velocity following error, which is the difference
between velocity command and the velocity feedback.
This property is used for query only. There is no checking against a max
threshold, unlike PE and PEmax.
The calculation uses the position error delay, such that the velocity feedback
is subtracted from the command issued a number of cycles previously, as
defined in the POSITIONERRORDELAY property.
In an axis, the velocity error is the difference between the velocity command
and velocity feedback.
In a group, the velocity error is the square root of the sum of squares of all
axes velocity errors.
In a robot, the velocity error is calculated using the position part (only XYZ
values, orientation part is not used) of the difference between velocity
command and feedback of the tool-tip:
?A1.VE
Robot
?SCARA.VE
Robot
?SCARA.VE
VELOCITYFEEDBACK
Description
This property returns the actual spatial velocity of the element.
Short form
<element>.VFb
Syntax
?<element>.VelocityFeedback
Domain
ELEMENT
Parameters
< element >: valid motion element
Return Value
returns the actual spatial velocity of the element
?A1.Vfb
Robot
?SCARA.VFb
See Also
VELOCITYCOMMAND
VELOCITYFEEDBACKCARTESIAN
Description
Returns a vector of the current feedback velocity of the robot's TCP.
The first three components are the linear velocity, and the last component(s)
is the angular velocity.
Short form
<ROBOT>.VFBCART
Syntax
<ROBOT>.VelocityFeedbackCartesian
Domain
ROBOT
Parameters
<ROBOT> : any valid robot
Return Value
Returns a vector of the current feedback velocity of the robot's TCP
VELOCITYFINALROT
Description
Defines the final rotation velocity of the robot. Together with VFTRAN, defines
to final velocity of a Cartesian motion.
If the velocity is non-zero, the other final velocity (VFTRAN) must be also non-
zero.
This value is used only in two motion commands: MOVES and CIRCLE. In
joint interpolated movements (MOVE), this value is ignored.
The system always takes the smaller of the two with a notification message
sent to the user.
Short form
<ROBOT>.vfrot
Syntax
<ROBOT>.vfrot=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot
VELOCITYFINALTRANS
Description
Defines the final translation velocity of the robot. Together with VFROT,
defines the final velocity of a Cartesian motion.
If the velocity is non-zero then the other final velocity (VFROT) must be also
non-zero.
This value is used only in two motion commands: MOVES and CIRCLE. In
joint interpolated movements (MOVE), this value is ignored.
The system always takes the smaller of the two with a notification message
sent to the user.
Short form
<ROBOT>.vftran
Syntax
<ROBOT>.vftran=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot
VELOCITYMAX
Description
Defines the maximum allowed velocity of the element. The system limits
element velocity commands to this value.
A1.Vmax = 300
Robot
SCARA.VMax=300
See Also
VELOCITYSCALE, ATTACH, VELOCITYOVERSPEED
VELOCITYMAXROT
Description
Defines the maximum rotation velocity of the robot. Used for both VFROT and
VROT.
The value limits only the Cartesian motion interpolations (MOVES, CIRCLE).
This parameter does not affect joint interpolated movements (MOVE).
Short form
<ROBOT>.vmrot
Syntax
<ROBOT>.vmrot=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot
VELOCITYMAXTRANS
Description
Defines the maximum translation velocity of the robot. Used for both VFTRAN
and VTRAN.
The value limits the Cartesian motion interpolations only (MOVES, CIRCLE).
VELOCITYOVERRIDE
Description
VELOCITYOVERRIDE modifies the actual element velocity by multiplying the
velocity by the specified override value.
The actual velocity rate of change is limited by the axis deceleration value.
The axis velocity override has no effect when the axis is being moved as part
of a group.
NOTE
VELOCITYOVERRIDE does not affect a slave axis as it is not moved via the
profile generator.
Short form
<element>.Vord
Syntax
<element>.VelocityOverride = <value>
Domain
ELEMENT
Parameters
<element>: any valid motion element
VELOCITYOVERSPEED
Description
Sets or queries the axis VELOCITYOVERSPEED value.
VELOCITYOVERSPEED defines an absolute motor velocity limit. When this
limit is exceeded, an error is generated and the axis is brought to an
immediate stop. While stopping, the overspeed condition is not checked.
Further action may be taken by the program error handler.
NOTE
VelocitySafetyLimit and VOSPD should be greater than:
1000/ser.cycletime/VFac. In cases where vfac is set too low regular velocity
values can trigger these.
Short form
<axis>.VOSPD
Syntax
<axis>.VelocityOverspeed = <value>
?<axis>.VelocityOverspeed
Domain
AXIS
Parameters
<value>: Double, Greater than zero.
Limitations
To set the value within a task, the axis must be attached to that task (using the
ATTACH command).
Examples
A1.VelocityOverspeed = a1.vmax
See Also
ATTACH, VELOCITYMAX
VELOCITYROT
Description
Defines the rotation (orientation) velocity of the robot. Together with VTRAN,
defines to cruise velocity of a Cartesian motion.
This value is used only in two motion commands: MOVES and CIRCLE. In
joint interpolated movements (MOVE), this value is ignored.
The system always takes a smaller of the two with a notification message sent
to the user.
Short form
<ROBOT>.vrot
Syntax
<ROBOT>.vrot=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot
VELOCITYROTVALUE
Description
This query returns the rotational velocity value of the robot's tool tip, in
degrees per second. this is a read-only value.
Short form
<ROBOT>.VELOCITYROTVALUE
Syntax
?<ROBOT>.VELOCITYROTVALUE
Domain
ROBOT
Parameters
<ROBOT> : any valid robot
Return Value
returns the rotational velocity value of the robot's tool tip, in degrees per
second
VELOCITYSCALE
Description
This property specifies percentage of desired cruise velocity compared to
maximal possible velocity for this type of movement. The motion generator
attempts to reach this velocity during motion commands.
The ability of the motion generator to reach this value is constrained by the
value of ACCELERATION, DECELERATION, SMOOTHFACTOR and the final
position.
?<element>.VelocityScale
Domain
ELEMENT
Parameters
< element >: valid motion element
A1.VelocityScale =30
SCARA.VelocityScale =40
VELOCITYTRANS
Description
Defines the translation velocity of the robot. Together with VROT, defines the
cruise velocity of a Cartesian motion.
This value is used only in two motion commands: MOVES and CIRCLE. In
joint interpolated movements (MOVE), this value is ignored.
The system always takes the smaller of the two with a notification message
sent to the user.
Short form
<robot>.vtran
Syntax
<robot>.vtran=<numeric expression>
Domain
ROBOT
Parameters
< ROBOT >: any valid robot
VELOCITYTRANSFEEDBACKVALUE
Description
Returns the magnitude of the feedback linear velocity of the robot's TCP.
This property is equivalent to taking the norm of the first three components of
VELOCITYFEEDBACKCARTESIAN.
Short form
<ROBOT>.vtfbk
Syntax
<ROBOT>.VelocityTransFeedbackValue
Domain
ROBOT
Parameters
<ROBOT> : any valid robot
Return Value
Returns the magnitude of the feedback linear velocity of the robot's TCP
VELOCITYTRANSVALUE
Description
This query returns the translation velocity value of the robot's tool tip, in
millimeters per second. This is a read-only value.
Short form
< ROBOT >.velocitytransvalue
Syntax
?< ROBOT >.velocitytransvalue
Domain
ROBOT
Parameters
<ROBOT> : any valid robot
Return Value
returns the translation velocity value of the robot's tool tip, in millimeters per
second
VGETJOBDATA
Description
If the VGetJobStatus command returns GET_DATA, you can get the Re-
spond Data from the station with the VGetJobData command.
VGETJOBERROR
Description
If the VGetJobStatus command returns GET_ERROR, you can get the
Respond error from the station with the VGetJobError command.
Syntax
VGetJobError (<StationName>, <JobName> , <ERROR>)
Parameters
<StationName>: any valid Vision Station, String
select RET
case GET_STATUS
case GET_DATA
LOOPCTL = false
case GET_ERROR
LOOPCTL = false
end select
See Also
VGETJOBDATA, VGETJOBSTATUS, VRUNJOB
VGETJOBSTATUS
Description
After running a job, you can get the Respond Status with the VGetJobStatus
command.
The program will block until the station sends a Respond Status or Respond
Data or Respond Error message..
Syntax
VGetJobStatus (<StationName>, <JobName>, <ERROR >, <Timeout>)
Parameters
<StationName>: any valid Vision Station, String
LOOPCTL = true
while LOOPCTL
MYSTATUS, 10000)
select RET
case GET_STATUS
case GET_DATA
LOOPCTL = false
case GET_ERROR
LOOPCTL = false
end select
end while
See Also
VGETJOBDATA, VGETJOBERROR, VRUNJOB
VOPENTCP
Description
If you want to send a user-defined string via TCP IP protocol, you can
manually open a socket by calling “VOpenTcp”.
Syntax
VOpenTcp (<StationName>)
Parameters
<StationName>: any valid Vision Station, String
Examples
VOpenTcp ("S1")
See Also
VRUNJOB, VCLOSETCP
VPIXELTOPOS
Description
After setting the vision calibration, you can convert pixel coordinates to robot
coordinates with the “VPixelToPos”.
This command can not be used until the selected vision station has been
calibrated
Syntax
VPixelToPos (<StationName>, <Pix_X> , <Pix_Y> , <Pos_X> , <Pos_Y> )
Parameters
<StationName>: any valid Vision Station, String
VRECEIVEDATA
Description
This command can be used to receive a user-defined string via TCP IP
protocol.This command can not be used before command VOpenTcp is
executed.
Syntax
VReceiveData (<StationName>, <ReceiveData> , <RecState>, <Timeout>)
Parameters
<StationName>: any valid Vision Station, String
< ReceiveData >: return the received data from the Vision Station, String
< Timeout> : Set the maximum time to wait when no data received, unit is
millisecond, Long
Return value
< ReceiveData >: return the received data from the Vision Station, String
VRUNJOB
Description
This command can be used to connect to Vision Station and run the Vision
Task.The controller will parses the station and job information and builds the
connection with the station.
Syntax
VRunJob (<StationName>, <JobName>, <Timeout>)
Parameters
<StationName>: any valid Vision Station, String
<Timeout>: the time-out period of the TCP connection, Long, unit millisecond
Return value
Return the function excuting status.
VRUNJOBFULL
Description
This command enables you to get the Respond Data or Respond Error
without dealing with the Respond Status. This command continually calls
“VGetJobStatus” until it returns Respond Data or Respond Error.
This command integrates all the relevant command and works in the seq-
uence of “VRunJob”, multiple “VGetJobStatus”, “VGetJobData” or ”VGet-
JobError”.
<Timeout>: the time-out period of the TCP connection, Long, unit millisecond
VSENDCMD
Description
This command is used to send a user-defined string via TCP IP protocol.
< Command >: command message will be sent to vision station, String
VSendCmd("VS1","TrigerStart",lState)
See Also
VRUNJOB
VSMODE
Description
VSmode(Vibration Suppression mode) is one of supported MotionMode
related commands. It allows enabling and disabling vibration suppression
functionality by setting the value to either “On” or “Off” accordingly. With the
proper setting of the associated parameters, this function decreases residual
vibration amplitude and time.
NOTE
You must complete the creation and setting of the payload and enable it in the
interface at first. And then you can enable the vibration suppression mode
through this command. In addition, this command will take effect only for the
next motion. Therefore, you need to insert the VSmode command before each
motion command that requires vibration suppression.
If you need more detailed use methods, please refer to the user manual.
Syntax
VSMode = < value >
Parameters
<value>: Long, On – enable the vsmode
VSTOPJOB
Description
This command is used to stop one vision station job which is running.
Syntax
VStopJob (<StationName>, <JobName>)
Parameters
<StationName>: any valid Vision Station, String
WAIT
Description
This command stops the program until some conditions are fulfilled.
Timeout can be set for wait command. If timeout is not set, program will
continue waiting until conditions are fulfilled.
Digital condition:
<value> is Long
Analog condition:
Edge condition:
<operator> is '='
WAITFORMOTION
Description
This command causes the program to wait until the currently executing motion
is completed, only after that the next line will be executed.
Syntax
WaitForMotion <element>
Parameters
<element>: any valid motion element
Limitations
Attachment is required.
Examples
Attach SCARA
WaitForMotion SCARA
Detach SCARA
See Also
MOVE, STARTTYPE, SLEEP
WHILE_..._END_WHILE
Description
While and End While keywords delimit a WHILE loop.
While loops are used to execute a section of code for as long as a specified
condition remains true.
The condition will be judged once before the statement inside the WHILE
structure starts to execute. Therefore, if the condition of the WHILE loop is
judged false for the first time, the internal statement will not be executed once.
WHILE can contain any number of statements. Of course, you can also add
no statements. If no statement is included, WHILE.... End WHILE can be used
as a delay operation.
NOTE
Do not use a loop structure that does not contain any statements or only
contains simple operation statements. If you must use it this way, please
insert at least one SLEEP 1 instruction to avoid CPU overload and system
exceptions.
Syntax
While <condition>
End While
Parameters
< condition >:Long, while condition expression
Examples
While A1.IsMoving = 1 ‘wait for profiler to finish
sleep 20
End While
End While
See Also
FOR_..._NEXT, DO_..._LOOP, PROGRAM_..._END_PROGRAM
WITH
Description
This command sets a Default Motion Element (axis or group). Thereafter, the
motion element is operated on without having to explicitly indicate the motion
element name.
With - Config.prg - The element who set as Default Motion Element (DME) at
the Config.prg file, function as DME for whole system. Therefore the only way to
change/stop the DME is to "kill" the Config.prg task, and manually change the
defaults.
In case of using Local With statement - The DME will be the one declared on the
local statement, and change back to the "Config.prg With" after the task
finished.
Local With - Set up a DME for local task. Unlike the "Config With" - using a local
With statement require to use With <element>..........End With method.
This way of use replace the current DME (that declare on the Config.prg or in
the Terminal) with a new one, until the task complete.
Terminal With - This way of use designated for run-time changes. After
declaring a DME on the terminal, the chosen element will function as DME as
long as the user didn't send an "End With" command via terminal. A With
command used inside the terminal scope does not affect any programs or vice-
versa.
WithGlobal - The DME which create with the "WithGlobal" command replaced
the With - Config.prg without shut down the system, or create a new DME in
case that there is no such a thing. For more information - WITHGLOBAL
Syntax
With <element name>
Parameters
<element name>:any valid motion element
Limitations
With commands cannot be nested.
A subroutine called from within a WITH block does not inherit the default
motion element, so the element is not defined within the subroutine, and an
error is flagged (Local With).
A1.Vord=5000
A1.VCruise=3000
A1.PEMax=10
A1.PESettle=0.01
Move A1 100
With A1
VMax=5000
Vord=5000
VCruise=3000
PEMax=10
PESettle=0.01
Move 100
End With
See Also
WITHGLOBAL, PROGRAM_..._END_PROGRAM
WITHGLOBAL
Description
This command sets a Default Motion Element (axis or group) globally. Like the
"WITH" statement, the motion element will operated without having to
explicitly indicate the motion element name.
The default motion element exists only after a WithGlobal statement, which
can be terminated in three ways:
A1.VCruise=3000
A1.PEMax=10
A1.PESettle=0.01
Move A1 100
WithGlobal A1
VMax=5000
VCruise=3000
PEMax=10
PESettle=0.01
Move 100
See Also
PROGRAM_..._END_PROGRAM, WITH
WITHPLS
Description
Nodal assignment of a path-PLS.
The WithPLS argument specifies the PLS switch that will be activated by the
motion command.
The specified PLS will be enabled during execution of the given motion and
disabled when the motion ends.
WORKPIECE
Description
WorkPiece is a Robot property which informs the system to use the specified
location as the workpiece transformation.
?Scara.UserFrame:WorkPiece:Base:Tool
{90 , 90 , 90 , 180}
See Also
BASE, TOOL, USERFRAME
XMAX
Description
This value is used in the pre-computation phase of the robot Cartesian
movements (MOVES, CIRCLE). Values of Xmin, Xmax, Ymin, Ymax, Zmin,
Zmax allow definition of safe workspace area in cartesian coordinates. These
limits will be checked in addition to other robot space limitations as joint pmin
& pmax values ad workspace radius limits (rmin & rmax).
Syntax
<ROBOT>.XMax = <numeric expression>
Domain
ROBOT
Parameters
<ROBOT>: any valid robot
XMIN
Description
This value is used in the pre-computation phase of the robot Cartesian
movements (MOVES, CIRCLE). Values of Xmin, Xmax, Ymin, Ymax, Zmin,
Zmax allow definition of safe workspace area in cartesian coordinates. These
limits will be checked in addition to other robot space limitations as joint pmin
& pmax values ad workspace radius limits (rmin & rmax).
Syntax
<ROBOT>.XMin = <numeric expression>
Domain
ROBOT
Parameters
<ROBOT>: any valid robot
YMAX
Description
This value is used in the pre-computation phase of the robot Cartesian
movements (MOVES, CIRCLE). Values of Xmin, Xmax, Ymin, Ymax, Zmin,
Zmax allow definition of safe workspace area in cartesian coordinates. These
limits will be checked in addition to other robot space limitations as joint pmin
& pmax values ad workspace radius limits (rmin & rmax).
Syntax
<ROBOT>.Ymax = <numeric expression>
Domain
ROBOT
Parameters
<ROBOT>: any valid robot
YMIN
Description
This value is used in the pre-computation phase of the robot Cartesian
movements (MOVES, CIRCLE). Values of Xmin, Xmax, Ymin, Ymax, Zmin,
Zmax allow definition of safe workspace area in cartesian coordinates. These
limits will be checked in addition to other robot space limitations as joint pmin
& pmax values ad workspace radius limits (rmin & rmax).
Syntax
<ROBOT>.YMin = <numeric expression>
Domain
ROBOT
Parameters
<ROBOT>: any valid robot
ZMAX
Description
This value is used in the pre-computation phase of the robot Cartesian
movements (MOVES, CIRCLE). Values of Xmin, Xmax, Ymin, Ymax, Zmin,
Zmax allow definition of safe workspace area in cartesian coordinates. These
limits will be checked in addition to other robot space limitations as joint pmin
& pmax values ad workspace radius limits (rmin & rmax).
Syntax
<ROBOT>.ZMax = <numeric expression>
Domain
ROBOT
Parameters
<ROBOT>: any valid robot
ZMIN
Description
This value is used in the pre-computation phase of the robot Cartesian
movements (MOVES, CIRCLE). It is used to prevent robot collisions with its
own body (base column).
Defines Z coordinate of the “lowest” robot position. No points below this plane
are allowed.
The attached devices and parameters not taken into robot setup could
significantly reduce the robots working area!
NOTE
Always check the ZMIN value before configuring a new robot.
Syntax
<ROBOT>.ZMin = <numeric expression>
Domain
ROBOT
Parameters
<ROBOT>: any valid robot
Example
Through several classic samples to help users learn common commands quickly.
'**********************************************************************************************************
'Define global variables
common shared Pick as location of xyzr = #{325,175,-100,0}
common shared Pick2 as location of xyzr = #{325,75,-100,0}
common shared Place as location of xyzr = #{325,-175,-100,0}
common shared HomePos as joint of xyzr = {0,0,-10,0}
common shared lProductID as long = 1
'Local variables
dim shared dLimZ as double = 0
dim shared xAllowPlace as long
program
'Internal variable
dim lSpeed as long = 50
dim Pos1 as location of xyzr
dim PickUp as location of xyzr
dim PrevClock as long
call Init
'Go home point
if j3.pfb > dLimZ then
move j3 dLimZ VScale = 10 'Z move to dLimZ
end if
'get current arm type; 0 - singular point(J2.pcmd = 0); 1- left type; 2 - right type
if ARMFBK = 1 then
'do something
else '
'do something
end if
while 1
sleep 10
PrevClock = sys.clock 'start the time
select case lProductID
case 1
setArm(Pick,1) 'set pick arm to left type
PickUp = #{Pick{1}, Pick{2}, -10, Pick{4};1}
move PickUp VScale= 10 blend = 20
move Pick VScale= 10
waitformotion SCARA
sleep 100
PickUp = #{Pick{1}, Pick{2}, -20, Pick{4};1}
move PickUp VScale= 10 blend = 20
lProductID = 2
case 2
setArm(Pick2,2) 'set pick arm to right type
jump Pick2 archno = 1 blend = 20 Vscale= 20
waitformotion SCARA
sleep 100
PickUp = #{Pick2{1}, Pick2{2}, -20, Pick2{4};2}
move PickUp VScale= 10 blend = 20
lProductID = 1
case else
'do something
end select
if xAllowPlace then
setArm(Place,2)
jump Place archno = 1 blend = 10 Vscale= 20
waitformotion SCARA
moves #{Place{1},Place{2},dLimZ,Place{4};2} blend = 20 Vscale= 20
end if
waitformotion SCARA
print "Run time is ",sys.clock - PrevClock
end while
detach
end program
'**********************************************************************************************************
sub Init
power_on()
Attach SCARA
vord = 100
dLimZ = 0
xAllowPlace = true
end sub
'**********************************************************************************************************
'Get the distance between two points (setpoint and pos)
function getDist (byval Pos as location of xyzr) as double
getDist = distl(setpoint,Pos)
end function
'**********************************************************************************************************
'**********************************************************************************************************
dim shared sVisionData as string
program
dim locPos as location of xyzr
dim sRetVal as string
dim sArrStr[10] as string
dim lGetNumber as long
dim jPos as joint of xyzr
dim lLocation as long
dim i as long
lGetNumber = splitstr ( sVisionData,",",sArrStr ) 'split string by comma, the result is placed in array
sArrPoint
for i = 1 to lGetNumber
print "sArrStr[" + STR$(i) + "]=",sArrStr[i]
next
'convert string type to double type
locPos{1} = val(sArrStr[1])
locPos{2} = val(sArrStr[2])
locPos{3} = val(sArrStr[3])
locPos{4} = val(sArrStr[4])
attach
power_on()
move locPos vscale = 10
waitformotion SCARA
print `"robot is arrive the location"`; ' result is "robot is arrive the location"
print `"robot is arrive the location"` ' result is "robot is arrive the location"\r\n
end program
'**********************************************************************************************************
sub getVisionData
''We can get data from the host computer or PLC through TCP/IP communication.
'More detailed use of TCP,can see the template program <DEMO_TCP_SERVER> or
<DEMO_TCP_CLIENT>.
'Here we simulate and get the data from TCP/IP.
sVisionData = "325.2,-175.1,-10,90,arm=1,vscale=100"
end sub
'**********************************************************************************************************
'Get the robot's current position
sub getCurrentPosition
dim sCurrentCmdLocPos as string
dim sX as string
dim sY as string
dim sZ as string
dim sA as string
end sub
'**********************************************************************************************************
'**********************************************************************************************************
program
dData[1] = 225.2
dData[2] = -175.1
dData[3] = -10
dData[4] = 90
'------------------------------------------------------------------
'convert float(32) type to long type
FloatToLong(dData, lData, 4, 1)'1- big Endian; 0- little endian
'lData[*] can be mapped to a analog output signal address, transmitted to the PLC
?lData[1] '17249
?lData[2] '13107
?lData[3] '49967
?lData[4] '6554
?lData[5] '49440
?lData[6] '0
?lData[7] '17076
?lData[8] '0
'------------------------------------------------------------------
'convert long type to float(32) type
'we can get lData[*] value from a analog input signal, this signal map to BUS address.
LongToFloat(lData, dData, 4, 1)'1- big Endian; 0- little endian
'------------------------------------------------------------------
'convert double(64) type to long type
DoubleToLong(dData, lData, 4, 1)'1- big Endian; 0- little endian
'------------------------------------------------------------------
'convert long type to double(64) type
'we can get lData[*] value from a analog input signal, this signal map to BUS address.
LongToDouble(lData, dData, 4, 1) '1- big Endian; 0- little endian
?dData[1]' 225.2
?dData[2]' -175.1
?dData[3]' -10
?dData[4]' 90
end program
'**********************************************************************************************************
After activating this function, the detected errors are classified into two
categories:
The forces exerted on the robot during a collision can be roughly divided into
two categories: the impact force of the instantaneous velocity at the moment
of collision, and the compressive force caused by the motor torque output
after the collision. Collision detection and torque limiting functions can limit the
motor torque output, effectively reducing the damage caused by compressive
forces after a collision. However, these functions have no effect on the impact
force of the velocity.
NOTE:
• In Auto mode, when running in Step (single step) mode, the motion
degrades to a situation without blend.
To reduce false detections when there is strong contact with the external
Other situations can reduce the occurrence of false detections through the
following actions:
• Adjust the torque limit value appropriately.
• Adjust the collision detection error threshold.
• Re-learn.
Steps:
To execute collision detection function, the following steps should be executed:
• Reset and initialize peak torque and peak velocity error values by
executingbResetPeakValue.
• Ensure collision detection is turned off.
• Execute the motion path that needs protection, learn the trajectory motion
several times, obtain the peak torque through PeakTorque, and obtain the
maximum velocity error value through PeakVelErr.
• Assign a value to SetDriveTorqueLimit based on the peak torque of the path
plus a threshold.
• Assign a value to SetvelErrThreshold based on the maximum velocity error
obtained plus a threshold.
• Turn on collision detection within the robot program.
If the robot pauses and resumes during learning, torque values and velocity error
values greater than normal program execution may be obtained. In this situation,
the measured peak torque and velocity error values will be included in the
measurement.
Program example:
The following is a sample program for learning and configuring collision detection
and torque limit functions.
Before starting the program, restore the maximum torque value and turn off
collision detection. In the first three runs, measure the maximum torque and
maximum speed error values, and then add a coefficient of 1.2/1.3 to the
measured values. From the fourth run onwards, set the upper limit torque value,
MC-Basic Commands 2.7 V1 丨 Issued: 18.04.2024 www.kuka.com | 405 / 415
MC-Basic Commands 2.7
Scope
Following table indicate the usage scope of each command.
Task can be used in user program or user library
Terminal can be used in terminal
Function can be used in function or Sub
COMMON_OR_DIM_SHARED_OR_DIM_..._AS_ √ √ √
LOCATION_OF
COMMON_OR_DIM_SHARED_VAR_NAME_AS √ √ √
_NOTE_OR_ERROR_ASCII_NUMBER
COMMON_SHARED_..._AS_SEMAPHORE √ √ √
COMMON_SHARED_OR_DIM_SHARED_OR_DI √ √ √
M_..._AS_TYPE
CONNECT √ - √
COS √ √ √
CUMULATIVEPOSITION √ √ √
CURRENTABSOLUTE √ √ √
CURRENTTIME √ - √
DECELERATION √ √ √
DECELERATIONMAX √ √ √
DECELERATIONROT √ √ √
DECELERATIONTRANS √ √ √
DELETE - √ -
DELETE$ - √ -
DELETESEM √ √ √
DEST √ √ √
DETACH √ - √
DETACHFROM √ √ √
DETACHFROM$ √ √ √
DISABLETIMEOUT √ √ √
DISTL √ √ √
DISTR √ √ √
DO_..._LOOP √ - √
DOUBLEMODE √ √ √
DOUBLEMODEPERCENTAGE √ √ √
ELEMENTID √ √ √
ELEMENTNAME √ √ √
ELEMENTSIZE √ √ √
ELEMENTSTATUS √ √ √
ERROR √ √ √
ERRORHANDLERMODE √ √ √
ERRORNUMBER √ √ √
EVENTDELETE √ - √
EVENTLIST - √ -
EVENTOFF √ √ √
EVENTON √ √ √
EXP √ √ √
FILESIZE √ √ √
FILESIZE$ √ √ √
FOR_..._NEXT √ - √
FUNCTION_..._END_FUNCTION √ - √
GETIO √ √ √
GOHOME √ - √
GOTO √ - √
GOTOLIMIT √ √ √
GROUPLIST - √ -
GRP_CLOSE_GRIPPER √ √ √
GRP_OPEN_GRIPPER √ √ √
HERE √ √ √
HEX$ √ √ √
ICMD √ √ √
IF_..._THEN_..._ELSE √ - √
IFBK √ √ √
IMPORT √ - √
INFORMATION √ √ √
INPUT$ √ √ √
INSTR √ √ √
INT √ √ √
INTERPOLATIONTYPE √ √ √
IPADDRESSMASK √ √ √
ISMOVING √ √ √
ISSETTLED √ √ √
JERK √ √ √
JERKACCELERATIONPERCENTAGE √ √ √
JERKDECELERATIONPERCENTAGE √ √ √
JERKMAX √ √ √
JERKMAXROT √ √ √
JERKMAXTRANS √ √ √
JERKROT √ √ √
JERKTRANS √ √ √
JUMP √ - √
JUMP3 √ - √
JUMP3CP √ - √
LCASE$ √ √ √
LEFT$ √ √ √
LEN √ √ √
LOC √ √ √
LOG √ √ √
LOGGER √ √ √
LTRIM$ √ √ √
MAINFILENAME √ √ √
MID$ √ √ √
MOTION √ √ √
MOTIONOVERLAP √ √ √
MOVE √ - √
MOVES √ - √
MSG √ √ √
NAME - √ -
NOOFCOORDINATES √ √ √
NUM √ √ √
NUMBEROFLOOPS √ √ √
ONERROR √ - √
ONEVENT √ - √
ONSYSTEMERROR √ - √
OPEN_FILE √ √ √
OPENSOCKET √ √ √
OPMODE √ √ √
PAYLOADINERTIA √ √ √
PAYLOADLX √ √ √
PAYLOADLY √ √ √
PAYLOADMASS √ √ √
PAYLOADMAX √ √ √
PING √ √ √
PLSLIST - √ -
PLSOUTPUT √ √ √
PLSPOLARITY √ √ √
PLSPOSITION √ √ √
PLSRELATEDTO √ √ √
PLSSOURCE √ √ √
PLT_GET_INDEX_STATUS √ √ √
PLT_MOVE_TO_ENTRY_POSITION √ - √
PLT_PICK_FROM_PALLET √ - √
PLT_PLACE_ON_PALLET √ - √
PLT_RETRACT_FROM_ITEM √ - √
PLT_SET_INDEX_STATUS √ √ √
PLT_SET_INDEX_STATUS_EMPTY √ √ √
PLT_SET_INDEX_STATUS_FULL √ √ √
POSITIONCOMMAND √ √ √
POSITIONCOMMANDHISTORY √ √ √
POSITIONERROR √ √ √
POSITIONERRORSETTLE √ √ √
POSITIONFEEDBACK √ √ √
POSITIONFINAL √ √ √
POSITIONTOGO √ √ √
POWER_OFF √ √ √
POWER_ON √ √ √
PRINT √ √ √
PRINT_HASH √ √ √
PRINTPOINT √ √ √
PRINTPOINTUSING √ √ √
PRINTTOBUFF √ √ √
PRINTUSING √ √ √
PRINTUSING$ √ √ √
PRINTUSING_HASH-SIGN √ √ √
PRINTUSINGTOBUFF √ √ √
PROCEED √ √ √
PROCEEDTYPE √ √ √
PROGRAM_..._END_PROGRAM √ - √
PULSE √ - √
RECORD √ √ √
RECORD$ √ √ √
RECORDCLOSE √ √ √
RECORDING √ √ √
RECORDOFF √ √ √
RECORDON √ √ √
REM √ - √
RIGHT$ √ √ √
ROUND √ √ √
RTRIM$ √ √ √
SELECT_..._CASE √ - √
SELECTAXES √ √ √
SELECTBASE √ √ √
SELECTTOOL √ √ √
SELECTUSERFRAME √ √ √
SEMAPHOREGIVE √ √ √
SEMAPHORESTATE √ √ √
SEMAPHORETAKE √ √ √
SETIO √ √ √
SETPOINT √ √ √
SETWORKSPACE √ √ √
SGN √ √ √
SHL √ √ √
SHR √ √ √
SIMULATED √ √ √
SIN √ √ √
SIZE √ √ √
SLEEP √ - √
SPACE$ √ √ √
SQRT √ √ √
START √ √ √
START_JOINT √ √ √
STARTTYPE √ √ √
STATE √ √ √
STATUS √ √ √
STOP √ √ √
STR$ √ √ √
STRD$ √ √ √
STRING$ √ √ √
STRL$ √ √ √
STRUCTURE_TYPE_DEFINITION - - -
SUB_..._END_SUB √ - √
SYSTEM.ERROR √ √ √
SYSTEM.MOTION √ √ √
TAN √ √ √
TASKERROR √ √ √
TASKERRORNUMBER √ √ √
TASKID √ √ √
TASKLIST - √ -
TASKSTATE √ √ √
TASKSTATUS √ √ √
THROW √ √ √
TIME - √ -
TOASCII8$ √ √ √
TOCART √ √ √
TOJOINT √ √ √
TOOL √ √ √
TORQUEADDCOMMAND √ √ √
TORQUEGEARCOMMAND √ √ √
TORQUEGEARFEEDBACK √ √ √
TORQUEERROR √ √ √
TORQUECOMMAND √ √ √
TORQUEFEEDBACK √ √ √
TOTALTIME √ √ √
TOUTF8$ √ √ √
TRY_..._END_TRY √ - √
TYPEOF-ROBOT √ √ √
TYPEOF √ √ √
UCASE$ √ √ √
USERFRAME √ √ √
UTF$ √ √ √
UTFSTRING$ √ √ √
VAL √ √ √
VARLIST √ √ √
VARLIST$ √ √ √
VCLOSETCP √ √ √
VELOCITYCOMMAND √ √ √
VELOCITYCOMMANDCARTESIAN √ √ √
VELOCITYERROR √ √ √
VELOCITYFEEDBACK √ √ √
VELOCITYFEEDBACKCARTESIAN √ √ √
VELOCITYFINALROT √ √ √
VELOCITYFINALTRANS √ √ √
VELOCITYMAX √ √ √
VELOCITYMAXROT √ √ √
VELOCITYMAXTRANS √ √ √
VELOCITYOVERRIDE √ √ √
VELOCITYOVERSPEED √ √ √
VELOCITYROT √ √ √
VELOCITYROTVALUE √ √ √
VELOCITYSCALE √ √ √
VELOCITYTRANS √ √ √
VELOCITYTRANSFEEDBACKVALUE √ √ √
VELOCITYTRANSVALUE √ √ √
VGETJOBDATA √ - √
VGETJOBERROR √ - √
VGETJOBSTATUS √ - √
VOPENTCP √ - √
VPIXELTOPOS √ - √
VRECEIVEDATA √ - √
VRUNJOB √ - √
VRUNJOBFULL √ - √
VSENDCMD √ - √
VSMODE √ √ √
VSTOPJOB √ - √
WAIT √ - √
WAITFORMOTION √ - √
WHILE_..._END_WHILE √ - √
WITH √ √ √
WITHGLOBAL √ √ √
WITHPLS - - -
WORKPIECE √ √ √
XMAX √ √ √
XMIN √ √ √
YMAX √ √ √
YMIN √ √ √
ZMAX √ √ √
ZMIN √ √ √